You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/12/06 17:59:48 UTC
[51/52] [partial] ISIS-188: more reorganizing of artifacts into
physical directories.
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java b/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java
new file mode 100644
index 0000000..be4be4b
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/HsqlTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.runtimes.dflt.objectstores.sql;
+
+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;
+import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures;
+
+/**
+ * @author Kevin kevin@kmz.co.za
+ *
+ * This test implementation uses the HyperSQL database engine to perform "serverless" tests of data creation and
+ * reloading.
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+public class HsqlTest extends SqlIntegrationTestData {
+
+ @Override
+ public void resetPersistenceStoreDirectlyIfRequired() {
+ Files.deleteFilesWithPrefix("hsql-db", "tests", Recursion.DONT_RECURSE);
+ }
+
+ @Override
+ protected void testCreate() throws Exception {
+ final SqlIntegrationTestFixtures sqlIntegrationTestFixtures = getSqlIntegrationTestFixtures();
+ for (final String tableName : Data.getTableNames()) {
+ sqlIntegrationTestFixtures.dropTable(tableName);
+ }
+ super.testCreate();
+ }
+
+ @Override
+ protected String getSqlSetupString() {
+ return "COMMIT;";
+ }
+
+ @Override
+ public String getPropertiesFilename() {
+ return "hsql.properties";
+ }
+
+ @Override
+ public String getSqlTeardownString() {
+ return "SHUTDOWN;";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PolymorphismTest.java
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PolymorphismTest.java b/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PolymorphismTest.java
new file mode 100755
index 0000000..795ff49
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PolymorphismTest.java
@@ -0,0 +1,349 @@
+/*
+ * 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.runtimes.dflt.objectstores.sql;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Test;
+
+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.SqlIntegrationTestCommonBase;
+import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures;
+import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestFixtures.State;
+import org.apache.isis.tck.dom.poly.Empty;
+import org.apache.isis.tck.dom.poly.EmptyEntityWithOwnProperty;
+import org.apache.isis.tck.dom.poly.ReferencingPolyTypesEntity;
+import org.apache.isis.tck.dom.poly.SelfReferencingEntity;
+import org.apache.isis.tck.dom.poly.StringBaseEntity;
+import org.apache.isis.tck.dom.poly.StringBaseEntitySub;
+import org.apache.isis.tck.dom.poly.StringBaseEntitySubThree;
+import org.apache.isis.tck.dom.poly.StringBaseEntitySubTwo;
+import org.apache.isis.tck.dom.poly.Stringable;
+import org.apache.isis.tck.dom.poly.StringableEntityWithOwnDerivedProperty;
+import org.apache.isis.tck.dom.poly.StringableEntityWithOwnProperties;
+import org.apache.isis.tck.dom.poly.StringableEntityWithOwnProperty;
+
+/**
+ * @author Kevin kevin@kmz.co.za
+ *
+ * This test implementation uses the HyperSQL database engine to perform "serverless" tests of polymorphic class
+ * object creation and reloading.
+ *
+ * The sql object store thus allows your domain objects to have properties referenced via interface or
+ * superclass. Both single reference properties and property collections are supported.
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class PolymorphismTest extends SqlIntegrationTestCommonBase {
+
+ private static final String IMPL_A_STRING = "Impl A String";
+ private static final String IMPL_B_STRING = "Impl B String";
+ private static final String CHILD_1 = "Child 1";
+
+ private static StringableEntityWithOwnProperty polyIntImpA;
+ private static StringableEntityWithOwnProperties polyIntImpB;
+
+ @Override
+ public String getPropertiesFilename() {
+ return "hsql-poly.properties";
+ }
+
+ @Override
+ public void resetPersistenceStoreDirectlyIfRequired() {
+ Files.deleteFilesWithPrefix("hsql-db", "poly", Recursion.DONT_RECURSE);
+ getSqlIntegrationTestFixtures();
+ }
+
+ @Override
+ public String getSqlTeardownString() {
+ return "SHUTDOWN;";
+ }
+
+ // Order is important. The next three "tests" must be executed in the correct sequential order.
+ @Test
+ /**
+ * Sets up the database connection and tells the test framework to create an instance of the
+ * Isis framework for the next "test".
+ */
+ public void test1SetupStoreAndDatabaseConnection() throws Exception {
+ testSetup();
+ }
+
+ @Test
+ /**
+ * Uses the database connection to drop database tables related to these tests.
+ * This forces (and exercises the ability of) the object store to re-create the tables.
+ *
+ * Also uses factory methods within the Isis framework to create the test data,
+ * thus exercising the "create data" portion of the object store.
+ *
+ * The Isis framework will be again be re-created in the next test unless the
+ * object store is "in-memory" (this is required since "in-memory" has to be
+ * left alone for created data to still be present in the next test).
+ */
+ public void test2SetupDataWithDatabaseConnection() throws Exception {
+ final SqlIntegrationTestFixtures sqlIntegrationTestFixtures = getSqlIntegrationTestFixtures();
+ sqlIntegrationTestFixtures.dropTable("ISIS_SELFREFERENCINGENTITY");
+ sqlIntegrationTestFixtures.dropTable("ISIS_STRINGABLEENTITYWITHOWNPROPERTY");
+ sqlIntegrationTestFixtures.dropTable("ISIS_STRINGABLEENTITYWITHOWNPROPERTIES");
+ sqlIntegrationTestFixtures.dropTable("ISIS_STRINGBASEENTITYSUB");
+ sqlIntegrationTestFixtures.dropTable("ISIS_STRINGBASEENTITYSUBTWO");
+ sqlIntegrationTestFixtures.dropTable("ISIS_STRINGBASEENTITYSUBTHREE");
+ sqlIntegrationTestFixtures.dropTable("ISIS_REFERENCINGPOLYTYPESENTITY");
+ sqlIntegrationTestFixtures.dropTable("ISIS_STRINGBASEENTITY");
+ sqlIntegrationTestFixtures.dropTable("ISIS_STRINGABLE");
+
+ final ReferencingPolyTypesEntity referencingPolyTypesEntity = factory.newPolyTestClass();
+ referencingPolyTypesEntity.setString("polyTestClassString");
+
+ // Setup self-referencing collection
+ final SelfReferencingEntity polySelfRefClassParent = factory.newPolySelfRefClass();
+ polySelfRefClassParent.setString("Parent");
+
+ final SelfReferencingEntity polySelfRefClassChild1 = factory.newPolySelfRefClass();
+ polySelfRefClassChild1.setString(CHILD_1);
+ polySelfRefClassParent.addToPolySelfRefClasses(polySelfRefClassChild1);
+
+ final SelfReferencingEntity polySelfRefClassChild2 = factory.newPolySelfRefClass();
+ polySelfRefClassChild2.setString("Child 2");
+ polySelfRefClassParent.addToPolySelfRefClasses(polySelfRefClassChild2);
+ factory.save(polySelfRefClassChild2);
+
+ final SelfReferencingEntity polySelfRefClassChild3 = factory.newPolySelfRefClass();
+ polySelfRefClassChild3.setString("Child 1 of Child 1");
+ polySelfRefClassChild1.addToPolySelfRefClasses(polySelfRefClassChild3);
+
+ factory.save(polySelfRefClassChild3);
+ factory.save(polySelfRefClassChild1);
+
+ factory.save(polySelfRefClassParent);
+ referencingPolyTypesEntity.setPolySelfRefClass(polySelfRefClassParent);
+
+ // polyTestClass.setPolyTestInterface(polyTestClass);
+
+ polyIntImpA = factory.newPolyInterfaceImplA();
+ polyIntImpA.setString(IMPL_A_STRING);
+ polyIntImpA.setSpecial("special");
+ factory.save(polyIntImpA);
+
+ referencingPolyTypesEntity.setPolyInterfaceType(polyIntImpA);
+ referencingPolyTypesEntity.getPolyInterfaces().add(polyIntImpA);
+
+ // setup the polyTestClass
+ final StringBaseEntitySub stringBaseEntitySub = factory.newPolySubClassOne();
+ stringBaseEntitySub.setStringBase("PolySubClassOne 1");
+ stringBaseEntitySub.setStringClassOne("Class 1");
+
+ final StringBaseEntitySubTwo stringBaseEntitySubTwo = factory.newPolySubClassTwo();
+ stringBaseEntitySubTwo.setStringBase("PolySubClassTwo 1");
+ stringBaseEntitySubTwo.setStringClassTwo("Class 2");
+
+ final StringBaseEntitySubThree stringBaseEntitySubThree = factory.newPolySubClassThree();
+ stringBaseEntitySubThree.setStringBase("PolySubClassThree 1");
+ stringBaseEntitySubThree.setStringClassThree("Another String");
+ stringBaseEntitySubThree.setStringClassTwo("Class 3");
+
+ referencingPolyTypesEntity.getPolyBaseClasses().add(stringBaseEntitySub);
+ referencingPolyTypesEntity.getPolyBaseClasses().add(stringBaseEntitySubTwo);
+ referencingPolyTypesEntity.getPolyBaseClasses().add(stringBaseEntitySubThree);
+
+ factory.save(stringBaseEntitySub);
+ factory.save(stringBaseEntitySubTwo);
+ factory.save(stringBaseEntitySubThree);
+
+ // store it and step the state engine
+ factory.save(referencingPolyTypesEntity);
+
+ setFixtureInitializationState(State.DONT_INITIALIZE, "in-memory");
+ }
+
+ @Test
+ /**
+ * The actual "tests". Unless the test is using the "in-memory" object store
+ * the Isis framework is re-created, thus ensuring that no domain objects are
+ * left over from the previous "create" step, forcing the objects to be created
+ * via the object store.
+ *
+ * Exercises the "restore data" portion of the object store.
+ *
+ * Confirms that polymorphic classes are loaded as expected (via interface,
+ * via super-class, etc.)
+ */
+ public void test3All() throws Exception {
+ load();
+
+ setUpFactory();
+
+ polymorphicLoad();
+ interfaceLoad();
+ loadSelfReferencingCollection();
+ interfaceLoadProperty();
+ interfaceLoadCollection();
+ interfaceEditSave();
+ interfaceEditLoad();
+ allInterfacesInstancesLoaded();
+ interfacesLoadedByQuery();
+ interfacesLoadedByQuerySpecial();
+ findByMatchPartialEntity();
+ cannotFindByMatchWithWrongValue();
+
+ // Must be here so that the Isis framework is initialised for the next test package.
+ setFixtureInitializationState(State.INITIALIZE);
+ }
+
+ private void load() {
+ final List<ReferencingPolyTypesEntity> dataClasses = factory.allPolyTestClasses();
+ assertEquals(1, dataClasses.size());
+ final ReferencingPolyTypesEntity referencingPolyTypesEntity = dataClasses.get(0);
+
+ getSqlIntegrationTestFixtures().setPolyTestClass(referencingPolyTypesEntity);
+
+ setFixtureInitializationState(State.DONT_INITIALIZE);
+ }
+
+ private void polymorphicLoad() {
+ final List<StringBaseEntity> polyBaseClasses = referencingPolyTypesEntity.getPolyBaseClasses();
+ assertEquals(3, polyBaseClasses.size());
+
+ StringBaseEntity polyClassBase = polyBaseClasses.get(0);
+ assertTrue(polyClassBase instanceof StringBaseEntitySub);
+ assertEquals("PolySubClassOne 1", polyClassBase.getStringBase());
+ final StringBaseEntitySub stringBaseEntitySub = (StringBaseEntitySub) polyClassBase;
+ assertEquals("Class 1", stringBaseEntitySub.getStringClassOne());
+
+ polyClassBase = polyBaseClasses.get(1);
+ assertTrue(polyClassBase instanceof StringBaseEntitySubTwo);
+ final StringBaseEntitySubTwo stringBaseEntitySubTwo = (StringBaseEntitySubTwo) polyClassBase;
+ assertEquals("Class 2", stringBaseEntitySubTwo.getStringClassTwo());
+
+ polyClassBase = polyBaseClasses.get(2);
+ assertTrue(polyClassBase instanceof StringBaseEntitySubThree);
+ final StringBaseEntitySubThree stringBaseEntitySubThree = (StringBaseEntitySubThree) polyClassBase;
+ assertEquals("Class 3", stringBaseEntitySubThree.getStringClassTwo());
+ assertEquals("Another String", stringBaseEntitySubThree.getStringClassThree());
+ }
+
+ private void interfaceLoad() {
+ final Stringable loaded = referencingPolyTypesEntity.getPolyInterfaceType();
+ factory.resolve(loaded);
+ assertEquals(polyIntImpA.getString(), loaded.getString());
+ }
+
+ private void loadSelfReferencingCollection() {
+ final SelfReferencingEntity polySelfRefParent = referencingPolyTypesEntity.getPolySelfRefClass();
+ final List<SelfReferencingEntity> list = polySelfRefParent.getPolySelfRefClasses();
+ assertEquals(2, list.size());
+
+ SelfReferencingEntity polySelfRefChild1 = null;
+ for (final SelfReferencingEntity selfReferencingEntity : list) {
+ if (selfReferencingEntity.getString().equals(CHILD_1)) {
+ polySelfRefChild1 = selfReferencingEntity;
+ }
+ }
+ assertNotNull(polySelfRefChild1);
+
+ assertEquals(CHILD_1, polySelfRefChild1.title());
+
+ List<SelfReferencingEntity> list2 = polySelfRefChild1.getPolySelfRefClasses();
+ factory.resolve(polySelfRefChild1);
+ list2 = polySelfRefChild1.getPolySelfRefClasses();
+ assertEquals(1, list2.size());
+ }
+
+ private void interfaceLoadProperty() {
+ final Stringable loaded = referencingPolyTypesEntity.getPolyInterfaceType();
+ assertEquals(polyIntImpA.getString(), loaded.getString());
+ }
+
+ private void interfaceLoadCollection() {
+ final List<Stringable> list = referencingPolyTypesEntity.getPolyInterfaces();
+
+ assertEquals(1, list.size());
+ final Stringable loaded = list.get(0);
+
+ assertEquals(polyIntImpA.getString(), loaded.getString());
+ }
+
+ private void interfaceEditSave() {
+ polyIntImpB = factory.newPolyInterfaceImplB();
+ polyIntImpB.setString(IMPL_B_STRING);
+ polyIntImpB.setSpecial("special");
+ polyIntImpB.setInteger(1);
+
+ factory.save(polyIntImpB);
+
+ referencingPolyTypesEntity.setPolyInterfaceType(polyIntImpB);
+
+ setFixtureInitializationState(State.INITIALIZE);
+ }
+
+ private void interfaceEditLoad() {
+ load(); // reload data
+
+ final Stringable loaded = referencingPolyTypesEntity.getPolyInterfaceType();
+ assertEquals(polyIntImpB.getString(), loaded.getString());
+ }
+
+ private void allInterfacesInstancesLoaded() {
+ final List<Stringable> list = factory.allPolyInterfaces();
+ assertEquals(2, list.size());
+ }
+
+ private void interfacesLoadedByQuery() {
+ // PolyInterface query = polyIntImpA;
+
+ final StringableEntityWithOwnDerivedProperty query = new StringableEntityWithOwnDerivedProperty();
+ query.setString(IMPL_A_STRING);
+
+ final List<Stringable> list = factory.queryPolyInterfaces(query);
+ assertEquals(1, list.size());
+ }
+
+ private void interfacesLoadedByQuerySpecial() {
+
+ final StringableEntityWithOwnDerivedProperty query = new StringableEntityWithOwnDerivedProperty();
+
+ final List<Stringable> list = factory.queryPolyInterfaces(query);
+ assertEquals(2, list.size());
+ }
+
+ private void findByMatchPartialEntity() {
+ final Empty match = new EmptyEntityWithOwnProperty();
+ final List<Empty> matches = factory.allEmptyInterfacesThatMatch(match);
+ assertEquals(1, matches.size());
+
+ final Empty empty = matches.get(0);
+ final StringableEntityWithOwnProperties imp = (StringableEntityWithOwnProperties) empty;
+ assertEquals(IMPL_B_STRING, imp.getString());
+ }
+
+ private void cannotFindByMatchWithWrongValue() {
+ final StringableEntityWithOwnProperties match = new StringableEntityWithOwnProperties();
+ match.setInteger(0);
+ final List<Empty> matches = factory.allEmptyInterfacesThatMatch(match);
+ assertEquals(0, matches.size());
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/InMemoryPersistenceTest.java
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/InMemoryPersistenceTest.java b/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/InMemoryPersistenceTest.java
new file mode 100644
index 0000000..af28e24
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/InMemoryPersistenceTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.runtimes.dflt.objectstores.sql.crosscheck;
+
+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 {
+
+ @Override
+ public Properties getProperties() {
+ final Properties properties = new Properties();
+ properties.put("isis.persistor", "in-memory");
+ 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";
+ }
+
+ @Override
+ public String getSqlTeardownString() {
+ return "SHUTDOWN;";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java b/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java
new file mode 100644
index 0000000..23e24a7
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-common/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/crosscheck/XmlPersistenceTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.runtimes.dflt.objectstores.sql.crosscheck;
+
+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 {
+
+ @Override
+ public void resetPersistenceStoreDirectlyIfRequired() {
+ Files.deleteFiles("xml/objects", ".xml", Recursion.DO_RECURSE);
+ }
+
+ @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", "off");
+ return properties;
+ }
+
+ @Override
+ public String getPropertiesFilename() {
+ return "xml.properties";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/NOTICE
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/NOTICE b/framework/component/objectstore/sql/sql-tests-served/NOTICE
new file mode 100644
index 0000000..d391f54
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/NOTICE
@@ -0,0 +1,7 @@
+Apache Isis
+Copyright 2010-2011 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/pom.xml
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/pom.xml b/framework/component/objectstore/sql/sql-tests-served/pom.xml
new file mode 100644
index 0000000..d03067a
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/pom.xml
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<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.runtimes.dflt.objectstores</groupId>
+ <artifactId>sql</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>sql-tests-served</artifactId>
+
+ <name>Default Runtime SQL ObjectStore Integration Tests - Served</name>
+
+ <properties>
+ <siteBaseDir>..</siteBaseDir>
+ <relativeUrl>sql-tests-served/</relativeUrl>
+
+ <postgresql.version>9.1-902.jdbc4</postgresql.version>
+ <mysql.version>5.1.22</mysql.version>
+ </properties>
+
+ <!-- used in Site generation for relative references. -->
+ <url>http://incubator.apache.org/isis/${relativeUrl}</url>
+
+ <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>
+ <version>${maven-project-info-reports-plugin}</version>
+ <inherited>false</inherited>
+ <configuration>
+ <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
+ </configuration>
+ <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.runtimes.dflt.objectstores</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>
+
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt</groupId>
+ <artifactId>runtime</artifactId>
+ </dependency>
+ <!-- Required for TestProxy -->
+ <!-- Isis defaults -->
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+ <artifactId>dflt</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+ <artifactId>dflt</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt.bytecode</groupId>
+ <artifactId>dflt</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+
+ <!-- Isis Object store -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sql-impl</artifactId>
+ </dependency>
+
+ <!-- Test common -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sql-tests-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>sql-tests-common</artifactId>
+ <type>test-jar</type>
+ <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>
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/src/main/resources/log4j.properties b/framework/component/objectstore/sql/sql-tests-served/src/main/resources/log4j.properties
new file mode 100644
index 0000000..bcafd74
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/src/main/resources/log4j.properties
@@ -0,0 +1,39 @@
+# 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.
+# 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
+
+
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/src/site/apt/index.apt b/framework/component/objectstore/sql/sql-tests-served/src/site/apt/index.apt
new file mode 100644
index 0000000..1668418
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/src/site/apt/index.apt
@@ -0,0 +1,29 @@
+~~ 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
+
+ This module runs tests against a few common database servers.
+
+ It will need to be configured for your server environment.
+
+Further Info
+
+ See this module's {{{./apidocs/index.html}Javadoc}} and {{{../docbkx/html/guide/isis-sql-objectstore.html}User Guide}} for more information.
+
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/src/site/apt/jottings.apt b/framework/component/objectstore/sql/sql-tests-served/src/site/apt/jottings.apt
new file mode 100644
index 0000000..c5d1200
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/src/site/apt/jottings.apt
@@ -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.
+
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/src/site/site.xml
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/src/site/site.xml b/framework/component/objectstore/sql/sql-tests-served/src/site/site.xml
new file mode 100644
index 0000000..521d3ce
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/src/site/site.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project>
+
+ <body>
+ <breadcrumbs>
+ <item name="Integration Tests" href="index.html"/>
+ </breadcrumbs>
+
+ <menu name="SQL ObjectStore Tests">
+ <item name="About" href="index.html" />
+ </menu>
+
+ <menu name="SQL OS Modules">
+ <item name="Implementation" href="../sql-impl/index.html" />
+ <item name="Common Tests" href="../sql-tests-common/index.html" />
+ <item name="Integration Tests" href="../sql-tests-served/index.html" />
+ </menu>
+
+ <menu name="Maven Reports" ref="reports" />
+ </body>
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/src/test/config/db2.properties
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/src/test/config/db2.properties b/framework/component/objectstore/sql/sql-tests-served/src/test/config/db2.properties
new file mode 100644
index 0000000..4e5195d
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/src/test/config/db2.properties
@@ -0,0 +1,27 @@
+# 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.
+
+
+
+# Sample configuration
+# Edit this file with your server and authentication details.
+
+# DB2 test
+isis.persistence.sql.jdbc.driver=com.ibm.db2.jcc.DB2Driver
+isis.persistence.sql.jdbc.connection=jdbc:db2://gtd-dev:50000/proddb
+isis.persistence.sql.jdbc.user=db2admin
+isis.persistence.sql.jdbc.password=db2srvtest
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/src/test/config/mssqlserver.properties
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/src/test/config/mssqlserver.properties b/framework/component/objectstore/sql/sql-tests-served/src/test/config/mssqlserver.properties
new file mode 100644
index 0000000..b1db3b7
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/src/test/config/mssqlserver.properties
@@ -0,0 +1,32 @@
+# 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.
+
+
+
+# Sample configuration
+# Edit this file with your server and authentication details.
+
+
+# SQL Server
+#isis.persistence.sql.jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
+#isis.persistence.sql.jdbc.connection=jdbc:sqlserver://SPRSRMS21;databaseName=AnalyticalData
+
+isis.persistence.sql.jdbc.driver=net.sourceforge.jtds.jdbc.Driver
+isis.persistence.sql.jdbc.connection=jdbc:jtds:sqlserver://SPRSRMS21;databaseName=AnalyticalData
+
+isis.persistence.sql.jdbc.user=grip
+isis.persistence.sql.jdbc.password=grip
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/src/test/config/mysql.properties
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/src/test/config/mysql.properties b/framework/component/objectstore/sql/sql-tests-served/src/test/config/mysql.properties
new file mode 100644
index 0000000..117c681
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/src/test/config/mysql.properties
@@ -0,0 +1,29 @@
+# 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.
+
+
+# Sample configuration
+# Edit this file with your server and authentication details.
+#
+# If this file exists, it overrides the MySqlTest#getProperties() method
+isis.persistor.sql.jdbc.driver=com.mysql.jdbc.Driver
+isis.persistor.sql.jdbc.connection=jdbc:mysql://abacus/noftest?useTimezone=false
+#true&serverTimezone=GMT
+isis.persistor.sql.jdbc.user=nof
+isis.persistor.sql.jdbc.password=
+
+isis.persistor.sql.datatypes.double=DOUBLE PRECISION
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/src/test/config/postgresql.properties
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/src/test/config/postgresql.properties b/framework/component/objectstore/sql/sql-tests-served/src/test/config/postgresql.properties
new file mode 100644
index 0000000..b9fccfb
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/src/test/config/postgresql.properties
@@ -0,0 +1,29 @@
+# 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.
+
+
+# Sample configuration
+# Edit this file with your server and authentication details.
+# If this file exists, it overrides the PostreSqlTest#getProperties() method
+isis.persistor.sql.jdbc.driver=org.postgresql.Driver
+isis.persistor.sql.jdbc.connection=jdbc:postgresql://abacus/noftest
+isis.persistor.sql.jdbc.user=nof
+isis.persistor.sql.jdbc.password=
+
+isis.persistor.sql.datatypes.timestamp=TIMESTAMP
+isis.persistor.sql.datatypes.datetime=TIMESTAMP
+isis.persistor.sql.datatypes.double=DOUBLE PRECISION
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/MySqlIntegrationTest.java
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/MySqlIntegrationTest.java b/framework/component/objectstore/sql/sql-tests-served/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/MySqlIntegrationTest.java
new file mode 100644
index 0000000..6f44816
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/MySqlIntegrationTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.runtimes.dflt.objectstores.sql;
+
+import java.util.Properties;
+
+import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestData;
+
+public class MySqlIntegrationTest extends SqlIntegrationTestData {
+
+ /**/
+ @Override
+ public Properties getProperties() {
+ Properties properties = super.getProperties();
+ if (properties == null) {
+ // Only used if *sql.properties is not found
+ properties = new Properties();
+ properties.put(SqlObjectStore.BASE_NAME + ".jdbc.driver", "com.mysql.jdbc.Driver");
+ // properties.put(SqlObjectStore.BASE_NAME + ".jdbc.connection",
+ // "jdbc:mysql://abacus/noftest&useTimezone=true&serverTimezone=GMT");
+ properties.put(SqlObjectStore.BASE_NAME + ".jdbc.connection", "jdbc:mysql://abacus/noftest&useLegacyDatetimeCode=false");
+ properties.put(SqlObjectStore.BASE_NAME + ".jdbc.user", "nof");
+ properties.put(SqlObjectStore.BASE_NAME + ".jdbc.jdbc.password", "");
+ }
+ return properties;
+ }
+
+ /**/
+
+ @Override
+ public String getPropertiesFilename() {
+ return "mysql.properties";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/sql-tests-served/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PostgreSqlIntegrationTest.java
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/sql-tests-served/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PostgreSqlIntegrationTest.java b/framework/component/objectstore/sql/sql-tests-served/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PostgreSqlIntegrationTest.java
new file mode 100644
index 0000000..1ecdd33
--- /dev/null
+++ b/framework/component/objectstore/sql/sql-tests-served/src/test/java/org/apache/isis/runtimes/dflt/objectstores/sql/PostgreSqlIntegrationTest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.runtimes.dflt.objectstores.sql;
+
+import java.util.Properties;
+
+import org.apache.isis.runtimes.dflt.objectstores.sql.common.SqlIntegrationTestData;
+
+public class PostgreSqlIntegrationTest extends SqlIntegrationTestData {
+
+ @Override
+ public Properties getProperties() {
+ Properties properties = super.getProperties();
+ if (properties == null) {
+ properties = new Properties();
+ // Only used if src/test/config/postgresql.properties does not
+ // exist.
+ properties.put(SqlObjectStore.BASE_NAME + ".jdbc.driver", "org.postgresql.Driver");
+ properties.put(SqlObjectStore.BASE_NAME + ".jdbc.connection", "jdbc:postgresql://abacus/noftest");
+ properties.put(SqlObjectStore.BASE_NAME + ".jdbc.user", "nof");
+ properties.put(SqlObjectStore.BASE_NAME + ".jdbc.password", "");
+
+ // properties.put(SqlObjectStore.BASE_NAME + ".datatypes.timestamp",
+ // "TIMESTAMP");
+ // properties.put(SqlObjectStore.BASE_NAME + ".datatypes.datetime",
+ // "TIMESTAMP");
+ }
+ return properties;
+ }
+
+ @Override
+ public String getPropertiesFilename() {
+ return "postgresql.properties";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/src/docbkx/guide/isis-sql-objectstore.xml
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/src/docbkx/guide/isis-sql-objectstore.xml b/framework/component/objectstore/sql/src/docbkx/guide/isis-sql-objectstore.xml
new file mode 100644
index 0000000..a0522bb
--- /dev/null
+++ b/framework/component/objectstore/sql/src/docbkx/guide/isis-sql-objectstore.xml
@@ -0,0 +1,886 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"file:./src/docbkx/dtd-4.5/docbookx.dtd">
+<book>
+ <bookinfo>
+ <title><?eval ${docbkxGuideTitle}?></title>
+
+ <subtitle><?eval ${docbkxGuideSubTitle}?></subtitle>
+
+ <releaseinfo><?eval ${project.version}?></releaseinfo>
+
+ <authorgroup>
+ <author>
+ <firstname>Kevin</firstname>
+
+ <surname>Meyer</surname>
+ </author>
+
+ <author>
+ <firstname>Robert</firstname>
+
+ <surname>Matthews</surname>
+ </author>
+ </authorgroup>
+
+ <legalnotice>
+ <para>Permission is granted to make and distribute verbatim copies of
+ this manual provided that the copyright notice and this permission
+ notice are preserved on all copies.</para>
+ </legalnotice>
+ </bookinfo>
+
+ <!-- front matter -->
+
+ <toc></toc>
+
+ <preface id="preface">
+ <title>Preface</title>
+
+ <para><emphasis>Apache Isis</emphasis> is designed to allow programmers
+ rapidly develop domain-driven applications following the <ulink
+ url="http://en.wikipedia.org/wiki/Naked_Objects">Naked Objects</ulink>
+ pattern. It is made up of a core framework plus a number of alternate
+ implementations, and supports various viewers and object stores. Apache
+ Isis is hosted at the <ulink url="http://incubator.apache.org/isis">Apache
+ Foundation</ulink>, and is licensed under <ulink
+ url="http://www.apache.org/licenses/LICENSE-2.0.html">Apache Software
+ License v2</ulink>.</para>
+
+ <para>This guide is written for programmers who want to use the
+ <emphasis>SQL Object Store</emphasis> to persist domain objects running
+ within the <emphasis>Apache Isis</emphasis> framework. Specifically, it
+ covers how to write repository implementations, how to configure the
+ object store, and how to deploy your applications using the object
+ store.</para>
+ </preface>
+
+ <!--main content -->
+
+ <chapter id="chp.Intro">
+ <title>Operation</title>
+
+ <abstract>
+ <para>What's it all about?</para>
+ </abstract>
+
+ <sect1>
+ <title>Background</title>
+
+ <para>The SQL objectstore provides a fully-automatic object store that
+ uses a jdbc SQL-compatible database server.</para>
+
+ <para>All domain objects (entities) are introspected during
+ initialisation, and have a 1-to-1 mapping onto a database table. All
+ properties (values) are mapped onto one or more columns with each
+ database table.</para>
+
+ <para>Domain object classes are introspected and all properties
+ recursively introspected to value types. Thus, if a property stores a
+ reference to a class, that class's properties are introspected,
+ etc.</para>
+ </sect1>
+
+ <sect1>
+ <title>Setup</title>
+
+ <sect2>
+ <title>Properties</title>
+
+ <para>The SQL objectstore is setup via the
+ <code>isis.properties</code> file. The required variables are given
+ below:</para>
+
+ <blockquote>
+ <para><property>isis.persistor.sql.jdbc.driver=org.hsqldb.jdbcDriver</property></para>
+
+ <para><property>isis.persistor.sql.jdbc.connection=jdbc:hsqldb:file:hsql-db/tests</property></para>
+
+ <para><property>isis.persistor.sql.jdbc.user=sa</property></para>
+
+ <para><property>isis.persistor.sql.jdbc.password=</property></para>
+ </blockquote>
+
+ <para>The driver property must contain the name of the jdbc driver
+ class that provides access to your SQL server. Known examples are
+ given below in <xref linkend="sec.servers.tested" />.</para>
+ </sect2>
+
+ <sect2>
+ <title>Table Creation</title>
+
+ <para>Missing database tables are automatically created when the SQL
+ objectstore is initialised.</para>
+
+ <para>Please note that changes to domain classes such as renaming
+ fields (properties) or the classes themselves, are
+ <emphasis>not</emphasis> automatically detected. If you rename a
+ property after a table has been created, you should use the
+ appropriate database administration tool to rename the column in the
+ containing table.</para>
+
+ <para>If you rename a domain class (entity), you must also rename the
+ appropriate table.</para>
+ </sect2>
+ </sect1>
+
+ <sect1>
+ <title>Mappers</title>
+
+ <para>The mappers take care of mapping a value type onto a SQL data
+ type. Default mappers are provided by
+ JdbcFieldMappingFactoryInstaller.</para>
+
+ <sect2>
+ <title id="sec.mappers.modifiable-values">Modifiable values</title>
+
+ <para>The following SQL datatypes can be overridden, if specified in
+ the properties file (the default value is given in parenthesis), [the
+ mapped value classes are given in square brackets]:<simplelist>
+ <member>isis.persistor.sql.datatypes.timestamp (DATETIME)
+ [TimeStamp, java.sql.Timestamp]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.datetime (DATETIME)
+ [DateTime]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.date (DATE) [Date,
+ java.sql.Date, java.util.Date]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.time (TIME) [Time]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.double (FLOAT)
+ [double]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.float (FLOAT)
+ [float]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.short (INT) [short]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.long (INT) [long,
+ Color]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.int (INT) [int]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.boolean (CHAR(1))
+ [boolean]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.string (VARCHAR(65))
+ [String]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.longstring (VARCHAR(128))
+ [String]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.password (VARCHAR(120))
+ [Password]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.default (VARCHAR(65))
+ [Everything else, e.g. Image]</member>
+ </simplelist></para>
+
+ <para><simplelist>
+ <member>isis.persistor.sql.datatypes.primarykey (INTEGER)
+ [IdMappingAbstract -> JdbcObjectReferenceMapping ->
+ JdbcObjectReferenceFieldMapping]</member>
+ </simplelist></para>
+
+ <para>The final value, primarykey, is a special value.</para>
+
+ <para>In general, be very careful about changing the SQL data type, as
+ the default value mappers are written assuming the default values.
+ Data parsing uses prepared statements and reads/writes values as
+ objects.</para>
+
+ <para>The datatype longstring is used to store classnames, required
+ for polymorphism.</para>
+ </sect2>
+
+ <sect2>
+ <title>Floating Point Value Limits</title>
+
+ <para><emphasis>Caution:</emphasis> Testing on certain database
+ servers (MySQL and PostgreSQL) has shown that <code>float</code>s and
+ <code>double</code>s (stored as <code>FLOAT</code> or <code>DOUBLE
+ PRECISION</code> respectively) are not stored to the same resolution
+ as supported by Java. The tested range of float is 1E-37 to 1E38, and
+ the tested range of double is 1E-307 to 1E308.</para>
+ </sect2>
+
+ <sect2>
+ <title>Fixed values</title>
+
+ <para>The following classes are not modifiable:</para>
+
+ <para>[char] is set to CHAR(1)</para>
+
+ <para>[Money] value is FLOAT, currency is VARCHAR(3)</para>
+
+ <para>[Percentage] is FLOAT</para>
+ </sect2>
+
+ <sect2>
+ <title>Modifying individual property types</title>
+
+ <para>By default, all property types will use the SQL datatype, as
+ determined above (see <xref
+ linkend="sec.mappers.modifiable-values" />), but it is possible to
+ override these values for individual object properties, by specifying
+ the following override in the properties file:</para>
+
+ <para><property>isis.persistor.sql.automapper.type.<object>.<property>=<SQL
+ data type></property></para>
+
+ <para>where</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>object is the final part of the domain object name (e.g. in
+ my.domain.Member, it'll be Member)</para>
+ </listitem>
+
+ <listitem>
+ <para>property is the lower case property name (e.g. in getName(),
+ it'll be name)</para>
+ </listitem>
+
+ <listitem>
+ <para>SQL data type is an acceptable datatype (e.g. VARCHAR(255)
+ )</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Again, please be very careful about changing the defaults as the
+ value mappers make assumptions about the underlying data type.</para>
+
+ <para>It is safe to change the size of VARCHAR() types, e.g. when you
+ know only a partcular field requires more that 65 characters, the
+ default String length.</para>
+ </sect2>
+ </sect1>
+
+ <sect1>
+ <title>Naming Conventions</title>
+
+ <para>While case is determined by the capabilities of the database
+ driver, all SQL names will be written in UPPER CASE, below.</para>
+
+ <sect2>
+ <title>Tables</title>
+
+ <para>By default, all Isis tables are preceded with "ISIS_". This
+ behaviour can be altered by specifying a replacement table prefix. See
+ <xref linkend="sec.defaults.tableprefix" />.</para>
+
+ <sect3>
+ <title>Internal Tables</title>
+
+ <para>ISIS_ADMIN_SERIAL_ID ISIS_ADMIN_SERVICES</para>
+ </sect3>
+
+ <sect3>
+ <title>Domain Tables</title>
+
+ <para>Only the "class" part of the package name is used. Thus a
+ domain class called "some.package.Client", will be mapped onto a
+ table "ISIS_CLIENT" (assuming that the default table prefix has not
+ been changed).</para>
+ </sect3>
+ </sect2>
+
+ <sect2>
+ <title>Columns</title>
+
+ <sect3>
+ <title>Internal column: pk_id</title>
+
+ <para>ID column: PK_ID</para>
+
+ <para>VERSION BIGINT,</para>
+
+ <para>MODIFIED_BY VARCHAR(32),</para>
+
+ <para>MODIFIED_ON TIMESTAMP</para>
+
+ <para>The default ID column name is "PK_ID", but this can be
+ over-ridden by specifying the new name in the properties
+ file:</para>
+
+ <para><property>isis.persistor.sql.pk_id=id</property></para>
+
+ <para><property>ID column: ID</property></para>
+
+ <para><property>Used internally by Isis to record services, in the
+ table "ISIS_ADMIN_SERVICES".</property></para>
+ </sect3>
+
+ <sect3>
+ <title>Properties</title>
+
+ <para>Most properties are named as per the class property. This
+ means you must take care not to use SQL reserved labels are property
+ names. The exceptions are collections and multi-field values (e.g.
+ Money).</para>
+ </sect3>
+
+ <sect3>
+ <title>Collections</title>
+
+ <para>Collections are mapped onto the child class:</para>
+
+ <para>If a parent class (some.package.Parent) has a collection of
+ (some.other.package.Child) named "children", the child table
+ (ISIS_CHILD) gets a column labeled "FK_PARENT_CHILDREN" of type
+ primarykey. The child property is assigned the ID of the parent
+ class.</para>
+
+ <para>This means that a given child can only appear in one parent's
+ collection of the same name.</para>
+ </sect3>
+
+ <sect3>
+ <title>Multi-field values</title>
+
+ <para>Some value types need more than 1 field to store their values,
+ e.g. Money - some.package.class#price.</para>
+
+ <para>In this case, the SQL objectstore creates 2 fields, price1 and
+ price2.</para>
+
+ <para>See "<code>JdbcMoneyValueMapper</code>", which extends
+ "<code>AbstractJdbcMultiFieldMapping</code>".</para>
+ </sect3>
+ </sect2>
+ </sect1>
+
+ <sect1>
+ <title>Number of instances returned by queries</title>
+
+ <para>By default, only up to 100 object instances are returned by
+ queries. This value can be changed by specifying:</para>
+
+ <para><property>isis.persistor.sql.maxinstances=100</property></para>
+ </sect1>
+
+ <sect1>
+ <title>Versioning</title>
+
+ <para>Isis uses a version number to assist in detecting concurrency
+ conflicts.</para>
+
+ <para>However, if you need to turn off versioning completely, or for a
+ particular table, you can control it with:</para>
+
+ <para><property>isis.persistor.sql.default.versioning=false</property></para>
+
+ <para>for global control, or by table:</para>
+
+ <para><property>isis.persistor.sql.default.versioning.members=false</property></para>
+ </sect1>
+
+ <sect1>
+ <title>Password values</title>
+
+ <para>The <code>JdbcPasswordValueMapper</code> value mapper has the
+ ability to (weakly) encode the password value strings stored in the
+ database tables.</para>
+
+ <para>By adding the following property values:</para>
+
+ <blockquote>
+ <para><property>isis.persistor.sql.default.password.seed=<random
+ string></property></para>
+
+ <para><property>isis.persistor.sql.default.password.length=<integer
+ length></property></para>
+ </blockquote>
+
+ <para>You can enable a weak password encoding/decoding scheme that will
+ obscure password values from casual browsers of your database
+ tables.</para>
+
+ <para>The length of all stored passwords is the same, and determined by
+ the <property>isis.persistor.sql.default.password.length</property>
+ property. This length must not exceed the SQL storage, as defined in
+ <xref linkend="sec.mappers.modifiable-values" />.</para>
+
+ <para>The passwords are convolved with the value of the string given by
+ the <property>isis.persistor.sql.default.password.seed</property>
+ property, and the resulting string is stored in the database
+ table.</para>
+
+ <para>If <property>isis.persistor.sql.default.password.seed</property>
+ is undefined (null), the passwords are stored as plain text.</para>
+ </sect1>
+ </chapter>
+
+ <chapter id="ch.supported.dbs">
+ <title>Supported Database Servers</title>
+
+ <abstract>
+ <para>Which SQL database servers have been used?</para>
+ </abstract>
+
+ <sect1>
+ <!--content: List of database servers tested.-->
+
+ <title id="sec.servers.tested">Tested</title>
+
+ <para>The following database servers are tested in the object store
+ integration tests:<itemizedlist>
+ <listitem>
+ <para>HSQLDB (tested against 1.8.0.10)</para>
+ </listitem>
+
+ <listitem>
+ <para>Postgresql (tested on 8.3.12-ubuntu9.04)</para>
+ </listitem>
+
+ <listitem>
+ <para>MySQL (tested on 5.1.31-1ubuntu2)</para>
+ </listitem>
+
+ <listitem>
+ <para>Microsoft SQL Server 2008 (Only from 2008 is DATE and TIME
+ supported)</para>
+ </listitem>
+ </itemizedlist></para>
+
+ <sect2>
+ <title>HSQLDB</title>
+
+ <para></para>
+ </sect2>
+
+ <sect2>
+ <title>Postgresql</title>
+
+ <para><blockquote>
+ <para><property>isis.persistor.sql.jdbc.driver=org.hsqldb.jdbcDriver</property></para>
+
+ <para><property>isis.persistor.sql.jdbc.connection=jdbc:hsqldb:file:hsql-db/tests</property></para>
+
+ <para><property>isis.persistor.sql.jdbc.user=sa</property></para>
+
+ <para><property>isis.persistor.sql.jdbc.password=</property></para>
+ </blockquote>The default <classname>TimeStamp</classname> and
+ <classname>DateTime</classname> SQL data class is DATETIME, which does
+ not work on Postgresql. Here, the default must be replaced with the
+ following properties file entries:</para>
+
+ <blockquote>
+ <para>isis.persistor.sql.datatypes.timestamp=TIMESTAMP</para>
+
+ <para>isis.persistor.sql.datatypes.datetme=TIMESTAMP</para>
+
+ <para>isis.persistor.sql.datatypes.double=DOUBLE PRECISION</para>
+ </blockquote>
+
+ <para></para>
+ </sect2>
+
+ <sect2>
+ <title>MySQL</title>
+
+ <para>There was an issue with storing and correctly retrieving date
+ (time) values - a special "try .. catch" has been used to ensure that
+ UTC temporal values are correctly retrieved.</para>
+
+ <para>The following data type overrides may be required:</para>
+
+ <blockquote>
+ <para>isis.persistor.sql.datatypes.double=DOUBLE PRECISION</para>
+ </blockquote>
+
+ <para></para>
+ </sect2>
+
+ <sect2>
+ <title>Microsoft SQL Server 2008</title>
+
+ <para>The sourceforge driver seemed to work well enough for
+ testing.</para>
+
+ <para>The tested connection parameters were:</para>
+
+ <para><blockquote>
+ <para># SQL Server </para>
+
+ <para>#isis.persistence.sql.jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver</para>
+
+ <para>isis.persistence.sql.jdbc.driver=net.sourceforge.jtds.jdbc.Driver</para>
+
+ <para>isis.persistence.sql.jdbc.connection=jdbc:jtds:sqlserver://<server>;databaseName=<database></para>
+
+ <para>isis.persistence.sql.jdbc.user=<user></para>
+
+ <para>isis.persistence.sql.jdbc.password=<password></para>
+ </blockquote></para>
+
+ <para></para>
+ </sect2>
+
+ <sect2>
+ <title>IBM DB2 (v8)</title>
+
+ <para>Beware! This version of DB2 has a very small limit on table and
+ column names. You will have to keep your domain class and property
+ names short to suit, especially collections!</para>
+
+ <para>The tested connection parameters were:</para>
+
+ <blockquote>
+ <para># DB2 test</para>
+
+ <para>
+ isis.persistence.sql.jdbc.driver=com.ibm.db2.jcc.DB2Driver</para>
+
+ <para>
+ isis.persistence.sql.jdbc.connection=jdbc:db2://<host>:50000/<database></para>
+
+ <para> isis.persistence.sql.jdbc.user=<user></para>
+
+ <para> isis.persistence.sql.jdbc.password=<password></para>
+ </blockquote>
+ </sect2>
+ </sect1>
+
+ <sect1>
+ <title>Tested values</title>
+
+ <para>The following value types have been tested (stored and
+ retrieved):</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>standard values: integer, short, long (INT), float, double
+ (FLOAT), char (CHAR(2)).</para>
+ </listitem>
+
+ <listitem>
+ <para>standard classes: Money (FLOAT and VARCHAR(3)), Percentage
+ (FLOAT), Password (VARCHAR(12)), Color (INT), String (VARCHAR
+ (65)).</para>
+ </listitem>
+
+ <listitem>
+ <para>Special value mappers:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para><code>org.apache.isis.applib.value.date</code> and
+ <code>java.sql.date</code> (DATE, via
+ <code>org.apache.isis.alternatives.objectstore.sql.jdbc.JdbcDateMapper</code>)</para>
+ </listitem>
+
+ <listitem>
+ <para>Time, DateTime (DATETIME), java.sql.Time, java.util.Date,
+ java.sql.Timestamp (DATETIME), TimeStamp (DATETIME) blah</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para></para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Default automapper is installed by
+ <code>org.apache.isis.alternatives.objectstore.sql.FieldMappingFactoryInstaller</code>
+ ..</para>
+
+ <para>Default automapper is
+ <code>org.apache.isis.runtimes.dflt.objectstores.sql.jdbc.installer.JdbcFieldMappingFactoryInstaller</code></para>
+
+ <para></para>
+ </sect1>
+ </chapter>
+
+ <chapter>
+ <title id="sec.defaults">Defaults</title>
+
+ <para>The SQL objectstore exposes several defaults that can be replaced
+ either in configuration or at runtime.</para>
+
+ <para>The class
+ <code>org.apache.isis.runtimes.dflt.objectstores.sql.Defaults</code>
+ contains the following:</para>
+
+ <para>Programmatic, at runtime:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>TimeZone: <code>setTimeZone(DateTimeZone.UTC)</code></para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Configuration, e.g. in isis.properties:</para>
+
+ <para><itemizedlist>
+ <listitem>
+ <para>Primary key column:</para>
+
+ <para><property>isis.persistor.sql.default.pk_id=pk_id</property></para>
+ </listitem>
+
+ <listitem>
+ <para>Service ID column:</para>
+
+ <para><property>isis.persistor.sql.default.id=id</property></para>
+ </listitem>
+
+ <listitem>
+ <para>Maximum records returned by objectstore methods that return a
+ list/collection, such as <code>allMatches()</code>, etc:</para>
+
+ <para><property><property>isis.persistor.sql.default.maxinstances=100</property></property></para>
+ </listitem>
+
+ <listitem>
+ <para id="sec.defaults.tableprefix" xreflabel="Table Prefix">Table
+ prefix. The default prefix "isis_" is added to all table created by
+ the object store. This prefix can be replaced, or left off entirely
+ by specifying an empty value, e.g.:</para>
+
+ <para><property>isis.persistor.sql.default.tableprefix=</property></para>
+ </listitem>
+
+ <listitem>
+ <para>See "Modifiable values", <link
+ linkend="sec.mappers.modifiable-values">above</link>.</para>
+ </listitem>
+ </itemizedlist></para>
+ </chapter>
+
+ <chapter>
+ <title>Polymorphism</title>
+
+ <para>The SQL Objectstore supports polymorphic classes. Both properties
+ and collections are supported.</para>
+
+ <sect1>
+ <title>Properties</title>
+
+ <para>Polymorphic properties are handled with
+ <classname>JdbcPolymorphicObjectReferenceMapping</classname>.</para>
+
+ <para>Two columns are created in the class table: The actual instance
+ class type, and the instance ID.</para>
+ </sect1>
+
+ <sect1>
+ <title>Collections</title>
+
+ <para>There are two implementations currently selectable by editting
+ <classname>AbstractAutoMapper</classname>.</para>
+
+ <para>The default implementation is
+ <classname>PolymorphicForeignKeyInChildCollectionBaseMapper</classname>.</para>
+
+ <sect2>
+ <title>PolymorphicForeignKeyInChildCollectionBaseMapper</title>
+
+ <para>Creates two columns in the child class table, to contain the
+ child class type and child class ID.</para>
+
+ <para>Used to map 1-to-many collections by creating, in the collection
+ child table (which may be an interface or abstract class), 2 columns
+ per parent collection.</para>
+
+ <para>The first column is the class type, the second is the entity
+ ID.</para>
+
+ <para>The columns are named by combining the final part of the parent
+ class name and the collection variable name.</para>
+
+ <para>Collection loading is a case of iterating through all collection
+ entries and adding the named class instance of the stored ID.</para>
+ </sect2>
+
+ <sect2>
+ <title>PolymorphicForeignKeyInChildCollectionMapper</title>
+
+ <para>Used to map 1-to-many collections by creating, in the child
+ table, 1 column per parent collection.</para>
+
+ <para>The column is named by combining the final part of the parent
+ class name and the collection variable name.</para>
+
+ <para>Collection loading is a case of iterating through all subclasses
+ of the collection type and adding class instances of the stored ID.
+ This could be problematic if different subclasses have the same
+ ID.</para>
+ </sect2>
+ </sect1>
+ </chapter>
+
+ <appendix>
+ <title>Example</title>
+
+ <para></para>
+
+ <para><property>isis.persistor.sql.jdbc.driver=com.mysql.jdbc.Driver</property></para>
+
+ <para><property>isis.persistor.sql.jdbc.connection=jdbc:mysql://localhost/isis_data</property></para>
+
+ <para><property>isis.persistor.sql.jdbc.user=isis</property></para>
+
+ <para><property>isis.persistor.sql.jdbc.password=noneofyourbusiness</property></para>
+
+ <para><property></property></para>
+
+ <para><property>isis.persistor.sql.default.versioning.Member=false
+ </property></para>
+
+ <para><property>isis.persistor.sql.automapper.type.Member.address=VARCHAR(255)
+ </property></para>
+
+ <para><property>isis.persistor.sql.automapper.type.Member.comments=VARCHAR(255)
+ </property></para>
+ </appendix>
+
+ <appendix>
+ <title>Correspondence</title>
+
+ <abstract>
+ <para>Who said what, when?</para>
+ </abstract>
+
+ <sect1 id="sec.module-ui">
+ <title>Email</title>
+
+ <para></para>
+
+ <sect2>
+ <title>2011/02/01, Response by Dan Haywood</title>
+
+ <para><remark>At the moment I'm just putting down whatever comes into
+ my head, with a view of later editting it into a coherent document,
+ but obviously there are questions of level of detail, etc. For
+ example, should I really bother with describing what persistance is,
+ and how the domain classes are introspected?! </remark></para>
+
+ <para>I don't think so, no.</para>
+
+ <para>That said, if you do find yourself writing "introductory"
+ material like this, we can always move it. The place for such stuff
+ should probably be the "core" documentation
+ (core/src/docbkx/guide/isis-core.xml), which is what I'm chipping away
+ at myself.</para>
+
+ <para><remark>Yes to: what SQL data types are used by default, yes to:
+ how to override the automappers and provide your own mapper, yes to:
+ how collections and parent/child relatonships are handled, etc.
+ </remark></para>
+
+ <para>It'd be worth showing examples of all the different types of
+ mappings supported, as well as those that are not supported.</para>
+
+ <para>For example:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Id generation - how is that supported?</para>
+ </listitem>
+
+ <listitem>
+ <para>optimistic locking - how supported?</para>
+ </listitem>
+
+ <listitem>
+ <para>one<->many</para>
+ </listitem>
+
+ <listitem>
+ <para>one<-many</para>
+ </listitem>
+
+ <listitem>
+ <para>one->many</para>
+ </listitem>
+
+ <listitem>
+ <para>two one<->many relationships between same types A and
+ B (if I recall, this isn't supported?)</para>
+ </listitem>
+
+ <listitem>
+ <para>many<->many</para>
+ </listitem>
+
+ <listitem>
+ <para>many->many - subtype relationships (roll-up, roll-down,
+ table per subtype)</para>
+ </listitem>
+
+ <listitem>
+ <para>polymorphic relationships to interfaces</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>You could also peruse some of the Hibernate ORM docs for
+ examples of mappings there; that might prompt you to consider some
+ additional scenarios.</para>
+
+ <para><remark>What else?</remark></para>
+
+ <para>Obviously, any additional entries required in isis.properties to
+ enable the SQL object store. In addition, as background it'd be worth
+ explaining about the different subcomponents used by the object store:
+ the OidGenerator, PersistAlgorithm, TransactionManager Also, I know
+ that the JPA object store has to configure a different
+ ClassSubstitutor/ObjectFactory, because it leaves the ORM to perform
+ cglib proxying. I don't think you have any similar restrictions, but
+ it might be worth saying so.</para>
+ </sect2>
+ </sect1>
+
+ <sect1>
+ <title>Edit History</title>
+
+ <para>Last editted: Kevin, 17/10/2011.<!--dd/mm/yyyy--></para>
+ </sect1>
+ </appendix>
+</book>
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/src/site/apt/index.apt
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/src/site/apt/index.apt b/framework/component/objectstore/sql/src/site/apt/index.apt
new file mode 100644
index 0000000..fa4323b
--- /dev/null
+++ b/framework/component/objectstore/sql/src/site/apt/index.apt
@@ -0,0 +1,48 @@
+~~ 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
+
+ The <sql> object store module provides the ability to persist
+ domain objects into an RDBMS. It has no external dependencies,
+ using simply JDBC.
+
+ For more information, see the
+ {{{./sql-impl/index.html}Implementation}},
+ {{{./sql-tests-common/index.html}Common Tests}} and
+ {{{./sql-tests-served/index.html}Served Tests}}
+ documentation.
+
+
+Alternatives
+
+ Alternatives include:
+
+ * the {{{../dflt/index.html}dflt}} in-memory object store (for prototyping only)
+
+ * the {{{../xml/index.html}XML}} object store
+
+ * the {{{../nosql/index.html}NoSQL}} object store
+
+ []
+
+ Another more sophisticated but also more complex alternative has been implemented
+ using JPA. However, this is currently not part of Isis because it has a
+ dependency on Hibernate (not compatible with the Apache license). One
+ option under consideration is to port JPA object store to use OpenJPA.
http://git-wip-us.apache.org/repos/asf/isis/blob/0861ed93/framework/component/objectstore/sql/src/site/apt/jottings.apt
----------------------------------------------------------------------
diff --git a/framework/component/objectstore/sql/src/site/apt/jottings.apt b/framework/component/objectstore/sql/src/site/apt/jottings.apt
new file mode 100644
index 0000000..c5d1200
--- /dev/null
+++ b/framework/component/objectstore/sql/src/site/apt/jottings.apt
@@ -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.
+