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 08:30:05 UTC
[53/58] [partial] ISIS-188: renaming packages in line with
groupId:artifactId
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_debug.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_debug.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_debug.java
deleted file mode 100644
index 5cfbe38..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_debug.java
+++ /dev/null
@@ -1,78 +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.dflt;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.apache.isis.core.commons.debug.DebugString;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.junit.Rule;
-import org.junit.Test;
-
-public class InMemoryObjectStoreTest_debug {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- private static InMemoryObjectStore getStore() {
- return (InMemoryObjectStore) IsisContext.getPersistenceSession().getObjectStore();
- }
-
- @Test
- public void debugTitle() throws Exception {
-
- // when
- final String debugTitle = getStore().debugTitle();
-
- // then
- assertThat(debugTitle, is("In-Memory Object Store"));
- }
-
-
- @Test
- public void debugXxx_whenHasObject() throws Exception {
-
- // given
- iswf.persist(iswf.fixtures.smpl1);
-
- // when
- final DebugString debug = new DebugString();
- getStore().debugData(debug);
-
-
- // then
- assertThat(debug.toString(), IsisMatchers.containsStripNewLines("SMPL:2"));
- }
-
-
- @Test
- public void testEmpty() throws Exception {
-
- // when
- final DebugString debug = new DebugString();
- getStore().debugData(debug);
-
- // then
- assertThat(debug.toString(), is("\nDomain Objects\n--------------\n\n"));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_init.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_init.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_init.java
deleted file mode 100644
index 3ac1914..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_init.java
+++ /dev/null
@@ -1,44 +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.dflt;
-
-import static org.junit.Assert.assertFalse;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-
-public class InMemoryObjectStoreTest_init {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- private static InMemoryObjectStore getStore() {
- return (InMemoryObjectStore) IsisContext.getPersistenceSession().getObjectStore();
- }
-
- @Test
- public void testStartsUpInUnitializedSate() throws Exception {
- assertFalse(getStore().isFixturesInstalled());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_name.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_name.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_name.java
deleted file mode 100644
index 79dc871..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_name.java
+++ /dev/null
@@ -1,41 +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.dflt;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class InMemoryObjectStoreTest_name {
-
- private InMemoryObjectStore store;
-
- @Before
- public void setUp() throws Exception {
- store = new InMemoryObjectStore();
- }
-
- @Test
- public void testName() throws Exception {
- assertEquals("In-Memory Object Store", store.name());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_openAndClose.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_openAndClose.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_openAndClose.java
deleted file mode 100644
index de0bc15..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_openAndClose.java
+++ /dev/null
@@ -1,120 +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.dflt;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-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.testsupport.jmock.JUnitRuleMockery2;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
-import org.apache.isis.runtimes.dflt.objectstores.dflt.internal.ObjectStorePersistedObjects;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
-
-/**
- * Tested in style of <i>Working Effectively with Legacy Code</i> (Feathers) and
- * <i>Growing Object-Oriented Software</i> (Freeman & Pryce).
- */
-public class InMemoryObjectStoreTest_openAndClose {
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- @Mock
- private InMemoryPersistenceSessionFactory mockInMemoryPersistenceSessionFactory;
- @Mock
- private PersistenceSession mockPersistenceSession;
- @Mock
- private ObjectStorePersistedObjects mockObjectStorePersistedObjects;
-
- private boolean recreatedAdapters = false;
-
- private InMemoryObjectStore objectStore;
-
- @Before
- public void setUp() throws Exception {
- objectStore = new InMemoryObjectStore() {
- @Override
- protected InMemoryPersistenceSessionFactory getInMemoryPersistenceSessionFactory() {
- return mockInMemoryPersistenceSessionFactory;
- }
-
- @Override
- protected PersistenceSession getPersistenceSession() {
- return mockPersistenceSession;
- }
-
- @Override
- protected void recreateAdapters() {
- recreatedAdapters = true;
- }
- };
- }
-
- @Test
- public void whenOpenForFirstTimeThenCreatesPersistedObjects() throws Exception {
- context.never(mockPersistenceSession);
- context.checking(new Expectations() {
- {
- one(mockInMemoryPersistenceSessionFactory).getPersistedObjects();
- will(returnValue(null));
-
- one(mockInMemoryPersistenceSessionFactory).createPersistedObjects();
- will(returnValue(mockObjectStorePersistedObjects));
- }
- });
- objectStore.open();
- }
-
- @Test
- public void whenOpenSubsequentlyThenObtainsPersistedObjectsFromObjectStoreFactoryAndRecreatesAdapters() throws Exception {
- context.never(mockPersistenceSession);
- context.checking(new Expectations() {
- {
- one(mockInMemoryPersistenceSessionFactory).getPersistedObjects();
- will(returnValue(mockObjectStorePersistedObjects));
- }
- });
-
- assertThat(recreatedAdapters, is(false));
- objectStore.open();
- assertThat(recreatedAdapters, is(true));
- }
-
- @Test
- public void whenCloseThenGivesObjectsBackToObjectStoreFactory() throws Exception {
- context.never(mockPersistenceSession);
- whenOpenSubsequentlyThenObtainsPersistedObjectsFromObjectStoreFactoryAndRecreatesAdapters();
-
- context.checking(new Expectations() {
- {
- one(mockInMemoryPersistenceSessionFactory).attach(with(mockPersistenceSession), with(mockObjectStorePersistedObjects));
- never(mockPersistenceSession);
- }
- });
- objectStore.close();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_persist.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_persist.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_persist.java
deleted file mode 100644
index ee82dfb..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_persist.java
+++ /dev/null
@@ -1,37 +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.dflt;
-
-import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures.Listener;
-import org.apache.isis.runtimes.dflt.testsupport.tck.ObjectStoreContractTest_persist;
-
-public class InMemoryObjectStoreTest_persist extends ObjectStoreContractTest_persist {
-
- @Override
- protected PersistenceMechanismInstaller createPersistenceMechanismInstaller() {
- return new InMemoryPersistenceMechanismInstaller();
- }
-
- @Override
- protected Listener iswfListener() {
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_persistAggregated.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_persistAggregated.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_persistAggregated.java
deleted file mode 100644
index 6f4c240..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_persistAggregated.java
+++ /dev/null
@@ -1,57 +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.dflt;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures.Listener;
-import org.apache.isis.runtimes.dflt.testsupport.tck.ObjectStoreContractTest_persist;
-import org.apache.isis.tck.dom.refs.ReferencingEntity;
-
-public class InMemoryObjectStoreTest_persistAggregated {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder()
- .with(createPersistenceMechanismInstaller())
- .build();
-
- protected PersistenceMechanismInstaller createPersistenceMechanismInstaller() {
- return new InMemoryPersistenceMechanismInstaller();
- }
-
- @Test
- public void persistAggregatedEntityWithinCollection() throws Exception {
- final ReferencingEntity referencingEntity = iswf.fixtures.rfcg2;
- referencingEntity.addAggregatedEntityToCollection().setName("Aggregated Entity #1");
- iswf.persist(referencingEntity);
- }
-
-
- @Test
- public void persistAggregatedEntityWithinProperty() throws Exception {
- final ReferencingEntity referencingEntity = iswf.fixtures.rfcg2;
- referencingEntity.addAggregatedReference().setName("Aggregated Entity #1");
- iswf.persist(referencingEntity);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_reset.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_reset.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_reset.java
deleted file mode 100644
index 2016a7b..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_reset.java
+++ /dev/null
@@ -1,81 +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.dflt;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManagerSpi;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.SimpleEntity;
-
-/**
- * This is really just a test of the test infrastructure, not a real test per se.
- */
-public class InMemoryObjectStoreTest_reset {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- protected ObjectAdapter epv2Adapter;
- protected ObjectSpecification epvSpecification;
-
- protected InMemoryObjectStore getStore() {
- return (InMemoryObjectStore) IsisContext.getPersistenceSession().getObjectStore();
- }
-
- @Before
- public void setUpFixtures() throws Exception {
- epv2Adapter = iswf.adapterFor(iswf.fixtures.smpl2);
- epvSpecification = iswf.loadSpecification(SimpleEntity.class);
- }
-
- @Test
- public void reset_clearsAdapterFromLoader() throws Exception {
-
- iswf.persist(iswf.fixtures.smpl2);
- iswf.bounceSystem();
-
- assertNotNull(getAdapterManager().getAdapterFor(epv2Adapter.getObject()));
-
- IsisContext.getPersistenceSession().testReset();
-
- assertNull(getAdapterManager().getAdapterFor(epv2Adapter.getObject()));
- }
-
-
- private PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- private AdapterManager getAdapterManager() {
- return getPersistenceSession().getAdapterManager();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_retrieve.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_retrieve.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_retrieve.java
deleted file mode 100644
index c2b335f..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_retrieve.java
+++ /dev/null
@@ -1,142 +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.dflt;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
-import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.runtimes.dflt.runtime.persistence.ObjectNotFoundException;
-import org.apache.isis.runtimes.dflt.runtime.persistence.query.PersistenceQueryFindAllInstances;
-import org.apache.isis.runtimes.dflt.runtime.persistence.query.PersistenceQueryFindByTitle;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.SimpleEntity;
-
-public class InMemoryObjectStoreTest_retrieve {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- protected ObjectAdapter epv2Adapter;
- protected ObjectSpecification epvSpecification;
-
- protected InMemoryObjectStore getStore() {
- return (InMemoryObjectStore) IsisContext.getPersistenceSession().getObjectStore();
- }
-
- @Before
- public void setUpFixtures() throws Exception {
- epv2Adapter = iswf.adapterFor(iswf.fixtures.smpl2);
- epvSpecification = iswf.loadSpecification(SimpleEntity.class);
- }
-
- @Test
- public void getObject_whenDoesNotExist() {
- final TypedOid oid = RootOidDefault.deString("SMPL:10", new OidMarshaller());
- try {
- getStore().loadInstanceAndAdapt(oid);
- fail();
- } catch (final ObjectNotFoundException expected) {
- }
- }
-
- @Test
- public void getObject_whenExists_returnsAdapter() throws Exception {
-
- // given
- iswf.persist(iswf.fixtures.smpl2);
- iswf.bounceSystem();
-
- final ObjectAdapter retrievedAdapter = getStore().loadInstanceAndAdapt((TypedOid) epv2Adapter.getOid());
-
- assertNotSame(epv2Adapter, retrievedAdapter);
- assertEquals(((SimpleEntity)epv2Adapter.getObject()).getName(), ((SimpleEntity)retrievedAdapter.getObject()).getName());
- assertEquals(epv2Adapter.getOid(), retrievedAdapter.getOid());
- }
-
- @Test
- public void getInstances_whenDoesNotExist() throws Exception {
- final List<ObjectAdapter> retrievedAdapters = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, epv2Adapter.titleString()));
- assertEquals(0, retrievedAdapters.size());
- }
-
- @Test
- public void getInstances_findByTitle() throws Exception {
- // given
- iswf.persist(iswf.fixtures.smpl2);
- iswf.bounceSystem();
-
- // when
- final List<ObjectAdapter> retrievedAdapters = getStore().loadInstancesAndAdapt(new PersistenceQueryFindByTitle(epvSpecification, epv2Adapter.titleString()));
-
- // then
- assertEquals(1, retrievedAdapters.size());
- final ObjectAdapter retrievedAdapter = retrievedAdapters.get(0);
-
- assertNotSame(epv2Adapter, retrievedAdapter);
- assertEquals(((SimpleEntity)epv2Adapter.getObject()).getName(), ((SimpleEntity)retrievedAdapter.getObject()).getName());
- assertEquals(epv2Adapter.getOid(), retrievedAdapter.getOid());
- }
-
- @Test
- public void getInstances_findAll() throws Exception {
- // given
- iswf.persist(iswf.fixtures.smpl2);
- iswf.bounceSystem();
-
- // when
- final List<ObjectAdapter> retrievedAdapters = getStore().loadInstancesAndAdapt(new PersistenceQueryFindAllInstances(epvSpecification));
-
- // then
- assertEquals(1, retrievedAdapters.size());
- final ObjectAdapter retrievedAdapter = retrievedAdapters.get(0);
-
- assertNotSame(epv2Adapter, retrievedAdapter);
- assertEquals(((SimpleEntity)epv2Adapter.getObject()).getName(), ((SimpleEntity)retrievedAdapter.getObject()).getName());
- assertEquals(epv2Adapter.getOid(), retrievedAdapter.getOid());
- }
-
- @Test
- public void hasInstances_whenEmpty() throws Exception {
- assertEquals(false, getStore().hasInstances(epvSpecification));
- }
-
- @Test
- public void hasInstances_whenHasSome() throws Exception {
- iswf.persist(iswf.fixtures.smpl2);
- iswf.bounceSystem();
-
- assertEquals(true, getStore().hasInstances(epvSpecification));
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_serviceRegistry.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_serviceRegistry.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_serviceRegistry.java
deleted file mode 100644
index e88684f..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/objectstores/dflt/InMemoryObjectStoreTest_serviceRegistry.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.dflt;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-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.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.ParentEntityRepository;
-import org.apache.isis.tck.dom.refs.SimpleEntity;
-
-public class InMemoryObjectStoreTest_serviceRegistry {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- protected ObjectAdapter epv2Adapter;
- protected ObjectSpecification epvSpecification;
-
- protected InMemoryObjectStore getStore() {
- return (InMemoryObjectStore) IsisContext.getPersistenceSession().getObjectStore();
- }
-
- @Before
- public void setUpFixtures() throws Exception {
- epv2Adapter = iswf.adapterFor(iswf.fixtures.smpl2);
- epvSpecification = iswf.loadSpecification(SimpleEntity.class);
- }
-
- @Test
- public void getOidForServices() throws Exception {
- final Oid oidForService = getStore().getOidForService(iswf.loadSpecification(ParentEntityRepository.class));
- assertEquals(RootOidDefault.create(ObjectSpecId.of("ParentEntities"), "1"), oidForService);
- }
-
-
-// @Test
-// public void registerService_canBeRetrieved() throws Exception {
-// registerService14();
-//
-// final Oid oidForService = store.getOidForService(serviceSpecification);
-// assertEquals(oid14, oidForService);
-// }
-//
-// @Test
-// public void testCantRegisterServiceMoreThanOnce() throws Exception {
-// registerService14();
-// try {
-// registerService14();
-// fail();
-// } catch (final IsisException expected) {
-// }
-// }
-//
-// @Test
-// public void testCanRegisterMoreThanOneService() throws Exception {
-// registerService14();
-// registerService15();
-// }
-//
-//
-// private void resetIdentityMap() {
-// IsisContext.getPersistenceSession().testReset();
-// }
-//
-// protected void addObjectToStore(final ObjectAdapter object) {
-// final PersistenceCommand command = store.createCreateObjectCommand(object);
-// assertEquals(object, command.onObject());
-// store.execute(Collections.<PersistenceCommand> singletonList(command));
-// }
-//
-// private RootOidDefault registerService14() {
-// return oid14 = registerService(""+14);
-// }
-//
-// private RootOidDefault registerService15() {
-// return registerService(""+15);
-// }
-//
-// private RootOidDefault registerService(final String id) {
-// final RootOidDefault oid = RootOidDefault.createPersistent("SVC", id);
-// store.registerService(oid);
-// resetIdentityMap();
-// return oid;
-// }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureFilePersistorTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureFilePersistorTest.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureFilePersistorTest.java
deleted file mode 100644
index e836775..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureFilePersistorTest.java
+++ /dev/null
@@ -1,210 +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.runtime.fixturedomainservice;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.*;
-import static org.junit.Assume.assumeThat;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.text.SimpleDateFormat;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Set;
-import java.util.TimeZone;
-
-import junit.framework.Assert;
-
-import com.google.common.collect.Sets;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.config.IsisConfigurationDefault;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.ParentEntity;
-import org.apache.isis.tck.dom.refs.ReferencingEntity;
-import org.apache.isis.tck.dom.refs.SimpleEntity;
-
-public class ObjectFixtureFilePersistorTest {
-
- private static final String DATEFORMAT_PATTERN = "dd-MMM-yyyy HH:mm z";
-
- private static final SimpleDateFormat dateFormat = new SimpleDateFormat(DATEFORMAT_PATTERN);
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder()
- .with(configuration()).build();
-
- private static IsisConfiguration configuration() {
- final IsisConfigurationDefault config = new IsisConfigurationDefault();
- config.add("isis.value.format.datetime", DATEFORMAT_PATTERN);
- return config;
- }
-
- private ObjectFixtureFilePersistor persistor;
-
- @Before
- public void setup() throws Exception {
- Logger.getRootLogger().setLevel(Level.OFF);
-
- Locale.setDefault(Locale.UK);
-
- persistor = new ObjectFixtureFilePersistor();
-
- iswf.fixtures.smpl1.setName("Fred Smith");
- iswf.fixtures.smpl1.setDate(dateFormat.parse("08-Mar-2010 01:00 UTC"));
-
- iswf.fixtures.smpl2.setName("Joe Bloggs");
- iswf.fixtures.smpl2.setDate(dateFormat.parse("09-Apr-2011 02:10 UTC"));
-
- assumeThat(TimeZone.getDefault().getDisplayName(), is("Greenwich Mean Time"));
- }
-
-
- @Test
- public void loadInstance() throws Exception {
-
- final StringReader reader = new StringReader(SimpleEntity.class.getName() + "#1\n name: Fred Smith\n date: 08-Mar-2010 01:00 UTC");
- final Set<Object> objects = persistor.loadData(reader);
-
- assertEquals(1, objects.size());
- final Object object = objects.toArray()[0];
- assertThat(object instanceof SimpleEntity, is(true));
- final SimpleEntity epv = (SimpleEntity) object;
- assertEquals("Fred Smith", epv.getName());
-
- assertEquals(dateFormat.parse("08-Mar-2010 01:00 GMT"), epv.getDate());
- }
-
- @Test
- public void invalidFieldLine() throws Exception {
- try {
- final StringReader reader = new StringReader(SimpleEntity.class.getName() + "#1\n name Fred Smith");
- persistor.loadData(reader);
- Assert.fail();
- } catch (final FixtureException e) {
- Assert.assertEquals("failed to load data at line 2", e.getMessage());
- Assert.assertEquals("no colon (:) in: name Fred Smith", e.getCause().getMessage());
- }
- }
-
- @Test
- public void oldFieldNameSkipped() throws Exception {
- final StringReader reader = new StringReader(SimpleEntity.class.getName() + "#1\n xname: Fred Smith");
- final Set<Object> objects = persistor.loadData(reader);
- final Object object = objects.toArray()[0];
- Assert.assertNull(((SimpleEntity) object).getName());
-
- }
-
- @Test
- public void saveNoObjects() throws Exception {
- // Person person = new Person();
- final Set<Object> objects = new HashSet<Object>();
- final StringWriter out = new StringWriter();
- persistor.save(objects, out);
- Assert.assertEquals("", out.toString());
- }
-
- @Test
- public void saveOneObject() throws Exception {
- final Set<Object> objects = Sets.newLinkedHashSet();
- objects.add(iswf.fixtures.smpl1);
-
- final StringWriter out = new StringWriter();
- persistor.save(objects, out);
- final String actual = out.toString().replaceAll("\r\n", "\n");
-
- final String expected = SimpleEntity.class.getName() + "#2\n date: 08-Mar-2010 01:00 UTC\n name: Fred Smith\n";
-
- assertThat(actual, IsisMatchers.startsWith(expected));
- }
-
- @Test
- public void saveTwoObjects() throws Exception {
- final Set<Object> objects = Sets.newLinkedHashSet();
- objects.add(iswf.fixtures.smpl1);
- objects.add(iswf.fixtures.smpl3);
-
- final StringWriter out = new StringWriter();
- persistor.save(objects, out);
- final String actual = out.toString().replaceAll("\r\n", "\n");
-
- final String expected1 = SimpleEntity.class.getName() + "#2\n date: 08-Mar-2010 01:00 UTC\n name: Fred Smith\n";
- final String expected2 = SimpleEntity.class.getName() + "#3\n date: \n name: \n";
- assertThat(actual, IsisMatchers.contains(expected1));
- assertThat(actual, IsisMatchers.contains(expected2));
- }
-
- @Test
- public void saveReferencedObject() throws Exception {
-
- final Set<Object> objects = Sets.newLinkedHashSet();
-
- iswf.fixtures.rfcg1.setReference(iswf.fixtures.smpl1);
- objects.add(iswf.fixtures.rfcg1);
- objects.add(iswf.fixtures.smpl1);
-
- final StringWriter out = new StringWriter();
- persistor.save(objects, out);
- final String actual = out.toString().replaceAll("\r\n", "\n");
-
- final String expected1 = ReferencingEntity.class.getName() + "#2\n aggregatedEntities: \n aggregatedReference: \n reference: " + SimpleEntity.class.getName() + "#3";
- final String expected2 = SimpleEntity.class.getName() + "#3\n date: 08-Mar-2010 01:00 UTC\n name: Fred Smith\n";
- assertThat(actual, IsisMatchers.contains(expected1));
- assertThat(actual, IsisMatchers.contains(expected2));
- }
-
-
- @Test
- public void saveObjectAndAssociatedCollection() throws Exception {
-
- final Set<Object> objects = Sets.newLinkedHashSet();
-
- iswf.fixtures.prnt1.getHomogeneousCollection().add(iswf.fixtures.smpl1);
- iswf.fixtures.prnt1.getHomogeneousCollection().add(iswf.fixtures.smpl2);
- objects.add(iswf.fixtures.prnt1);
-
- objects.add(iswf.fixtures.smpl1);
- objects.add(iswf.fixtures.smpl2);
-
- final StringWriter out = new StringWriter();
- persistor.save(objects, out);
- final String actual = out.toString().replaceAll("\r\n", "\n");
-
- final String expected1a = ParentEntity.class.getName() + "#2\n";
- final String expected1b = "heterogeneousCollection: \n homogeneousCollection: " + SimpleEntity.class.getName() + "#3 " + SimpleEntity.class.getName() + "#4 " + "\n";
- final String expected2 = SimpleEntity.class.getName() + "#3\n date: 08-Mar-2010 01:00 UTC\n name: Fred Smith\n";
- final String expected3 = SimpleEntity.class.getName() + "#4\n date: 09-Apr-2011 02:10 UTC\n name: Joe Bloggs\n";
- assertThat(actual.replaceAll("\n", "###"), IsisMatchers.contains(expected1a.replaceAll("\n", "###")));
- assertThat(actual.replaceAll("\n", "###"), IsisMatchers.contains(expected1b.replaceAll("\n", "###")));
- assertThat(actual, IsisMatchers.contains(expected2));
- assertThat(actual, IsisMatchers.contains(expected3));
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_loadFile.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_loadFile.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_loadFile.java
deleted file mode 100644
index efcef62..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_loadFile.java
+++ /dev/null
@@ -1,87 +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.runtime.fixturedomainservice;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Date;
-import java.util.Locale;
-import java.util.Set;
-
-import junit.framework.Assert;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.commons.config.ConfigurationConstants;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.config.IsisConfigurationDefault;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.movies.Person;
-import org.apache.isis.tck.dom.refs.SimpleEntity;
-
-public class ObjectFixtureServiceTest_loadFile {
-
- private static IsisConfiguration configuration() {
- IsisConfigurationDefault configuration = new IsisConfigurationDefault();
- configuration.add(ConfigurationConstants.ROOT + "exploration-objects.file", "test.data");
- return configuration;
- }
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().with(configuration()).build();
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- private ObjectFixtureService service;
-
-
- @Before
- public void setup() {
- Logger.getRootLogger().setLevel(Level.OFF);
- Locale.setDefault(Locale.UK);
-
- service = new ObjectFixtureService();
- }
-
-
- @Test
- public void loadFile() throws Exception {
-
- // when
- service.loadFile();
-
- // then
- final Set<Object> objects = service.allSavedObjects();
- Assert.assertEquals(1, objects.size());
- final Object object = objects.toArray()[0];
- assertThat(object instanceof SimpleEntity, is(true));
- Assert.assertEquals("Fred Smith", ((SimpleEntity) object).getName());
- Assert.assertEquals(new Date(110, 2, 8, 13, 32), ((SimpleEntity) object).getDate());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_loadFile_nothingExists.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_loadFile_nothingExists.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_loadFile_nothingExists.java
deleted file mode 100644
index 84208b5..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_loadFile_nothingExists.java
+++ /dev/null
@@ -1,71 +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.runtime.fixturedomainservice;
-
-import java.io.File;
-import java.util.Locale;
-import java.util.Set;
-
-import junit.framework.Assert;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-
-public class ObjectFixtureServiceTest_loadFile_nothingExists {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- private ObjectFixtureService service;
-
-
- @Before
- public void setup() {
- Logger.getRootLogger().setLevel(Level.OFF);
- Locale.setDefault(Locale.UK);
-
- service = new ObjectFixtureService();
- deleteFixtureData();
- }
-
-
- private static void deleteFixtureData() {
- new File("fixture-data").delete();
- }
-
- @Test
- public void loadNothingIfNoFileExists() throws Exception {
- service.loadFile();
-
- final Set<Object> objects = service.allSavedObjects();
- Assert.assertEquals(0, objects.size());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_save.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_save.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_save.java
deleted file mode 100644
index b662ad9..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureServiceTest_save.java
+++ /dev/null
@@ -1,82 +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.runtime.fixturedomainservice;
-
-import java.io.File;
-import java.util.Date;
-import java.util.Locale;
-import java.util.Set;
-
-import junit.framework.Assert;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.ParentEntity;
-import org.apache.isis.tck.dom.refs.SimpleEntity;
-
-public class ObjectFixtureServiceTest_save {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- private ObjectFixtureService service;
-
-
- @Before
- public void setup() {
- Logger.getRootLogger().setLevel(Level.OFF);
- Locale.setDefault(Locale.UK);
-
- service = new ObjectFixtureService();
- deleteFixtureData();
- }
-
-
- private static void deleteFixtureData() {
- new File("fixture-data").delete();
- }
-
-
- @Test
- public void saveObjectAddedToList() throws Exception {
-
- final SimpleEntity epv = iswf.fixtures.smpl1;
- epv.setName("Fred Smith");
- epv.setDate(new Date(110, 2, 8, 13, 32));
-
- final ParentEntity epc = iswf.fixtures.prnt1;
- epc.getHomogeneousCollection().add(iswf.fixtures.smpl1);
- epc.getHomogeneousCollection().add(iswf.fixtures.smpl2);
- service.save(epc);
-
- final Set<Object> savedObjects = service.allSavedObjects();
- Assert.assertEquals(3, savedObjects.size());
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/memento/MementoTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/memento/MementoTest.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/memento/MementoTest.java
deleted file mode 100644
index 9bff553..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/memento/MementoTest.java
+++ /dev/null
@@ -1,218 +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.runtime.memento;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.log4j.Appender;
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.commons.encoding.DataInputStreamExtended;
-import org.apache.isis.core.commons.encoding.DataOutputStreamExtended;
-import org.apache.isis.core.commons.encoding.FieldType;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.refs.BaseEntity;
-import org.apache.isis.tck.dom.refs.ParentEntity;
-import org.apache.isis.tck.dom.refs.ReferencingEntity;
-import org.apache.isis.tck.dom.refs.SimpleEntity;
-
-public class MementoTest {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- private ObjectAdapter originalAdapterForEpv1;
- private ObjectAdapter originalAdapterForEpr1;
- private ObjectAdapter originalAdapterForEpc1;
-
- private ObjectAdapter recreatedAdapter;
-
- private Memento mementoForEpv1;
- private Memento mementoForEpr1;
- private Memento mementoForEpc1;
-
- private byte[] bytesForEpv1;
- private byte[] bytesForEpr1;
- private byte[] bytesForEpc1;
-
- private ByteArrayInputStream bais;
-
-
- @Before
- public void setUpSystem() throws Exception {
-
-// final Logger logger = Logger.getLogger(FieldType.class);
-// logger.setLevel(Level.DEBUG);
-// logger.addAppender(new ConsoleAppender());
-// BasicConfigurator.configure();
-
- iswf.fixtures.smpl1.setName("Fred");
- iswf.fixtures.smpl2.setName("Harry");
-
- iswf.fixtures.rfcg1_a1.setName("Tom");
-
- iswf.fixtures.rfcg1.setReference(iswf.fixtures.smpl1);
- iswf.fixtures.rfcg1.setAggregatedReference(iswf.fixtures.rfcg1_a1);
-
- 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);
-
- originalAdapterForEpv1 = iswf.adapterFor(iswf.fixtures.smpl1);
- originalAdapterForEpr1 = iswf.adapterFor(iswf.fixtures.rfcg1);
- originalAdapterForEpc1 = iswf.adapterFor(iswf.fixtures.prnt1);
-
- mementoForEpv1 = new Memento(originalAdapterForEpv1);
- mementoForEpr1 = new Memento(originalAdapterForEpr1);
- mementoForEpc1 = new Memento(originalAdapterForEpc1);
-
- bytesForEpv1 = toBytes(mementoForEpv1);
- bytesForEpr1 = toBytes(mementoForEpr1);
- bytesForEpc1 = toBytes(mementoForEpc1);
-
- iswf.tearDownSystem();
-
-// logger.debug("*************************************");
-
- iswf.setUpSystem();
-
- mementoForEpv1 = fromBytes(bytesForEpv1);
- mementoForEpr1 = fromBytes(bytesForEpr1);
- mementoForEpc1 = fromBytes(bytesForEpc1);
- }
-
-
- private Memento fromBytes(final byte[] bytes) throws IOException {
- bais = new ByteArrayInputStream(bytes);
- DataInputStreamExtended input = new DataInputStreamExtended(bais);
- final Memento recreate = Memento.recreateFrom(input);
- return recreate;
- }
-
-
- private static byte[] toBytes(final Memento memento) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- DataOutputStreamExtended output = new DataOutputStreamExtended(baos);
- memento.encodedData(output);
- return baos.toByteArray();
- }
-
-
- @Test
- public void recreateObject_adaptersAreNotSame() throws Exception {
-
- recreatedAdapter = mementoForEpv1.recreateObject();
-
- assertNotSame(originalAdapterForEpv1, recreatedAdapter);
- }
-
- @Test
- public void recreateObject_getOid_areEquals() throws Exception {
- recreatedAdapter = mementoForEpv1.recreateObject();
-
- assertEquals(originalAdapterForEpv1.getOid(), recreatedAdapter.getOid());
- }
-
- @Test
- public void recreateObject_getSpecification_isSame() throws Exception {
- recreatedAdapter = mementoForEpv1.recreateObject();
-
- final ObjectSpecification specification = originalAdapterForEpv1.getSpecification();
- final ObjectSpecification recreatedSpecification = recreatedAdapter.getSpecification();
- assertSame(specification, recreatedSpecification);
- }
-
- @Test
- public void recreateObject_valuePreserved() throws Exception {
- recreatedAdapter = mementoForEpv1.recreateObject();
- final SimpleEntity recreatedObject = (SimpleEntity)recreatedAdapter.getObject();
- assertEquals("Fred", recreatedObject.getName());
- }
-
- @Test
- public void recreateObject_referencePreserved() throws Exception {
- recreatedAdapter = mementoForEpr1.recreateObject();
- final ReferencingEntity recreatedObject = (ReferencingEntity)recreatedAdapter.getObject();
- final SimpleEntity reference1 = recreatedObject.getReference();
- assertNotNull(reference1);
-
- assertThat("Fred", equalTo(reference1.getName()));
- }
-
- @Test
- public void recreateObject_homogeneousCollectionPreserved() throws Exception {
- recreatedAdapter = mementoForEpc1.recreateObject();
- final ParentEntity recreatedObject = (ParentEntity)recreatedAdapter.getObject();
- final List<SimpleEntity> homogenousCollection = recreatedObject.getHomogeneousCollection();
- assertNotNull(homogenousCollection);
-
- assertThat(homogenousCollection.size(), is(2));
- assertThat(homogenousCollection.get(0).getName(), is("Fred"));
- assertThat(homogenousCollection.get(1).getName(), is("Harry"));
- }
-
- @Test
- public void recreateObject_heterogeneousCollectionPreserved() throws Exception {
- recreatedAdapter = mementoForEpc1.recreateObject();
- final ParentEntity recreatedObject = (ParentEntity)recreatedAdapter.getObject();
- final List<BaseEntity> hetrogenousCollection = recreatedObject.getHeterogeneousCollection();
- assertNotNull(hetrogenousCollection);
-
- assertThat(hetrogenousCollection.size(), is(2));
- final SimpleEntity firstObj = (SimpleEntity)hetrogenousCollection.get(0);
- assertThat(firstObj.getName(), is("Fred"));
-
- final ReferencingEntity secondObj = (ReferencingEntity)hetrogenousCollection.get(1);
- final SimpleEntity reference1 = secondObj.getReference();
- assertThat(reference1.getName(), is("Fred"));
-
- assertSame(firstObj, reference1);
- }
-
- @Test
- public void recreateObject_whenNull() throws Exception {
- final Memento memento = new Memento(null);
- ObjectAdapter returnedAdapter = memento.recreateObject();
- assertNull(returnedAdapter);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/memento/MementoTest_data.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/memento/MementoTest_data.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/memento/MementoTest_data.java
deleted file mode 100644
index a77a685..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/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.runtimes.dflt.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.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-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.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/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/memento/MementoTest_encodedData.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/memento/MementoTest_encodedData.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/memento/MementoTest_encodedData.java
deleted file mode 100644
index 7b30b48..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/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.runtimes.dflt.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.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
-import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-
-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/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistorSessionHydratorTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistorSessionHydratorTest.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistorSessionHydratorTest.java
deleted file mode 100644
index e6042c3..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/PersistorSessionHydratorTest.java
+++ /dev/null
@@ -1,119 +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.runtime.persistence;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.jmock.Expectations;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
-import org.apache.isis.runtimes.dflt.objectstores.dflt.InMemoryPersistenceMechanismInstaller;
-import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures.Fixtures.Initialization;
-import org.apache.isis.tck.dom.refs.ParentEntityRepository;
-import org.apache.isis.tck.dom.refs.SimpleEntity;
-
-public class PersistorSessionHydratorTest {
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- private RootOid epvTransientOid = RootOidDefault.deString("!SMPL:-999", new OidMarshaller());
-
- private IdentifierGenerator mockIdentifierGenerator = context.mock(IdentifierGenerator.class);
- {
- context.checking(new Expectations() {
- {
- allowing(mockIdentifierGenerator).createTransientIdentifierFor(with(equalTo(ObjectSpecId.of("ParentEntities"))), with(an(ParentEntityRepository.class)));
- will(returnValue("1"));
- allowing(mockIdentifierGenerator).createPersistentIdentifierFor(with(equalTo(ObjectSpecId.of("ParentEntities"))), with(an(ParentEntityRepository.class)), with(any(RootOid.class)));
- will(returnValue("1"));
-
- allowing(mockIdentifierGenerator).createTransientIdentifierFor(with(equalTo(ObjectSpecId.of("SMPL"))), with(an(SimpleEntity.class)));
- will(returnValue("-999"));
-
- allowing(mockIdentifierGenerator).createPersistentIdentifierFor(with(equalTo(ObjectSpecId.of("SMPL"))), with(an(SimpleEntity.class)), with(any(RootOid.class)));
- will(returnValue("1"));
- }
- });
- }
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder()
- .with(Initialization.NO_INIT)
- .with(new InMemoryPersistenceMechanismInstaller() {
- public IdentifierGenerator createIdentifierGenerator(IsisConfiguration configuration) {
- return mockIdentifierGenerator;
- };
- })
- .build();
-
-
- @Test
- public void adaptorFor_whenTransient() {
- // given
- iswf.fixtures.smpl1 = iswf.container.newTransientInstance(SimpleEntity.class);
-
- // when
- final ObjectAdapter adapter = iswf.adapterFor(iswf.fixtures.smpl1);
-
- // then
- assertEquals(epvTransientOid, adapter.getOid());
- assertEquals(iswf.fixtures.smpl1, adapter.getObject());
- assertEquals(ResolveState.TRANSIENT, adapter.getResolveState());
- assertEquals(null, adapter.getVersion());
- }
-
- @Test
- public void recreateAdapter_whenPersistent() throws Exception {
-
- // given persisted object
- iswf.fixtures.smpl1 = iswf.container.newTransientInstance(SimpleEntity.class);
- iswf.fixtures.smpl1.setName("Fred");
- iswf.persist(iswf.fixtures.smpl1);
- iswf.tearDownSystem();
- iswf.setUpSystem();
-
- // when
- final RootOidDefault oid = RootOidDefault.deString("SMPL:1", new OidMarshaller());
- final ObjectAdapter adapter = iswf.recreateAdapter(oid);
-
- // then
- assertEquals(oid, adapter.getOid());
- assertEquals(ResolveState.GHOST, adapter.getResolveState());
-
- final SimpleEntity epv = (SimpleEntity)adapter.getObject();
- assertEquals("Fred", epv.getName());
- assertNotNull(adapter.getVersion());
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/RuntimeTestPojo.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/RuntimeTestPojo.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/RuntimeTestPojo.java
deleted file mode 100644
index a6756c3..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/runtime/persistence/RuntimeTestPojo.java
+++ /dev/null
@@ -1,52 +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.runtime.persistence;
-
-public class RuntimeTestPojo {
-
- private static int nextId;
- private final int id = nextId++;
- private final String state = "pojo" + id;
-
- @Override
- public String toString() {
- return "Pojo#" + id;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (other == null) {
- return false;
- }
- if (other == this) {
- return true;
- }
- if (other.getClass() == getClass()) {
- final RuntimeTestPojo otherTestPojo = (RuntimeTestPojo) other;
- return otherTestPojo.state.equals(state);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return state.hashCode();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/testsupport/IsisSystemWithFixturesTest_basicTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/testsupport/IsisSystemWithFixturesTest_basicTest.java b/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/testsupport/IsisSystemWithFixturesTest_basicTest.java
deleted file mode 100644
index 088a981..0000000
--- a/core/integtestsupport/src/test/java/org/apache/isis/runtimes/dflt/testsupport/IsisSystemWithFixturesTest_basicTest.java
+++ /dev/null
@@ -1,45 +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.testsupport;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.tck.dom.scalars.JdkValuedEntity;
-
-public class IsisSystemWithFixturesTest_basicTest {
-
- @Rule
- public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder().build();
-
- @Test
- public void savePojo() throws Exception {
-
- assertThat(iswf.container.allInstances(JdkValuedEntity.class).size(), is(0));
-
- iswf.container.persist(iswf.fixtures.jve1);
-
- assertThat(iswf.container.allInstances(JdkValuedEntity.class).size(), is(1));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/metamodel/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java b/core/metamodel/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java
index 643a1ae..7637cff 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java
@@ -23,7 +23,6 @@ import static org.junit.Assert.*;
import java.util.Iterator;
-import org.jmock.auto.Mock;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
@@ -31,8 +30,9 @@ import org.junit.Test;
import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.commons.config.IsisConfigurationDefault;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+import org.apache.isis.core.unittestsupport.jmock.auto.Mock;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
public class IsisConfigurationDefaultTest_createSubset {
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/AggregatedOidTest_valueSemantics.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/AggregatedOidTest_valueSemantics.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/AggregatedOidTest_valueSemantics.java
index 5157b04..67ff20f 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/AggregatedOidTest_valueSemantics.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/AggregatedOidTest_valueSemantics.java
@@ -23,7 +23,7 @@ import java.util.List;
import org.apache.isis.core.metamodel.adapter.oid.Oid.State;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.testsupport.value.ValueTypeContractTestAbstract;
+import org.apache.isis.core.unittestsupport.value.ValueTypeContractTestAbstract;
public class AggregatedOidTest_valueSemantics extends ValueTypeContractTestAbstract<AggregatedOid> {
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/CollectionOidTest_valueSemantics.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/CollectionOidTest_valueSemantics.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/CollectionOidTest_valueSemantics.java
index 9718cf9..6631167 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/CollectionOidTest_valueSemantics.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/CollectionOidTest_valueSemantics.java
@@ -23,7 +23,7 @@ import java.util.List;
import org.apache.isis.core.metamodel.adapter.oid.Oid.State;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.testsupport.value.ValueTypeContractTestAbstract;
+import org.apache.isis.core.unittestsupport.value.ValueTypeContractTestAbstract;
public class CollectionOidTest_valueSemantics extends ValueTypeContractTestAbstract<CollectionOid> {
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefaultTest_valueSemantics_whenPersistent.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefaultTest_valueSemantics_whenPersistent.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefaultTest_valueSemantics_whenPersistent.java
index 7d544c3..d53fb86 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefaultTest_valueSemantics_whenPersistent.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefaultTest_valueSemantics_whenPersistent.java
@@ -23,7 +23,7 @@ import java.util.List;
import org.apache.isis.core.metamodel.adapter.oid.Oid.State;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.testsupport.value.ValueTypeContractTestAbstract;
+import org.apache.isis.core.unittestsupport.value.ValueTypeContractTestAbstract;
public class RootOidDefaultTest_valueSemantics_whenPersistent extends ValueTypeContractTestAbstract<RootOidDefault> {
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefaultTest_valueSemantics_whenTransient.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefaultTest_valueSemantics_whenTransient.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefaultTest_valueSemantics_whenTransient.java
index 4e50b84..4b5b91a 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefaultTest_valueSemantics_whenTransient.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefaultTest_valueSemantics_whenTransient.java
@@ -23,7 +23,7 @@ import java.util.List;
import org.apache.isis.core.metamodel.adapter.oid.Oid.State;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.testsupport.value.ValueTypeContractTestAbstract;
+import org.apache.isis.core.unittestsupport.value.ValueTypeContractTestAbstract;
public class RootOidDefaultTest_valueSemantics_whenTransient extends ValueTypeContractTestAbstract<RootOidDefault> {
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/VersionTest_valueSemantics.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/VersionTest_valueSemantics.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/VersionTest_valueSemantics.java
index 0f642e5..7eb0d42 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/VersionTest_valueSemantics.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/oid/VersionTest_valueSemantics.java
@@ -23,7 +23,7 @@ import java.util.Date;
import java.util.List;
import org.apache.isis.core.metamodel.adapter.version.Version;
-import org.apache.isis.core.testsupport.value.ValueTypeContractTestAbstract;
+import org.apache.isis.core.unittestsupport.value.ValueTypeContractTestAbstract;
public class VersionTest_valueSemantics extends ValueTypeContractTestAbstract<Version> {
http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/version/VersionTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/version/VersionTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/version/VersionTest.java
index cad2f8d..a73fcd5 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/version/VersionTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/version/VersionTest.java
@@ -22,15 +22,15 @@ package org.apache.isis.core.metamodel.adapter.version;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import org.jmock.auto.Mock;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.apache.isis.core.commons.encoding.DataInputExtended;
import org.apache.isis.core.commons.encoding.DataOutputExtended;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
-import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+import org.apache.isis.core.unittestsupport.jmock.auto.Mock;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
public class VersionTest {