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/13 01:01:06 UTC
[9/52] [partial] ISIS-188: renaming packages in line with
groupId:artifactId
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java
new file mode 100644
index 0000000..25a858f
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java
@@ -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.objectstore.jdo.datanucleus.scenarios.scalar;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
+import org.apache.isis.core.tck.dom.scalars.AutoAssignedEntity;
+import org.apache.isis.core.tck.dom.scalars.AutoAssignedEntityRepository;
+import org.apache.isis.objectstore.jdo.datanucleus.Utils;
+
+public class Persistence_persist_dataStoreAssignedPrimaryKey {
+
+ private AutoAssignedEntityRepository repo = new AutoAssignedEntityRepository();
+
+ @Rule
+ public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+ .with(Utils.listenerToDeleteFrom("AUTOASSIGNEDENTITY"))
+ .withServices(repo)
+ .build();
+
+ @Test
+ public void persistTwo() throws Exception {
+ iswf.beginTran();
+ repo.newEntity();
+ repo.newEntity();
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ List<AutoAssignedEntity> list = repo.list();
+ assertThat(list.size(), is(2));
+ iswf.commitTran();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisDateConverterTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisDateConverterTest.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisDateConverterTest.java
new file mode 100644
index 0000000..48773ca
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisDateConverterTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.objectstore.jdo.datanucleus.valuetypes;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.value.Date;
+import org.apache.isis.objectstore.jdo.datanucleus.valuetypes.IsisDateConverter;
+
+public class IsisDateConverterTest {
+
+ private IsisDateConverter converter;
+
+ @Before
+ public void setUp() throws Exception {
+ converter = new IsisDateConverter();
+ }
+
+ @Test
+ public void roundTrip() {
+ Date date = new Date();
+ final Long value = converter.toDatastoreType(date);
+ Date date2 = (Date) converter.toMemberType(value);
+
+ // necessary to use dateValue() because the Isis date (rather poorly) does not
+ // override equals() / hashCode()
+ assertThat(date.dateValue(), is(equalTo(date2.dateValue())));
+ }
+
+ @Test
+ public void toLong_whenNull() {
+ assertNull(converter.toDatastoreType(null));
+ }
+
+ @Test
+ public void toObject_whenNull() {
+ assertNull(converter.toMemberType(null));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisDateMappingTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisDateMappingTest.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisDateMappingTest.java
new file mode 100644
index 0000000..718ddad
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/valuetypes/IsisDateMappingTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.objectstore.jdo.datanucleus.valuetypes;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.value.Date;
+import org.apache.isis.objectstore.jdo.datanucleus.valuetypes.IsisDateMapping;
+
+public class IsisDateMappingTest {
+
+ private IsisDateMapping dateMapping;
+
+ @Before
+ public void setUp() throws Exception {
+ dateMapping = new IsisDateMapping();
+ }
+
+ @Test
+ public void roundTrip() {
+ Date date = new Date();
+ final Long datastoreValue = dateMapping.objectToLong(date);
+ Date date2 = (Date) dateMapping.longToObject(datastoreValue);
+
+ // necessary to use dateValue() because the Isis date (rather poorly) does not
+ // override equals() / hashCode()
+ assertThat(date.dateValue(), is(equalTo(date2.dateValue())));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java
deleted file mode 100644
index 0276f64..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.jdo.datanucleus;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
-
-public class DataNucleusPersistenceMechanismInstallerTest_getName {
-
- private DataNucleusPersistenceMechanismInstaller installer;
-
- @Before
- public void setUp() throws Exception {
- installer = new DataNucleusPersistenceMechanismInstaller();
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void isSet() {
- assertThat(installer.getName(), is("datanucleus"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java
deleted file mode 100644
index 0474440..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.jdo.datanucleus;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
-
-public class DataNucleusPersistenceMechanismInstallerTest_services {
-
- private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .withServices(repo)
- .build();
-
- @Test
- public void servicesBootstrapped() {
- final List<Object> services = IsisContext.getServices();
- assertThat(services.size(), is(1));
- assertThat(services.get(0), is((Object)repo));
-
- final ObjectAdapter serviceAdapter = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(repo);
- assertThat(serviceAdapter, is(not(nullValue())));
-
- assertThat(serviceAdapter.getOid(), is(equalTo((Oid)RootOidDefault.create(ObjectSpecId.of("PrimitiveValuedEntities"), "1"))));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/Utils.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/Utils.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/Utils.java
deleted file mode 100644
index 75d7b07..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/Utils.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.jdo.datanucleus;
-
-import java.sql.Connection;
-import java.sql.Statement;
-import java.util.Properties;
-
-import org.joda.time.LocalDate;
-import org.joda.time.LocalDateTime;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.config.IsisConfigurationDefault;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-
-public class Utils {
-
- private Utils(){}
-
- public static IsisSystemWithFixtures.Builder systemBuilder() {
- return IsisSystemWithFixtures.builder()
- .with(configurationForDataNucleusDb())
- .with(new DataNucleusPersistenceMechanismInstaller());
- }
-
- public static IsisSystemWithFixtures.Listener listenerToDeleteFrom(final String... tables) {
- return new IsisSystemWithFixtures.ListenerAdapter(){
-
- @Override
- public void postSetupSystem(boolean firstTime) throws Exception {
- Connection connection = getConnection();
- try {
- final Statement statement = connection.createStatement();
- for(String table: tables) {
- statement.executeUpdate("DELETE FROM " + table);
- }
- } catch(Exception ex) {
- connection.rollback();
- throw ex;
- } finally {
- connection.commit();
- }
- }
-
- private Connection getConnection() {
- final DataNucleusObjectStore objectStore = (DataNucleusObjectStore) IsisContext.getPersistenceSession().getObjectStore();
- return objectStore.getJavaSqlConnection();
- }
- };
- }
-
- public static IsisConfiguration configurationForDataNucleusDb() {
- final IsisConfigurationDefault configuration = new IsisConfigurationDefault();
- Properties props = new Properties();
-
- props.put("isis.persistor.datanucleus.impl.javax.jdo.PersistenceManagerFactoryClass", "org.datanucleus.api.jdo.JDOPersistenceManagerFactory");
-
- // last one wins!
- configureHsqlDbFileBased(props);
- configureForMsSqlServer(props);
- configureHsqlDbInMemory(props);
-
- props.put("isis.persistor.datanucleus.impl.datanucleus.autoCreateSchema", "true");
- props.put("isis.persistor.datanucleus.impl.datanucleus.validateTables", "true");
- props.put("isis.persistor.datanucleus.impl.datanucleus.validateConstraints", "true");
-
- props.put("isis.persistor.datanucleus.impl.datanucleus.cache.level2.type", "none");
-
- configuration.add(props);
- return configuration;
- }
-
-
- private static void configureHsqlDbInMemory(Properties props) {
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName", "org.hsqldb.jdbcDriver");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:hsqldb:mem:test");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName", "sa");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword", "");
- }
-
- private static void configureHsqlDbFileBased(Properties props) {
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName", "org.hsqldb.jdbcDriver");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:hsqldb:file:hsql-db/test;hsqldb.write_delay=false;shutdown=true");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName", "sa");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword", "");
- }
-
- private static void configureForMsSqlServer(Properties props) {
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName", "com.microsoft.sqlserver.jdbc.SQLServerDriver");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:sqlserver://127.0.0.1:1433;instance=SQLEXPRESS;databaseName=jdo;");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName", "jdo");
- props.put("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword", "jdopass");
- }
-
-
-
- public static long toMillis(int year, int monthOfYear, int dayOfMonth) {
- LocalDate d = new LocalDate(year, monthOfYear, dayOfMonth);
- return d.toDateMidnight().getMillis();
- }
-
- public static long toMillis(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute) {
- LocalDateTime d = new LocalDateTime(year, monthOfYear, dayOfMonth, hourOfDay, minuteOfHour, secondOfMinute);
- return d.toDateTime().getMillis();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/JdoObjectIdSerializerTest.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/JdoObjectIdSerializerTest.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/JdoObjectIdSerializerTest.java
deleted file mode 100644
index 0a73e2b..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/persistence/spi/JdoObjectIdSerializerTest.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.jdo.datanucleus.persistence.spi;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.math.BigInteger;
-import java.util.Date;
-
-import org.apache.isis.applib.annotation.ObjectType;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.datanucleus.identity.OIDImpl;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class JdoObjectIdSerializerTest {
-
- @ObjectType("CUS")
- public static class Customer {}
-
- public static class CustomerRepository {
- public void foo(Customer x) {}
- }
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder()
- .withServices(new CustomerRepository())
- .build();
-
-
-
- @Test
- public void whenJavaxJdoIntIdentity() throws Exception {
- Object jdoObjectId = new javax.jdo.identity.IntIdentity(Customer.class, 123);
- String id = JdoObjectIdSerializer.toOidIdentifier(jdoObjectId);
- assertThat(id, is("i_123"));
-
- RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
- Object jdoObjectIdRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
-
- assertThat(jdoObjectIdRecreated, is(jdoObjectId));
- }
-
-
- @Test
- public void whenJavaxJdoStringIdentity() throws Exception {
- Object jdoObjectId = new javax.jdo.identity.StringIdentity(Customer.class, "123");
- String id = JdoObjectIdSerializer.toOidIdentifier(jdoObjectId);
- assertThat(id, is("s_123"));
-
- RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
- Object jdoObjectIdRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
-
- assertThat(jdoObjectIdRecreated, is(jdoObjectId));
- }
-
-
- @Test
- public void whenJavaxJdoLongIdentity() throws Exception {
- Object jdoObjectId = new javax.jdo.identity.LongIdentity(Customer.class, 123L);
- String id = JdoObjectIdSerializer.toOidIdentifier(jdoObjectId);
- assertThat(id, is("l_123"));
-
- RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
- Object jdoObjectIdRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
-
- assertThat(jdoObjectIdRecreated, is(jdoObjectId));
- }
-
-
- @Test
- public void whenLong() throws Exception {
- Object jdoOid = new OIDImpl(Customer.class.getName(), 123L);
- String id = JdoObjectIdSerializer.toOidIdentifier(jdoOid);
- assertThat(id, is("L_123"));
-
- RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
- Object jdoOidRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
-
- assertThat(jdoOidRecreated, is((Object)("123"+ "[OID]" + Customer.class.getName())));
- }
-
- @Test
- public void whenDataNucleusOidAndLong() throws Exception {
- Object jdoOid = new OIDImpl(Customer.class.getName(), 123L);
- String id = JdoObjectIdSerializer.toOidIdentifier(jdoOid);
- assertThat(id, is("L_123"));
-
- RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
- Object jdoOidRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
-
- assertThat(jdoOidRecreated, is((Object)("123"+ "[OID]" + Customer.class.getName())));
- }
-
- @Test
- public void whenDataNucleusOidAndBigInteger() throws Exception {
- Object jdoOid = new OIDImpl(Customer.class.getName(), new BigInteger("123"));
- String id = JdoObjectIdSerializer.toOidIdentifier(jdoOid);
- assertThat(id, is("B_123"));
-
- RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
- Object jdoOidRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
-
- assertThat(jdoOidRecreated, is(((Object)("123"+ "[OID]" + Customer.class.getName()))));
- }
-
- @Test
- public void whenDataNucleusOidAndString() throws Exception {
- Object jdoOid = new OIDImpl(Customer.class.getName(), "456");
- String id = JdoObjectIdSerializer.toOidIdentifier(jdoOid);
- assertThat(id, is("S_456"));
-
- RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
- Object jdoOidRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
-
- assertThat(jdoOidRecreated, is((Object)("456" + "[OID]" + Customer.class.getName())));
- }
-
- @Test
- public void whenDataNucleusOidAndOtherKeyValue() throws Exception {
- Date key = new Date();
- Object jdoOid = new OIDImpl(Customer.class.getName(), key);
- String id = JdoObjectIdSerializer.toOidIdentifier(jdoOid);
- assertThat(id, IsisMatchers.startsWith(OIDImpl.class.getName() + "_" + key.toString()));
-
- RootOidDefault oid = RootOidDefault.create(ObjectSpecId.of("CUS"), id);
- Object jdoOidRecreated = JdoObjectIdSerializer.toJdoObjectId(oid);
-
- assertThat(jdoOidRecreated, is((Object)(key.toString() + "[OID]" + Customer.class.getName())));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java
deleted file mode 100644
index 1cb51b0f..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.adaptermanager;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.UnidirReferencedEntity;
-import org.apache.isis.tck.dom.refs.UnidirReferencedEntityRepository;
-import org.apache.isis.tck.dom.refs.UnidirReferencingEntity;
-import org.apache.isis.tck.dom.refs.UnidirReferencingEntityRepository;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class Persistence_lazyLoading {
-
- private UnidirReferencingEntityRepository referencingRepo = new UnidirReferencingEntityRepository();
- private UnidirReferencedEntityRepository referencedRepo = new UnidirReferencedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCINGENTITY"))
- .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCEDENTITY"))
- .withServices(referencingRepo, referencedRepo)
- .build();
-
- @Test
- public void lazyLoading_and_adapters() throws Exception {
- iswf.beginTran();
- referencedRepo.newEntity().setName("Referenced 1");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- UnidirReferencedEntity referencedEntity1 = referencedRepo.list().get(0);
-
- UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
- referencingEntity1.setName("Referencing 1");
- referencingEntity1.setReferenced(referencedEntity1);
-
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<UnidirReferencingEntity> list = referencingRepo.list();
- referencingEntity1 = list.get(0);
-
- assertThat(referencingEntity1.referenced, is(nullValue())); // lazy loading
- UnidirReferencedEntity referenced = referencingEntity1.getReferenced();
- ObjectAdapter referencedAdapter = iswf.adapterFor(referenced);
- assertThat(referencedAdapter.getResolveState(), is(ResolveState.RESOLVED));
- assertThat(referenced, is(not(nullValue())));
-
- iswf.commitTran();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java
deleted file mode 100644
index a0c9db0..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.adaptermanager;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.UnidirReferencedEntity;
-import org.apache.isis.tck.dom.refs.UnidirReferencedEntityRepository;
-import org.apache.isis.tck.dom.refs.UnidirReferencingEntity;
-import org.apache.isis.tck.dom.refs.UnidirReferencingEntityRepository;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class Persistence_loadObject {
-
- private UnidirReferencingEntityRepository referencingRepo = new UnidirReferencingEntityRepository();
- private UnidirReferencedEntityRepository referencedRepo = new UnidirReferencedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCINGENTITY"))
- .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCEDENTITY"))
- .withServices(referencingRepo, referencedRepo)
- .build();
-
-
- @Test
- public void persist_then_update_using_persistentAdapterFor() throws Exception {
-
- iswf.beginTran();
- UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
- referencedEntity1.setName("Referenced 1");
- UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
- referencedEntity2.setName("Referenced 2");
-
- UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
- referencingEntity1.setName("Referencing 1");
- referencingEntity1.setReferenced(referencedEntity1);
- UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
- referencingEntity2.setName("Referencing 2");
- referencingEntity2.setReferenced(referencedEntity1);
- UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
- referencingEntity3.setName("Referencing 3");
- referencingEntity3.setReferenced(referencedEntity2);
-
- iswf.commitTran();
-
- TypedOid referencingOid2 = (TypedOid) iswf.adapterFor(referencingEntity2).getOid();
-
- TypedOid referencedOid1 = (TypedOid) iswf.adapterFor(referencedEntity1).getOid();
- TypedOid referencedOid2 = (TypedOid) iswf.adapterFor(referencedEntity2).getOid();
-
-
- // when ...
- iswf.bounceSystem();
-
- iswf.beginTran();
-
- ObjectAdapter referencingAdapter2 = iswf.getPersistor().loadObject(referencingOid2);
- referencingEntity2 = (UnidirReferencingEntity) referencingAdapter2.getObject();
-
- UnidirReferencedEntity referenced = referencingEntity2.getReferenced();
-
- ObjectAdapter referencedAdapter1 = iswf.getAdapterManager().adapterFor(referencedOid1);
- assertThat(referenced, is(referencedAdapter1.getObject()));
-
- // ...switch to refer to other
-
- ObjectAdapter referencedAdapter2 = iswf.getAdapterManager().adapterFor(referencedOid2);
- referencedEntity2 = (UnidirReferencedEntity) referencedAdapter2.getObject();
-
- referencingEntity2.setReferenced(referencedEntity2);
- iswf.commitTran();
-
- }
-
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java
deleted file mode 100644
index 1f37a0b..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.adaptermanager;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.UnidirReferencedEntity;
-import org.apache.isis.tck.dom.refs.UnidirReferencedEntityRepository;
-import org.apache.isis.tck.dom.refs.UnidirReferencingEntity;
-import org.apache.isis.tck.dom.refs.UnidirReferencingEntityRepository;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class Persistence_persistentAdapterFor {
-
- private UnidirReferencingEntityRepository referencingRepo = new UnidirReferencingEntityRepository();
- private UnidirReferencedEntityRepository referencedRepo = new UnidirReferencedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCINGENTITY"))
- .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCEDENTITY"))
- .withServices(referencingRepo, referencedRepo)
- .build();
-
-
- @Test
- public void persist_then_update_using_persistentAdapterFor() throws Exception {
-
- iswf.beginTran();
- UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
- referencedEntity1.setName("Referenced 1");
- UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
- referencedEntity2.setName("Referenced 2");
-
- UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
- referencingEntity1.setName("Referencing 1");
- referencingEntity1.setReferenced(referencedEntity1);
- UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
- referencingEntity2.setName("Referencing 2");
- referencingEntity2.setReferenced(referencedEntity1);
- UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
- referencingEntity3.setName("Referencing 3");
- referencingEntity3.setReferenced(referencedEntity2);
-
- iswf.commitTran();
-
- TypedOid referencingOid2 = (TypedOid) iswf.adapterFor(referencingEntity2).getOid();
-
- TypedOid referencedOid1 = (TypedOid) iswf.adapterFor(referencedEntity1).getOid();
- TypedOid referencedOid2 = (TypedOid) iswf.adapterFor(referencedEntity2).getOid();
-
-
- // when ...
- iswf.bounceSystem();
-
- iswf.beginTran();
-
- ObjectAdapter referencingAdapter2 = iswf.getAdapterManager().adapterFor(referencingOid2);
- referencingEntity2 = (UnidirReferencingEntity) referencingAdapter2.getObject();
-
- UnidirReferencedEntity referenced = referencingEntity2.getReferenced();
-
- ObjectAdapter referencedAdapter1 = iswf.getAdapterManager().adapterFor(referencedOid1);
- assertThat(referenced, is(referencedAdapter1.getObject()));
-
- // ...switch to refer to other
-
- ObjectAdapter referencedAdapter2 = iswf.getAdapterManager().adapterFor(referencedOid2);
- referencedEntity2 = (UnidirReferencedEntity) referencedAdapter2.getObject();
-
- referencingEntity2.setReferenced(referencedEntity2);
- iswf.commitTran();
-
- // then...
- iswf.bounceSystem();
-
- iswf.beginTran();
-
- referencingAdapter2 = iswf.getAdapterManager().adapterFor(referencingOid2);
- referencingEntity2 = (UnidirReferencingEntity) referencingAdapter2.getObject();
-
- referenced = referencingEntity2.getReferenced();
-
- referencedAdapter2 = iswf.getAdapterManager().adapterFor(referencedOid2);
-
- // ...is switched
- assertThat(referenced, is(referencedAdapter2.getObject()));
-
- iswf.commitTran();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java
deleted file mode 100644
index da36c89..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.BidirWithListChildEntity;
-import org.apache.isis.tck.dom.refs.BidirWithListParentEntity;
-import org.apache.isis.tck.dom.refs.BidirWithListParentEntityRepository;
-
-public class Persistence_persist_bidirWithListParent {
-
- private BidirWithListParentEntityRepository repo = new BidirWithListParentEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("BIDIRWITHLISTCHILDeNTITY"))
- .with(Utils.listenerToDeleteFrom("BIDIRWITHLISTPARENTENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwoParents() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<BidirWithListParentEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
- @Test
- public void persistTwoChildrenOfParent() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- BidirWithListParentEntity retrievedEntity = repo.list().get(0);
- retrievedEntity.newChild("Child 1 of Parent 1");
- retrievedEntity.newChild("Child 2 of Parent 1");
- retrievedEntity.newChild("Child 3 of Parent 1");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- retrievedEntity = repo.list().get(0);
- List<BidirWithListChildEntity> children = retrievedEntity.getChildren();
- assertThat(children.size(), is(3));
- iswf.commitTran();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java
deleted file mode 100644
index c26237b..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.BidirWithSetChildEntity;
-import org.apache.isis.tck.dom.refs.BidirWithSetParentEntity;
-import org.apache.isis.tck.dom.refs.BidirWithSetParentEntityRepository;
-import org.apache.isis.tck.dom.refs.ParentEntity;
-import org.apache.isis.tck.dom.refs.ParentEntityRepository;
-
-public class Persistence_persist_bidirWithSetParent {
-
- private BidirWithSetParentEntityRepository repo = new BidirWithSetParentEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("BIDIRWITHSETCHILDENTITY"))
- .with(Utils.listenerToDeleteFrom("BIDIRWITHSETPARENTENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwoParents() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<BidirWithSetParentEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
- @Test
- public void persistTwoChildrenOfParent() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- BidirWithSetParentEntity retrievedEntity = repo.list().get(0);
- retrievedEntity.newChild("Child 1 of Parent 1");
- retrievedEntity.newChild("Child 2 of Parent 1");
- retrievedEntity.newChild("Child 3 of Parent 1");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- retrievedEntity = repo.list().get(0);
- Set<BidirWithSetChildEntity> children = retrievedEntity.getChildren();
- assertThat(children.size(), is(3));
- iswf.commitTran();
- }
-
- @Ignore("Not currently working, is an update")
- @Test
- public void updateBidirectional() throws Exception {
- iswf.beginTran();
- BidirWithSetParentEntity parent1 = repo.newEntity();
- parent1.setName("Parent 1");
- BidirWithSetParentEntity parent2 = repo.newEntity();
- parent2.setName("Parent 2");
-
- parent1.newChild("Child 1 of Parent 1");
- parent1.newChild("Child 2 of Parent 1");
- parent1.newChild("Child 3 of Parent 1");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- parent1 = repo.list().get(0);
- parent2 = repo.list().get(0);
- Set<BidirWithSetChildEntity> children = parent1.getChildren();
- assertThat(children.size(), is(3));
- BidirWithSetChildEntity child1 = parent1.getChildren().iterator().next();
- child1.moveTo(parent2);
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- parent1 = repo.list().get(0);
- parent2 = repo.list().get(0);
- children = parent1.getChildren();
- assertThat(children.size(), is(2));
-
- children = parent2.getChildren();
- assertThat(children.size(), is(1));
- iswf.commitTran();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java
deleted file mode 100644
index 2a93457..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.PolyClassChildEntity;
-import org.apache.isis.tck.dom.refs.PolyClassParentEntity;
-import org.apache.isis.tck.dom.refs.PolyClassParentEntityRepository;
-
-public class Persistence_persist_polyclass {
-
- private PolyClassParentEntityRepository repo = new PolyClassParentEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("POLYCLASSSUBTYPE1ENTITY"))
- .with(Utils.listenerToDeleteFrom("POLYCLASSCHILDENTITY"))
- .with(Utils.listenerToDeleteFrom("POLYCLASSPARENTENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwoParents() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<PolyClassParentEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
- @Test
- public void persistSixDifferentChildrenOfParent() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- PolyClassParentEntity retrievedEntity = repo.list().get(0);
- retrievedEntity.newSubtype1("Child 1 of Parent 1", 123);
- retrievedEntity.newSubtype1("Child 2 of Parent 1", 456);
- retrievedEntity.newSubtype2("Child 3 of Parent 1", "abc");
- retrievedEntity.newSubtype2("Child 4 of Parent 1", "def");
- retrievedEntity.newSubtype3("Child 5 of Parent 1", BigDecimal.ONE);
- retrievedEntity.newSubtype3("Child 6 of Parent 1", BigDecimal.TEN);
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- retrievedEntity = repo.list().get(0);
- Set<PolyClassChildEntity> children = retrievedEntity.getChildren();
- assertThat(children.size(), is(6));
- iswf.commitTran();
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java
deleted file mode 100644
index e230959..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.PolyClassChildEntity;
-import org.apache.isis.tck.dom.refs.PolyClassParentEntity;
-import org.apache.isis.tck.dom.refs.PolyClassParentEntityRepository;
-import org.apache.isis.tck.dom.refs.PolyInterface;
-import org.apache.isis.tck.dom.refs.PolyInterfaceParentEntity;
-import org.apache.isis.tck.dom.refs.PolyInterfaceParentEntityRepository;
-
-public class Persistence_persist_polyinter {
-
- private PolyInterfaceParentEntityRepository repo = new PolyInterfaceParentEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("POLYINTERFACEPARENTENTITY_CHILDREN"))
- .with(Utils.listenerToDeleteFrom("POLYINTERFACESUBTYPE1ENTITY"))
- .with(Utils.listenerToDeleteFrom("POLYINTERFACESUBTYPE2ENTITY"))
- .with(Utils.listenerToDeleteFrom("POLYINTERFACESUBTYPE3ENTITY"))
- .with(Utils.listenerToDeleteFrom("POLYINTERFACEPARENTENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwoParents() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<PolyInterfaceParentEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
- @Test
- public void persistSixDifferentChildrenOfParent() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- PolyInterfaceParentEntity retrievedEntity = repo.list().get(0);
- retrievedEntity.newSubtype1("Child 1 of Parent 1", 123);
- retrievedEntity.newSubtype1("Child 2 of Parent 1", 456);
- retrievedEntity.newSubtype2("Child 3 of Parent 1", "abc");
- retrievedEntity.newSubtype2("Child 4 of Parent 1", "def");
- retrievedEntity.newSubtype3("Child 5 of Parent 1", BigDecimal.ONE);
- retrievedEntity.newSubtype3("Child 6 of Parent 1", BigDecimal.TEN);
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- retrievedEntity = repo.list().get(0);
- Set<PolyInterface> children = retrievedEntity.getChildren();
- assertThat(children.size(), is(6));
- iswf.commitTran();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java
deleted file mode 100644
index a1f5faa..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.PolyClassChildEntity;
-import org.apache.isis.tck.dom.refs.PolyClassParentEntity;
-import org.apache.isis.tck.dom.refs.PolyClassParentEntityRepository;
-import org.apache.isis.tck.dom.refs.PolyInterface;
-import org.apache.isis.tck.dom.refs.PolyInterfaceIdentityStrategy;
-import org.apache.isis.tck.dom.refs.PolyInterfaceIdentityStrategyParentEntity;
-import org.apache.isis.tck.dom.refs.PolyInterfaceIdentityStrategyParentEntityRepository;
-import org.apache.isis.tck.dom.refs.PolyInterfaceParentEntity;
-import org.apache.isis.tck.dom.refs.PolyInterfaceParentEntityRepository;
-
-public class Persistence_persist_polyinterIdentityStrategy {
-
- private PolyInterfaceIdentityStrategyParentEntityRepository repo = new PolyInterfaceIdentityStrategyParentEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("POLYINTERFACEIDENTITYSTRATEGYPARENTENTITY_CHILDREN"))
- .with(Utils.listenerToDeleteFrom("POLYINTERFACEIDENTITYSTRATEGYSUBTYPE1ENTITY"))
- .with(Utils.listenerToDeleteFrom("POLYINTERFACEIDENTITYSTRATEGYSUBTYPE2ENTITY"))
- .with(Utils.listenerToDeleteFrom("POLYINTERFACEIDENTITYSTRATEGYSUBTYPE3ENTITY"))
- .with(Utils.listenerToDeleteFrom("POLYINTERFACEIDENTITYSTRATEGYPARENTENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwoParents() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<PolyInterfaceIdentityStrategyParentEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
- @Test
- public void persistSixDifferentChildrenOfParent() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- PolyInterfaceIdentityStrategyParentEntity retrievedEntity = repo.list().get(0);
- retrievedEntity.newSubtype1("Child 1 of Parent 1", 123);
- retrievedEntity.newSubtype1("Child 2 of Parent 1", 456);
- retrievedEntity.newSubtype2("Child 3 of Parent 1", "abc");
- retrievedEntity.newSubtype2("Child 4 of Parent 1", "def");
- retrievedEntity.newSubtype3("Child 5 of Parent 1", BigDecimal.ONE);
- retrievedEntity.newSubtype3("Child 6 of Parent 1", BigDecimal.TEN);
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- retrievedEntity = repo.list().get(0);
- Set<PolyInterfaceIdentityStrategy> children = retrievedEntity.getChildren();
- assertThat(children.size(), is(6));
- iswf.commitTran();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java
deleted file mode 100644
index dbe851f..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.UnidirReferencedEntity;
-import org.apache.isis.tck.dom.refs.UnidirReferencedEntityRepository;
-import org.apache.isis.tck.dom.refs.UnidirReferencingEntity;
-import org.apache.isis.tck.dom.refs.UnidirReferencingEntityRepository;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class Persistence_persist_referencing {
-
- private UnidirReferencingEntityRepository referencingRepo = new UnidirReferencingEntityRepository();
- private UnidirReferencedEntityRepository referencedRepo = new UnidirReferencedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCINGENTITY"))
- .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCEDENTITY"))
- .withServices(referencingRepo, referencedRepo)
- .build();
-
- @Test
- public void persist() throws Exception {
-
- iswf.beginTran();
- referencedRepo.newEntity().setName("Referenced 1");
- referencedRepo.newEntity().setName("Referenced 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- UnidirReferencedEntity referencedEntity1 = referencedRepo.list().get(0);
- UnidirReferencedEntity referencedEntity2 = referencedRepo.list().get(1);
-
- UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
- referencingEntity1.setName("Referencing 1");
- referencingEntity1.setReferenced(referencedEntity1);
-
- UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
- referencingEntity2.setName("Referencing 2");
- referencingEntity2.setReferenced(referencedEntity1);
-
- UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
- referencingEntity3.setName("Referencing 3");
- referencingEntity3.setReferenced(referencedEntity2);
-
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<UnidirReferencingEntity> list = referencingRepo.list();
- referencingEntity1 = list.get(0);
- referencingEntity2 = list.get(1);
- referencingEntity3 = list.get(2);
-
- assertThat(referencingEntity1.getReferenced(), is(not(nullValue())));
- assertThat(referencingEntity2.getReferenced(), is(not(nullValue())));
- assertThat(referencingEntity3.getReferenced(), is(not(nullValue())));
-
- assertThat(referencingEntity1.getReferenced(), is(referencingEntity1.getReferenced()));
- assertThat(referencingEntity1.getReferenced(), is(not(referencingEntity3.getReferenced())));
- iswf.commitTran();
- }
-
- @Test
- public void persistAGraphOfObjects() throws Exception {
-
- iswf.beginTran();
- UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
- referencedEntity1.setName("Referenced 1");
- UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
- referencedEntity2.setName("Referenced 2");
-
- UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
- referencingEntity1.setName("Referencing 1");
- referencingEntity1.setReferenced(referencedEntity1);
- UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
- referencingEntity2.setName("Referencing 2");
- referencingEntity2.setReferenced(referencedEntity1);
- UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
- referencingEntity3.setName("Referencing 3");
- referencingEntity3.setReferenced(referencedEntity2);
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<UnidirReferencingEntity> list = referencingRepo.list();
- referencingEntity1 = list.get(0);
- referencingEntity2 = list.get(1);
- referencingEntity3 = list.get(2);
-
- assertThat(referencingEntity1.getReferenced(), is(not(nullValue())));
- assertThat(referencingEntity2.getReferenced(), is(not(nullValue())));
- assertThat(referencingEntity3.getReferenced(), is(not(nullValue())));
-
- assertThat(referencingEntity1.getReferenced(), is(referencingEntity1.getReferenced()));
- assertThat(referencingEntity1.getReferenced(), is(not(referencingEntity3.getReferenced())));
- iswf.commitTran();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java
deleted file mode 100644
index 87f7fd0..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.BidirWithSetChildEntity;
-import org.apache.isis.tck.dom.refs.BidirWithSetParentEntity;
-import org.apache.isis.tck.dom.refs.BidirWithSetParentEntityRepository;
-import org.apache.isis.tck.dom.refs.ParentEntity;
-import org.apache.isis.tck.dom.refs.ParentEntityRepository;
-import org.apache.isis.tck.dom.refs.UnidirFkChildEntity;
-import org.apache.isis.tck.dom.refs.UnidirFkParentEntity;
-import org.apache.isis.tck.dom.refs.UnidirFkParentEntityRepository;
-
-public class Persistence_persist_unidir {
-
- private UnidirFkParentEntityRepository repo = new UnidirFkParentEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("UNIDIRFKCHILDENTITY"))
- .with(Utils.listenerToDeleteFrom("UNIDIRFKPARENTENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwoParents() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<UnidirFkParentEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
- @Test
- public void persistTwoChildrenOfParent() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- UnidirFkParentEntity retrievedEntity = repo.list().get(0);
- retrievedEntity.newChild("Child 1 of Parent 1");
- retrievedEntity.newChild("Child 2 of Parent 1");
- retrievedEntity.newChild("Child 3 of Parent 1");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- retrievedEntity = repo.list().get(0);
- Set<UnidirFkChildEntity> children = retrievedEntity.getChildren();
- assertThat(children.size(), is(3));
- iswf.commitTran();
- }
-
- @Ignore("Not currently working, is an update")
- @Test
- public void updateBidirectional() throws Exception {
- iswf.beginTran();
- UnidirFkParentEntity parent1 = repo.newEntity();
- parent1.setName("Parent 1");
- UnidirFkParentEntity parent2 = repo.newEntity();
- parent2.setName("Parent 2");
-
- parent1.newChild("Child 1 of Parent 1");
- parent1.newChild("Child 2 of Parent 1");
- parent1.newChild("Child 3 of Parent 1");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- parent1 = repo.list().get(0);
- parent2 = repo.list().get(0);
- Set<UnidirFkChildEntity> children = parent1.getChildren();
- assertThat(children.size(), is(3));
- UnidirFkChildEntity child1 = parent1.getChildren().iterator().next();
- parent1.removeChild(child1);
- parent2.addChild(child1);
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- parent1 = repo.list().get(0);
- parent2 = repo.list().get(0);
- children = parent1.getChildren();
- assertThat(children.size(), is(2));
-
- children = parent2.getChildren();
- assertThat(children.size(), is(1));
- iswf.commitTran();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java
deleted file mode 100644
index d94a2d0..0000000
--- a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.BidirWithSetChildEntity;
-import org.apache.isis.tck.dom.refs.BidirWithSetParentEntity;
-import org.apache.isis.tck.dom.refs.BidirWithSetParentEntityRepository;
-import org.apache.isis.tck.dom.refs.ParentEntity;
-import org.apache.isis.tck.dom.refs.ParentEntityRepository;
-import org.apache.isis.tck.dom.refs.UnidirFkChildEntity;
-import org.apache.isis.tck.dom.refs.UnidirFkParentEntity;
-import org.apache.isis.tck.dom.refs.UnidirFkParentEntityRepository;
-import org.apache.isis.tck.dom.refs.UnidirJoinChildEntity;
-import org.apache.isis.tck.dom.refs.UnidirJoinParentEntity;
-import org.apache.isis.tck.dom.refs.UnidirJoinParentEntityRepository;
-
-public class Persistence_persist_unidirJoin {
-
- private UnidirJoinParentEntityRepository repo = new UnidirJoinParentEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("UNIDIRJOINCHILDENTITY"))
- .with(Utils.listenerToDeleteFrom("UNIDIRJOINPARENTENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwoParents() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<UnidirJoinParentEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
- @Test
- public void persistTwoChildrenOfParent() throws Exception {
- iswf.beginTran();
- repo.newEntity().setName("Parent 1");
- repo.newEntity().setName("Parent 2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- UnidirJoinParentEntity retrievedEntity = repo.list().get(0);
- retrievedEntity.newChild("Child 1 of Parent 1");
- retrievedEntity.newChild("Child 2 of Parent 1");
- retrievedEntity.newChild("Child 3 of Parent 1");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- retrievedEntity = repo.list().get(0);
- Set<UnidirJoinChildEntity> children = retrievedEntity.getChildren();
- assertThat(children.size(), is(3));
- iswf.commitTran();
- }
-
- @Ignore("Not currently working, is an update")
- @Test
- public void updateBidirectional() throws Exception {
- iswf.beginTran();
- UnidirJoinParentEntity parent1 = repo.newEntity();
- parent1.setName("Parent 1");
- UnidirJoinParentEntity parent2 = repo.newEntity();
- parent2.setName("Parent 2");
-
- parent1.newChild("Child 1 of Parent 1");
- parent1.newChild("Child 2 of Parent 1");
- parent1.newChild("Child 3 of Parent 1");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- parent1 = repo.list().get(0);
- parent2 = repo.list().get(0);
- Set<UnidirJoinChildEntity> children = parent1.getChildren();
- assertThat(children.size(), is(3));
- UnidirJoinChildEntity child1 = parent1.getChildren().iterator().next();
- parent1.removeChild(child1);
- parent2.addChild(child1);
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- parent1 = repo.list().get(0);
- parent2 = repo.list().get(0);
- children = parent1.getChildren();
- assertThat(children.size(), is(2));
-
- children = parent2.getChildren();
- assertThat(children.size(), is(1));
- iswf.commitTran();
- }
-
-
-}