incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r1384047 - in /incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src: main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/ test/java/org/apache/isis/runtimes/dflt/objectstores/sql/ test/java/org/apac...
Date Wed, 12 Sep 2012 17:34:49 GMT
Author: kevin
Date: Wed Sep 12 17:34:49 2012
New Revision: 1384047

URL: http://svn.apache.org/viewvc?rev=1384047&view=rev
Log:
ISIS-268: Patched XmlPersistenceTest and InMemoryPersistanceTest to get them passing tests
again

Modified:
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/Data.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommonBase.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestData.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/InMemoryPersistenceTest.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/Data.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/Data.java?rev=1384047&r1=1384046&r2=1384047&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/Data.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/Data.java
Wed Sep 12 17:34:49 2012
@@ -75,7 +75,7 @@ public class Data {
     static final List<String> stringList2 = Arrays.asList("Fridge", "Deli", "Fresh
Produce", "Frozen", "Household",
         "Other..");
 
-    static List<String> getTableNames() {
+    public static List<String> getTableNames() {
         return Arrays.asList("sqldataclass", "simpleclass", "simpleclasstwo", "primitivevaluedentity");
     }
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommonBase.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommonBase.java?rev=1384047&r1=1384046&r2=1384047&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommonBase.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestCommonBase.java
Wed Sep 12 17:34:49 2012
@@ -18,10 +18,8 @@
  */
 package org.apache.isis.runtimes.dflt.objectstores.sql.common;
 
-import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
 import java.io.IOException;
 import java.sql.SQLException;
 import java.util.Properties;
@@ -32,7 +30,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 
-import org.apache.isis.core.testsupport.files.Files;
 import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
 import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures.State;
@@ -44,7 +41,7 @@ public abstract class SqlIntegrationTest
 
     @Rule
     public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-    
+
     protected SqlIntegrationTestFixtures getSqlIntegrationTestFixtures() {
         return SqlIntegrationTestFixtures.getInstance();
     }
@@ -67,11 +64,8 @@ public abstract class SqlIntegrationTest
         return null;
     }
 
-    
-
     public abstract String getPropertiesFilename();
 
-
     protected void setFixtureInitializationStateIfNot(State state, String persistenceMechanism)
{
         if (!persistenceMechanismIs(persistenceMechanism)) {
             setFixtureInitializationState(state);
@@ -87,26 +81,21 @@ public abstract class SqlIntegrationTest
     protected void setFixtureInitializationState(final State state) {
         getSqlIntegrationTestFixtures().setState(state);
     }
-    
+
     protected boolean persistenceMechanismIs(final String persistenceMechanism) {
         return getProperties().getProperty("isis.persistor").equals(persistenceMechanism);
     }
 
-
-    
     /**
-     * This method can be used to do any DB specific actions the first time the
-     * test framework is setup. e.g. In the XML test, it must delete all XML
-     * files in the data store directory.
+     * This method can be used to do any DB specific actions the first time the test framework
is setup. e.g. In the XML
+     * test, it must delete all XML files in the data store directory.
      */
     public void resetPersistenceStoreDirectlyIfRequired() {
     }
 
-    
-    
-    ////////////////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////////////////
     // before, after
-    ////////////////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////////////////
 
     @Before
     public void setUpSystem() throws Exception {
@@ -115,7 +104,7 @@ public abstract class SqlIntegrationTest
         if (!getSqlIntegrationTestFixtures().getState().isInitialize()) {
             return;
         }
-        
+
         final Properties properties = getProperties();
         if (properties == null) {
             getSqlIntegrationTestFixtures().initSystem("src/test/config", getPropertiesFilename());
@@ -128,7 +117,6 @@ public abstract class SqlIntegrationTest
             getSqlIntegrationTestFixtures().sqlExecute(sqlSetupString);
         }
     }
-    
 
     /**
      * optional hook
@@ -140,22 +128,21 @@ public abstract class SqlIntegrationTest
     @Before
     public void setUpFactory() throws Exception {
         factory = getSqlIntegrationTestFixtures().getSqlDataClassFactory();
-        
+
         // may have been setup by previous test
         sqlDataClass = getSqlIntegrationTestFixtures().getSqlDataClass();
         referencingPolyTypesEntity = getSqlIntegrationTestFixtures().getPolyTestClass();
     }
 
-
-    ////////////////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////////////////
     // after
-    ////////////////////////////////////////////////////////////////////////////////
+    // //////////////////////////////////////////////////////////////////////////////
 
     @After
     public void tearDown() throws Exception {
         if (!getSqlIntegrationTestFixtures().getState().isInitialize()) {
             return;
-        } 
+        }
         final String sqlTeardownString = getSqlTeardownString();
         if (sqlTeardownString != null) {
             try {
@@ -174,6 +161,4 @@ public abstract class SqlIntegrationTest
         return null;
     }
 
-
-
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestData.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestData.java?rev=1384047&r1=1384046&r2=1384047&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestData.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/common/SqlIntegrationTestData.java
Wed Sep 12 17:34:49 2012
@@ -120,15 +120,12 @@ public abstract class SqlIntegrationTest
 
     }
 
-    private void testSetup() {
+    protected void testSetup() {
         resetPersistenceStoreDirectlyIfRequired();
         getSqlIntegrationTestFixtures().setState(State.INITIALIZE);
     }
 
-    private void testCreate() throws Exception {
-        for (final String tableName : Data.getTableNames()) {
-            getSqlIntegrationTestFixtures().dropTable(tableName);
-        }
+    protected void testCreate() throws Exception {
 
         sqlDataClass = factory.newDataClass();
 
@@ -164,6 +161,7 @@ public abstract class SqlIntegrationTest
         pve2.setLongProperty(Data.longMinValue);
         pve2.setDoubleProperty(Data.doubleMinValue);
         pve2.setFloatProperty(Data.floatMinValue);
+        pve2.setCharProperty((char) (32)); // temporary work around: See ISIS-269
 
         sqlDataClass.setPrimitiveValuedEntityMin(pve2);
 
@@ -174,6 +172,7 @@ public abstract class SqlIntegrationTest
         pve1.setLongProperty(Data.longMaxValue);
         pve1.setDoubleProperty(Data.doubleMaxValue);
         pve1.setFloatProperty(Data.floatMaxValue);
+        pve1.setCharProperty((char) (255));
 
         sqlDataClass.setPrimitiveValuedEntityMax(pve1);
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java?rev=1384047&r1=1384046&r2=1384047&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java
Wed Sep 12 17:34:49 2012
@@ -20,6 +20,7 @@ package org.apache.isis.runtimes.dflt.ob
 
 import org.apache.isis.core.testsupport.files.Files;
 import org.apache.isis.core.testsupport.files.Files.Recursion;
+import org.apache.isis.runtimes.dflt.objectstores.sql.common.Data;
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestData;
 
 public class HsqlTest extends SqlIntegrationTestData {
@@ -30,6 +31,14 @@ public class HsqlTest extends SqlIntegra
     }
 
     @Override
+    protected void testCreate() throws Exception {
+        for (final String tableName : Data.getTableNames()) {
+            getSqlIntegrationTestFixtures().dropTable(tableName);
+        }
+        super.testCreate();
+    }
+
+    @Override
     public String getPropertiesFilename() {
         return "hsql.properties";
     }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/InMemoryPersistenceTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/InMemoryPersistenceTest.java?rev=1384047&r1=1384046&r2=1384047&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/InMemoryPersistenceTest.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/InMemoryPersistenceTest.java
Wed Sep 12 17:34:49 2012
@@ -25,6 +25,8 @@ package org.apache.isis.runtimes.dflt.ob
 import java.util.Properties;
 
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestData;
+import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures;
+import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures.State;
 
 public class InMemoryPersistenceTest extends SqlIntegrationTestData {
 
@@ -32,11 +34,23 @@ public class InMemoryPersistenceTest ext
     public Properties getProperties() {
         final Properties properties = new Properties();
         properties.put("isis.persistor", "in-memory");
-        properties.put("isis.logging.objectstore", "on");
+        properties.put("isis.logging.objectstore", "off");
         return properties;
     }
 
     @Override
+    protected void testSetup() {
+        resetPersistenceStoreDirectlyIfRequired();
+        SqlIntegrationTestFixtures.recreate();
+        try {
+            SqlIntegrationTestFixtures.getInstance().initSystem(getProperties());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        getSqlIntegrationTestFixtures().setState(State.INITIALIZE);
+    }
+
+    @Override
     public String getPropertiesFilename() {
         return "inmemory.properties";
     }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java?rev=1384047&r1=1384046&r2=1384047&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java
Wed Sep 12 17:34:49 2012
@@ -27,6 +27,8 @@ import java.util.Properties;
 import org.apache.isis.core.testsupport.files.Files;
 import org.apache.isis.core.testsupport.files.Files.Recursion;
 import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestData;
+import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures;
+import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures.State;
 
 public class XmlPersistenceTest extends SqlIntegrationTestData {
 
@@ -36,10 +38,22 @@ public class XmlPersistenceTest extends 
     }
 
     @Override
+    protected void testSetup() {
+        resetPersistenceStoreDirectlyIfRequired();
+        SqlIntegrationTestFixtures.recreate();
+        try {
+            SqlIntegrationTestFixtures.getInstance().initSystem(getProperties());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        getSqlIntegrationTestFixtures().setState(State.INITIALIZE);
+    }
+
+    @Override
     public Properties getProperties() {
         final Properties properties = new Properties();
         properties.put("isis.persistor", "xml");
-        properties.put("isis.logging.objectstore", "on");
+        properties.put("isis.logging.objectstore", "off");
         return properties;
     }
 



Mime
View raw message