cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1204585 - in /cxf/branches/2.4.x-fixes: ./ 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/
Date Mon, 21 Nov 2011 16:43:30 GMT
Author: ay
Date: Mon Nov 21 16:43:29 2011
New Revision: 1204585

URL: http://svn.apache.org/viewvc?rev=1204585&view=rev
Log:
Merged revisions 1204500,1204537 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1204500 | ay | 2011-11-21 14:59:23 +0100 (Mon, 21 Nov 2011) | 1 line
  
  [CXF-3921] makingRMTxStore's tabel-exists error state configurable
........
  r1204537 | ay | 2011-11-21 16:19:36 +0100 (Mon, 21 Nov 2011) | 1 line
  
  fixing jdk15 build for CXF-3921
........

Added:
    cxf/branches/2.4.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/txstore-custom-error-bean.xml
      - copied unchanged from r1204500, cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/txstore-custom-error-bean.xml
Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
    cxf/branches/2.4.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreConfigurationTest.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 21 16:43:29 2011
@@ -1 +1 @@
-/cxf/trunk:1202267
+/cxf/trunk:1202267,1204500,1204537

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java?rev=1204585&r1=1204584&r2=1204585&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
Mon Nov 21 16:43:29 2011
@@ -148,6 +148,9 @@ public class RMTxStore implements RMStor
     private String userName;
     private String password;
     
+    private String tableExistsState = DERBY_TABLE_EXISTS_STATE;
+    private int tableExistsCode = ORACLE_TABLE_EXISTS_CODE;
+    
     // configuration
     
     public void setDriverClassName(String dcn) {
@@ -182,6 +185,22 @@ public class RMTxStore implements RMStor
         return userName;
     }
    
+    public String getTableExistsState() {
+        return tableExistsState;
+    }
+
+    public void setTableExistsState(String tableExistsState) {
+        this.tableExistsState = tableExistsState;
+    }
+
+    public int getTableExistsCode() {
+        return tableExistsCode;
+    }
+
+    public void setTableExistsCode(int tableExistsCode) {
+        this.tableExistsCode = tableExistsCode;
+    }
+
     public void setConnection(Connection c) {
         connection = c;
     }
@@ -742,8 +761,9 @@ public class RMTxStore implements RMStor
     }
 
     protected boolean isTableExistsError(SQLException ex) {
-        return DERBY_TABLE_EXISTS_STATE.equals(ex.getSQLState())
-                || ORACLE_TABLE_EXISTS_CODE == ex.getErrorCode();
+        // we could be deriving the state/code from the driver url to avoid explicit setting
of them
+        return (null != tableExistsState && tableExistsState.equals(ex.getSQLState()))
+                || tableExistsCode == ex.getErrorCode();
     }
 
 

Modified: cxf/branches/2.4.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreConfigurationTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreConfigurationTest.java?rev=1204585&r1=1204584&r2=1204585&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreConfigurationTest.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStoreConfigurationTest.java
Mon Nov 21 16:43:29 2011
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.ws.rm.persistence.jdbc;
 
+import java.sql.SQLException;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.ws.rm.RMManager;
@@ -46,4 +48,16 @@ public class RMTxStoreConfigurationTest 
         assertEquals("jdbc:derby://localhost:1527/rmdb;create=true", store.getUrl());
     }
    
+    @Test
+    public void testSetCustomTableExistsState() {
+        SpringBusFactory factory = new SpringBusFactory();
+        Bus bus = factory.createBus("org/apache/cxf/ws/rm/persistence/jdbc/txstore-custom-error-bean.xml");
+        RMManager manager = bus.getExtension(RMManager.class);
+        assertNotNull(manager);
+        RMTxStore store = (RMTxStore)manager.getStore();
+                
+        assertTrue(store.isTableExistsError(new SQLException("Table exists", "I6000", 288)));
+        
+        assertFalse(store.isTableExistsError(new SQLException("Unknown error", "00000", -1)));
+    }
 }



Mime
View raw message