Mercurial > hg > audiodb
annotate bindings/java/test/TestQuery.java @ 725:7e1fa27b67ee
* Full status support
* Insert support (not fully tested)
* Unit tests for create + initial insert
author | mas01mj |
---|---|
date | Wed, 21 Jul 2010 14:27:07 +0000 |
parents | |
children | fe2282b9bfb0 |
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@725 | 30 } |
mas01mj@725 | 31 |
mas01mj@725 | 32 } |