diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/java/test/TestQuery.java	Wed Jul 21 14:27:07 2010 +0000
@@ -0,0 +1,32 @@
+import junit.framework.*;
+import java.io.File;
+import org.omras2.*;
+
+public class TestQuery extends TestCase
+{
+	File testDBFile;
+	File testFeatureFile;
+	protected void setUp()
+	{
+		testDBFile = new File("testfiles/test.adb");
+		testFeatureFile = new File("testfiles/testfeature");
+		if(testDBFile.exists())
+			testDBFile.delete();
+	}
+
+	public void testQuery()
+	{
+		// Insert the same feature twice
+		AudioDB testDB = new AudioDB(testDBFile);
+		assertTrue("DB created", testDB.create(1, 2, 1));
+		testDB.open(AudioDB.Mode.O_RDWR);
+		assertTrue("Insert feature file", testDB.insert("feat1", testFeatureFile));
+		assertTrue("Insert feature file again", testDB.insert("feat2", testFeatureFile));
+		testDB.close();
+
+		testDB.open(AudioDB.Mode.O_RDONLY);
+		Status status = testDB.getStatus();
+		assertEquals("Two features", 2, status.getNumFiles());
+	}
+
+}