cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r538918 - in /incubator/cxf/trunk: rt/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/ rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/ systests/src/test/java/org/apache/cxf/systest/ws/rm/ testutils/src/main/java/...
Date Thu, 17 May 2007 13:42:47 GMT
Author: andreasmyth
Date: Thu May 17 06:42:45 2007
New Revision: 538918

URL: http://svn.apache.org/viewvc?view=rev&rev=538918
Log:
Propagated system property derby.system.home to server to avoid creation of build artefacts
outside of target directory.
Used different derby home directory for client and server so both can use the embedded driver.

Modified:
    incubator/cxf/trunk/rt/pom.xml
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/PersistenceTest.java
    incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java

Modified: incubator/cxf/trunk/rt/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/pom.xml?view=diff&rev=538918&r1=538917&r2=538918
==============================================================================
--- incubator/cxf/trunk/rt/pom.xml (original)
+++ incubator/cxf/trunk/rt/pom.xml Thu May 17 06:42:45 2007
@@ -32,6 +32,7 @@
     </parent>
 
     <modules>
+        <!--
         <module>core</module>
         <module>transports/local</module>
         <module>databinding/jaxb</module>
@@ -49,6 +50,8 @@
         <module>ws/rm</module>
         <module>ws/security</module>
         <module>management</module>
+        -->
+        <module>ws/rm</module>
     </modules>
 
     <scm>

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java?view=diff&rev=538918&r1=538917&r2=538918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
(original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
Thu May 17 06:42:45 2007
@@ -542,7 +542,7 @@
     synchronized void init() {
         
         if (null == connection) {
-
+            LOG.log(Level.FINE, "Using derby.system.home: {0}", System.getProperty("derby.system.home"));
             assert null != url;
             assert null != driverClassName;
             try {
@@ -556,6 +556,7 @@
 
             } catch (SQLException ex) {
                 LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", ex);
+                return;
             }
         }
         
@@ -564,6 +565,12 @@
             createTables();
         } catch (SQLException ex) {
             LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", ex);
+            SQLException se = ex;
+            while (se.getNextException() != null) {
+                se = se.getNextException();
+                LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", se);
+            }
+            throw new RMStoreException(ex);
         }   
     }   
     
@@ -576,22 +583,27 @@
     }
     
     public static void deleteDatabaseFiles(String path, boolean now) {
-        File root = null;
         String dsh = System.getProperty("derby.system.home");
+       
+        File root = null;  
+        File log = null;
         if (null == dsh) {
-            File log = new File("derby.log");
-            if (log.exists()) {
-                if (now) {
-                    log.delete();
-                } else {
-                    log.deleteOnExit();
-                }
-            }
-            root = new File(path);
+            log = new File("derby.log");
+            root = new File(path);            
         } else {
-            root = new File(dsh);
+            log = new File(dsh, "derby.log"); 
+            root = new File(dsh, path);
+        }
+        if (log.exists()) {            
+            if (now) {
+                boolean deleted = log.delete();
+                LOG.log(Level.FINE, "Deleted log file {0}: {1}", new Object[] {log, deleted});
+            } else {
+                log.deleteOnExit();
+            }
         }
         if (root.exists()) {
+            LOG.log(Level.FINE, "Trying to delete directory {0}", root);
             recursiveDelete(root, now);
         }
 

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTest.java?view=diff&rev=538918&r1=538917&r2=538918
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTest.java
(original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreTest.java
Thu May 17 06:42:45 2007
@@ -68,7 +68,6 @@
 
         store = new RMTxStore();
         store.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
-        store.setUrl("jdbc:derby:rmdb;create=true");
         store.init();
         
         ack1 = new SequenceAcknowledgement();

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/PersistenceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/PersistenceTest.java?view=diff&rev=538918&r1=538917&r2=538918
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/PersistenceTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/PersistenceTest.java
Thu May 17 06:42:45 2007
@@ -45,6 +45,7 @@
 import org.apache.cxf.ws.rm.persistence.RMMessage;
 import org.apache.cxf.ws.rm.persistence.RMStore;
 import org.apache.cxf.ws.rm.persistence.jdbc.RMTxStore;
+import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
@@ -78,6 +79,7 @@
 
         public static void main(String[] args) {
             try {
+                RMTxStore.deleteDatabaseFiles();
                 Server s = new Server();
                 s.start();
             } catch (Exception ex) {
@@ -90,9 +92,20 @@
     }
 
     @BeforeClass
-    public static void startServers() throws Exception {
-        RMTxStore.deleteDatabaseFiles("rmdb", true);
-        assertTrue("server did not launch correctly", launchServer(Server.class));
+    public static void startServers() throws Exception {        
+        String derbyHome = System.getProperty("derby.system.home");
+        try {
+            System.setProperty("derby.system.home", derbyHome + "-server");
+            assertTrue("server did not launch correctly", launchServer(Server.class));
+        } finally {
+            System.setProperty("derby.system.home", derbyHome);
+        }
+        RMTxStore.deleteDatabaseFiles();
+    }
+    
+    @AfterClass
+    public static void tearDownOnce() {
+        RMTxStore.deleteDatabaseFiles(RMTxStore.DEFAULT_DATABASE_DIR, false);
     }
 
     @Before
@@ -162,7 +175,11 @@
         
         Collection<RMMessage> msgs = 
             store.getMessages(sss.iterator().next().getIdentifier(), true);
-        assertEquals(3, msgs.size());            
+        assertEquals(3, msgs.size());  
+        
+        msgs = 
+            store.getMessages(sss.iterator().next().getIdentifier(), false);
+        assertEquals(0, msgs.size());  
     }
     
     @Ignore

Modified: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java?view=diff&rev=538918&r1=538917&r2=538918
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
(original)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
Thu May 17 06:42:45 2007
@@ -352,6 +352,10 @@
         if (null != validationMode) {
             cmd.add("-Dspring.validation.mode=" + validationMode);
         }
+        String derbyHome = System.getProperty("derby.system.home");
+        if (null != derbyHome) {
+            cmd.add("-Dderby.system.home=" + derbyHome);
+        }
         
         cmd.add(className);
 



Mime
View raw message