Author: glandais Date: 2007-12-04 18:32:09 +0000 (Tue, 04 Dec 2007) New Revision: 38 Added: trunk/simexplorer-si-storage/src/test/ trunk/simexplorer-si-storage/src/test/org/ trunk/simexplorer-si-storage/src/test/org/cemagref/ trunk/simexplorer-si-storage/src/test/org/cemagref/simexplorer/ trunk/simexplorer-si-storage/src/test/org/cemagref/simexplorer/si/ trunk/simexplorer-si-storage/src/test/org/cemagref/simexplorer/si/storage/ trunk/simexplorer-si-storage/src/test/org/cemagref/simexplorer/si/storage/test/ trunk/simexplorer-si-storage/src/test/org/cemagref/simexplorer/si/storage/test/LuceneDatabaseTestCase.java Modified: trunk/simexplorer-si-storage/.classpath Log: JUnit tests Modified: trunk/simexplorer-si-storage/.classpath =================================================================== --- trunk/simexplorer-si-storage/.classpath 2007-12-04 18:31:49 UTC (rev 37) +++ trunk/simexplorer-si-storage/.classpath 2007-12-04 18:32:09 UTC (rev 38) @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src/java"/> + <classpathentry kind="src" path="src/test"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.12/log4j-1.2.12.jar"/> <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/> Added: trunk/simexplorer-si-storage/src/test/org/cemagref/simexplorer/si/storage/test/LuceneDatabaseTestCase.java =================================================================== --- trunk/simexplorer-si-storage/src/test/org/cemagref/simexplorer/si/storage/test/LuceneDatabaseTestCase.java (rev 0) +++ trunk/simexplorer-si-storage/src/test/org/cemagref/simexplorer/si/storage/test/LuceneDatabaseTestCase.java 2007-12-04 18:32:09 UTC (rev 38) @@ -0,0 +1,113 @@ +package org.cemagref.simexplorer.si.storage.test; + +import java.util.UUID; + +import junit.framework.TestCase; + +import org.cemagref.simexplorer.si.storage.database.lucene.LuceneDatabase; +import org.cemagref.simexplorer.si.storage.entities.ExplorationData; +import org.cemagref.simexplorer.si.storage.entities.LoggableElement; + +public class LuceneDatabaseTestCase extends TestCase { + + private LuceneDatabase database; + + protected void setUp() throws Exception { + super.setUp(); + try { + database = new LuceneDatabase(); + } catch (Throwable e) { + throw new Exception(e); + } + } + + protected void tearDown() throws Exception { + super.tearDown(); + try { + database.shutDown(); + } catch (Throwable e) { + throw new Exception(e); + } + } + + public final void testPushElement() { + try { + String description1 = UUID.randomUUID().toString(); + String uuid1 = UUID.randomUUID().toString(); + Integer majorVersion1 = 5; + Integer minorVersion1 = 12; + ExplorationData explorationData1 = new ExplorationData(); + explorationData1.setUuid(uuid1); + explorationData1.setMajorVersion(majorVersion1); + explorationData1.setMinorVersion(minorVersion1); + explorationData1.setDescription(description1); + database.pushElement(explorationData1); + + LoggableElement element = database.findElement(uuid1, majorVersion1, minorVersion1); + assertNotNull(element); + assertEquals(description1, element.getDescription()); + + String description2 = UUID.randomUUID().toString(); + ExplorationData explorationData2 = new ExplorationData(); + explorationData2.setUuid(uuid1); + explorationData2.setMajorVersion(majorVersion1); + explorationData2.setMinorVersion(minorVersion1); + explorationData2.setDescription(description2); + database.pushElement(explorationData2); + + assertEquals(description2, database.findElement(uuid1, majorVersion1, minorVersion1).getDescription()); + + String description3 = UUID.randomUUID().toString(); + Integer minorVersion3 = minorVersion1 + 1; + ExplorationData explorationData3 = new ExplorationData(); + explorationData3.setUuid(uuid1); + explorationData3.setMajorVersion(majorVersion1); + explorationData3.setMinorVersion(minorVersion3); + explorationData3.setDescription(description3); + database.pushElement(explorationData3); + + assertEquals(description3, database.findElement(uuid1, majorVersion1, minorVersion3).getDescription()); + + } catch (Throwable e) { + fail(e.toString()); + } + } + + public final void testFindElement() { + fail("Not yet implemented"); // TODO + } + + public final void testGetElementLatestVersion() { + fail("Not yet implemented"); // TODO + } + + public final void testFindElementsById() { + fail("Not yet implemented"); // TODO + } + + public final void testFindElementsByPropertiesMapOfStringString() { + fail("Not yet implemented"); // TODO + } + + public final void testFindElementsByPropertiesMapOfStringStringClass() { + fail("Not yet implemented"); // TODO + } + + public final void testDeleteElementString() { + fail("Not yet implemented"); // TODO + } + + public final void testDeleteElementStringIntegerInteger() { + fail("Not yet implemented"); // TODO + } + + public final void testLuceneDatabase() { + try { + LuceneDatabase database = new LuceneDatabase(); + } catch (Throwable e) { + fail(e.toString()); + } + + } + +}
participants (1)
-
glandais@users.labs.libre-entreprise.org