annotate bindings/java/test/TestQuery.java @ 726:fe2282b9bfb0
Initial querying: doesn't return results yet, but handles almost all params.
author |
mas01mj |
date |
Mon, 26 Jul 2010 13:19:09 +0000 |
parents |
7e1fa27b67ee |
children |
4d9e4ff0a9cd |
rev |
line source |
mas01mj@725
|
1 import junit.framework.*;
|
mas01mj@725
|
2 import java.io.File;
|
mas01mj@725
|
3 import org.omras2.*;
|
mas01mj@725
|
4
|
mas01mj@725
|
5 public class TestQuery extends TestCase
|
mas01mj@725
|
6 {
|
mas01mj@725
|
7 File testDBFile;
|
mas01mj@725
|
8 File testFeatureFile;
|
mas01mj@725
|
9 protected void setUp()
|
mas01mj@725
|
10 {
|
mas01mj@725
|
11 testDBFile = new File("testfiles/test.adb");
|
mas01mj@725
|
12 testFeatureFile = new File("testfiles/testfeature");
|
mas01mj@725
|
13 if(testDBFile.exists())
|
mas01mj@725
|
14 testDBFile.delete();
|
mas01mj@725
|
15 }
|
mas01mj@725
|
16
|
mas01mj@725
|
17 public void testQuery()
|
mas01mj@725
|
18 {
|
mas01mj@725
|
19 // Insert the same feature twice
|
mas01mj@725
|
20 AudioDB testDB = new AudioDB(testDBFile);
|
mas01mj@725
|
21 assertTrue("DB created", testDB.create(1, 2, 1));
|
mas01mj@725
|
22 testDB.open(AudioDB.Mode.O_RDWR);
|
mas01mj@725
|
23 assertTrue("Insert feature file", testDB.insert("feat1", testFeatureFile));
|
mas01mj@725
|
24 assertTrue("Insert feature file again", testDB.insert("feat2", testFeatureFile));
|
mas01mj@725
|
25 testDB.close();
|
mas01mj@725
|
26
|
mas01mj@725
|
27 testDB.open(AudioDB.Mode.O_RDONLY);
|
mas01mj@725
|
28 Status status = testDB.getStatus();
|
mas01mj@725
|
29 assertEquals("Two features", 2, status.getNumFiles());
|
mas01mj@726
|
30
|
mas01mj@726
|
31 Query query = new Query();
|
mas01mj@726
|
32 query.setSeqLength(1);
|
mas01mj@726
|
33 query.setSeqStart(0);
|
mas01mj@726
|
34 testDB.query("feat1", query);
|
mas01mj@725
|
35 }
|
mas01mj@725
|
36
|
mas01mj@725
|
37 }
|