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/08/15 23:15:42 UTC
svn commit: r1373632 [3/5] - in /incubator/isis/trunk/framework:
core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/
core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/oid/
core/metamodel/src/main/java/org/apache/i...
Copied: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_applibValuedEntity.java (from r1372659, incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_applibValuedEntity.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_applibValuedEntity.java?p2=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_applibValuedEntity.java&p1=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_applibValuedEntity.java&r1=1372659&r2=1373632&rev=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_applibValuedEntity.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_applibValuedEntity.java Wed Aug 15 21:15:39 2012
@@ -1,92 +1,92 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.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.applib.value.Date;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.scalars.ApplibValuedEntity;
-import org.apache.isis.tck.dom.scalars.ApplibValuedEntityRepository;
-
-public class Persistence_persistAndUpdate_applibValuedEntity {
-
- private ApplibValuedEntityRepository repo = new ApplibValuedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("APPLIBVALUEDENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwo() throws Exception {
- iswf.beginTran();
- repo.newEntity().setStringProperty("1");
- repo.newEntity().setStringProperty("2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<ApplibValuedEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
- @Test
- public void persist_then_update() throws Exception {
- iswf.beginTran();
-
- ApplibValuedEntity entity = repo.newEntity();
- entity.setStringProperty("1");
-
- Date date = new Date();
- entity.setDateProperty(date);
-
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- entity = repo.list().get(0);
- assertThat(entity.getDateProperty().dateValue(), is(date.dateValue()));
-
- date = date.add(-1, -1, -1);
- entity.setDateProperty(date);
-
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- entity = repo.list().get(0);
- assertThat(entity.getDateProperty().dateValue(), is(date.dateValue()));
-
- iswf.commitTran();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.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.applib.value.Date;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.ApplibValuedEntity;
+import org.apache.isis.tck.dom.scalars.ApplibValuedEntityRepository;
+
+public class Persistence_persistAndUpdate_applibValuedEntity {
+
+ private ApplibValuedEntityRepository repo = new ApplibValuedEntityRepository();
+
+ @Rule
+ public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+ .with(Utils.listenerToDeleteFrom("APPLIBVALUEDENTITY"))
+ .withServices(repo)
+ .build();
+
+ @Test
+ public void persistTwo() throws Exception {
+ iswf.beginTran();
+ repo.newEntity().setStringProperty("1");
+ repo.newEntity().setStringProperty("2");
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ List<ApplibValuedEntity> list = repo.list();
+ assertThat(list.size(), is(2));
+ iswf.commitTran();
+ }
+
+ @Test
+ public void persist_then_update() throws Exception {
+ iswf.beginTran();
+
+ ApplibValuedEntity entity = repo.newEntity();
+ entity.setStringProperty("1");
+
+ Date date = new Date();
+ entity.setDateProperty(date);
+
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ entity = repo.list().get(0);
+ assertThat(entity.getDateProperty().dateValue(), is(date.dateValue()));
+
+ date = date.add(-1, -1, -1);
+ entity.setDateProperty(date);
+
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ entity = repo.list().get(0);
+ assertThat(entity.getDateProperty().dateValue(), is(date.dateValue()));
+
+ iswf.commitTran();
+ }
+
+}
Copied: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_jdkValuedEntity.java (from r1372659, incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_jdkValuedEntity.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_jdkValuedEntity.java?p2=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_jdkValuedEntity.java&p1=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_jdkValuedEntity.java&r1=1372659&r2=1373632&rev=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_jdkValuedEntity.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_jdkValuedEntity.java Wed Aug 15 21:15:39 2012
@@ -1,117 +1,117 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scalar;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.Timestamp;
-import java.util.List;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.scalars.JdkValuedEntity;
-import org.apache.isis.tck.dom.scalars.JdkValuedEntityRepository;
-import org.apache.isis.tck.dom.scalars.MyEnum;
-
-public class Persistence_persistAndUpdate_jdkValuedEntity {
-
- private JdkValuedEntityRepository repo = new JdkValuedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("JDKVALUEDENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwo() throws Exception {
- iswf.beginTran();
- repo.newEntity().setStringProperty("1");
- repo.newEntity().setStringProperty("2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<JdkValuedEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
- @Test
- public void persist_then_update() throws Exception {
- iswf.beginTran();
- JdkValuedEntity entity = repo.newEntity();
- entity.setStringProperty("1");
- entity.setBigDecimalProperty(BigDecimal.valueOf(543210987654321L, 0)); // mssqlserver can cope with scale>0, but hsqldb cannot
- entity.setBigIntegerProperty(BigInteger.valueOf(123456789012345L));
- entity.setJavaSqlDateProperty(new java.sql.Date(Utils.toMillis(2009, 6, 11)));
- entity.setJavaSqlTimeProperty(new java.sql.Time(Utils.toMillis(1970, 1, 1, 0, 5, 10))); // date portion is unimportant, is preserved on mssqlserver but not on hsqldb
- entity.setJavaSqlTimestampProperty(new Timestamp(Utils.toMillis(2010, 5, 13, 20, 25, 30)));
- entity.setJavaUtilDateProperty(new java.util.Date(Utils.toMillis(2010, 5, 13, 22, 17, 12)));
- entity.setMyEnum(MyEnum.GREEN);
-
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- entity = repo.list().get(0);
-
- assertThat(entity.getStringProperty(), is("1"));
- assertThat(entity.getBigDecimalProperty(), is(BigDecimal.valueOf(543210987654321L, 0)));
- assertThat(entity.getBigIntegerProperty(), is(BigInteger.valueOf(123456789012345L)));
- assertThat(entity.getJavaSqlDateProperty(), is(new java.sql.Date(Utils.toMillis(2009, 6, 11))));
- assertThat(entity.getJavaSqlTimeProperty(), is(new java.sql.Time(Utils.toMillis(1970, 1, 1, 0, 5, 10))));
- assertThat(entity.getJavaSqlTimestampProperty(), is(new Timestamp(Utils.toMillis(2010, 5, 13, 20, 25, 30))));
- assertThat(entity.getJavaUtilDateProperty(), is(new java.util.Date(Utils.toMillis(2010, 5, 13, 22, 17, 12))));
- assertThat(entity.getMyEnum(), is(MyEnum.GREEN));
-
-
- entity.setBigDecimalProperty(BigDecimal.valueOf(123456789012345L, 0));
- entity.setBigIntegerProperty(BigInteger.valueOf(543210987654321L));
- entity.setJavaSqlDateProperty(new java.sql.Date(Utils.toMillis(2010, 5, 13)));
- entity.setJavaSqlTimeProperty(new java.sql.Time(Utils.toMillis(1970, 1, 1, 5, 10, 15)));
- entity.setJavaSqlTimestampProperty(new Timestamp(Utils.toMillis(2010, 5, 13, 10, 15, 20)));
- entity.setJavaUtilDateProperty(new java.util.Date(Utils.toMillis(2010, 5, 13, 20, 15, 10)));
- entity.setMyEnum(MyEnum.BLUE);
-
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- entity = repo.list().get(0);
- assertThat(entity.getBigDecimalProperty(), is(BigDecimal.valueOf(123456789012345L, 0)));
- assertThat(entity.getBigIntegerProperty(), is(BigInteger.valueOf(543210987654321L)));
- assertThat(entity.getJavaSqlDateProperty(), is(new java.sql.Date(Utils.toMillis(2010, 5, 13))));
- assertThat(entity.getJavaSqlTimeProperty(), is(new java.sql.Time(Utils.toMillis(1970, 1, 1, 5, 10, 15))));
- assertThat(entity.getJavaSqlTimestampProperty(), is(new Timestamp(Utils.toMillis(2010, 5, 13, 10, 15, 20))));
- assertThat(entity.getJavaUtilDateProperty(), is(new java.util.Date(Utils.toMillis(2010, 5, 13, 20, 15, 10))));
- assertThat(entity.getMyEnum(), is(MyEnum.BLUE));
-
- iswf.commitTran();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.scalar;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.sql.Timestamp;
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.JdkValuedEntity;
+import org.apache.isis.tck.dom.scalars.JdkValuedEntityRepository;
+import org.apache.isis.tck.dom.scalars.MyEnum;
+
+public class Persistence_persistAndUpdate_jdkValuedEntity {
+
+ private JdkValuedEntityRepository repo = new JdkValuedEntityRepository();
+
+ @Rule
+ public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+ .with(Utils.listenerToDeleteFrom("JDKVALUEDENTITY"))
+ .withServices(repo)
+ .build();
+
+ @Test
+ public void persistTwo() throws Exception {
+ iswf.beginTran();
+ repo.newEntity().setStringProperty("1");
+ repo.newEntity().setStringProperty("2");
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ List<JdkValuedEntity> list = repo.list();
+ assertThat(list.size(), is(2));
+ iswf.commitTran();
+ }
+
+ @Test
+ public void persist_then_update() throws Exception {
+ iswf.beginTran();
+ JdkValuedEntity entity = repo.newEntity();
+ entity.setStringProperty("1");
+ entity.setBigDecimalProperty(BigDecimal.valueOf(543210987654321L, 0)); // mssqlserver can cope with scale>0, but hsqldb cannot
+ entity.setBigIntegerProperty(BigInteger.valueOf(123456789012345L));
+ entity.setJavaSqlDateProperty(new java.sql.Date(Utils.toMillis(2009, 6, 11)));
+ entity.setJavaSqlTimeProperty(new java.sql.Time(Utils.toMillis(1970, 1, 1, 0, 5, 10))); // date portion is unimportant, is preserved on mssqlserver but not on hsqldb
+ entity.setJavaSqlTimestampProperty(new Timestamp(Utils.toMillis(2010, 5, 13, 20, 25, 30)));
+ entity.setJavaUtilDateProperty(new java.util.Date(Utils.toMillis(2010, 5, 13, 22, 17, 12)));
+ entity.setMyEnum(MyEnum.GREEN);
+
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ entity = repo.list().get(0);
+
+ assertThat(entity.getStringProperty(), is("1"));
+ assertThat(entity.getBigDecimalProperty(), is(BigDecimal.valueOf(543210987654321L, 0)));
+ assertThat(entity.getBigIntegerProperty(), is(BigInteger.valueOf(123456789012345L)));
+ assertThat(entity.getJavaSqlDateProperty(), is(new java.sql.Date(Utils.toMillis(2009, 6, 11))));
+ assertThat(entity.getJavaSqlTimeProperty(), is(new java.sql.Time(Utils.toMillis(1970, 1, 1, 0, 5, 10))));
+ assertThat(entity.getJavaSqlTimestampProperty(), is(new Timestamp(Utils.toMillis(2010, 5, 13, 20, 25, 30))));
+ assertThat(entity.getJavaUtilDateProperty(), is(new java.util.Date(Utils.toMillis(2010, 5, 13, 22, 17, 12))));
+ assertThat(entity.getMyEnum(), is(MyEnum.GREEN));
+
+
+ entity.setBigDecimalProperty(BigDecimal.valueOf(123456789012345L, 0));
+ entity.setBigIntegerProperty(BigInteger.valueOf(543210987654321L));
+ entity.setJavaSqlDateProperty(new java.sql.Date(Utils.toMillis(2010, 5, 13)));
+ entity.setJavaSqlTimeProperty(new java.sql.Time(Utils.toMillis(1970, 1, 1, 5, 10, 15)));
+ entity.setJavaSqlTimestampProperty(new Timestamp(Utils.toMillis(2010, 5, 13, 10, 15, 20)));
+ entity.setJavaUtilDateProperty(new java.util.Date(Utils.toMillis(2010, 5, 13, 20, 15, 10)));
+ entity.setMyEnum(MyEnum.BLUE);
+
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ entity = repo.list().get(0);
+ assertThat(entity.getBigDecimalProperty(), is(BigDecimal.valueOf(123456789012345L, 0)));
+ assertThat(entity.getBigIntegerProperty(), is(BigInteger.valueOf(543210987654321L)));
+ assertThat(entity.getJavaSqlDateProperty(), is(new java.sql.Date(Utils.toMillis(2010, 5, 13))));
+ assertThat(entity.getJavaSqlTimeProperty(), is(new java.sql.Time(Utils.toMillis(1970, 1, 1, 5, 10, 15))));
+ assertThat(entity.getJavaSqlTimestampProperty(), is(new Timestamp(Utils.toMillis(2010, 5, 13, 10, 15, 20))));
+ assertThat(entity.getJavaUtilDateProperty(), is(new java.util.Date(Utils.toMillis(2010, 5, 13, 20, 15, 10))));
+ assertThat(entity.getMyEnum(), is(MyEnum.BLUE));
+
+ iswf.commitTran();
+ }
+}
Copied: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_objectAdapters.java (from r1372659, incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_objectAdapters.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_objectAdapters.java?p2=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_objectAdapters.java&p1=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_objectAdapters.java&r1=1372659&r2=1373632&rev=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_objectAdapters.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_objectAdapters.java Wed Aug 15 21:15:39 2012
@@ -1,111 +1,111 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scalar;
-
-import static org.hamcrest.CoreMatchers.*;
-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.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntity;
-import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
-
-public class Persistence_persistAndUpdate_objectAdapters {
-
- private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void transient_then_persistent() throws Exception {
-
- iswf.beginTran();
- PrimitiveValuedEntity entity = repo.newEntity();
- ObjectAdapter adapter = iswf.adapterFor(entity);
-
- assertThat(adapter.isTransient(), is(true));
- assertThat(adapter.getResolveState(), is(ResolveState.TRANSIENT));
- assertThat(adapter.getOid().isTransient(), is(true));
-
- entity.setId(1);
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- final List<PrimitiveValuedEntity> list = repo.list();
- assertThat(list.size(), is(1));
-
- adapter = iswf.adapterFor(list.get(0));
- assertThat(adapter.getResolveState(), is(ResolveState.RESOLVED));
- assertThat(adapter.isTransient(), is(false));
- assertThat(adapter.getOid().enString(), is("PRMV:1"));
-
- iswf.commitTran();
- }
-
- @Test
- public void updated_and_retrieved() throws Exception {
-
- // given persisted
- iswf.beginTran();
- PrimitiveValuedEntity entity = repo.newEntity();
- ObjectAdapter adapter = iswf.adapterFor(entity);
-
- entity.setId(1);
- entity.setCharProperty('X');
-
- iswf.commitTran();
-
- // when update
- iswf.bounceSystem();
-
- iswf.beginTran();
- entity = repo.list().get(0);
- entity.setCharProperty('Y');
- iswf.commitTran();
-
- // then adapter's state is resolved
- iswf.bounceSystem();
-
- iswf.beginTran();
- entity = repo.list().get(0);
- assertThat(entity.getCharProperty(), is('Y'));
-
- adapter = iswf.adapterFor(entity);
- assertThat(adapter.getResolveState(), is(ResolveState.RESOLVED));
-
- iswf.commitTran();
-
- }
-
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.scalar;
+
+import static org.hamcrest.CoreMatchers.*;
+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.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ResolveState;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntity;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
+
+public class Persistence_persistAndUpdate_objectAdapters {
+
+ private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
+
+ @Rule
+ public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+ .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
+ .withServices(repo)
+ .build();
+
+ @Test
+ public void transient_then_persistent() throws Exception {
+
+ iswf.beginTran();
+ PrimitiveValuedEntity entity = repo.newEntity();
+ ObjectAdapter adapter = iswf.adapterFor(entity);
+
+ assertThat(adapter.isTransient(), is(true));
+ assertThat(adapter.getResolveState(), is(ResolveState.TRANSIENT));
+ assertThat(adapter.getOid().isTransient(), is(true));
+
+ entity.setId(1);
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ final List<PrimitiveValuedEntity> list = repo.list();
+ assertThat(list.size(), is(1));
+
+ adapter = iswf.adapterFor(list.get(0));
+ assertThat(adapter.getResolveState(), is(ResolveState.RESOLVED));
+ assertThat(adapter.isTransient(), is(false));
+ assertThat(adapter.getOid().enString(), is("PRMV:i~1"));
+
+ iswf.commitTran();
+ }
+
+ @Test
+ public void updated_and_retrieved() throws Exception {
+
+ // given persisted
+ iswf.beginTran();
+ PrimitiveValuedEntity entity = repo.newEntity();
+ ObjectAdapter adapter = iswf.adapterFor(entity);
+
+ entity.setId(1);
+ entity.setCharProperty('X');
+
+ iswf.commitTran();
+
+ // when update
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ entity = repo.list().get(0);
+ entity.setCharProperty('Y');
+ iswf.commitTran();
+
+ // then adapter's state is resolved
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ entity = repo.list().get(0);
+ assertThat(entity.getCharProperty(), is('Y'));
+
+ adapter = iswf.adapterFor(entity);
+ assertThat(adapter.getResolveState(), is(ResolveState.RESOLVED));
+
+ iswf.commitTran();
+
+ }
+
+
+}
Copied: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_primitiveValuedEntity.java (from r1372659, incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_primitiveValuedEntity.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_primitiveValuedEntity.java?p2=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_primitiveValuedEntity.java&p1=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_primitiveValuedEntity.java&r1=1372659&r2=1373632&rev=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_primitiveValuedEntity.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_primitiveValuedEntity.java Wed Aug 15 21:15:39 2012
@@ -1,119 +1,119 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.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.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntity;
-import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
-
-public class Persistence_persistAndUpdate_primitiveValuedEntity {
-
- private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwo() 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();
- }
-
- @Test
- public void persist_then_update() throws Exception {
-
- iswf.beginTran();
- PrimitiveValuedEntity entity = repo.newEntity();
- entity.setId(1);
-
- entity.setBooleanProperty(false);
- entity.setByteProperty((byte)456);
- entity.setDoubleProperty(123456789876.0);
- entity.setFloatProperty(654321.0f);
- entity.setIntProperty(765);
- entity.setLongProperty(7654321012345L);
- entity.setShortProperty((short)543);
- entity.setCharProperty('A');
-
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- entity = repo.list().get(0);
-
- assertThat(entity.getBooleanProperty(), is(false));
- assertThat(entity.getByteProperty(), is((byte)456));
- assertThat(entity.getDoubleProperty(), is(123456789876.0));
- assertThat(entity.getFloatProperty(), is(654321.0f));
- assertThat(entity.getIntProperty(), is(765));
- assertThat(entity.getLongProperty(), is(7654321012345L));
- assertThat(entity.getShortProperty(), is((short)543));
- assertThat(entity.getCharProperty(), is('A'));
-
-
- entity.setBooleanProperty(true);
- entity.setByteProperty((byte)123);
- entity.setDoubleProperty(9876543210987.0);
- entity.setFloatProperty(123456.0f);
- entity.setIntProperty(456);
- entity.setLongProperty(12345678901L);
- entity.setShortProperty((short)4567);
- entity.setCharProperty('X');
-
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- entity = repo.list().get(0);
-
- assertThat(entity.getBooleanProperty(), is(true));
- assertThat(entity.getByteProperty(), is((byte)123));
- assertThat(entity.getDoubleProperty(), is(9876543210987.0));
- assertThat(entity.getFloatProperty(), is(123456.0f));
- assertThat(entity.getIntProperty(), is(456));
- assertThat(entity.getLongProperty(), is(12345678901L));
- assertThat(entity.getShortProperty(), is((short)4567));
- assertThat(entity.getCharProperty(), is('X'));
-
- iswf.commitTran();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.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.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntity;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
+
+public class Persistence_persistAndUpdate_primitiveValuedEntity {
+
+ private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
+
+ @Rule
+ public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+ .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
+ .withServices(repo)
+ .build();
+
+ @Test
+ public void persistTwo() 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();
+ }
+
+ @Test
+ public void persist_then_update() throws Exception {
+
+ iswf.beginTran();
+ PrimitiveValuedEntity entity = repo.newEntity();
+ entity.setId(1);
+
+ entity.setBooleanProperty(false);
+ entity.setByteProperty((byte)456);
+ entity.setDoubleProperty(123456789876.0);
+ entity.setFloatProperty(654321.0f);
+ entity.setIntProperty(765);
+ entity.setLongProperty(7654321012345L);
+ entity.setShortProperty((short)543);
+ entity.setCharProperty('A');
+
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ entity = repo.list().get(0);
+
+ assertThat(entity.getBooleanProperty(), is(false));
+ assertThat(entity.getByteProperty(), is((byte)456));
+ assertThat(entity.getDoubleProperty(), is(123456789876.0));
+ assertThat(entity.getFloatProperty(), is(654321.0f));
+ assertThat(entity.getIntProperty(), is(765));
+ assertThat(entity.getLongProperty(), is(7654321012345L));
+ assertThat(entity.getShortProperty(), is((short)543));
+ assertThat(entity.getCharProperty(), is('A'));
+
+
+ entity.setBooleanProperty(true);
+ entity.setByteProperty((byte)123);
+ entity.setDoubleProperty(9876543210987.0);
+ entity.setFloatProperty(123456.0f);
+ entity.setIntProperty(456);
+ entity.setLongProperty(12345678901L);
+ entity.setShortProperty((short)4567);
+ entity.setCharProperty('X');
+
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ entity = repo.list().get(0);
+
+ assertThat(entity.getBooleanProperty(), is(true));
+ assertThat(entity.getByteProperty(), is((byte)123));
+ assertThat(entity.getDoubleProperty(), is(9876543210987.0));
+ assertThat(entity.getFloatProperty(), is(123456.0f));
+ assertThat(entity.getIntProperty(), is(456));
+ assertThat(entity.getLongProperty(), is(12345678901L));
+ assertThat(entity.getShortProperty(), is((short)4567));
+ assertThat(entity.getCharProperty(), is('X'));
+
+ iswf.commitTran();
+ }
+}
Copied: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_wrapperValuedEntity.java (from r1372659, incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_wrapperValuedEntity.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_wrapperValuedEntity.java?p2=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_wrapperValuedEntity.java&p1=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_wrapperValuedEntity.java&r1=1372659&r2=1373632&rev=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persistAndUpdate_wrapperValuedEntity.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_wrapperValuedEntity.java Wed Aug 15 21:15:39 2012
@@ -1,122 +1,122 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.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.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntity;
-import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
-import org.apache.isis.tck.dom.scalars.WrapperValuedEntity;
-import org.apache.isis.tck.dom.scalars.WrapperValuedEntityRepository;
-
-public class Persistence_persistAndUpdate_wrapperValuedEntity {
-
- private WrapperValuedEntityRepository repo = new WrapperValuedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("WRAPPERVALUEDENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwo() throws Exception {
- iswf.beginTran();
- repo.newEntity().setStringProperty("1");
- repo.newEntity().setStringProperty("2");
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<WrapperValuedEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
-
- @Test
- public void persist_then_update() throws Exception {
- iswf.beginTran();
- WrapperValuedEntity entity = repo.newEntity();
- entity.setStringProperty("1");
- entity.setBooleanProperty(false);
- entity.setByteProperty((byte)321);
- entity.setDoubleProperty(123456768723429.0);
- entity.setFloatProperty(654321.0f);
- entity.setIntegerProperty(543);
- entity.setLongProperty(90876512345L);
- entity.setShortProperty((short)7654);
- entity.setCharacterProperty('A');
-
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- entity = repo.list().get(0);
- assertThat(entity.getStringProperty(), is("1"));
- assertThat(entity.getBooleanProperty(), is(false));
- assertThat(entity.getByteProperty(), is((byte)321));
- assertThat(entity.getDoubleProperty(), is(123456768723429.0));
- assertThat(entity.getFloatProperty(), is(654321.0f));
- assertThat(entity.getIntegerProperty(), is(543));
- assertThat(entity.getLongProperty(), is(90876512345L));
- assertThat(entity.getShortProperty(), is((short)7654));
- assertThat(entity.getCharacterProperty(), is('A'));
-
-
- entity.setBooleanProperty(true);
- entity.setByteProperty((byte)123);
- entity.setDoubleProperty(9876543210987.0);
- entity.setFloatProperty(123456.0f);
- entity.setIntegerProperty(456);
- entity.setLongProperty(12345678901L);
- entity.setShortProperty((short)4567);
- entity.setCharacterProperty('X');
-
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- entity = repo.list().get(0);
- assertThat(entity.getBooleanProperty(), is(true));
- assertThat(entity.getByteProperty(), is((byte)123));
- assertThat(entity.getDoubleProperty(), is(9876543210987.0));
- assertThat(entity.getFloatProperty(), is(123456.0f));
- assertThat(entity.getIntegerProperty(), is(456));
- assertThat(entity.getLongProperty(), is(12345678901L));
- assertThat(entity.getShortProperty(), is((short)4567));
- assertThat(entity.getCharacterProperty(), is('X'));
-
- iswf.commitTran();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.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.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ResolveState;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntity;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
+import org.apache.isis.tck.dom.scalars.WrapperValuedEntity;
+import org.apache.isis.tck.dom.scalars.WrapperValuedEntityRepository;
+
+public class Persistence_persistAndUpdate_wrapperValuedEntity {
+
+ private WrapperValuedEntityRepository repo = new WrapperValuedEntityRepository();
+
+ @Rule
+ public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+ .with(Utils.listenerToDeleteFrom("WRAPPERVALUEDENTITY"))
+ .withServices(repo)
+ .build();
+
+ @Test
+ public void persistTwo() throws Exception {
+ iswf.beginTran();
+ repo.newEntity().setStringProperty("1");
+ repo.newEntity().setStringProperty("2");
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ List<WrapperValuedEntity> list = repo.list();
+ assertThat(list.size(), is(2));
+ iswf.commitTran();
+ }
+
+
+ @Test
+ public void persist_then_update() throws Exception {
+ iswf.beginTran();
+ WrapperValuedEntity entity = repo.newEntity();
+ entity.setStringProperty("1");
+ entity.setBooleanProperty(false);
+ entity.setByteProperty((byte)321);
+ entity.setDoubleProperty(123456768723429.0);
+ entity.setFloatProperty(654321.0f);
+ entity.setIntegerProperty(543);
+ entity.setLongProperty(90876512345L);
+ entity.setShortProperty((short)7654);
+ entity.setCharacterProperty('A');
+
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ entity = repo.list().get(0);
+ assertThat(entity.getStringProperty(), is("1"));
+ assertThat(entity.getBooleanProperty(), is(false));
+ assertThat(entity.getByteProperty(), is((byte)321));
+ assertThat(entity.getDoubleProperty(), is(123456768723429.0));
+ assertThat(entity.getFloatProperty(), is(654321.0f));
+ assertThat(entity.getIntegerProperty(), is(543));
+ assertThat(entity.getLongProperty(), is(90876512345L));
+ assertThat(entity.getShortProperty(), is((short)7654));
+ assertThat(entity.getCharacterProperty(), is('A'));
+
+
+ entity.setBooleanProperty(true);
+ entity.setByteProperty((byte)123);
+ entity.setDoubleProperty(9876543210987.0);
+ entity.setFloatProperty(123456.0f);
+ entity.setIntegerProperty(456);
+ entity.setLongProperty(12345678901L);
+ entity.setShortProperty((short)4567);
+ entity.setCharacterProperty('X');
+
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ entity = repo.list().get(0);
+ assertThat(entity.getBooleanProperty(), is(true));
+ assertThat(entity.getByteProperty(), is((byte)123));
+ assertThat(entity.getDoubleProperty(), is(9876543210987.0));
+ assertThat(entity.getFloatProperty(), is(123456.0f));
+ assertThat(entity.getIntegerProperty(), is(456));
+ assertThat(entity.getLongProperty(), is(12345678901L));
+ assertThat(entity.getShortProperty(), is((short)4567));
+ assertThat(entity.getCharacterProperty(), is('X'));
+
+ iswf.commitTran();
+ }
+
+}
Copied: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java (from r1372659, incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java?p2=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java&p1=incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java&r1=1372659&r2=1373632&rev=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persist_dataStoreAssignedPrimaryKey.java Wed Aug 15 21:15:39 2012
@@ -1,59 +1,59 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.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.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
-import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
-import org.apache.isis.tck.dom.scalars.AutoAssignedEntity;
-import org.apache.isis.tck.dom.scalars.AutoAssignedEntityRepository;
-
-public class Persistence_persist_dataStoreAssignedPrimaryKey {
-
- private AutoAssignedEntityRepository repo = new AutoAssignedEntityRepository();
-
- @Rule
- public IsisSystemWithFixtures iswf = Utils.systemBuilder()
- .with(Utils.listenerToDeleteFrom("AUTOASSIGNEDENTITY"))
- .withServices(repo)
- .build();
-
- @Test
- public void persistTwo() throws Exception {
- iswf.beginTran();
- repo.newEntity();
- repo.newEntity();
- iswf.commitTran();
-
- iswf.bounceSystem();
-
- iswf.beginTran();
- List<AutoAssignedEntity> list = repo.list();
- assertThat(list.size(), is(2));
- iswf.commitTran();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.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.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.AutoAssignedEntity;
+import org.apache.isis.tck.dom.scalars.AutoAssignedEntityRepository;
+
+public class Persistence_persist_dataStoreAssignedPrimaryKey {
+
+ private AutoAssignedEntityRepository repo = new AutoAssignedEntityRepository();
+
+ @Rule
+ public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+ .with(Utils.listenerToDeleteFrom("AUTOASSIGNEDENTITY"))
+ .withServices(repo)
+ .build();
+
+ @Test
+ public void persistTwo() throws Exception {
+ iswf.beginTran();
+ repo.newEntity();
+ repo.newEntity();
+ iswf.commitTran();
+
+ iswf.bounceSystem();
+
+ iswf.beginTran();
+ List<AutoAssignedEntity> list = repo.list();
+ assertThat(list.size(), is(2));
+ iswf.commitTran();
+ }
+
+}
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/ObjectReader.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/ObjectReader.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/ObjectReader.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/main/java/org/apache/isis/runtimes/dflt/objectstores/nosql/ObjectReader.java Wed Aug 15 21:15:39 2012
@@ -47,6 +47,7 @@ import org.apache.isis.runtimes.dflt.obj
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.runtime.system.persistence.Persistor;
public class ObjectReader {
@@ -226,32 +227,22 @@ public class ObjectReader {
}
protected ObjectAdapter getAdapter(final TypedOid oid) {
- return getPersistenceSession().recreatePersistentAdapter(oid);
+ return getAdapterManager().adapterFor(oid);
}
- // replaced with getAdapter(TypedOid) above
-// protected ObjectAdapter getAdapter(final ObjectSpecification specification, final Oid oid) {
-// final AdapterManager objectLoader = getPersistenceSession().getAdapterManager();
-// final ObjectAdapter adapter = objectLoader.getAdapterFor(oid);
-// if (adapter != null) {
-// return adapter;
-// }
-// return getPersistenceSession().recreateAdapter(specification, oid);
-// }
-
- protected ObjectAdapter getAdapter(final RootOid oid) {
- return getPersistenceSession().recreatePersistentAdapter(oid);
+
+ ////////////////////////////////////////////////////////////////////////////
+ // from context
+ ////////////////////////////////////////////////////////////////////////////
+
+ protected Persistor getPersistenceSession() {
+ return IsisContext.getPersistenceSession();
}
-
protected AdapterManager getAdapterManager() {
return getPersistenceSession().getAdapterManager();
}
- protected PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
protected SpecificationLoaderSpi getSpecificationLoader() {
return IsisContext.getSpecificationLoader();
}
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/test/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/mongo/ObjectReaderMongoIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/test/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/mongo/ObjectReaderMongoIntegrationTest.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/test/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/mongo/ObjectReaderMongoIntegrationTest.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/nosql/src/test/java/org/apache/isis/runtimes/dflt/objectstores/nosql/db/mongo/ObjectReaderMongoIntegrationTest.java Wed Aug 15 21:15:39 2012
@@ -242,10 +242,7 @@ public class ObjectReaderMongoIntegratio
}
});
- final ObjectSpecification spec = getSpecificationLoader().loadSpecification(SimpleEntity.class);
-
- final Object recreatedPojo = spec.createObject();
- final ObjectAdapter readObject = getPersistenceSession().mapRecreatedPojo(RootOidDefault.create(ObjectSpecId.of("EVP"), ""+4), recreatedPojo);
+ final ObjectAdapter readObject = getAdapterManager().adapterFor(RootOidDefault.create(ObjectSpecId.of("SMPL"), ""+4));
objectReader.update(reader1, versionCreator, dataEncrypter, readObject);
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/IdMappingAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/IdMappingAbstract.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/IdMappingAbstract.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/IdMappingAbstract.java Wed Aug 15 21:15:39 2012
@@ -95,6 +95,8 @@ public class IdMappingAbstract {
if (adapter != null) {
return adapter;
}
+ // REVIEW: where the oid is a TypedOid, the following two lines could be replaced by getPersistenceSession().recreatePersistentAdapter(oid)
+ // is preferable, since then reuses the PojoRecreator impl defined within SqlPersistorInstaller
final Object recreatedPojo = spec.createObject();
return getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
}
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/sql/sql-impl/src/main/java/org/apache/isis/runtimes/dflt/objectstores/sql/auto/AbstractAutoMapper.java Wed Aug 15 21:15:39 2012
@@ -303,6 +303,9 @@ public abstract class AbstractAutoMapper
if (adapter != null) {
return adapter;
}
+
+ // REVIEW: where the oid is a TypedOid, the following two lines could be replaced by getPersistenceSession().recreatePersistentAdapter(oid)
+ // is preferable, since then reuses the PojoRecreator impl defined within SqlPersistorInstaller
final Object recreatedPojo = spec.createObject();
return getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
}
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStore.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStore.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStore.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/xml/src/main/java/org/apache/isis/runtimes/dflt/objectstores/xml/XmlObjectStore.java Wed Aug 15 21:15:39 2012
@@ -183,35 +183,27 @@ public class XmlObjectStore implements O
}
private void initObjectSetupReference(final ObjectAdapter object, final ObjectData data, final ObjectAssociation field) {
- final RootOidDefault referenceOid = (RootOidDefault) data.get(field.getId());
+
+ final RootOid referencedOid = (RootOidDefault) data.get(field.getId());
if(LOG.isDebugEnabled()) {
- LOG.debug("setting up field " + field + " with " + referenceOid);
+ LOG.debug("setting up field " + field + " with " + referencedOid);
}
- if (referenceOid == null) {
+ if (referencedOid == null) {
return;
}
- final Data fieldData = dataManager.loadData(referenceOid);
+ final Data fieldData = dataManager.loadData(referencedOid);
+ final ObjectAdapter referencedAdapter = getAdapterManager().adapterFor(referencedOid);
if (fieldData == null) {
- ObjectSpecification spec = field.getSpecification();
-
- final Object recreatedPojo = spec.createObject();
- final ObjectAdapter adapter = getPersistenceSession().mapRecreatedPojo(referenceOid, recreatedPojo);
-
- if (!adapter.isDestroyed()) {
- adapter.changeState(ResolveState.DESTROYED);
+ if (!referencedAdapter.isDestroyed()) {
+ referencedAdapter.changeState(ResolveState.DESTROYED);
}
- ((OneToOneAssociation) field).initAssociation(object, adapter);
-
- LOG.warn("No data found for " + referenceOid + " so field '" + field.getName() + "' not set in object '" + object.titleString() + "'");
- } else {
- ObjectSpecification spec = specFor(fieldData);
- final Object recreatedPojo = spec.createObject();
- final ObjectAdapter reference = getPersistenceSession().mapRecreatedPojo(referenceOid, recreatedPojo);
- ((OneToOneAssociation) field).initAssociation(object, reference);
+ LOG.warn("No data found for " + referencedOid + " so field '" + field.getName() + "' not set in object '" + object.titleString() + "'");
}
+ ((OneToOneAssociation) field).initAssociation(object, referencedAdapter);
+ // REVIEW: what was this commented out code for?
/*
* if (loadedObjects().isLoaded(referenceOid)) { ObjectAdapter
* loadedObject = loadedObjects().getLoadedObject(referenceOid);
@@ -331,7 +323,7 @@ public class XmlObjectStore implements O
ObjectAdapter object;
if (data instanceof ObjectData) {
- object = recreateObject((ObjectData) data);
+ object = recreateAdapter((ObjectData) data);
} else if (data instanceof CollectionData) {
throw new IsisException();
} else {
@@ -357,13 +349,11 @@ public class XmlObjectStore implements O
* The ObjectData holds all references for internal collections, so the
* object should haves its internal collection populated by this method.
*/
- private ObjectAdapter recreateObject(final ObjectData data) {
+ private ObjectAdapter recreateAdapter(final ObjectData data) {
final RootOid oid = data.getRootOid();
- final ObjectSpecification spec = specFor(data);
- final Object recreatedPojo = spec.createObject();
- final ObjectAdapter object = getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
- initObject(object, data);
- return object;
+ final ObjectAdapter adapter = getAdapterManager().adapterFor(oid);
+ initObject(adapter, data);
+ return adapter;
}
// /////////////////////////////////////////////////////////
@@ -397,10 +387,7 @@ public class XmlObjectStore implements O
final RootOid oid = instanceData.getRootOid();
- final ObjectSpecification spec = specFor(instanceData);
- final Object recreatedPojo = spec.createObject();
-
- final ObjectAdapter adapter = getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
+ final ObjectAdapter adapter = getAdapterManager().adapterFor(oid);
if(LOG.isDebugEnabled()) {
LOG.debug("recreated instance " + adapter);
}
@@ -413,10 +400,6 @@ public class XmlObjectStore implements O
return instances;
}
- private ObjectSpecification specFor(final Data data) {
- return getSpecificationLookup().lookupBySpecId(data.getObjectSpecId());
- }
-
// /////////////////////////////////////////////////////////
// services
// /////////////////////////////////////////////////////////
Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureFilePersistor.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureFilePersistor.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureFilePersistor.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/fixturedomainservice/ObjectFixtureFilePersistor.java Wed Aug 15 21:15:39 2012
@@ -207,7 +207,7 @@ class LoadedObjects {
if (object == null) {
final String className = data.substring(0, pos);
final ObjectSpecification specification = getSpecificationLoader().loadSpecification(className);
- object = getPersistenceSession().createInstance(specification);
+ object = getPersistenceSession().createTransientInstance(specification);
idMap.put(id, object);
objects.add(object.getObject());
}
Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Data.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Data.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Data.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Data.java Wed Aug 15 21:15:39 2012
@@ -28,6 +28,7 @@ import org.apache.isis.core.commons.enco
import org.apache.isis.core.commons.encoding.Encodable;
import org.apache.isis.core.metamodel.adapter.ResolveState;
import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
public class Data implements Encodable, Serializable {
@@ -70,6 +71,10 @@ public class Data implements Encodable,
return oid;
}
+ /**
+ * REVIEW: this probably isn't needed anymore given that {@link #getOid() oid} (at least for {@link TypedOid})
+ * includes the object type.
+ */
public String getClassName() {
return className;
}
Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java Wed Aug 15 21:15:39 2012
@@ -30,11 +30,14 @@ import org.apache.log4j.Logger;
import org.apache.isis.core.commons.debug.DebugBuilder;
import org.apache.isis.core.commons.encoding.DataInputStreamExtended;
import org.apache.isis.core.commons.encoding.DataOutputStreamExtended;
+import org.apache.isis.core.commons.ensure.Assert;
import org.apache.isis.core.commons.exceptions.IsisException;
import org.apache.isis.core.commons.exceptions.UnknownTypeException;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.ParentedOid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
import org.apache.isis.core.metamodel.facets.accessor.PropertyOrCollectionAccessorFacet;
import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacetUtils;
@@ -187,12 +190,20 @@ public class Memento implements Serializ
final ObjectSpecification spec =
getSpecificationLoader().loadSpecification(data.getClassName());
- final Object recreatedPojo = spec.createObject();
- ObjectAdapter adapter = getPersistenceSession().mapRecreatedPojo(getOid(), recreatedPojo);
+ ObjectAdapter adapter;
- if (adapter.getSpecification().isParentedOrFreeCollection()) {
+ final Oid oid = getOid();
+ if (spec.isParentedOrFreeCollection()) {
+
+ final Object recreatedPojo = spec.createObject();
+ adapter = getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
populateCollection(adapter, (CollectionData) data);
+
} else {
+ Assert.assertTrue("oid must be a TypedOid representing an object because spec is not a collection and cannot be a value", oid instanceof TypedOid);
+ TypedOid typedOid = (TypedOid) oid;
+
+ adapter = getAdapterManager().adapterFor(typedOid);
updateObject(adapter, data);
}
@@ -215,30 +226,41 @@ public class Memento implements Serializ
}
private ObjectAdapter recreateReference(final Data data) {
- final ObjectSpecification spec = getSpecificationLoader().loadSpecification(data.getClassName());
+ // handle values
if (data instanceof StandaloneData) {
final StandaloneData standaloneData = (StandaloneData) data;
return standaloneData.getAdapter();
- }
- final Oid oid = data.getOid();
- if (oid == null) {
+ }
+
+ // reference to entity
+
+ Oid oid = data.getOid();
+ Assert.assertTrue("can only create a reference to an entity", oid instanceof TypedOid);
+
+ final TypedOid typedOid = (TypedOid) oid;
+ if (typedOid == null) {
return null;
}
- final Object recreatedPojo = spec.createObject();
- ObjectAdapter referencedAdapter = getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
+ final ObjectAdapter referencedAdapter = getAdapterManager().adapterFor(typedOid);
+
if (data instanceof ObjectData) {
- if (spec.isParented()) {
- // rather than the following, is it equivalent to pass in RESOLVING (like everywhere else?)
-// final ResolveState targetState = ResolveState.GHOST;
-// if (referencedAdapter.getResolveState().isValidToChangeTo(targetState)) {
-// referencedAdapter.changeState(targetState);
-// }
- updateObject(referencedAdapter, data);
- } else if (oid.isTransient()) {
- updateObject(referencedAdapter, data);
- }
+
+ // no longer needed
+ //final ObjectSpecification spec = getSpecificationLoader().loadSpecification(data.getClassName());
+ if(typedOid instanceof ParentedOid) { // equiv to spec.isParented()), I think
+
+ // rather than the following, is it equivalent to pass in RESOLVING? (like everywhere else)
+// final ResolveState targetState = ResolveState.GHOST;
+// if (referencedAdapter.getResolveState().isValidToChangeTo(targetState)) {
+// referencedAdapter.changeState(targetState);
+// }
+
+ updateObject(referencedAdapter, data);
+ } else if (typedOid.isTransient()) {
+ updateObject(referencedAdapter, data);
+ }
}
return referencedAdapter;
}
Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java Wed Aug 15 21:15:39 2012
@@ -273,7 +273,7 @@ public class AdapterManagerDefault imple
// //////////////////////////////////////////////////////////////////
@Override
- public ObjectAdapter recreatePersistentAdapter(final TypedOid typedOid) {
+ public ObjectAdapter adapterFor(final TypedOid typedOid) {
// attempt to locate adapter for the Oid
final ObjectAdapter adapterLookedUpByOid = getAdapterFor(typedOid);
Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/internal/RuntimeContextFromSession.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/internal/RuntimeContextFromSession.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/internal/RuntimeContextFromSession.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/internal/RuntimeContextFromSession.java Wed Aug 15 21:15:39 2012
@@ -42,6 +42,7 @@ import org.apache.isis.core.metamodel.ad
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacetUtils;
import org.apache.isis.core.metamodel.runtimecontext.RuntimeContextAbstract;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
@@ -119,12 +120,18 @@ public class RuntimeContextFromSession e
}
@Override
+ public ObjectAdapter adapterFor(TypedOid oid) {
+ return getRuntimeAdapterManager().adapterFor(oid);
+ }
+
+ @Override
public void injectInto(Object candidate) {
if (AdapterManagerAware.class.isAssignableFrom(candidate.getClass())) {
final AdapterManagerAware cast = AdapterManagerAware.class.cast(candidate);
cast.setAdapterManager(this);
}
}
+
};
this.objectInstantiator = new ObjectInstantiatorAbstract() {
@@ -168,12 +175,12 @@ public class RuntimeContextFromSession e
@Override
public ObjectAdapter createTransientInstance(final ObjectSpecification spec) {
- return getPersistenceSession().createInstance(spec);
+ return getPersistenceSession().createTransientInstance(spec);
}
@Override
public ObjectAdapter createAggregatedInstance(final ObjectSpecification spec, final ObjectAdapter parent) {
- return getPersistenceSession().createInstance(spec, parent);
+ return getPersistenceSession().createAggregatedInstance(spec, parent);
};
@Override
Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/SimpleRepository.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/SimpleRepository.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/SimpleRepository.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/SimpleRepository.java Wed Aug 15 21:15:39 2012
@@ -94,7 +94,7 @@ public final class SimpleRepository {
// //////////////////////////////////////////////////////
public Object newPersistentInstance() {
- final ObjectAdapter adapter = getPersistenceSession().createInstance(getSpec());
+ final ObjectAdapter adapter = getPersistenceSession().createTransientInstance(getSpec());
getPersistenceSession().makePersistent(adapter);
return adapter.getObject();
}
@@ -104,7 +104,7 @@ public final class SimpleRepository {
// //////////////////////////////////////////////////////
public Object newTransientInstance() {
- return getPersistenceSession().createInstance(getSpec()).getObject();
+ return getPersistenceSession().createTransientInstance(getSpec()).getObject();
}
// //////////////////////////////////////////////////////
Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/persistence/AdapterLifecycleTransitioner.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/persistence/AdapterLifecycleTransitioner.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/persistence/AdapterLifecycleTransitioner.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/persistence/AdapterLifecycleTransitioner.java Wed Aug 15 21:15:39 2012
@@ -20,13 +20,7 @@
package org.apache.isis.runtimes.dflt.runtime.system.persistence;
import org.apache.isis.applib.annotation.Aggregated;
-import org.apache.isis.core.commons.components.Resettable;
-import org.apache.isis.core.commons.components.SessionScopedComponent;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterRecreator;
import org.apache.isis.core.metamodel.adapter.oid.Oid;
import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/persistence/OidGenerator.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/persistence/OidGenerator.java?rev=1373632&r1=1373631&r2=1373632&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/persistence/OidGenerator.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/system/persistence/OidGenerator.java Wed Aug 15 21:15:39 2012
@@ -28,7 +28,6 @@ import org.apache.isis.core.metamodel.ad
import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.metamodel.adapter.oid.stringable.OidStringifier;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.SpecificationLoader;
@@ -36,7 +35,6 @@ import org.apache.isis.runtimes.dflt.run
public class OidGenerator implements DebuggableWithTitle {
- private final OidStringifier oidStringifier;
private final IdentifierGenerator identifierGenerator;
public OidGenerator() {
@@ -45,7 +43,6 @@ public class OidGenerator implements Deb
public OidGenerator(final IdentifierGenerator identifierGenerator) {
this.identifierGenerator = identifierGenerator;
- this.oidStringifier = new OidStringifier(RootOidDefault.class);
}
@@ -53,14 +50,6 @@ public class OidGenerator implements Deb
return identifierGenerator;
}
- /**
- * An {@link OidStringifier} to use for stringifying instances of the
- * concrete {@link Oid} generated by this generator.
- */
- public final OidStringifier getOidStringifier() {
- return oidStringifier;
- }
-
// //////////////////////////////////////////////////////////////
// API and mandatory hooks