You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ke...@apache.org on 2010/10/22 19:47:24 UTC
svn commit: r1026427 [1/2] - in
/incubator/isis/trunk/alternatives/objectstore/sql: ./ integrationtests/
tests-common/ tests-common/src/ tests-common/src/main/
tests-common/src/main/java/ tests-common/src/main/java/org/
tests-common/src/main/java/org/a...
Author: kevin
Date: Fri Oct 22 17:47:22 2010
New Revision: 1026427
URL: http://svn.apache.org/viewvc?rev=1026427&view=rev
Log:
Separated sql integration tests into two. "tests-common" can be run on all systems (requires: hsql-db, in-memory and xml objectstore).
"tests-served" requires configuration. Refer to config/*.properties.
Use profile -P integration-tests to run full test suite, otherwise only tests-common are run.
Added:
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/pom.xml
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/common/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/common/SqlIntegrationTestCommon.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/InMemoryPersistanceTest.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/XmlPersistanceTest.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/singleton/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/singleton/SqlIntegrationTestSingleton.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/SqlDataClassFactory.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/TestProxySystemIII.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SimpleClass.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SimpleClassTwo.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SqlDataClass.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/resources/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/resources/log4j.properties
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/index.apt
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/jottings.apt
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/site.xml
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/config/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/config/hsql.properties
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/apache/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/apache/isis/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/apache/isis/extensions/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/apache/isis/extensions/sql/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/apache/isis/extensions/sql/objectstore/
incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/apache/isis/extensions/sql/objectstore/HsqlTest.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/pom.xml
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/java/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/java/org/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/java/org/apache/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/java/org/apache/isis/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/java/org/apache/isis/extensions/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/java/org/apache/isis/extensions/sql/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/java/org/apache/isis/extensions/sql/objectstore/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/resources/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/resources/log4j.properties
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/index.apt
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/jottings.apt
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/site.xml
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/config/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/config/mysql.properties
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/config/postgresql.properties
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/java/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/java/org/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/java/org/apache/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/java/org/apache/isis/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/java/org/apache/isis/extensions/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/java/org/apache/isis/extensions/sql/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/java/org/apache/isis/extensions/sql/objectstore/
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/java/org/apache/isis/extensions/sql/objectstore/MySqlTest.java
incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/test/java/org/apache/isis/extensions/sql/objectstore/PostgreSqlTest.java
Removed:
incubator/isis/trunk/alternatives/objectstore/sql/integrationtests/
Modified:
incubator/isis/trunk/alternatives/objectstore/sql/pom.xml
Modified: incubator/isis/trunk/alternatives/objectstore/sql/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/pom.xml?rev=1026427&r1=1026426&r2=1026427&view=diff
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/pom.xml (original)
+++ incubator/isis/trunk/alternatives/objectstore/sql/pom.xml Fri Oct 22 17:47:22 2010
@@ -68,24 +68,19 @@
</activation>
<modules>
<module>persistor</module>
+ <module>tests-common</module>
</modules>
</profile>
<profile>
<id>integration-tests</id>
<modules>
<module>persistor</module>
- <module>integrationtests</module>
+ <module>tests-common</module>
+ <module>tests-served</module>
</modules>
</profile>
</profiles>
- <!--
- <modules>
- <module>persistor</module>
- <module>integrationtests</module>
- </modules>
- -->
-
<dependencyManagement>
<dependencies>
<dependency>
@@ -95,9 +90,14 @@
</dependency>
<dependency>
<groupId>org.apache.isis.alternatives.objectstore</groupId>
- <artifactId>sql-integrationtests</artifactId>
+ <artifactId>tests-common</artifactId>
<version>0.1-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.isis.alternatives.objectstore</groupId>
+ <artifactId>tests-served</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </dependency>
</dependencies>
</dependencyManagement>
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/pom.xml?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/pom.xml (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/pom.xml Fri Oct 22 17:47:22 2010
@@ -0,0 +1,116 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.alternatives.objectstore</groupId>
+ <artifactId>sql</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>sql-tests-common</artifactId>
+
+ <name>SQL ObjectStore Integration Tests - Common</name>
+
+ <properties>
+ <xml-objectstore.version>0.1-SNAPSHOT</xml-objectstore.version>
+ <hsqldb.version>1.8.0.10</hsqldb.version>
+ <siteBaseDir>../../..</siteBaseDir>
+ </properties>
+
+ <description>Common code to test the sql persistor. Uses the HSQLDB for maximum compatibility.</description>
+ <build>
+ <plugins>
+ <!-- TODO: currently set to ignore test failures -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <testFailureIgnore>true</testFailureIgnore>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <inherited>false</inherited>
+ <reportSets>
+ <reportSet>
+ <inherited>false</inherited>
+ <reports>
+ <report>dependency-management</report>
+ <report>dependencies</report>
+ <report>dependency-convergence</report>
+ <report>plugins</report>
+ <report>summary</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>${hsqldb.version}</version>
+ </dependency>
+ <!-- Required to support the XML cross-test -->
+ <dependency>
+ <groupId>org.apache.isis.alternatives.objectstore</groupId>
+ <artifactId>xml</artifactId>
+ <version>${xml-objectstore.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- Required for TestProxy -->
+ <!-- Isis defaults -->
+ <dependency>
+ <groupId>org.apache.isis.defaults</groupId>
+ <artifactId>objectstore</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.defaults</groupId>
+ <artifactId>objectstore</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.defaults</groupId>
+ <artifactId>progmodel</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.defaults</groupId>
+ <artifactId>bytecode</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Isis Object store -->
+ <dependency>
+ <groupId>org.apache.isis.alternatives.objectstore</groupId>
+ <artifactId>sql-impl</artifactId>
+ </dependency>
+
+ <!-- HSQLDB -->
+ <dependency>
+ <groupId>org.hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </dependency>
+ <!-- Required to support the XML cross-test -->
+ <dependency>
+ <groupId>org.apache.isis.alternatives.objectstore</groupId>
+ <artifactId>xml</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/common/SqlIntegrationTestCommon.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/common/SqlIntegrationTestCommon.java?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/common/SqlIntegrationTestCommon.java (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/common/SqlIntegrationTestCommon.java Fri Oct 22 17:47:22 2010
@@ -0,0 +1,512 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ *
+ */
+package org.apache.isis.extensions.sql.objectstore.common;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.isis.applib.value.Color;
+import org.apache.isis.applib.value.Date;
+import org.apache.isis.applib.value.DateTime;
+import org.apache.isis.applib.value.Image;
+import org.apache.isis.applib.value.Password;
+import org.apache.isis.applib.value.Percentage;
+import org.apache.isis.applib.value.Time;
+import org.apache.isis.applib.value.TimeStamp;
+import org.apache.isis.metamodel.config.ConfigurationBuilderFileSystem;
+import org.apache.isis.extensions.sql.objectstore.singleton.SqlIntegrationTestSingleton;
+import org.apache.isis.runtime.testsystem.SqlDataClassFactory;
+import org.apache.isis.runtime.testsystem.dataclasses.SimpleClass;
+import org.apache.isis.runtime.testsystem.dataclasses.SimpleClassTwo;
+import org.apache.isis.runtime.testsystem.dataclasses.SqlDataClass;
+
+/**
+ * @author Kevin
+ * kevin@kmz.co.za
+ *
+ * The Singleton class {@link SqlIntegrationTestSingleton} is used to preserve values between tests.
+ * If {@link SqlIntegrationTestSingleton} state is 0, then a full NOF context is recreated.
+ * If {@link SqlIntegrationTestSingleton} state is 1, then the previous context is re-used.
+ *
+ * The state of 1 is used to separate tests into stand-alone methods,
+ * for clarity purposes - without reloading the entire framework.
+ *
+ */
+public abstract class SqlIntegrationTestCommon extends TestCase {
+ // Helper values
+ @SuppressWarnings("deprecation")
+ private static final java.sql.Date sqlDate = new java.sql.Date(java.sql.Date.UTC(110 , 03, 10, 0, 0, 0));
+ private static final Date applibDate = new Date(2010, 3, 5);
+ //private static final Money money = new Money(99.99, "GBP");
+ private static final DateTime dateTime = new DateTime(2010, 3, 5, 22, 23);
+ private static final TimeStamp timeStamp = new TimeStamp(dateTime.longValue());
+ private static final Time time = new Time(14,56);
+ private static final Color color = Color.BLACK;
+ private static final Image image = new Image(new int[][]{{1,2,3},{4,5,6},{7,8,9}});
+ private static final Password password = new Password("password");
+ private static final Percentage percentage = new Percentage(42);
+ // Collection mapper tests
+ private static final List<String> stringList1 = Arrays.asList("Baking", "Bakery",
+ "Canned", "Dairy");
+ private static final List<String> stringList2 = Arrays.asList("Fridge", "Deli",
+ "Fresh Produce", "Frozen", "Household", "Other..");
+ private static List<SimpleClass> simpleClassList1 = new ArrayList<SimpleClass>();
+ private static List<SimpleClass> simpleClassList2 = new ArrayList<SimpleClass>();
+
+ private static SimpleClassTwo simpleClassTwoA;
+ //private static SimpleClassTwo simpleClassTwoB;
+
+ ConfigurationBuilderFileSystem loader;
+
+ private SqlIntegrationTestSingleton getSingletonInstance() {
+ return SqlIntegrationTestSingleton.getInstance();
+ }
+
+ public Properties getProperties(){
+ try {
+ Properties properties = new Properties();
+ properties.load(new FileInputStream("src/test/config/"+getPropertiesFilename()));
+ return properties;
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+ public abstract String getPropertiesFilename();
+ public String getPersonTableName() {
+ return "sqldataclass";
+ }
+ public String getSimpleClassTableName() {
+ return "simpleclass";
+ }
+ public String getSimpleClassTwoTableName() {
+ return "simpleclasstwo";
+ }
+
+ public String getSqlSetupString(){
+ return null;
+ }
+ public String getSqlTeardownString(){
+ return null;
+ }
+
+ /**
+ * 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 initialiseTests() {
+ }
+
+ // Set-up the test environment
+ public void setUp() throws FileNotFoundException, IOException,
+ ClassNotFoundException, InstantiationException, IllegalAccessException,
+ SQLException {
+ Logger.getRootLogger().setLevel(Level.INFO );
+
+ // Initialise the framework
+ if (getSingletonInstance().getState() == 0){
+ Properties properties = getProperties();
+ if (properties == null){
+ getSingletonInstance().initNOF("src/test/config", getPropertiesFilename());
+ } else {
+ getSingletonInstance().initNOF(properties);
+ }
+
+ String sqlSetupString = getSqlSetupString();
+ if (sqlSetupString != null){
+ getSingletonInstance().sqlExecute(sqlSetupString);
+ }
+ }
+ }
+ // Tear down the test environment
+ public void tearDown(){
+ if (getSingletonInstance().getState() == 0){
+ String sqlTeardownString = getSqlTeardownString();
+ if (sqlTeardownString != null){
+ try {
+ getSingletonInstance().sqlExecute(sqlTeardownString);
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ getSingletonInstance().shutDown();
+ }
+ }
+
+
+ /**
+ * TODO Confirm that the system tables are created as expected
+ */
+ public void testSetup() {
+ initialiseTests();
+ getSingletonInstance().setState(0);
+ }
+
+ /**
+ * Create a {@link SqlDataClass} and persist to the store.
+ * @throws Exception
+ */
+ public void testCreate() throws Exception {
+ SqlIntegrationTestSingleton.drop(getPersonTableName());
+ SqlIntegrationTestSingleton.drop(getSimpleClassTableName());
+ SqlIntegrationTestSingleton.drop(getSimpleClassTwoTableName());
+
+ SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
+ SqlDataClass sqlDataClass = factory.newDataClass();
+ sqlDataClass.setString("Test String");
+ sqlDataClass.setDate(applibDate);
+ sqlDataClass.setSqlDate(sqlDate);
+ //sqlDataClass.setMoney(money); // TODO: Money is broken
+ sqlDataClass.setDateTime(dateTime);
+ sqlDataClass.setTimeStamp(timeStamp);
+ sqlDataClass.setTime(time);
+ sqlDataClass.setColor(color);
+ sqlDataClass.setImage(image);
+ sqlDataClass.setPassword(password);
+ sqlDataClass.setPercentage(percentage);
+
+ // Setup SimpleClassTwo
+ simpleClassTwoA = factory.newSimpleClassTwo();
+ simpleClassTwoA.setText("A");
+ //simpleClassTwoB = factory.newSimpleClassTwo();
+ //simpleClassTwoB.setString("A");
+
+ sqlDataClass.setSimpleClassTwo(simpleClassTwoA);
+
+ // Initialise collection1
+ boolean bMustAdd = false;
+ if (simpleClassList1.size() == 0){
+ bMustAdd = true;
+ }
+ for (String string : SqlIntegrationTestCommon.stringList1) {
+ SimpleClass simpleClass = factory.newSimpleClass();
+ simpleClass.setString(string);
+ simpleClass.setSimpleClassTwoA(simpleClassTwoA);
+ sqlDataClass.addToSimpleClasses1(simpleClass);
+ if (bMustAdd){
+ simpleClassList1.add(simpleClass);
+ }
+ }
+
+ // Initialise collection2
+ /**/
+ for (String string : SqlIntegrationTestCommon.stringList2) {
+ SimpleClass simpleClass = factory.newSimpleClass();
+ simpleClass.setString(string);
+ simpleClass.setSimpleClassTwoA(simpleClassTwoA);
+ sqlDataClass.addToSimpleClasses2(simpleClass);
+ if (bMustAdd){
+ simpleClassList2.add(simpleClass);
+ }
+ }
+ /**/
+ factory.save(sqlDataClass);
+
+ // For in-memory only!
+ if (getProperties().getProperty("isis.persistence") == "in-memory"){
+ getSingletonInstance().setState(1);
+ }
+
+ }
+
+ /**
+ * Test loading a persisted {@link SqlDataClass} from the sql store.
+ * @throws Exception
+ */
+ public void testLoad() throws Exception {
+ SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
+ List<SqlDataClass> people = factory.allDataClasses();
+ assertEquals(1, people.size());
+ SqlDataClass sqlDataClass = people.get(0);
+ SqlIntegrationTestSingleton.setPerson(sqlDataClass);
+ getSingletonInstance().setState(1);
+ }
+
+ /**
+ * Test {@link SqlDataClass} {@link String} field.
+ * @throws Exception
+ */
+ public void testString(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ assertEquals("Test String", sqlDataClass.getString());
+ }
+
+ /**
+ * Test {@link SqlDataClass} {@link Date} field.
+ * @throws Exception
+ */
+ public void testDate(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ Logger.getRootLogger().log(Level.INFO, sqlDataClass.getDate());
+ assertTrue(applibDate.toString()+" is not equal to "+sqlDataClass.getDate().toString(),
+ applibDate.isEqualTo(sqlDataClass.getDate()));
+ }
+
+ /**
+ * Test {@link SqlDataClass} {@link java.sql.Date} field.
+ * @throws Exception
+ */
+ public void testSqlDate(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ Logger.getRootLogger().log(Level.INFO, sqlDataClass.getSqlDate());
+ assertTrue("SQL date "+sqlDate.toString()+" is not equal to "+sqlDataClass.getSqlDate().toString(),
+ sqlDate.compareTo(sqlDataClass.getSqlDate())==0);
+ }
+
+ /**
+ * Test {@link Money} type.
+ */
+ /*
+ public void testMoney(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ assertTrue("Money "+money.toString()+" is not equal to "+sqlDataClass.getMoney().toString(),
+ money.equals(sqlDataClass.getMoney()));
+ }
+ */
+
+ /**
+ * Test {@link DateTime} type.
+ */
+ public void testDateTime(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ assertTrue("DateTime "+dateTime.toString()+" is not equal to "+sqlDataClass.getDateTime().toString(),
+ dateTime.equals(sqlDataClass.getDateTime()));
+ }
+ /**
+ * Test {@link TimeStamp} type.
+ */
+ public void testTimeStamp(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ assertTrue("TimeStamp "+timeStamp.toString()+" is not equal to "+sqlDataClass.getTimeStamp().toString(),
+ timeStamp.isEqualTo(sqlDataClass.getTimeStamp()));
+ }
+
+
+ /**
+ * Test {@link Time} type.
+ */
+ /**/
+ public void testTime(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ assertNotNull("sqlDataClass is null", sqlDataClass);
+ assertNotNull("getTime() is null", sqlDataClass.getTime());
+ assertTrue("Time "+time.toString()+" is not equal to "+sqlDataClass.getTime().toString(),
+ time.isEqualTo(sqlDataClass.getTime()));
+ }
+ /**/
+
+ /**
+ * Test {@link Color} type.
+ */
+ public void testColor(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ assertTrue("Color "+color.toString()+" is not equal to "+sqlDataClass.getColor().toString(),
+ color.isEqualTo(sqlDataClass.getColor()));
+ }
+
+ /**
+ * Test {@link Image} type.
+ */
+ // TODO: Images are not equal...
+ /*
+ public void testImage(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ Image image2 = sqlDataClass.getImage();
+ assertEqual(image, image2);
+ }
+
+ private void assertEqual(Image image2, Image image3) {
+ assertEquals(image2.getHeight(), image3.getHeight());
+ assertEquals(image2.getWidth(), image3.getWidth());
+ boolean same = true;
+ int i=0,j=0;
+ int p1=0, p2=0;
+ String error = "";
+ int [][] i1 = image2.getImage(), i2 = image3.getImage();
+ for(i = 0; same && i<image2.getHeight();i++){
+ int [] r1 = i1[i], r2 = i2[i];
+ for (j = 0; same && j < image2.getWidth(); j++){
+ if (r1[j] != r2[j]){
+ same = false;
+ p1 = r1[j]; p2 = r2[j];
+ error = "Images differ at i = "+i+", j = "+j+", "+p1+
+ " is not "+p2+"!";
+ break;
+ }
+ }
+ }
+ assertTrue(error, same);
+ }
+ */
+
+
+ /**
+ * Test {@link Password} type.
+ */
+ public void testPassword(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ assertTrue("Password "+password.toString()+" is not equal to "+sqlDataClass.getPassword().toString(),
+ password.equals(sqlDataClass.getPassword()));
+ }
+
+ /**
+ * Test {@link Percentage} type.
+ */
+ public void testPercentage(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ assertTrue("Percentage "+percentage.toString()+" is not equal to "+sqlDataClass.getPercentage().toString(),
+ percentage.equals(sqlDataClass.getPercentage()));
+ }
+
+ /**
+ * Test {@link StringCollection} type.
+ */
+ /*
+ public void testStringCollection(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ List<String> collection = sqlDataClass.getStringCollection();
+ int i = 0;
+ for (String string : collection) {
+ assertEquals(SqlIntegrationTestCommon.stringList.get(i++), string);
+ }
+ }
+ */
+
+ public void testSimpleClassCollection1Lazy(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ List<SimpleClass> collection = sqlDataClass.getSimpleClasses1();
+
+ //assertEquals("collection size is not equal!",
+ // SqlIntegrationTestCommon.simpleClassList1.size(),
+ // collection.size());
+ if (collection.size() == 0){
+ SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
+ factory.resolve(sqlDataClass);
+ }
+ }
+
+ /**
+ * Test a collection of {@link SimpleClass} type.
+ */
+ public void testSimpleClassCollection1(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ List<SimpleClass> collection = sqlDataClass.getSimpleClasses1();
+
+ assertEquals("collection size is not equal!",
+ SqlIntegrationTestCommon.simpleClassList1.size(),
+ collection.size());
+
+ int i = 0;
+ for (SimpleClass simpleClass : SqlIntegrationTestCommon.simpleClassList1) {
+ assertEquals(simpleClass.getString(), collection.get(i++).getString());
+ }
+ }
+
+ /**
+ * Test another collection of {@link SimpleClass} type.
+ */
+ /**/
+ public void testSimpleClassCollection2(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ List<SimpleClass> collection = sqlDataClass.getSimpleClasses2();
+
+ assertEquals("collection size is not equal!",
+ SqlIntegrationTestCommon.simpleClassList2.size(),
+ collection.size());
+
+ int i = 0;
+ for (SimpleClass simpleClass : SqlIntegrationTestCommon.simpleClassList2) {
+ assertEquals(simpleClass.getString(), collection.get(i++).getString());
+ }
+ }
+ /**/
+ public void testSingleReferenceLazy(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ SimpleClassTwo a = sqlDataClass.getSimpleClassTwo();
+ if (getProperties().getProperty("isis.persistence") != "in-memory"){
+ assertEquals(null, a.getText());
+ }
+ }
+
+ public void testSimpleClassTwoReferenceLazy(){
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ List<SimpleClass> collection = sqlDataClass.getSimpleClasses1();
+ if (getProperties().getProperty("isis.persistence") != "in-memory"){
+ for (SimpleClass simpleClass : collection) {
+ SimpleClassTwo a = simpleClass.getSimpleClassTwoA();
+ assertEquals(null, a.getText());
+ }
+ }
+ }
+
+ public void testSingleReferenceResolve(){
+ SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ SimpleClassTwo a = sqlDataClass.getSimpleClassTwo();
+ factory.resolve(a);
+ assertEquals(simpleClassTwoA.getText(), a.getText());
+ }
+
+
+ public void testSimpleClassTwoReferenceResolve(){
+ SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
+ SqlDataClass sqlDataClass = SqlIntegrationTestSingleton.getPerson();
+ List<SimpleClass> collection = sqlDataClass.getSimpleClasses1();
+ for (SimpleClass simpleClass : collection) {
+ SimpleClassTwo a = simpleClass.getSimpleClassTwoA();
+ factory.resolve(a);
+ assertEquals(simpleClassTwoA.getText(), a.getText());
+ }
+ }
+
+
+ public void testSimpleClassTwo(){
+ SqlDataClassFactory factory = SqlIntegrationTestSingleton.getSqlDataClassFactory();
+ List<SimpleClassTwo> classes = factory.allSimpleClassTwos();
+ assertEquals(1, classes.size());
+ for (SimpleClassTwo simpleClass : classes) {
+ assertEquals(simpleClassTwoA.getText(), simpleClass.getText());
+ }
+ }
+
+
+ // Last "test" - Set the Singleton state to 0 to invoke a clean shutdown.
+ public void testSetStateZero(){
+ getSingletonInstance().setState(0);
+ }
+
+}
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/InMemoryPersistanceTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/InMemoryPersistanceTest.java?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/InMemoryPersistanceTest.java (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/InMemoryPersistanceTest.java Fri Oct 22 17:47:22 2010
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ *
+ */
+package org.apache.isis.extensions.sql.objectstore.crosscheck;
+
+import java.util.Properties;
+
+import org.apache.isis.extensions.sql.objectstore.common.SqlIntegrationTestCommon;
+
+
+
+
+public class InMemoryPersistanceTest extends SqlIntegrationTestCommon {
+
+ @Override
+ public Properties getProperties(){
+ Properties properties = new Properties();
+ properties.put("isis.persistence", "in-memory");
+ properties.put("isis.logging.objectstore","on");
+ return properties;
+ }
+
+ public String getPropertiesFilename(){
+ return "inmemory.properties";
+ }
+ @Override
+ public String getSqlTeardownString(){
+ return "SHUTDOWN;";
+ }
+
+
+}
+
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/XmlPersistanceTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/XmlPersistanceTest.java?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/XmlPersistanceTest.java (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/crosscheck/XmlPersistanceTest.java Fri Oct 22 17:47:22 2010
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ *
+ */
+package org.apache.isis.extensions.sql.objectstore.crosscheck;
+
+import java.util.Properties;
+
+import org.apache.isis.extensions.sql.objectstore.common.SqlIntegrationTestCommon;
+import java.io.*;
+
+
+
+
+public class XmlPersistanceTest extends SqlIntegrationTestCommon {
+
+ public static void deleteFiles( String directory, FilenameFilter extension ) {
+ File dir = new File(directory);
+
+ String[] list = dir.list(extension);
+ File file;
+ if (list.length == 0) return;
+
+ for (int i = 0; i < list.length; i++) {
+ file = new File(directory, list[i]);
+ file.delete();
+ }
+ }
+
+ public void initialiseTests() {
+ // Delete all XML files.
+ deleteFiles("xml/objects", new FilenameFilter() {
+
+ @Override
+ public boolean accept(File arg0, String arg1) {
+ return arg1.endsWith(".xml");
+ }
+ });
+ }
+
+ @Override
+ public Properties getProperties(){
+ Properties properties = new Properties();
+ properties.put("isis.persistence", "xml");
+ properties.put("isis.logging.objectstore","on");
+ return properties;
+ }
+ public String getPropertiesFilename(){
+ return "xml.properties";
+ }
+ @Override
+ public String getSqlTeardownString(){
+ return "SHUTDOWN;";
+ }
+
+
+}
+
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/singleton/SqlIntegrationTestSingleton.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/singleton/SqlIntegrationTestSingleton.java?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/singleton/SqlIntegrationTestSingleton.java (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/extensions/sql/objectstore/singleton/SqlIntegrationTestSingleton.java Fri Oct 22 17:47:22 2010
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ *
+ */
+package org.apache.isis.extensions.sql.objectstore.singleton;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.isis.metamodel.config.internal.PropertiesConfiguration;
+import org.apache.isis.runtime.testsystem.SqlDataClassFactory;
+import org.apache.isis.runtime.testsystem.TestProxySystemIII;
+import org.apache.isis.runtime.testsystem.dataclasses.SimpleClass;
+import org.apache.isis.runtime.testsystem.dataclasses.SqlDataClass;
+//import org.postgresql.util.PSQLException;
+
+/**
+ * @author Kevin
+ *
+ */
+public class SqlIntegrationTestSingleton {
+ static SqlIntegrationTestSingleton instance;
+ public static SqlIntegrationTestSingleton getInstance(){
+ if (instance == null){
+ instance = new SqlIntegrationTestSingleton();
+ }
+ return instance;
+ }
+
+
+ private int state = 0;
+ public int getState() {
+ return state;
+ }
+ public void setState(int state) {
+ this.state = state;
+ }
+ private String persistorName;
+ private SqlDataClassFactory sqlDataClassFactory = null;
+ private TestProxySystemIII system = null;
+ public void initNOF(String propertiesDirectory, String propertiesFileName) throws FileNotFoundException, IOException,
+ SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException{
+
+ Properties properties = new Properties();
+ properties.load(new FileInputStream(propertiesDirectory+"/"+propertiesFileName));
+ this.initNOF(properties);
+ }
+
+ public void initNOF(Properties properties) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException {
+ PropertiesConfiguration configuration = new PropertiesConfiguration();
+ configuration.add(properties);
+ persistorName = configuration.getString("isis.persistence");
+
+ resetPersistorState(configuration);
+
+ sqlDataClassFactory = new SqlDataClassFactory();
+ if (system != null){
+ system.shutDown();
+ }
+ system = new TestProxySystemIII();
+ system.setConfiguration(configuration);
+ system.init(sqlDataClassFactory);
+ }
+
+ // JDBC
+ private Connection c = null;
+ private Statement s = null;
+ private SqlDataClass sqlDataClass;
+
+ @SuppressWarnings("unchecked")
+ private void resetPersistorState(PropertiesConfiguration PropertiesConfiguration) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException{
+ String jdbcClassName = PropertiesConfiguration.getString("isis.persistence.sql.jdbc.driver");
+ if (jdbcClassName == null){
+ c = null;
+ s = null;
+ return;
+ }
+ Class<Driver> driverClass = (Class<Driver>) Class.forName(jdbcClassName);
+ Driver driver = driverClass.newInstance();
+ DriverManager.registerDriver(driver);
+
+ // jdbc - connect to DB and drop tables.
+ c = DriverManager.getConnection(
+ PropertiesConfiguration.getString("isis.persistence.sql.jdbc.connection"),
+ PropertiesConfiguration.getString("isis.persistence.sql.jdbc.user"),
+ PropertiesConfiguration.getString("isis.persistence.sql.jdbc.password"));
+ s = c.createStatement();
+
+ dropTable("no_services");
+ }
+ private void dropTable(String tableName) {
+ if (s == null){
+ if (persistorName == "xml"){
+ // Delete the xml files..
+ }
+
+ if (tableName == "sqldataclass"){
+ List<SqlDataClass> list = sqlDataClassFactory.allDataClasses();
+ for (SqlDataClass sqlDataClass : list) {
+ sqlDataClassFactory.delete(sqlDataClass);
+ }
+ return;
+ }
+ if (tableName == "simpleclass"){
+ List<SimpleClass> list = sqlDataClassFactory.allSimpleClasses();
+ for (SimpleClass sqlClass : list) {
+ sqlDataClassFactory.delete(sqlClass);
+ }
+ return;
+ }
+ return;
+ }
+ /**/
+ try {
+ s.executeUpdate("DROP TABLE "+tableName+";");
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ /**/
+ }
+
+ public void sqlExecute(String sqlString) throws SQLException{
+ if (s != null){
+ s.executeUpdate(sqlString);
+ }
+ }
+
+ public static SqlDataClassFactory getSqlDataClassFactory(){
+ return getInstance().sqlDataClassFactory;
+ }
+
+ public static void drop(String tableName){
+ getInstance().dropTable(tableName);
+ }
+
+ public void shutDown(){
+ if (system != null){
+ system.shutDown();
+ }
+ }
+
+ public static void setPerson(SqlDataClass person) {
+ getInstance().setSqlDataClass(person);
+
+ }
+ public static SqlDataClass getPerson() {
+ return getInstance().getSqlDataClass();
+
+ }
+
+ private void setSqlDataClass(SqlDataClass person) {
+ this.sqlDataClass = person;
+
+ }
+ /**
+ * @return the sqlDataClass
+ */
+ public SqlDataClass getSqlDataClass() {
+ return sqlDataClass;
+ }
+}
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/SqlDataClassFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/SqlDataClassFactory.java?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/SqlDataClassFactory.java (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/SqlDataClassFactory.java Fri Oct 22 17:47:22 2010
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ *
+ */
+package org.apache.isis.runtime.testsystem;
+
+import java.util.List;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.runtime.testsystem.dataclasses.SimpleClass;
+import org.apache.isis.runtime.testsystem.dataclasses.SimpleClassTwo;
+import org.apache.isis.runtime.testsystem.dataclasses.SqlDataClass;
+
+
+/**
+ * @author Kevin
+ *
+ */
+public class SqlDataClassFactory extends AbstractFactoryAndRepository {
+ public List<SqlDataClass> allDataClasses() {
+ return allInstances(SqlDataClass.class);
+ }
+
+ public SqlDataClass newDataClass() {
+ SqlDataClass object = newTransientInstance(SqlDataClass.class);
+ return object;
+ }
+
+ public void save(SqlDataClass sqlDataClass){
+ persist(sqlDataClass);
+ }
+ public void delete(SqlDataClass sqlDataClass){
+ remove(sqlDataClass);
+ }
+
+ // SimpleClass
+ public List<SimpleClass> allSimpleClasses() {
+ return allInstances(SimpleClass.class);
+ }
+
+ public SimpleClass newSimpleClass() {
+ SimpleClass object = newTransientInstance(SimpleClass.class);
+ return object;
+ }
+
+ public void save(SimpleClass simpleClass){
+ persist(simpleClass);
+ }
+
+ public void delete(SimpleClass simpleClass){
+ remove(simpleClass);
+ }
+
+ // SimpleClassTwo
+ public List<SimpleClassTwo> allSimpleClassTwos() {
+ return allInstances(SimpleClassTwo.class);
+ }
+
+ public SimpleClassTwo newSimpleClassTwo() {
+ SimpleClassTwo object = newTransientInstance(SimpleClassTwo.class);
+ return object;
+ }
+
+ public void save(SimpleClassTwo simpleClassTwo){
+ persist(simpleClassTwo);
+ }
+
+ public void delete(SimpleClassTwo simpleClassTwo){
+ remove(simpleClassTwo);
+ }
+
+ public void resolve(final Object domainObject) {
+ getContainer().resolve(domainObject);
+ }
+
+}
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/TestProxySystemIII.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/TestProxySystemIII.java?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/TestProxySystemIII.java (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/TestProxySystemIII.java Fri Oct 22 17:47:22 2010
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.isis.runtime.testsystem;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.jmock.lib.legacy.ClassImposteriser;
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.metamodel.config.internal.PropertiesConfiguration;
+import org.apache.isis.metamodel.specloader.ObjectReflectorAbstract;
+import org.apache.isis.metamodel.specloader.SpecificationLoader;
+import org.apache.isis.extensions.sql.objectstore.SqlPersistorInstaller;
+import org.apache.isis.extensions.xml.objectstore.XmlPersistenceMechanismInstaller;
+import org.apache.isis.runtime.authentication.AuthenticationManager;
+import org.apache.isis.runtime.authentication.standard.SimpleSession;
+import org.apache.isis.runtime.authorization.AuthorizationManager;
+import org.apache.isis.runtime.context.IsisContext;
+import org.apache.isis.runtime.context.IsisContextStatic;
+import org.apache.isis.runtime.imageloader.TemplateImageLoader;
+import org.apache.isis.runtime.objectstore.inmemory.InMemoryPersistenceMechanismInstaller;
+import org.apache.isis.runtime.persistence.PersistenceSessionFactory;
+import org.apache.isis.runtime.persistence.internal.RuntimeContextFromSession;
+import org.apache.isis.runtime.persistence.objectstore.ObjectStorePersistenceMechanismInstallerAbstract;
+import org.apache.isis.runtime.session.IsisSessionFactoryDefault;
+import org.apache.isis.runtime.system.DeploymentType;
+import org.apache.isis.runtime.system.installers.JavaReflectorInstaller;
+import org.apache.isis.runtime.userprofile.UserProfileLoader;
+
+/*
+ * TODO allow to be created with specific requirements for components being set up rather than using mocks.
+ */
+public class TestProxySystemIII {
+
+ private PropertiesConfiguration configuration;
+ public void setConfiguration(PropertiesConfiguration configuration) {
+ this.configuration = configuration;
+ }
+ public PropertiesConfiguration getConfiguration() {
+ if (configuration == null){
+ configuration = new PropertiesConfiguration();
+ }
+ return configuration;
+ }
+
+
+ private List<Object> servicesList;
+ private Mockery mockery = new JUnit4Mockery(){{
+ setImposteriser(ClassImposteriser.INSTANCE);
+ }};
+ private IsisSessionFactoryDefault sessionFactory = null;
+ private ObjectStorePersistenceMechanismInstallerAbstract persistenceMechanismInstaller;
+
+
+
+ public void init(AbstractFactoryAndRepository factory) {
+ servicesList = new ArrayList<Object>();
+ servicesList.add(factory);
+
+ final TemplateImageLoader mockTemplateImageLoader = mockery.mock(TemplateImageLoader.class);
+ final UserProfileLoader mockUserProfileLoader = mockery.mock(UserProfileLoader.class);
+ final AuthenticationManager mockAuthenticationManager = mockery.mock(AuthenticationManager.class);
+ final AuthorizationManager mockAuthorizationManager = mockery.mock(AuthorizationManager.class);
+
+ mockery.checking(new Expectations() {
+ {
+ ignoring(mockTemplateImageLoader);
+ ignoring(mockUserProfileLoader);
+ ignoring(mockAuthenticationManager);
+ ignoring(mockAuthorizationManager);
+ }
+ });
+
+ SpecificationLoader mockSpecificationLoader;
+ JavaReflectorInstaller javaReflectorInstaller = new JavaReflectorInstaller();
+ javaReflectorInstaller.setConfiguration(configuration);
+ mockSpecificationLoader = javaReflectorInstaller.createReflector();
+
+ ((ObjectReflectorAbstract) mockSpecificationLoader).setRuntimeContext(new RuntimeContextFromSession());
+
+ if (configuration.getString("isis.persistence.sql.jdbc.driver") == null){
+ if (configuration.getString("isis.persistence") == "in-memory"){
+ /*InMemoryPersistenceMechanismInstaller*/ //persistenceMechanismInstaller = new InMemoryPersistenceMechanismInstaller();
+ persistenceMechanismInstaller = new InMemoryPersistenceMechanismInstaller();
+ } else {
+ persistenceMechanismInstaller = new XmlPersistenceMechanismInstaller();
+ }
+ } else {
+ persistenceMechanismInstaller = new SqlPersistorInstaller();
+ }
+
+ persistenceMechanismInstaller.setConfiguration(configuration);
+ PersistenceSessionFactory persistenceSessionFactory = persistenceMechanismInstaller.createPersistenceSessionFactory(DeploymentType.PROTOTYPE);
+
+ sessionFactory = new IsisSessionFactoryDefault(
+ DeploymentType.EXPLORATION,
+ configuration,
+ mockTemplateImageLoader,
+ mockSpecificationLoader,
+ mockAuthenticationManager,
+ mockAuthorizationManager,
+ mockUserProfileLoader,
+ persistenceSessionFactory,
+ servicesList);
+ IsisContext context = IsisContextStatic.createRelaxedInstance(sessionFactory);
+ IsisContext.setConfiguration(sessionFactory.getConfiguration());
+ sessionFactory.init();
+
+ context.openSessionInstance(new SimpleSession("tester", new String[0], "001"));
+ }
+
+ public void addToConfiguration(String key, String value) {
+ configuration.add(key, value);
+ }
+
+ public void shutDown(){
+ if (sessionFactory != null){
+ sessionFactory.shutdown();
+ }
+ if (persistenceMechanismInstaller != null){
+ persistenceMechanismInstaller.shutdown();
+ }
+ }
+}
+
+
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SimpleClass.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SimpleClass.java?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SimpleClass.java (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SimpleClass.java Fri Oct 22 17:47:22 2010
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ *
+ */
+package org.apache.isis.runtime.testsystem.dataclasses;
+
+import org.apache.isis.applib.AbstractDomainObject;
+
+/**
+ * @author Kevin
+ *
+ */
+public class SimpleClass extends AbstractDomainObject {
+ public String title() {
+ return string;
+ }
+ // {{ String type
+ private String string;
+ public String getString() {
+ return string;
+ }
+ public void setString(final String string) {
+ this.string = string;
+ }
+ // }}
+
+ // {{ SimpleClassTwoA
+ private SimpleClassTwo simplyClassTwoA;
+ public SimpleClassTwo getSimpleClassTwoA() {
+ return simplyClassTwoA;
+ }
+ public void setSimpleClassTwoA(final SimpleClassTwo simpleClassTwoA) {
+ this.simplyClassTwoA = simpleClassTwoA;
+ }
+ // }}
+
+
+}
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SimpleClassTwo.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SimpleClassTwo.java?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SimpleClassTwo.java (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SimpleClassTwo.java Fri Oct 22 17:47:22 2010
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ *
+ */
+package org.apache.isis.runtime.testsystem.dataclasses;
+
+import org.apache.isis.applib.AbstractDomainObject;
+
+/**
+ * @author Kevin
+ *
+ */
+public class SimpleClassTwo extends AbstractDomainObject {
+ public String title() {
+ return text;
+ }
+ // {{ String type
+ private String text;
+ public String getText() {
+ return text;
+ }
+ public void setText(final String text) {
+ this.text = text;
+ }
+ // }}
+
+ // {{ Value
+ private Integer integer;
+
+ public Integer getValue() {
+ return integer;
+ }
+
+ public void setValue(final Integer integer) {
+ this.integer = integer;
+ }
+ // }}
+
+
+}
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SqlDataClass.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SqlDataClass.java?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SqlDataClass.java (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/java/org/apache/isis/runtime/testsystem/dataclasses/SqlDataClass.java Fri Oct 22 17:47:22 2010
@@ -0,0 +1,277 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.isis.runtime.testsystem.dataclasses;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.applib.AbstractDomainObject;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.value.Color;
+import org.apache.isis.applib.value.Date;
+import org.apache.isis.applib.value.DateTime;
+import org.apache.isis.applib.value.Image;
+import org.apache.isis.applib.value.Money;
+import org.apache.isis.applib.value.Password;
+import org.apache.isis.applib.value.Percentage;
+import org.apache.isis.applib.value.Time;
+import org.apache.isis.applib.value.TimeStamp;
+import org.apache.isis.extensions.sql.objectstore.common.SqlIntegrationTestCommon;
+
+/**
+ * The SqlDataClass is a test class used in the sql-persistor integration tests.
+ * It's properties are stored and retrieved using the persistor, to confirm
+ * accurate persistence behaviour.
+ *
+ * Each property here requires an equivalent test in {@link SqlIntegrationTestCommon}
+ *
+ * @author Kevin Meyer
+ *
+ */
+
+public class SqlDataClass extends AbstractDomainObject{
+ public String title() {
+ return string;
+ }
+
+ // Isis Date Type
+ // {{ Date
+ private Date date;
+ public Date getDate() {
+ return date;
+ }
+ public void setDate(final Date date) {
+ this.date = date;
+ }
+ // }}
+
+ // {{ String type
+ private String string;
+ public String getString() {
+ return string;
+ }
+ public void setString(final String string) {
+ this.string = string;
+ }
+ // }}
+
+ // SQL Date Type
+ // {{ SqlDate
+ private java.sql.Date sqlDate;
+
+ @MemberOrder(sequence = "1")
+ public java.sql.Date getSqlDate() {
+ return sqlDate;
+ }
+
+ public void setSqlDate(final java.sql.Date sqlDate) {
+ this.sqlDate = sqlDate;
+ }
+ // }}
+
+ // {{ Money
+ private Money money;
+
+ @MemberOrder(sequence = "1")
+ public Money getMoney() {
+ return money;
+ }
+
+ public void setMoney(final Money money) {
+ this.money = money;
+ }
+ // }}
+
+ // {{ DateTime
+ private DateTime dateTime;
+
+ @MemberOrder(sequence = "1")
+ public DateTime getDateTime() {
+ return dateTime;
+ }
+
+ public void setDateTime(final DateTime dateTime) {
+ this.dateTime = dateTime;
+ }
+ // }}
+
+ // {{ TimeStamp
+ private TimeStamp timeStamp;
+
+ @MemberOrder(sequence = "1")
+ public TimeStamp getTimeStamp() {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(final TimeStamp timeStamp) {
+ this.timeStamp = timeStamp;
+ }
+ // }}
+
+
+ // Color, Image, Password, Percentage, Time
+ // {{ Time
+ private Time time;
+ @MemberOrder(sequence = "1")
+ public Time getTime() {
+ return time;
+ }
+ public void setTime(final Time time) {
+ this.time = time;
+ }
+ // }}
+
+
+ // {{ Color
+ private Color color;
+ @MemberOrder(sequence = "1")
+ public Color getColor() {
+ return color;
+ }
+ public void setColor(final Color color) {
+ this.color = color;
+ }
+ // }}
+
+ // {{ Image
+ private Image image;
+ @MemberOrder(sequence = "1")
+ public Image getImage() {
+ return image;
+ }
+ public void setImage(final Image image) {
+ this.image = image;
+ }
+ // }}
+
+ // {{ Password
+ private Password password;
+ @MemberOrder(sequence = "1")
+ public Password getPassword() {
+ return password;
+ }
+ public void setPassword(final Password password) {
+ this.password = password;
+ }
+ // }}
+
+ // {{ Percentage
+ private Percentage percentage;
+ @MemberOrder(sequence = "1")
+ public Percentage getPercentage() {
+ return percentage;
+ }
+ public void setPercentage(final Percentage percentage) {
+ this.percentage = percentage;
+ }
+ // }}
+
+ // {{ SimpleClasses
+ private List<SimpleClass> simpleClasses1 = new ArrayList<SimpleClass>();
+
+ @MemberOrder(sequence = "1")
+ public List<SimpleClass> getSimpleClasses1() {
+ return simpleClasses1;
+ }
+
+ public void setSimpleClasses1(final List<SimpleClass> simpleClasses) {
+ this.simpleClasses1 = simpleClasses;
+ }
+ public void addToSimpleClasses1(final SimpleClass simpleClass) {
+ // check for no-op
+ if (simpleClass == null || getSimpleClasses1().contains(simpleClass)) {
+ return;
+ }
+ // associate new
+ getSimpleClasses1().add(simpleClass);
+ // additional business logic
+ onAddToSimpleClasses1(simpleClass);
+ }
+
+ public void removeFromSimpleClasses1(final SimpleClass simpleClass) {
+ // check for no-op
+ if (simpleClass == null || !getSimpleClasses1().contains(simpleClass)) {
+ return;
+ }
+ // dissociate existing
+ getSimpleClasses1().remove(simpleClass);
+ // additional business logic
+ onRemoveFromSimpleClasses1(simpleClass);
+ }
+
+ protected void onAddToSimpleClasses1(final SimpleClass simpleClass) {
+ }
+ protected void onRemoveFromSimpleClasses1(final SimpleClass simpleClass) {
+ }
+ // }}
+
+ // {{ SimpleClasses2
+ /**/
+ private List<SimpleClass> simpleClasses2 = new ArrayList<SimpleClass>();
+
+ @MemberOrder(sequence = "1")
+ public List<SimpleClass> getSimpleClasses2() {
+ return simpleClasses2;
+ }
+
+ public void setSimpleClasses2(final List<SimpleClass> simpleClasses) {
+ this.simpleClasses2 = simpleClasses;
+ }
+ public void addToSimpleClasses2(final SimpleClass simpleClass) {
+ // check for no-op
+ if (simpleClass == null || getSimpleClasses2().contains(simpleClass)) {
+ return;
+ }
+ // associate new
+ getSimpleClasses2().add(simpleClass);
+ // additional business logic
+ onAddToSimpleClasses2(simpleClass);
+ }
+
+ public void removeFromSimpleClasses2(final SimpleClass simpleClass) {
+ // check for no-op
+ if (simpleClass == null || !getSimpleClasses2().contains(simpleClass)) {
+ return;
+ }
+ // dissociate existing
+ getSimpleClasses2().remove(simpleClass);
+ // additional business logic
+ onRemoveFromSimpleClasses2(simpleClass);
+ }
+
+ protected void onAddToSimpleClasses2(final SimpleClass simpleClass) {
+ }
+ protected void onRemoveFromSimpleClasses2(final SimpleClass simpleClass) {
+ }
+ /**/
+ // }}
+
+ // {{ SimpleClassTwo
+ private SimpleClassTwo simplyClassTwo;
+ public SimpleClassTwo getSimpleClassTwo() {
+ return simplyClassTwo;
+ }
+ public void setSimpleClassTwo(final SimpleClassTwo simpleClassTwo) {
+ this.simplyClassTwo = simpleClassTwo;
+ }
+ // }}
+}
+// Copyright (c) Kevin Meyer, www.kmz.co.za.
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/resources/log4j.properties?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/resources/log4j.properties (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/main/resources/log4j.properties Fri Oct 22 17:47:22 2010
@@ -0,0 +1,23 @@
+# apache's log4j is used to provide system logging.
+log4j.rootCategory=DEBUG, Console, File
+#log4j.rootCategory=INFO, Console, File
+
+
+# The console appender
+log4j.appender.Console=org.apache.log4j.ConsoleAppender
+log4j.appender.Console.target=System.out
+log4j.appender.Console.layout=org.apache.log4j.PatternLayout
+log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} [%-20c{1} %-10t %-5p] %m%n
+
+
+log4j.appender.File=org.apache.log4j.RollingFileAppender
+log4j.appender.File.file=isis.log
+log4j.appender.File.append=false
+#log4j.appender.File.maxFileSize=500KB
+#log4j.appender.File.maxBackupIndex=1
+log4j.appender.File.layout=org.apache.log4j.PatternLayout
+log4j.appender.File.layout.ConversionPattern=%d [%-20c{1} %-10t %-5p] %m%n
+
+
+
+
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/index.apt?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/index.apt (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/index.apt Fri Oct 22 17:47:22 2010
@@ -0,0 +1,24 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+
+
+SQL ObjectStore Integration Tests
+
+* ALPHA
+
+ This module holds the integration tests for the {{{../index.html}SQL ObjectStore}}.
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/jottings.apt
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/jottings.apt?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/jottings.apt (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/apt/jottings.apt Fri Oct 22 17:47:22 2010
@@ -0,0 +1,24 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+
+
+Jottings
+
+ This page is to capture any random jottings relating to this module prior
+ to being moved into formal documentation.
+
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/site.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/site.xml?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/site.xml (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/site/site.xml Fri Oct 22 17:47:22 2010
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+
+ <body>
+ <breadcrumbs>
+ <item name="Tests" />
+ </breadcrumbs>
+
+ <menu name="SQL ObjectStore Tests">
+ <item name="About" href="index.html" />
+ </menu>
+
+ <menu name="Maven Reports" ref="reports" />
+ </body>
+</project>
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/config/hsql.properties
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/config/hsql.properties?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/config/hsql.properties (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/config/hsql.properties Fri Oct 22 17:47:22 2010
@@ -0,0 +1,5 @@
+# This should be fine for all implementations
+isis.persistence.sql.jdbc.driver=org.hsqldb.jdbcDriver
+isis.persistence.sql.jdbc.connection=jdbc:hsqldb:file:hsql-db/tests
+isis.persistence.sql.jdbc.user=sa
+isis.persistence.sql.jdbc.password=
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/apache/isis/extensions/sql/objectstore/HsqlTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/apache/isis/extensions/sql/objectstore/HsqlTest.java?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/apache/isis/extensions/sql/objectstore/HsqlTest.java (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-common/src/test/java/org/apache/isis/extensions/sql/objectstore/HsqlTest.java Fri Oct 22 17:47:22 2010
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+/**
+ *
+ */
+package org.apache.isis.extensions.sql.objectstore;
+
+import java.util.Properties;
+
+import org.apache.isis.extensions.sql.objectstore.common.SqlIntegrationTestCommon;
+
+
+
+
+public class HsqlTest extends SqlIntegrationTestCommon {
+
+ @Override
+ public Properties getProperties(){
+ Properties properties = super.getProperties();
+ if (properties == null){
+ properties = new Properties();
+ properties.put("isis.persistence.sql.jdbc.driver", "org.hsqldb.jdbcDriver");
+ properties.put("isis.persistence.sql.jdbc.connection", "jdbc:hsqldb:file:hsql-db/tests");
+ properties.put("isis.persistence.sql.jdbc.user", "sa");
+ properties.put("isis.persistence.sql.jdbc.password", "");
+ properties.put("isis.logging.objectstore","on");
+ }
+
+ return properties;
+ }
+
+ public String getPropertiesFilename(){
+ return "hsql.properties";
+ }
+
+ @Override
+ public
+ String getSqlTeardownString(){
+ return "SHUTDOWN;";
+ }
+
+
+}
+
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-served/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-served/pom.xml?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-served/pom.xml (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-served/pom.xml Fri Oct 22 17:47:22 2010
@@ -0,0 +1,139 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.isis.alternatives.objectstore</groupId>
+ <artifactId>sql</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>sql-tests-served</artifactId>
+
+ <name>SQL ObjectStore Integration Tests - Served</name>
+
+ <properties>
+ <postgresql.version>8.4-701.jdbc4</postgresql.version>
+ <mysql.version>5.0.5</mysql.version>
+ <siteBaseDir>../../..</siteBaseDir>
+ </properties>
+
+ <description>Runs the common tests against a few server implementations.
+Just add your server implementation to org.apache.isis.extensions.sql.objectstore</description>
+ <build>
+ <plugins>
+ <!-- TODO: currently set to ignore test failures -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <testFailureIgnore>true</testFailureIgnore>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <inherited>false</inherited>
+ <reportSets>
+ <reportSet>
+ <inherited>false</inherited>
+ <reports>
+ <report>dependency-management</report>
+ <report>dependencies</report>
+ <report>dependency-convergence</report>
+ <report>plugins</report>
+ <report>summary</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- SQL integration tests common -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sql-tests-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- Required to support the XML cross-test -->
+ <!--
+ <dependency>
+ <groupId>org.apache.isis.alternatives.objectstore</groupId>
+ <artifactId>xml</artifactId>
+ <version>${xml-objectstore.version}</version>
+ </dependency>
+ -->
+
+ <!-- JDBC drivers -->
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>${postgresql.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${mysql.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- Required for TestProxy -->
+ <!-- Isis defaults -->
+ <dependency>
+ <groupId>org.apache.isis.defaults</groupId>
+ <artifactId>objectstore</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.defaults</groupId>
+ <artifactId>objectstore</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.defaults</groupId>
+ <artifactId>progmodel</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.defaults</groupId>
+ <artifactId>bytecode</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Isis Object store -->
+ <dependency>
+ <groupId>org.apache.isis.alternatives.objectstore</groupId>
+ <artifactId>sql-impl</artifactId>
+ </dependency>
+
+ <!-- Test common -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sql-tests-common</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Required to support the implemented servers -->
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/resources/log4j.properties?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/resources/log4j.properties (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/main/resources/log4j.properties Fri Oct 22 17:47:22 2010
@@ -0,0 +1,23 @@
+# apache's log4j is used to provide system logging.
+log4j.rootCategory=DEBUG, Console, File
+#log4j.rootCategory=INFO, Console, File
+
+
+# The console appender
+log4j.appender.Console=org.apache.log4j.ConsoleAppender
+log4j.appender.Console.target=System.out
+log4j.appender.Console.layout=org.apache.log4j.PatternLayout
+log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} [%-20c{1} %-10t %-5p] %m%n
+
+
+log4j.appender.File=org.apache.log4j.RollingFileAppender
+log4j.appender.File.file=isis.log
+log4j.appender.File.append=false
+#log4j.appender.File.maxFileSize=500KB
+#log4j.appender.File.maxBackupIndex=1
+log4j.appender.File.layout=org.apache.log4j.PatternLayout
+log4j.appender.File.layout.ConversionPattern=%d [%-20c{1} %-10t %-5p] %m%n
+
+
+
+
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/index.apt?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/index.apt (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/index.apt Fri Oct 22 17:47:22 2010
@@ -0,0 +1,24 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+
+
+SQL ObjectStore Integration Tests
+
+* ALPHA
+
+ This module holds the integration tests for the {{{../index.html}SQL ObjectStore}}.
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/jottings.apt
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/jottings.apt?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/jottings.apt (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/apt/jottings.apt Fri Oct 22 17:47:22 2010
@@ -0,0 +1,24 @@
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+
+
+
+Jottings
+
+ This page is to capture any random jottings relating to this module prior
+ to being moved into formal documentation.
+
Added: incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/site.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/site.xml?rev=1026427&view=auto
==============================================================================
--- incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/site.xml (added)
+++ incubator/isis/trunk/alternatives/objectstore/sql/tests-served/src/site/site.xml Fri Oct 22 17:47:22 2010
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project>
+
+ <body>
+ <breadcrumbs>
+ <item name="Tests" />
+ </breadcrumbs>
+
+ <menu name="SQL ObjectStore Tests">
+ <item name="About" href="index.html" />
+ </menu>
+
+ <menu name="Maven Reports" ref="reports" />
+ </body>
+</project>