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 2015/07/25 11:29:35 UTC
[17/48] isis git commit: ISIS-1178: mothballing the tck tests.
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/core/runtime/memento/MementoTest_data.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/core/runtime/memento/MementoTest_data.java b/tck/tck-integtests/src/test/java/org/apache/isis/core/runtime/memento/MementoTest_data.java
deleted file mode 100644
index 3ecc2d1..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/core/runtime/memento/MementoTest_data.java
+++ /dev/null
@@ -1,93 +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.core.runtime.memento;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.tck.dom.scalars.WrapperValuedEntity;
-
-public class MementoTest_data {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- private ObjectAdapter originalAdapter1, originalAdapter2;
- private Oid oid1, oid2;
-
- private Memento memento1, memento2;
- private Data data1, data2;
-
- @Before
- public void setUpSystem() throws Exception {
- iswf.fixtures.wve1.setStringProperty("Fred");
-
- originalAdapter1 = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(iswf.fixtures.wve1);
- oid1 = originalAdapter1.getOid();
- memento1 = new Memento(originalAdapter1);
- data1 = memento1.getData();
-
- iswf.fixtures.wve2.setStringProperty("Harry");
- iswf.container.persist(iswf.fixtures.wve2);
-
- originalAdapter2 = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(iswf.fixtures.wve2);
- oid2 = originalAdapter2.getOid();
- memento2 = new Memento(originalAdapter2);
- data2 = memento2.getData();
- }
-
-
- @Test
- public void data_whenNull() throws Exception {
- final Memento memento = new Memento(null);
- Data data = memento.getData();
-
- assertEquals(null, data);
- }
-
-
- @Test
- public void data_getOid_equal() throws Exception {
- assertEquals(oid1, data1.getOid());
- }
-
-
-
- @Test
- public void data_getClassName() throws Exception {
- assertEquals(WrapperValuedEntity.class.getName(), data1.getClassName());
- }
-
-
- @Test
- public void data_getEntry_forStringField() throws Exception {
- assertEquals(ObjectData.class, data1.getClass());
- final ObjectData objectData = (ObjectData) data1;
- assertEquals("Fred", objectData.getEntry("stringProperty"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/core/runtime/memento/MementoTest_encodedData.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/core/runtime/memento/MementoTest_encodedData.java b/tck/tck-integtests/src/test/java/org/apache/isis/core/runtime/memento/MementoTest_encodedData.java
deleted file mode 100644
index f86d96d..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/core/runtime/memento/MementoTest_encodedData.java
+++ /dev/null
@@ -1,80 +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.core.runtime.memento;
-
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.commons.encoding.DataOutputStreamExtended;
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-
-public class MementoTest_encodedData {
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- private ObjectAdapter rootAdapter;
-
- private Memento memento;
-
- @Mock
- private DataOutputStreamExtended mockOutputImpl;
-
- @Before
- public void setUpSystem() throws Exception {
- iswf.fixtures.smpl1.setName("Fred");
- iswf.fixtures.smpl2.setName("Harry");
-
- iswf.fixtures.rfcg1.setReference(iswf.fixtures.smpl1);
-
- iswf.fixtures.prnt1.getHomogeneousCollection().add(iswf.fixtures.smpl1);
- iswf.fixtures.prnt1.getHomogeneousCollection().add(iswf.fixtures.smpl2);
-
- iswf.fixtures.prnt1.getHeterogeneousCollection().add(iswf.fixtures.smpl1);
- iswf.fixtures.prnt1.getHeterogeneousCollection().add(iswf.fixtures.rfcg1);
-
-
- rootAdapter = IsisContext.getPersistenceSession().getAdapterManager().adapterFor(iswf.fixtures.smpl1);
-
- memento = new Memento(rootAdapter);
- }
-
-
- @Test
- public void encodedData() throws Exception {
- context.checking(new Expectations() {
- {
- one(mockOutputImpl).writeEncodable(memento.getData());
- }
- });
- memento.encodedData(mockOutputImpl);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java
deleted file mode 100644
index ebba602..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_getName.java
+++ /dev/null
@@ -1,46 +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.objectstore.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;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstallerTest_services.java
deleted file mode 100644
index 44a5b46..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/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.objectstore.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.integtestsupport.IsisSystemWithFixtures;
-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.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/Utils.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/Utils.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/Utils.java
deleted file mode 100644
index 5b0bb73..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/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.objectstore.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.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/spi/JdoObjectIdSerializerTest.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/spi/JdoObjectIdSerializerTest.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/spi/JdoObjectIdSerializerTest.java
deleted file mode 100644
index f4c5364..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/spi/JdoObjectIdSerializerTest.java
+++ /dev/null
@@ -1,150 +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.objectstore.jdo.datanucleus.persistence.spi;
-
-import java.math.BigInteger;
-import java.util.Date;
-import org.datanucleus.identity.ObjectId;
-import org.junit.Rule;
-import org.junit.Test;
-import org.apache.isis.applib.annotation.ObjectType;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-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 ObjectId(Customer.class, 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 ObjectId(Customer.class, 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 ObjectId(Customer.class, 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 ObjectId(Customer.class, "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 ObjectId(Customer.class, key);
- String id = JdoObjectIdSerializer.toOidIdentifier(jdoOid);
- assertThat(id, IsisMatchers.startsWith(ObjectId.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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java
deleted file mode 100644
index 94087d7..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java
+++ /dev/null
@@ -1,84 +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.objectstore.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.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencedEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencedEntityRepository;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencingEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencingEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java
deleted file mode 100644
index 32487be..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java
+++ /dev/null
@@ -1,102 +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.objectstore.jdo.datanucleus.scenarios.adaptermanager;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencedEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencedEntityRepository;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencingEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencingEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java
deleted file mode 100644
index 39d9833..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java
+++ /dev/null
@@ -1,115 +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.objectstore.jdo.datanucleus.scenarios.adaptermanager;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencedEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencedEntityRepository;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencingEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencingEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java
deleted file mode 100644
index b618efd..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/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.objectstore.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.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.tck.dom.refs.BidirWithListChildEntity;
-import org.apache.isis.core.tck.dom.refs.BidirWithListParentEntity;
-import org.apache.isis.core.tck.dom.refs.BidirWithListParentEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java
deleted file mode 100644
index 21447b7..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java
+++ /dev/null
@@ -1,127 +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.objectstore.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.tck.dom.refs.BidirWithSetChildEntity;
-import org.apache.isis.core.tck.dom.refs.BidirWithSetParentEntity;
-import org.apache.isis.core.tck.dom.refs.BidirWithSetParentEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java
deleted file mode 100644
index bb1b8c6..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/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.objectstore.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.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.tck.dom.refs.PolyClassChildEntity;
-import org.apache.isis.core.tck.dom.refs.PolyClassParentEntity;
-import org.apache.isis.core.tck.dom.refs.PolyClassParentEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java
deleted file mode 100644
index 60a8ee7..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java
+++ /dev/null
@@ -1,95 +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.objectstore.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.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.tck.dom.refs.PolyInterface;
-import org.apache.isis.core.tck.dom.refs.PolyInterfaceParentEntity;
-import org.apache.isis.core.tck.dom.refs.PolyInterfaceParentEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java
deleted file mode 100644
index 9484c1d..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.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.objectstore.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.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.tck.dom.refs.PolyInterfaceIdentityStrategy;
-import org.apache.isis.core.tck.dom.refs.PolyInterfaceIdentityStrategyParentEntity;
-import org.apache.isis.core.tck.dom.refs.PolyInterfaceIdentityStrategyParentEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java
deleted file mode 100644
index d29c674..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java
+++ /dev/null
@@ -1,133 +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.objectstore.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.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencedEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencedEntityRepository;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencingEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencingEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java
deleted file mode 100644
index 387f561..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java
+++ /dev/null
@@ -1,128 +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.objectstore.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.tck.dom.refs.UnidirFkChildEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirFkParentEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirFkParentEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java
deleted file mode 100644
index 3f56f4e..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java
+++ /dev/null
@@ -1,128 +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.objectstore.jdo.datanucleus.scenarios.refs;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.tck.dom.refs.UnidirJoinChildEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirJoinParentEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirJoinParentEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-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();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_update_using_domMethodCalls.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_update_using_domMethodCalls.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_update_using_domMethodCalls.java
deleted file mode 100644
index b7d8026..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/refs/Persistence_update_using_domMethodCalls.java
+++ /dev/null
@@ -1,108 +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.objectstore.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.core.integtestsupport.IsisSystemWithFixtures;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencedEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencedEntityRepository;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencingEntity;
-import org.apache.isis.core.tck.dom.refs.UnidirReferencingEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-public class Persistence_update_using_domMethodCalls {
-
- 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() 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();
-
- // when ...
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<UnidirReferencingEntity> referencingList = referencingRepo.list();
- referencingEntity1 = referencingList.get(0);
- referencingEntity2 = referencingList.get(1);
- referencingEntity3 = referencingList.get(2);
-
- List<UnidirReferencedEntity> referencedList = referencedRepo.list();
- referencedEntity1 = referencedList.get(0);
- referencedEntity2 = referencedList.get(1);
-
- assertThat(referencingEntity2.getReferenced(), is(referencedEntity1));
-
- // ...switch to refer to other
- referencingEntity2.setReferenced(referencedEntity2);
- iswf.commitTran();
-
- // then...
- iswf.bounceSystem();
-
- iswf.beginTran();
- referencingList = referencingRepo.list();
- referencingEntity1 = referencingList.get(0);
- referencingEntity2 = referencingList.get(1);
- referencingEntity3 = referencingList.get(2);
-
- referencedList = referencedRepo.list();
- referencedEntity1 = referencedList.get(0);
- referencedEntity2 = referencedList.get(1);
-
- // ...is switched
- assertThat(referencingEntity2.getReferenced(), is(referencedEntity2));
- iswf.commitTran();
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/93a1d5cc/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/scalar/Persistence_allInstances.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/scalar/Persistence_allInstances.java b/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/scalar/Persistence_allInstances.java
deleted file mode 100644
index 7a2fad1..0000000
--- a/tck/tck-integtests/src/test/java/org/apache/isis/objectstore/jdo/datanucleus/scenarios/scalar/Persistence_allInstances.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.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.PrimitiveValuedEntity;
-import org.apache.isis.core.tck.dom.scalars.PrimitiveValuedEntityRepository;
-import org.apache.isis.objectstore.jdo.datanucleus.Utils;
-
-public class Persistence_allInstances {
-
- private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void whenNoInstances() {
- iswf.beginTran();
- final List<PrimitiveValuedEntity> list = repo.list();
- assertThat(list.size(), is(0));
- iswf.commitTran();
- }
-
- @Test
- public void persist_dontBounce_listAll() throws Exception {
-
- iswf.beginTran();
- PrimitiveValuedEntity entity = repo.newEntity();
- entity.setId(1);
- entity = repo.newEntity();
- entity.setId(2);
- iswf.commitTran();
-
- // don't bounce
- iswf.beginTran();
- List<PrimitiveValuedEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
- @Test
- public void persist_bounce_listAll() throws Exception {
-
- iswf.beginTran();
- repo.newEntity().setId(1);
- repo.newEntity().setId(2);
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<PrimitiveValuedEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
-
-}