From: Wolfgang M. M. <wol...@us...> - 2004-09-12 19:51:34
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20942/src/org/exist/xmldb/test Modified Files: RemoteDBTest.java RemoteCollectionTest.java ResourceTest.java Log Message: Changed the remote tests to shut down the database server after the test. Index: RemoteCollectionTest.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/test/RemoteCollectionTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RemoteCollectionTest.java 12 Sep 2004 09:25:22 -0000 1.4 --- RemoteCollectionTest.java 12 Sep 2004 19:51:24 -0000 1.5 *************** *** 8,11 **** --- 8,13 ---- import java.util.Iterator; + import junit.textui.TestRunner; + import org.exist.schema.RemoteSchemaService; import org.exist.xmldb.RemoteCollectionManagementService; *************** *** 38,44 **** protected void tearDown() throws Exception { removeCollection(); } - public void testIndexQueryService() { // TODO ............. --- 40,46 ---- protected void tearDown() throws Exception { removeCollection(); + stopServer(getCollection()); } public void testIndexQueryService() { // TODO ............. *************** *** 83,86 **** --- 85,95 ---- } + public void testGetNonExistentResource() throws XMLDBException { + System.out.println("Retrieving non-existing resource -----------------"); + Collection collection = getCollection(); + Resource resource = collection.getResource("12345.xml"); + assertNull(resource); + } + public void testListResources() throws XMLDBException { ArrayList xmlNames = new ArrayList(); *************** *** 115,117 **** --- 124,129 ---- } + public static void main(String[] args) { + TestRunner.run(RemoteCollectionTest.class); + } } Index: RemoteDBTest.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/test/RemoteDBTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RemoteDBTest.java 3 Sep 2004 09:05:33 -0000 1.1 --- RemoteDBTest.java 12 Sep 2004 19:51:24 -0000 1.2 *************** *** 87,90 **** --- 87,93 ---- // Thread ?? Server.main(new String[] {}); + synchronized(this) { + wait(500); + } } *************** *** 104,107 **** --- 107,117 ---- if (mgr != null) mgr.shutdown(); + Server.shutdown(); + synchronized(this) { + try { + wait(1000); + } catch (InterruptedException e) { + } + } } Index: ResourceTest.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/test/ResourceTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ResourceTest.java 3 Aug 2004 16:45:44 -0000 1.10 --- ResourceTest.java 12 Sep 2004 19:51:24 -0000 1.11 *************** *** 23,26 **** --- 23,27 ---- import org.xmldb.api.base.Collection; import org.xmldb.api.base.Database; + import org.xmldb.api.base.Resource; import org.xmldb.api.base.XMLDBException; import org.xmldb.api.modules.XMLResource; *************** *** 39,42 **** --- 40,55 ---- } + public void testReadNonExistingResource() { + try { + Collection testCollection = DatabaseManager.getCollection(URI + "/test"); + assertNotNull(testCollection); + Resource nonExistent = testCollection.getResource("12345.xml"); + assertNull(nonExistent); + } catch(Exception e) { + System.out.println("testReadNonExistingResource(): Exception: " + e); + fail(e.getMessage()); + } + } + public void testReadResource() { try { |