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 2016/07/05 06:54:54 UTC
[1/8] isis git commit: Revert "ISIS-1461: defers the call to buildGui
on EntityPage to the onRder"
Repository: isis
Updated Branches:
refs/heads/master 225bb6011 -> 497e09379
Revert "ISIS-1461: defers the call to buildGui on EntityPage to the onRder"
This reverts commit 6dd1a9c497547cdd21325d9ce10a1b599d725138.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/9f5eadda
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/9f5eadda
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/9f5eadda
Branch: refs/heads/master
Commit: 9f5eadda457edec6a68090424b3c91d13acf23a9
Parents: 225bb60
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Jun 29 08:37:15 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Jun 29 08:37:15 2016 +0100
----------------------------------------------------------------------
.../apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/9f5eadda/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
index ac1d6dd..9574b18 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
@@ -110,6 +110,8 @@ public class EntityPage extends PageAbstract {
this.model = entityModel;
this.titleString = titleString;
+
+ buildPage();
}
private void addBreadcrumb(final EntityModel entityModel) {
@@ -133,14 +135,14 @@ public class EntityPage extends PageAbstract {
*/
@Override
protected void onBeforeRender() {
+
+
ConcurrencyChecking.executeWithConcurrencyCheckingDisabled(
new Runnable() {
@Override
public void run() {
EntityPage.this.model.load(ConcurrencyChecking.NO_CHECK);
EntityPage.super.onBeforeRender();
-
- buildPage();
}
}
);
[8/8] isis git commit: ISIS-1335: tweaks the bootstrap override CSS,
to adjust positioning of buttons on collections up by a couple of
pixels.
Posted by da...@apache.org.
ISIS-1335: tweaks the bootstrap override CSS, to adjust positioning of buttons on collections up by a couple of pixels.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/497e0937
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/497e0937
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/497e0937
Branch: refs/heads/master
Commit: 497e09379468a4baf6979da335bed6a71de88c88
Parents: 2ed9fa3
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Jul 5 07:41:27 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Jul 5 07:41:27 2016 +0100
----------------------------------------------------------------------
.../apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/497e0937/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
index 3018d2c..8edc19c 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
@@ -1,3 +1,4 @@
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -492,7 +493,7 @@ div.additionalLinkList {
.col .additionalLinksAndSelectorDropDown,
.entityPropertiesPanel .additionalLinks,
.entityCollectionsPanel .additionalLinksAndSelectorDropDown {
- margin-top: -4px;
+ margin-top: -6px;
}
.collection.panel-body {
[3/8] isis git commit: ISIS-1335: fixes auditing for simpleapp;
fixes logging for simpleapp.
Posted by da...@apache.org.
ISIS-1335: fixes auditing for simpleapp; fixes logging for simpleapp.
For auditing, it would seem that properties cannot be read-only. Also, the
logging configuration for auditer and publisher services was wrong (additivity
setting incorrect).
Also, added new 'notes' property to simpleObject; minor tweaks to integtests
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/07d2fd28
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/07d2fd28
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/07d2fd28
Branch: refs/heads/master
Commit: 07d2fd28c60e8e9da48e249175408da2cd4bf80c
Parents: 116325d
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Jul 5 06:13:48 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Jul 5 06:28:56 2016 +0100
----------------------------------------------------------------------
.../java/domainapp/dom/simple/SimpleObject.java | 68 ++++-----
.../dom/simple/SimpleObject.layout.xml | 5 +-
.../domainapp/dom/simple/SimpleObjectMenu.java | 42 +----
.../dom/simple/SimpleObjectRepository.java | 11 +-
.../dom/simple/SimpleObjectRepositoryTest.java | 39 +++--
.../modules/simple/SimpleObjectIntegTest.java | 139 -----------------
.../simple/SimpleObjectMenuIntegTest.java | 146 ------------------
.../simple/SimpleObjectMenu_IntegTest.java | 146 ++++++++++++++++++
.../modules/simple/SimpleObject_IntegTest.java | 153 +++++++++++++++++++
.../src/main/webapp/WEB-INF/logging.properties | 4 +-
10 files changed, 379 insertions(+), 374 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/07d2fd28/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
index 0d8edfb..676b75c 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
@@ -25,7 +25,7 @@ import org.apache.isis.applib.annotation.Action;
import org.apache.isis.applib.annotation.Auditing;
import org.apache.isis.applib.annotation.CommandReification;
import org.apache.isis.applib.annotation.DomainObject;
-import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Editing;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.Property;
import org.apache.isis.applib.annotation.Publishing;
@@ -40,22 +40,16 @@ import org.apache.isis.applib.util.ObjectContracts;
@javax.jdo.annotations.PersistenceCapable(
identityType=IdentityType.DATASTORE,
- schema = "simple",
- table = "SimpleObject"
+ schema = "simple"
)
@javax.jdo.annotations.DatastoreIdentity(
strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY,
column="id")
@javax.jdo.annotations.Version(
-// strategy=VersionStrategy.VERSION_NUMBER,
strategy= VersionStrategy.DATE_TIME,
column="version")
@javax.jdo.annotations.Queries({
@javax.jdo.annotations.Query(
- name = "find", language = "JDOQL",
- value = "SELECT "
- + "FROM domainapp.dom.simple.SimpleObject "),
- @javax.jdo.annotations.Query(
name = "findByName", language = "JDOQL",
value = "SELECT "
+ "FROM domainapp.dom.simple.SimpleObject "
@@ -68,44 +62,35 @@ import org.apache.isis.applib.util.ObjectContracts;
)
public class SimpleObject implements Comparable<SimpleObject> {
-
//region > title
-
public TranslatableString title() {
return TranslatableString.tr("Object: {name}", "name", getName());
}
+ //endregion
+ //region > constructor
+ public SimpleObject(final String name) {
+ setName(name);
+ }
//endregion
- //region > name (property)
+ //region > name (read-only property)
public static final int NAME_LENGTH = 40;
- public static class NameDomainEvent extends PropertyDomainEvent<SimpleObject,String> {}
- @javax.jdo.annotations.Column(
- allowsNull="false",
- length = NAME_LENGTH
- )
+ @javax.jdo.annotations.Column(allowsNull = "false", length = NAME_LENGTH)
+ private String name;
@Property(
- command = CommandReification.ENABLED,
- publishing = Publishing.ENABLED,
- domainEvent = NameDomainEvent.class
+ editing = Editing.DISABLED
)
- private String name;
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
-
- public TranslatableString validateName(final String name) {
- return name != null && name.contains("!")? TranslatableString.tr("Exclamation mark is not allowed"): null;
- }
-
//endregion
//region > updateName (action)
-
public static class UpdateNameDomainEvent extends ActionDomainEvent<SimpleObject> {}
@Action(
command = CommandReification.ENABLED,
@@ -113,7 +98,6 @@ public class SimpleObject implements Comparable<SimpleObject> {
semantics = SemanticsOf.IDEMPOTENT,
domainEvent = UpdateNameDomainEvent.class
)
- @MemberOrder(name="name", sequence = "1") // associate with 'name' property
public SimpleObject updateName(@ParameterLayout(named="Name") final String name) {
setName(name);
return this;
@@ -122,25 +106,31 @@ public class SimpleObject implements Comparable<SimpleObject> {
return getName();
}
public TranslatableString validate0UpdateName(final String name) {
- return validateName(name);
+ return name != null && name.contains("!")? TranslatableString.tr("Exclamation mark is not allowed"): null;
}
//endregion
- //region > delete (action)
+ //region > notes (editable property)
+ public static final int NOTES_LENGTH = 4000;
-
- public static class DeleteDomainEvent extends ActionDomainEvent<SimpleObject> {}
- @Action(
- domainEvent = DeleteDomainEvent.class,
- semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE
+ public static class NotesDomainEvent extends PropertyDomainEvent<SimpleObject,String> {}
+ @javax.jdo.annotations.Column(
+ allowsNull="true",
+ length = NOTES_LENGTH
)
- public void delete() {
- final String title = titleService.titleOf(this);
- messageService.informUser(String.format("'%s' deleted", title));
- repositoryService.remove(this);
+ private String notes;
+ @Property(
+ command = CommandReification.ENABLED,
+ publishing = Publishing.ENABLED,
+ domainEvent = NotesDomainEvent.class
+ )
+ public String getNotes() {
+ return notes;
+ }
+ public void setNotes(final String notes) {
+ this.notes = notes;
}
-
//endregion
//region > toString, compareTo
http://git-wip-us.apache.org/repos/asf/isis/blob/07d2fd28/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
index c0c6d14..b995607 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
@@ -32,7 +32,10 @@
<bs3:col span="12">
<c:fieldSet name="Name">
<c:action id="delete"/>
- <c:property id="name" namedEscaped="true"/>
+ <c:property id="name" namedEscaped="true">
+ <c:action id="updateName"/>
+ </c:property>
+ <c:property id="notes" namedEscaped="true" multiLine="10" hidden="ALL_TABLES"/>
</c:fieldSet>
</bs3:col>
</bs3:row>
http://git-wip-us.apache.org/repos/asf/isis/blob/07d2fd28/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectMenu.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectMenu.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectMenu.java
index cdf153f..4079bc8 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectMenu.java
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectMenu.java
@@ -30,47 +30,28 @@ import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.SemanticsOf;
import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
-import org.apache.isis.applib.services.i18n.TranslatableString;
@DomainService(
nature = NatureOfService.VIEW_MENU_ONLY,
repositoryFor = SimpleObject.class
)
@DomainServiceLayout(
+ named = "Simple Objects",
menuOrder = "10"
)
public class SimpleObjectMenu {
- //region > title
- public TranslatableString title() {
- return TranslatableString.tr("Simple Objects");
- }
- //endregion
- //region > listAll (action)
- public static class ListAllEvent extends ActionDomainEvent<SimpleObjectMenu> {}
- @Action(
- semantics = SemanticsOf.SAFE,
- domainEvent = ListAllEvent.class
- )
- @ActionLayout(
- bookmarking = BookmarkPolicy.AS_ROOT
- )
+ @Action(semantics = SemanticsOf.SAFE)
+ @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
@MemberOrder(sequence = "1")
public List<SimpleObject> listAll() {
return simpleObjectRepository.listAll();
}
- //endregion
- //region > findByName (action)
- public static class FindByNameEvent extends ActionDomainEvent<SimpleObjectMenu> {}
- @Action(
- semantics = SemanticsOf.SAFE,
- domainEvent = FindByNameEvent.class
- )
- @ActionLayout(
- bookmarking = BookmarkPolicy.AS_ROOT
- )
+
+ @Action(semantics = SemanticsOf.SAFE)
+ @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT)
@MemberOrder(sequence = "2")
public List<SimpleObject> findByName(
@ParameterLayout(named="Name")
@@ -78,13 +59,10 @@ public class SimpleObjectMenu {
) {
return simpleObjectRepository.findByName(name);
}
- //endregion
- //region > create (action)
+
public static class CreateDomainEvent extends ActionDomainEvent<SimpleObjectMenu> {}
- @Action(
- domainEvent = CreateDomainEvent.class
- )
+ @Action(domainEvent = CreateDomainEvent.class)
@MemberOrder(sequence = "3")
public SimpleObject create(
@ParameterLayout(named="Name")
@@ -92,12 +70,8 @@ public class SimpleObjectMenu {
return simpleObjectRepository.create(name);
}
- //endregion
-
- //region > injected services
@javax.inject.Inject
SimpleObjectRepository simpleObjectRepository;
- //endregion
}
http://git-wip-us.apache.org/repos/asf/isis/blob/07d2fd28/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectRepository.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectRepository.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectRepository.java
index f0cf4a3..a5d29e0 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectRepository.java
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectRepository.java
@@ -23,6 +23,7 @@ import java.util.List;
import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.applib.services.registry.ServiceRegistry2;
import org.apache.isis.applib.services.repository.RepositoryService;
@DomainService(
@@ -44,12 +45,14 @@ public class SimpleObjectRepository {
}
public SimpleObject create(final String name) {
- final SimpleObject obj = repositoryService.instantiate(SimpleObject.class);
- obj.setName(name);
- repositoryService.persist(obj);
- return obj;
+ final SimpleObject object = new SimpleObject(name);
+ serviceRegistry.injectServicesInto(object);
+ repositoryService.persist(object);
+ return object;
}
@javax.inject.Inject
RepositoryService repositoryService;
+ @javax.inject.Inject
+ ServiceRegistry2 serviceRegistry;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/07d2fd28/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectRepositoryTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectRepositoryTest.java b/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectRepositoryTest.java
index f1f96ec..ccf4ddf 100644
--- a/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectRepositoryTest.java
+++ b/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectRepositoryTest.java
@@ -20,6 +20,9 @@ import java.util.List;
import com.google.common.collect.Lists;
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
import org.jmock.Expectations;
import org.jmock.Sequence;
import org.jmock.auto.Mock;
@@ -27,6 +30,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.apache.isis.applib.services.registry.ServiceRegistry2;
import org.apache.isis.applib.services.repository.RepositoryService;
import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
@@ -39,14 +43,18 @@ public class SimpleObjectRepositoryTest {
public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
@Mock
- RepositoryService mockRepositoryService;
+ ServiceRegistry2 mockServiceRegistry;
+ @Mock
+ RepositoryService mockRepositoryService;
+
SimpleObjectRepository simpleObjectRepository;
@Before
public void setUp() throws Exception {
simpleObjectRepository = new SimpleObjectRepository();
simpleObjectRepository.repositoryService = mockRepositoryService;
+ simpleObjectRepository.serviceRegistry = mockServiceRegistry;
}
public static class Create extends SimpleObjectRepositoryTest {
@@ -54,29 +62,42 @@ public class SimpleObjectRepositoryTest {
@Test
public void happyCase() throws Exception {
- // given
- final SimpleObject simpleObject = new SimpleObject();
+ final String someName = "Foobar";
+ // given
final Sequence seq = context.sequence("create");
context.checking(new Expectations() {
{
- oneOf(mockRepositoryService).instantiate(SimpleObject.class);
+ oneOf(mockServiceRegistry).injectServicesInto(with(any(SimpleObject.class)));
inSequence(seq);
- will(returnValue(simpleObject));
- oneOf(mockRepositoryService).persist(simpleObject);
+ oneOf(mockRepositoryService).persist(with(nameOf(someName)));
inSequence(seq);
}
+
});
// when
- final SimpleObject obj = simpleObjectRepository.create("Foobar");
+ final SimpleObject obj = simpleObjectRepository.create(someName);
// then
- assertThat(obj).isEqualTo(simpleObject);
- assertThat(obj.getName()).isEqualTo("Foobar");
+ assertThat(obj).isNotNull();
+ assertThat(obj.getName()).isEqualTo(someName);
}
+ private static Matcher<SimpleObject> nameOf(final String name) {
+ return new TypeSafeMatcher<SimpleObject>() {
+ @Override
+ protected boolean matchesSafely(final SimpleObject item) {
+ return name.equals(item.getName());
+ }
+
+ @Override
+ public void describeTo(final Description description) {
+ description.appendText("has name of '" + name + "'");
+ }
+ };
+ }
}
public static class ListAll extends SimpleObjectRepositoryTest {
http://git-wip-us.apache.org/repos/asf/isis/blob/07d2fd28/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java
deleted file mode 100644
index 7905b56..0000000
--- a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java
+++ /dev/null
@@ -1,139 +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 domainapp.integtests.tests.modules.simple;
-
-import java.sql.Timestamp;
-
-import javax.inject.Inject;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.fixturescripts.FixtureScripts;
-import org.apache.isis.applib.services.wrapper.InvalidException;
-import org.apache.isis.core.metamodel.services.jdosupport.Persistable_datanucleusIdLong;
-import org.apache.isis.core.metamodel.services.jdosupport.Persistable_datanucleusVersionTimestamp;
-
-import domainapp.dom.simple.SimpleObject;
-import domainapp.fixture.scenarios.RecreateSimpleObjects;
-import domainapp.integtests.tests.DomainAppIntegTest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SimpleObjectIntegTest extends DomainAppIntegTest {
-
- @Inject
- FixtureScripts fixtureScripts;
-
- RecreateSimpleObjects fs;
- SimpleObject simpleObjectPojo;
- SimpleObject simpleObjectWrapped;
-
- @Before
- public void setUp() throws Exception {
- // given
- fs = new RecreateSimpleObjects().setNumber(1);
- fixtureScripts.runFixtureScript(fs, null);
-
- simpleObjectPojo = fs.getSimpleObjects().get(0);
-
- assertThat(simpleObjectPojo).isNotNull();
- simpleObjectWrapped = wrap(simpleObjectPojo);
- }
-
- public static class Name extends SimpleObjectIntegTest {
-
- @Test
- public void accessible() throws Exception {
- // when
- final String name = simpleObjectWrapped.getName();
- // then
- assertThat(name).isEqualTo(fs.NAMES.get(0));
- }
-
- }
-
- public static class UpdateName extends SimpleObjectIntegTest {
-
- @Test
- public void canBeUpdatedDirectly() throws Exception {
-
- // when
- simpleObjectWrapped.setName("new name");
-
- // then
- assertThat(simpleObjectWrapped.getName()).isEqualTo("new name");
- }
-
- @Test
- public void failsValidation() throws Exception {
-
- // expect
- expectedExceptions.expect(InvalidException.class);
- expectedExceptions.expectMessage("Exclamation mark is not allowed");
-
- // when
- simpleObjectWrapped.setName("new name!");
- }
- }
-
-
- public static class Title extends SimpleObjectIntegTest {
-
- @Inject
- DomainObjectContainer container;
-
- @Test
- public void interpolatesName() throws Exception {
-
- // given
- final String name = simpleObjectWrapped.getName();
-
- // when
- final String title = container.titleOf(simpleObjectWrapped);
-
- // then
- assertThat(title).isEqualTo("Object: " + name);
- }
- }
-
- public static class DataNucleusId extends SimpleObjectIntegTest {
-
- @Test
- public void shouldBePopulated() throws Exception {
- // when
- final Long id = mixin(Persistable_datanucleusIdLong.class, simpleObjectPojo).$$();
- // then
- assertThat(id).isGreaterThanOrEqualTo(0);
- }
- }
-
- public static class DataNucleusVersionTimestamp extends SimpleObjectIntegTest {
-
- @Test
- public void shouldBePopulated() throws Exception {
- // when
- final Timestamp timestamp = mixin(Persistable_datanucleusVersionTimestamp.class, simpleObjectPojo).$$();
- // then
- assertThat(timestamp).isNotNull();
- }
- }
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/07d2fd28/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenuIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenuIntegTest.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenuIntegTest.java
deleted file mode 100644
index ba3b3db..0000000
--- a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenuIntegTest.java
+++ /dev/null
@@ -1,146 +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 domainapp.integtests.tests.modules.simple;
-
-import java.sql.SQLIntegrityConstraintViolationException;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import com.google.common.base.Throwables;
-
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
-import org.junit.Test;
-
-import org.apache.isis.applib.fixturescripts.FixtureScript;
-import org.apache.isis.applib.fixturescripts.FixtureScripts;
-import org.apache.isis.applib.services.xactn.TransactionService;
-
-import domainapp.dom.simple.SimpleObject;
-import domainapp.dom.simple.SimpleObjectMenu;
-import domainapp.fixture.dom.simple.SimpleObjectsTearDown;
-import domainapp.fixture.scenarios.RecreateSimpleObjects;
-import domainapp.integtests.tests.DomainAppIntegTest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SimpleObjectMenuIntegTest extends DomainAppIntegTest {
-
- @Inject
- FixtureScripts fixtureScripts;
- @Inject
- TransactionService transactionService;
- @Inject
- SimpleObjectMenu simpleObjectMenu;
-
- public static class ListAll extends SimpleObjectMenuIntegTest {
-
- @Test
- public void happyCase() throws Exception {
-
- // given
- RecreateSimpleObjects fs = new RecreateSimpleObjects();
- fixtureScripts.runFixtureScript(fs, null);
- transactionService.nextTransaction();
-
- // when
- final List<SimpleObject> all = wrap(simpleObjectMenu).listAll();
-
- // then
- assertThat(all).hasSize(fs.getSimpleObjects().size());
-
- SimpleObject simpleObject = wrap(all.get(0));
- assertThat(simpleObject.getName()).isEqualTo(fs.getSimpleObjects().get(0).getName());
- }
-
- @Test
- public void whenNone() throws Exception {
-
- // given
- FixtureScript fs = new SimpleObjectsTearDown();
- fixtureScripts.runFixtureScript(fs, null);
- transactionService.nextTransaction();
-
- // when
- final List<SimpleObject> all = wrap(simpleObjectMenu).listAll();
-
- // then
- assertThat(all).hasSize(0);
- }
- }
-
- public static class Create extends SimpleObjectMenuIntegTest {
-
- @Test
- public void happyCase() throws Exception {
-
- // given
- FixtureScript fs = new SimpleObjectsTearDown();
- fixtureScripts.runFixtureScript(fs, null);
- transactionService.nextTransaction();
-
- // when
- wrap(simpleObjectMenu).create("Faz");
-
- // then
- final List<SimpleObject> all = wrap(simpleObjectMenu).listAll();
- assertThat(all).hasSize(1);
- }
-
- @Test
- public void whenAlreadyExists() throws Exception {
-
- // given
- FixtureScript fs = new SimpleObjectsTearDown();
- fixtureScripts.runFixtureScript(fs, null);
- transactionService.nextTransaction();
- wrap(simpleObjectMenu).create("Faz");
- transactionService.nextTransaction();
-
- // then
- expectedExceptions.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));
-
- // when
- wrap(simpleObjectMenu).create("Faz");
- transactionService.nextTransaction();
- }
-
- private static Matcher<? extends Throwable> causalChainContains(final Class<?> cls) {
- return new TypeSafeMatcher<Throwable>() {
- @Override
- protected boolean matchesSafely(Throwable item) {
- final List<Throwable> causalChain = Throwables.getCausalChain(item);
- for (Throwable throwable : causalChain) {
- if(cls.isAssignableFrom(throwable.getClass())){
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void describeTo(Description description) {
- description.appendText("exception with causal chain containing " + cls.getSimpleName());
- }
- };
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/07d2fd28/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenu_IntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenu_IntegTest.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenu_IntegTest.java
new file mode 100644
index 0000000..ed34260
--- /dev/null
+++ b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenu_IntegTest.java
@@ -0,0 +1,146 @@
+/*
+ * 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 domainapp.integtests.tests.modules.simple;
+
+import java.sql.SQLIntegrityConstraintViolationException;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import com.google.common.base.Throwables;
+
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
+import org.junit.Test;
+
+import org.apache.isis.applib.fixturescripts.FixtureScript;
+import org.apache.isis.applib.fixturescripts.FixtureScripts;
+import org.apache.isis.applib.services.xactn.TransactionService;
+
+import domainapp.dom.simple.SimpleObject;
+import domainapp.dom.simple.SimpleObjectMenu;
+import domainapp.fixture.dom.simple.SimpleObjectsTearDown;
+import domainapp.fixture.scenarios.RecreateSimpleObjects;
+import domainapp.integtests.tests.DomainAppIntegTest;
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class SimpleObjectMenu_IntegTest extends DomainAppIntegTest {
+
+ @Inject
+ FixtureScripts fixtureScripts;
+ @Inject
+ TransactionService transactionService;
+ @Inject
+ SimpleObjectMenu menu;
+
+ public static class ListAll extends SimpleObjectMenu_IntegTest {
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // given
+ RecreateSimpleObjects fs = new RecreateSimpleObjects();
+ fixtureScripts.runFixtureScript(fs, null);
+ transactionService.nextTransaction();
+
+ // when
+ final List<SimpleObject> all = wrap(menu).listAll();
+
+ // then
+ assertThat(all).hasSize(fs.getSimpleObjects().size());
+
+ SimpleObject simpleObject = wrap(all.get(0));
+ assertThat(simpleObject.getName()).isEqualTo(fs.getSimpleObjects().get(0).getName());
+ }
+
+ @Test
+ public void whenNone() throws Exception {
+
+ // given
+ FixtureScript fs = new SimpleObjectsTearDown();
+ fixtureScripts.runFixtureScript(fs, null);
+ transactionService.nextTransaction();
+
+ // when
+ final List<SimpleObject> all = wrap(menu).listAll();
+
+ // then
+ assertThat(all).hasSize(0);
+ }
+ }
+
+ public static class Create extends SimpleObjectMenu_IntegTest {
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // given
+ FixtureScript fs = new SimpleObjectsTearDown();
+ fixtureScripts.runFixtureScript(fs, null);
+ transactionService.nextTransaction();
+
+ // when
+ wrap(menu).create("Faz");
+
+ // then
+ final List<SimpleObject> all = wrap(menu).listAll();
+ assertThat(all).hasSize(1);
+ }
+
+ @Test
+ public void whenAlreadyExists() throws Exception {
+
+ // given
+ FixtureScript fs = new SimpleObjectsTearDown();
+ fixtureScripts.runFixtureScript(fs, null);
+ transactionService.nextTransaction();
+ wrap(menu).create("Faz");
+ transactionService.nextTransaction();
+
+ // then
+ expectedExceptions.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));
+
+ // when
+ wrap(menu).create("Faz");
+ transactionService.nextTransaction();
+ }
+
+ private static Matcher<? extends Throwable> causalChainContains(final Class<?> cls) {
+ return new TypeSafeMatcher<Throwable>() {
+ @Override
+ protected boolean matchesSafely(Throwable item) {
+ final List<Throwable> causalChain = Throwables.getCausalChain(item);
+ for (Throwable throwable : causalChain) {
+ if(cls.isAssignableFrom(throwable.getClass())){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("exception with causal chain containing " + cls.getSimpleName());
+ }
+ };
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/07d2fd28/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObject_IntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObject_IntegTest.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObject_IntegTest.java
new file mode 100644
index 0000000..be97784
--- /dev/null
+++ b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObject_IntegTest.java
@@ -0,0 +1,153 @@
+/*
+ * 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 domainapp.integtests.tests.modules.simple;
+
+import java.sql.Timestamp;
+
+import javax.inject.Inject;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.fixturescripts.FixtureScripts;
+import org.apache.isis.applib.services.title.TitleService;
+import org.apache.isis.applib.services.wrapper.DisabledException;
+import org.apache.isis.applib.services.wrapper.InvalidException;
+import org.apache.isis.applib.services.xactn.TransactionService;
+import org.apache.isis.core.metamodel.services.jdosupport.Persistable_datanucleusIdLong;
+import org.apache.isis.core.metamodel.services.jdosupport.Persistable_datanucleusVersionTimestamp;
+
+import domainapp.dom.simple.SimpleObject;
+import domainapp.fixture.scenarios.RecreateSimpleObjects;
+import domainapp.integtests.tests.DomainAppIntegTest;
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class SimpleObject_IntegTest extends DomainAppIntegTest {
+
+ @Inject
+ FixtureScripts fixtureScripts;
+ @Inject
+ TransactionService transactionService;
+
+ SimpleObject simpleObject;
+
+ @Before
+ public void setUp() throws Exception {
+ // given
+ RecreateSimpleObjects fs = new RecreateSimpleObjects().setNumber(1);
+ fixtureScripts.runFixtureScript(fs, null);
+ transactionService.nextTransaction();
+
+ simpleObject = fs.getSimpleObjects().get(0);
+
+ assertThat(simpleObject).isNotNull();
+ }
+
+ public static class Name extends SimpleObject_IntegTest {
+
+ @Test
+ public void accessible() throws Exception {
+ // when
+ final String name = wrap(simpleObject).getName();
+
+ // then
+ assertThat(name).isEqualTo(simpleObject.getName());
+ }
+
+ @Test
+ public void not_editable() throws Exception {
+ // expect
+ expectedExceptions.expect(DisabledException.class);
+
+ // when
+ wrap(simpleObject).setName("new name");
+ }
+
+ }
+
+ public static class UpdateName extends SimpleObject_IntegTest {
+
+ @Test
+ public void can_be_updated_directly() throws Exception {
+
+ // when
+ wrap(simpleObject).updateName("new name");
+ transactionService.nextTransaction();
+
+ // then
+ assertThat(wrap(simpleObject).getName()).isEqualTo("new name");
+ }
+
+ @Test
+ public void failsValidation() throws Exception {
+
+ // expect
+ expectedExceptions.expect(InvalidException.class);
+ expectedExceptions.expectMessage("Exclamation mark is not allowed");
+
+ // when
+ wrap(simpleObject).updateName("new name!");
+ }
+ }
+
+
+ public static class Title extends SimpleObject_IntegTest {
+
+ @Inject
+ TitleService titleService;
+
+ @Test
+ public void interpolatesName() throws Exception {
+
+ // given
+ final String name = wrap(simpleObject).getName();
+
+ // when
+ final String title = titleService.titleOf(simpleObject);
+
+ // then
+ assertThat(title).isEqualTo("Object: " + name);
+ }
+ }
+
+ public static class DataNucleusId extends SimpleObject_IntegTest {
+
+ @Test
+ public void should_be_populated() throws Exception {
+ // when
+ final Long id = mixin(Persistable_datanucleusIdLong.class, simpleObject).$$();
+
+ // then
+ assertThat(id).isGreaterThanOrEqualTo(0);
+ }
+ }
+
+ public static class DataNucleusVersionTimestamp extends SimpleObject_IntegTest {
+
+ @Test
+ public void should_be_populated() throws Exception {
+ // when
+ final Timestamp timestamp = mixin(Persistable_datanucleusVersionTimestamp.class, simpleObject).$$();
+ // then
+ assertThat(timestamp).isNotNull();
+ }
+ }
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/07d2fd28/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/logging.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/logging.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/logging.properties
index 7cbfcc6..1efa120 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/logging.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/logging.properties
@@ -83,7 +83,7 @@ log4j.appender.PublisherServiceLogging.layout=org.apache.log4j.PatternLayout
log4j.appender.PublisherServiceLogging.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n
log4j.logger.org.apache.isis.applib.services.publish.PublisherServiceLogging=DEBUG,PublisherServiceLogging
-log4j.additivity.log4j.logger.org.apache.isis.applib.services.publish.PublisherServiceLogging=false
+log4j.additivity.org.apache.isis.applib.services.publish.PublisherServiceLogging=false
# auditing
@@ -94,7 +94,7 @@ log4j.appender.AuditerServiceLogging.layout=org.apache.log4j.PatternLayout
log4j.appender.AuditerServiceLogging.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %m%n
log4j.logger.org.apache.isis.applib.services.audit.AuditerServiceLogging=DEBUG,AuditerServiceLogging
-log4j.additivity.log4j.logger.org.apache.isis.applib.services.audit.AuditerServiceLogging=false
+log4j.additivity.org.apache.isis.applib.services.audit.AuditerServiceLogging=false
[2/8] isis git commit: ISIS-1335: splits SimpleObjects service into
Menu and Repository
Posted by da...@apache.org.
ISIS-1335: splits SimpleObjects service into Menu and Repository
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/116325dd
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/116325dd
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/116325dd
Branch: refs/heads/master
Commit: 116325dd64ff6299d94a71396c3b717527abeacd
Parents: 9f5eadd
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Jul 4 23:05:12 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Jul 4 23:05:12 2016 +0100
----------------------------------------------------------------------
.../services/homepage/HomePageViewModel.java | 6 +-
.../domainapp/dom/simple/SimpleObjectMenu.java | 103 +++++++++++++
.../dom/simple/SimpleObjectRepository.java | 55 +++++++
.../domainapp/dom/simple/SimpleObjects.java | 112 --------------
.../dom/simple/SimpleObjectRepositoryTest.java | 104 +++++++++++++
.../domainapp/dom/simple/SimpleObjectsTest.java | 104 -------------
.../fixture/dom/simple/SimpleObjectCreate.java | 6 +-
.../modules/simple/SimpleObjectGlue.java | 6 +-
.../simple/SimpleObjectMenuIntegTest.java | 146 +++++++++++++++++++
.../modules/simple/SimpleObjectsIntegTest.java | 143 ------------------
10 files changed, 417 insertions(+), 368 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/116325dd/example/application/simpleapp/app/src/main/java/domainapp/app/services/homepage/HomePageViewModel.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/app/src/main/java/domainapp/app/services/homepage/HomePageViewModel.java b/example/application/simpleapp/app/src/main/java/domainapp/app/services/homepage/HomePageViewModel.java
index 47c6e08..cc3ffb6 100644
--- a/example/application/simpleapp/app/src/main/java/domainapp/app/services/homepage/HomePageViewModel.java
+++ b/example/application/simpleapp/app/src/main/java/domainapp/app/services/homepage/HomePageViewModel.java
@@ -24,7 +24,7 @@ import org.apache.isis.applib.annotation.ViewModel;
import org.apache.isis.applib.services.i18n.TranslatableString;
import domainapp.dom.simple.SimpleObject;
-import domainapp.dom.simple.SimpleObjects;
+import domainapp.dom.simple.SimpleObjectRepository;
@ViewModel
public class HomePageViewModel {
@@ -38,14 +38,14 @@ public class HomePageViewModel {
//region > object (collection)
@org.apache.isis.applib.annotation.HomePage
public List<SimpleObject> getObjects() {
- return simpleObjects.listAll();
+ return simpleObjectRepository.listAll();
}
//endregion
//region > injected services
@javax.inject.Inject
- SimpleObjects simpleObjects;
+ SimpleObjectRepository simpleObjectRepository;
//endregion
}
http://git-wip-us.apache.org/repos/asf/isis/blob/116325dd/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectMenu.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectMenu.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectMenu.java
new file mode 100644
index 0000000..cdf153f
--- /dev/null
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectMenu.java
@@ -0,0 +1,103 @@
+/*
+ * 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 domainapp.dom.simple;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.ActionLayout;
+import org.apache.isis.applib.annotation.BookmarkPolicy;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
+import org.apache.isis.applib.services.i18n.TranslatableString;
+
+@DomainService(
+ nature = NatureOfService.VIEW_MENU_ONLY,
+ repositoryFor = SimpleObject.class
+)
+@DomainServiceLayout(
+ menuOrder = "10"
+)
+public class SimpleObjectMenu {
+
+ //region > title
+ public TranslatableString title() {
+ return TranslatableString.tr("Simple Objects");
+ }
+ //endregion
+
+ //region > listAll (action)
+ public static class ListAllEvent extends ActionDomainEvent<SimpleObjectMenu> {}
+ @Action(
+ semantics = SemanticsOf.SAFE,
+ domainEvent = ListAllEvent.class
+ )
+ @ActionLayout(
+ bookmarking = BookmarkPolicy.AS_ROOT
+ )
+ @MemberOrder(sequence = "1")
+ public List<SimpleObject> listAll() {
+ return simpleObjectRepository.listAll();
+ }
+ //endregion
+
+ //region > findByName (action)
+ public static class FindByNameEvent extends ActionDomainEvent<SimpleObjectMenu> {}
+ @Action(
+ semantics = SemanticsOf.SAFE,
+ domainEvent = FindByNameEvent.class
+ )
+ @ActionLayout(
+ bookmarking = BookmarkPolicy.AS_ROOT
+ )
+ @MemberOrder(sequence = "2")
+ public List<SimpleObject> findByName(
+ @ParameterLayout(named="Name")
+ final String name
+ ) {
+ return simpleObjectRepository.findByName(name);
+ }
+ //endregion
+
+ //region > create (action)
+ public static class CreateDomainEvent extends ActionDomainEvent<SimpleObjectMenu> {}
+ @Action(
+ domainEvent = CreateDomainEvent.class
+ )
+ @MemberOrder(sequence = "3")
+ public SimpleObject create(
+ @ParameterLayout(named="Name")
+ final String name) {
+ return simpleObjectRepository.create(name);
+ }
+
+ //endregion
+
+ //region > injected services
+
+ @javax.inject.Inject
+ SimpleObjectRepository simpleObjectRepository;
+
+ //endregion
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/116325dd/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectRepository.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectRepository.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectRepository.java
new file mode 100644
index 0000000..f0cf4a3
--- /dev/null
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjectRepository.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package domainapp.dom.simple;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.applib.services.repository.RepositoryService;
+
+@DomainService(
+ nature = NatureOfService.DOMAIN,
+ repositoryFor = SimpleObject.class
+)
+public class SimpleObjectRepository {
+
+ public List<SimpleObject> listAll() {
+ return repositoryService.allInstances(SimpleObject.class);
+ }
+
+ public List<SimpleObject> findByName(final String name) {
+ return repositoryService.allMatches(
+ new QueryDefault<>(
+ SimpleObject.class,
+ "findByName",
+ "name", name));
+ }
+
+ public SimpleObject create(final String name) {
+ final SimpleObject obj = repositoryService.instantiate(SimpleObject.class);
+ obj.setName(name);
+ repositoryService.persist(obj);
+ return obj;
+ }
+
+ @javax.inject.Inject
+ RepositoryService repositoryService;
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/116325dd/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjects.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjects.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjects.java
deleted file mode 100644
index 98910da..0000000
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjects.java
+++ /dev/null
@@ -1,112 +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 domainapp.dom.simple;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Action;
-import org.apache.isis.applib.annotation.ActionLayout;
-import org.apache.isis.applib.annotation.BookmarkPolicy;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.DomainServiceLayout;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.ParameterLayout;
-import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.query.QueryDefault;
-import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
-import org.apache.isis.applib.services.i18n.TranslatableString;
-import org.apache.isis.applib.services.repository.RepositoryService;
-
-@DomainService(
- nature = NatureOfService.VIEW,
- repositoryFor = SimpleObject.class
-)
-@DomainServiceLayout(
- menuOrder = "10"
-)
-public class SimpleObjects {
-
- //region > title
- public TranslatableString title() {
- return TranslatableString.tr("Simple Objects");
- }
- //endregion
-
- //region > listAll (action)
- public static class ListAllEvent extends ActionDomainEvent<SimpleObjects> {}
- @Action(
- semantics = SemanticsOf.SAFE,
- domainEvent = ListAllEvent.class
- )
- @ActionLayout(
- bookmarking = BookmarkPolicy.AS_ROOT
- )
- @MemberOrder(sequence = "1")
- public List<SimpleObject> listAll() {
- return repositoryService.allInstances(SimpleObject.class);
- }
- //endregion
-
- //region > findByName (action)
- public static class FindByNameEvent extends ActionDomainEvent<SimpleObjects> {}
- @Action(
- semantics = SemanticsOf.SAFE,
- domainEvent = FindByNameEvent.class
- )
- @ActionLayout(
- bookmarking = BookmarkPolicy.AS_ROOT
- )
- @MemberOrder(sequence = "2")
- public List<SimpleObject> findByName(
- @ParameterLayout(named="Name")
- final String name
- ) {
- return repositoryService.allMatches(
- new QueryDefault<>(
- SimpleObject.class,
- "findByName",
- "name", name));
- }
- //endregion
-
- //region > create (action)
- public static class CreateDomainEvent extends ActionDomainEvent<SimpleObjects> {}
- @Action(
- domainEvent = CreateDomainEvent.class
- )
- @MemberOrder(sequence = "3")
- public SimpleObject create(
- @ParameterLayout(named="Name")
- final String name) {
- final SimpleObject obj = repositoryService.instantiate(SimpleObject.class);
- obj.setName(name);
- repositoryService.persist(obj);
- return obj;
- }
-
- //endregion
-
- //region > injected services
-
- @javax.inject.Inject
- RepositoryService repositoryService;
-
- //endregion
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/116325dd/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectRepositoryTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectRepositoryTest.java b/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectRepositoryTest.java
new file mode 100644
index 0000000..f1f96ec
--- /dev/null
+++ b/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectRepositoryTest.java
@@ -0,0 +1,104 @@
+/**
+ * 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 domainapp.dom.simple;
+
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+import org.jmock.Expectations;
+import org.jmock.Sequence;
+import org.jmock.auto.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.applib.services.repository.RepositoryService;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class SimpleObjectRepositoryTest {
+
+ @Rule
+ public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+ @Mock
+ RepositoryService mockRepositoryService;
+
+ SimpleObjectRepository simpleObjectRepository;
+
+ @Before
+ public void setUp() throws Exception {
+ simpleObjectRepository = new SimpleObjectRepository();
+ simpleObjectRepository.repositoryService = mockRepositoryService;
+ }
+
+ public static class Create extends SimpleObjectRepositoryTest {
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // given
+ final SimpleObject simpleObject = new SimpleObject();
+
+ final Sequence seq = context.sequence("create");
+ context.checking(new Expectations() {
+ {
+ oneOf(mockRepositoryService).instantiate(SimpleObject.class);
+ inSequence(seq);
+ will(returnValue(simpleObject));
+
+ oneOf(mockRepositoryService).persist(simpleObject);
+ inSequence(seq);
+ }
+ });
+
+ // when
+ final SimpleObject obj = simpleObjectRepository.create("Foobar");
+
+ // then
+ assertThat(obj).isEqualTo(simpleObject);
+ assertThat(obj.getName()).isEqualTo("Foobar");
+ }
+
+ }
+
+ public static class ListAll extends SimpleObjectRepositoryTest {
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // given
+ final List<SimpleObject> all = Lists.newArrayList();
+
+ context.checking(new Expectations() {
+ {
+ oneOf(mockRepositoryService).allInstances(SimpleObject.class);
+ will(returnValue(all));
+ }
+ });
+
+ // when
+ final List<SimpleObject> list = simpleObjectRepository.listAll();
+
+ // then
+ assertThat(list).isEqualTo(all);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/116325dd/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectsTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectsTest.java b/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectsTest.java
deleted file mode 100644
index e68e781..0000000
--- a/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectsTest.java
+++ /dev/null
@@ -1,104 +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 domainapp.dom.simple;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.jmock.Expectations;
-import org.jmock.Sequence;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.applib.services.repository.RepositoryService;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SimpleObjectsTest {
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- @Mock
- RepositoryService mockRepositoryService;
-
- SimpleObjects simpleObjects;
-
- @Before
- public void setUp() throws Exception {
- simpleObjects = new SimpleObjects();
- simpleObjects.repositoryService = mockRepositoryService;
- }
-
- public static class Create extends SimpleObjectsTest {
-
- @Test
- public void happyCase() throws Exception {
-
- // given
- final SimpleObject simpleObject = new SimpleObject();
-
- final Sequence seq = context.sequence("create");
- context.checking(new Expectations() {
- {
- oneOf(mockRepositoryService).instantiate(SimpleObject.class);
- inSequence(seq);
- will(returnValue(simpleObject));
-
- oneOf(mockRepositoryService).persist(simpleObject);
- inSequence(seq);
- }
- });
-
- // when
- final SimpleObject obj = simpleObjects.create("Foobar");
-
- // then
- assertThat(obj).isEqualTo(simpleObject);
- assertThat(obj.getName()).isEqualTo("Foobar");
- }
-
- }
-
- public static class ListAll extends SimpleObjectsTest {
-
- @Test
- public void happyCase() throws Exception {
-
- // given
- final List<SimpleObject> all = Lists.newArrayList();
-
- context.checking(new Expectations() {
- {
- oneOf(mockRepositoryService).allInstances(SimpleObject.class);
- will(returnValue(all));
- }
- });
-
- // when
- final List<SimpleObject> list = simpleObjects.listAll();
-
- // then
- assertThat(list).isEqualTo(all);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/116325dd/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectCreate.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectCreate.java b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectCreate.java
index 8823dd9..dae9a58 100644
--- a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectCreate.java
+++ b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectCreate.java
@@ -22,7 +22,7 @@ package domainapp.fixture.dom.simple;
import org.apache.isis.applib.fixturescripts.FixtureScript;
import domainapp.dom.simple.SimpleObject;
-import domainapp.dom.simple.SimpleObjects;
+import domainapp.dom.simple.SimpleObjectMenu;
public class SimpleObjectCreate extends FixtureScript {
@@ -59,13 +59,13 @@ public class SimpleObjectCreate extends FixtureScript {
String name = checkParam("name", ec, String.class);
- this.simpleObject = wrap(simpleObjects).create(name);
+ this.simpleObject = wrap(simpleObjectMenu).create(name);
// also make available to UI
ec.addResult(this, simpleObject);
}
@javax.inject.Inject
- private SimpleObjects simpleObjects;
+ private SimpleObjectMenu simpleObjectMenu;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/116325dd/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java
index 8263915..9b9d9aa 100644
--- a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java
+++ b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java
@@ -24,7 +24,7 @@ import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.When;
import domainapp.dom.simple.SimpleObject;
-import domainapp.dom.simple.SimpleObjects;
+import domainapp.dom.simple.SimpleObjectMenu;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -33,7 +33,7 @@ public class SimpleObjectGlue extends CukeGlueAbstract {
@Given("^there are.* (\\d+) simple objects$")
public void there_are_N_simple_objects(int n) throws Throwable {
try {
- final List<SimpleObject> findAll = service(SimpleObjects.class).listAll();
+ final List<SimpleObject> findAll = service(SimpleObjectMenu.class).listAll();
assertThat(findAll.size(), is(n));
putVar("list", "all", findAll);
@@ -44,7 +44,7 @@ public class SimpleObjectGlue extends CukeGlueAbstract {
@When("^I create a new simple object$")
public void I_create_a_new_simple_object() throws Throwable {
- service(SimpleObjects.class).create(UUID.randomUUID().toString());
+ service(SimpleObjectMenu.class).create(UUID.randomUUID().toString());
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/116325dd/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenuIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenuIntegTest.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenuIntegTest.java
new file mode 100644
index 0000000..ba3b3db
--- /dev/null
+++ b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectMenuIntegTest.java
@@ -0,0 +1,146 @@
+/*
+ * 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 domainapp.integtests.tests.modules.simple;
+
+import java.sql.SQLIntegrityConstraintViolationException;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import com.google.common.base.Throwables;
+
+import org.hamcrest.Description;
+import org.hamcrest.Matcher;
+import org.hamcrest.TypeSafeMatcher;
+import org.junit.Test;
+
+import org.apache.isis.applib.fixturescripts.FixtureScript;
+import org.apache.isis.applib.fixturescripts.FixtureScripts;
+import org.apache.isis.applib.services.xactn.TransactionService;
+
+import domainapp.dom.simple.SimpleObject;
+import domainapp.dom.simple.SimpleObjectMenu;
+import domainapp.fixture.dom.simple.SimpleObjectsTearDown;
+import domainapp.fixture.scenarios.RecreateSimpleObjects;
+import domainapp.integtests.tests.DomainAppIntegTest;
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class SimpleObjectMenuIntegTest extends DomainAppIntegTest {
+
+ @Inject
+ FixtureScripts fixtureScripts;
+ @Inject
+ TransactionService transactionService;
+ @Inject
+ SimpleObjectMenu simpleObjectMenu;
+
+ public static class ListAll extends SimpleObjectMenuIntegTest {
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // given
+ RecreateSimpleObjects fs = new RecreateSimpleObjects();
+ fixtureScripts.runFixtureScript(fs, null);
+ transactionService.nextTransaction();
+
+ // when
+ final List<SimpleObject> all = wrap(simpleObjectMenu).listAll();
+
+ // then
+ assertThat(all).hasSize(fs.getSimpleObjects().size());
+
+ SimpleObject simpleObject = wrap(all.get(0));
+ assertThat(simpleObject.getName()).isEqualTo(fs.getSimpleObjects().get(0).getName());
+ }
+
+ @Test
+ public void whenNone() throws Exception {
+
+ // given
+ FixtureScript fs = new SimpleObjectsTearDown();
+ fixtureScripts.runFixtureScript(fs, null);
+ transactionService.nextTransaction();
+
+ // when
+ final List<SimpleObject> all = wrap(simpleObjectMenu).listAll();
+
+ // then
+ assertThat(all).hasSize(0);
+ }
+ }
+
+ public static class Create extends SimpleObjectMenuIntegTest {
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // given
+ FixtureScript fs = new SimpleObjectsTearDown();
+ fixtureScripts.runFixtureScript(fs, null);
+ transactionService.nextTransaction();
+
+ // when
+ wrap(simpleObjectMenu).create("Faz");
+
+ // then
+ final List<SimpleObject> all = wrap(simpleObjectMenu).listAll();
+ assertThat(all).hasSize(1);
+ }
+
+ @Test
+ public void whenAlreadyExists() throws Exception {
+
+ // given
+ FixtureScript fs = new SimpleObjectsTearDown();
+ fixtureScripts.runFixtureScript(fs, null);
+ transactionService.nextTransaction();
+ wrap(simpleObjectMenu).create("Faz");
+ transactionService.nextTransaction();
+
+ // then
+ expectedExceptions.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));
+
+ // when
+ wrap(simpleObjectMenu).create("Faz");
+ transactionService.nextTransaction();
+ }
+
+ private static Matcher<? extends Throwable> causalChainContains(final Class<?> cls) {
+ return new TypeSafeMatcher<Throwable>() {
+ @Override
+ protected boolean matchesSafely(Throwable item) {
+ final List<Throwable> causalChain = Throwables.getCausalChain(item);
+ for (Throwable throwable : causalChain) {
+ if(cls.isAssignableFrom(throwable.getClass())){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("exception with causal chain containing " + cls.getSimpleName());
+ }
+ };
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/116325dd/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
deleted file mode 100644
index 7266845..0000000
--- a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
+++ /dev/null
@@ -1,143 +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 domainapp.integtests.tests.modules.simple;
-
-import java.sql.SQLIntegrityConstraintViolationException;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import com.google.common.base.Throwables;
-
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
-import org.junit.Test;
-
-import org.apache.isis.applib.fixturescripts.FixtureScript;
-import org.apache.isis.applib.fixturescripts.FixtureScripts;
-
-import domainapp.dom.simple.SimpleObject;
-import domainapp.dom.simple.SimpleObjects;
-import domainapp.fixture.dom.simple.SimpleObjectsTearDown;
-import domainapp.fixture.scenarios.RecreateSimpleObjects;
-import domainapp.integtests.tests.DomainAppIntegTest;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SimpleObjectsIntegTest extends DomainAppIntegTest {
-
- @Inject
- FixtureScripts fixtureScripts;
- @Inject
- SimpleObjects simpleObjects;
-
- public static class ListAll extends SimpleObjectsIntegTest {
-
- @Test
- public void happyCase() throws Exception {
-
- // given
- RecreateSimpleObjects fs = new RecreateSimpleObjects();
- fixtureScripts.runFixtureScript(fs, null);
- nextTransaction();
-
- // when
- final List<SimpleObject> all = wrap(simpleObjects).listAll();
-
- // then
- assertThat(all).hasSize(fs.getSimpleObjects().size());
-
- SimpleObject simpleObject = wrap(all.get(0));
- assertThat(simpleObject.getName()).isEqualTo(fs.getSimpleObjects().get(0).getName());
- }
-
- @Test
- public void whenNone() throws Exception {
-
- // given
- FixtureScript fs = new SimpleObjectsTearDown();
- fixtureScripts.runFixtureScript(fs, null);
- nextTransaction();
-
- // when
- final List<SimpleObject> all = wrap(simpleObjects).listAll();
-
- // then
- assertThat(all).hasSize(0);
- }
- }
-
- public static class Create extends SimpleObjectsIntegTest {
-
- @Test
- public void happyCase() throws Exception {
-
- // given
- FixtureScript fs = new SimpleObjectsTearDown();
- fixtureScripts.runFixtureScript(fs, null);
- nextTransaction();
-
- // when
- wrap(simpleObjects).create("Faz");
-
- // then
- final List<SimpleObject> all = wrap(simpleObjects).listAll();
- assertThat(all).hasSize(1);
- }
-
- @Test
- public void whenAlreadyExists() throws Exception {
-
- // given
- FixtureScript fs = new SimpleObjectsTearDown();
- fixtureScripts.runFixtureScript(fs, null);
- nextTransaction();
- wrap(simpleObjects).create("Faz");
- nextTransaction();
-
- // then
- expectedExceptions.expectCause(causalChainContains(SQLIntegrityConstraintViolationException.class));
-
- // when
- wrap(simpleObjects).create("Faz");
- nextTransaction();
- }
-
- private static Matcher<? extends Throwable> causalChainContains(final Class<?> cls) {
- return new TypeSafeMatcher<Throwable>() {
- @Override
- protected boolean matchesSafely(Throwable item) {
- final List<Throwable> causalChain = Throwables.getCausalChain(item);
- for (Throwable throwable : causalChain) {
- if(cls.isAssignableFrom(throwable.getClass())){
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void describeTo(Description description) {
- description.appendText("exception with causal chain containing " + cls.getSimpleName());
- }
- };
- }
- }
-
-}
\ No newline at end of file
[5/8] isis git commit: ISIS-1434: changes the order in which the
Shiro session is invalidated,
to perform before Wicket viewer completes its own invalidation.
Posted by da...@apache.org.
ISIS-1434: changes the order in which the Shiro session is invalidated, to perform before Wicket viewer completes its own invalidation.
The original implementation worked on jetty but not as a war file under Tomcat.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/0d906485
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/0d906485
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/0d906485
Branch: refs/heads/master
Commit: 0d906485127c41771d85e15783c0869313a27eea
Parents: 2f67917
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Jul 5 07:38:34 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Jul 5 07:38:34 2016 +0100
----------------------------------------------------------------------
.../wicket/AuthenticatedWebSessionForIsis.java | 28 +++++++++++++++++---
1 file changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/0d906485/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/AuthenticatedWebSessionForIsis.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/AuthenticatedWebSessionForIsis.java b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/AuthenticatedWebSessionForIsis.java
index 16e4454..60750f0 100644
--- a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/AuthenticatedWebSessionForIsis.java
+++ b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/AuthenticatedWebSessionForIsis.java
@@ -81,6 +81,30 @@ public class AuthenticatedWebSessionForIsis extends AuthenticatedWebSession impl
}
@Override
+ public void invalidateNow() {
+
+ // similar code in Restful Objects viewer (UserResourceServerside#logout)
+ // this needs to be done here because Wicket will expire the HTTP session
+ // while the Shiro authenticator uses the session to obtain the details of the principals for it to logout
+ //
+ // org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1195)
+ // org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:108)
+ // org.apache.shiro.web.session.HttpServletSession.getAttribute(HttpServletSession.java:146)
+ // org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121)
+ // org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469)
+ // org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153)
+ // org.apache.shiro.mgt.DefaultSecurityManager.logout(DefaultSecurityManager.java:547)
+ // org.apache.shiro.subject.support.DelegatingSubject.logout(DelegatingSubject.java:363)
+ // org.apache.isis.security.shiro.ShiroAuthenticatorOrAuthorizor.logout(ShiroAuthenticatorOrAuthorizor.java:179)
+ // org.apache.isis.core.runtime.authentication.standard.AuthenticationManagerStandard.closeSession(AuthenticationManagerStandard.java:141)
+
+ getAuthenticationManager().closeSession(authenticationSession);
+ getIsisSessionFactory().closeSession();
+
+ super.invalidateNow();
+ }
+
+ @Override
public void onInvalidate() {
super.onInvalidate();
@@ -93,10 +117,6 @@ public class AuthenticatedWebSessionForIsis extends AuthenticatedWebSession impl
userName = authenticationSession.getUserName();
}
- // similar code in Restful Objects viewer (UserResourceServerside#logout)
- getAuthenticationManager().closeSession(authenticationSession);
- getIsisSessionFactory().closeSession();
-
log(SessionLoggingService.Type.LOGOUT, userName, causedBy);
}
[7/8] isis git commit: ISIS-1335: makes tiny improvement to cg docs,
suggesting to tail the catalina.out once deployed to check ok.
Posted by da...@apache.org.
ISIS-1335: makes tiny improvement to cg docs, suggesting to tail the catalina.out once deployed to check ok.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/2ed9fa39
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/2ed9fa39
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/2ed9fa39
Branch: refs/heads/master
Commit: 2ed9fa3915e2685016b0786ddd08d30b2b784b4b
Parents: 4caa85b
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Jul 5 07:40:50 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Jul 5 07:40:50 2016 +0100
----------------------------------------------------------------------
.../src/main/asciidoc/guides/_cgcom_cutting-a-release.adoc | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/2ed9fa39/adocs/documentation/src/main/asciidoc/guides/_cgcom_cutting-a-release.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_cgcom_cutting-a-release.adoc b/adocs/documentation/src/main/asciidoc/guides/_cgcom_cutting-a-release.adoc
index 5943b14..d1b9566 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_cgcom_cutting-a-release.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_cgcom_cutting-a-release.adoc
@@ -449,6 +449,7 @@ popd
cp webapp/target/simpleapp.war $CATALINA_HOME/webapps/ROOT.war
pushd $CATALINA_HOME/bin
sh startup.sh
+tail -f ../logs/catalina.out
----
+
quit using:
[4/8] isis git commit: ISIS-1461: alternative fix for concurrency
exception when click on link.
Posted by da...@apache.org.
ISIS-1461: alternative fix for concurrency exception when click on link.
The solution is more localized; just disable concurrency checking when rendering a link.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/2f67917b
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/2f67917b
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/2f67917b
Branch: refs/heads/master
Commit: 2f67917b59eff89c2fc4d790bb8468ae97af9517
Parents: 07d2fd2
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Jul 5 07:36:31 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Jul 5 07:36:31 2016 +0100
----------------------------------------------------------------------
.../widgets/entitysimplelink/EntityLinkSimplePanel.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/2f67917b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java
index cf04df6..ed810b1 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/entitysimplelink/EntityLinkSimplePanel.java
@@ -24,6 +24,7 @@ import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.FormComponentPanel;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
import org.apache.isis.viewer.wicket.ui.ComponentFactory;
import org.apache.isis.viewer.wicket.ui.ComponentType;
@@ -44,7 +45,15 @@ public class EntityLinkSimplePanel extends FormComponentPanelAbstract<ObjectAdap
public EntityLinkSimplePanel(final String id, final EntityModel entityModel) {
super(id, entityModel);
setType(ObjectAdapter.class);
- buildGui();
+
+ // this is a bit of a hack, but getting a concurrency exception when click on a tab
+ // which simply holds a newly modified reference.
+ AdapterManager.ConcurrencyChecking.executeWithConcurrencyCheckingDisabled(new Runnable() {
+ @Override
+ public void run() {
+ buildGui();
+ }
+ });
}
public EntityModel getEntityModel() {
[6/8] isis git commit: ISIS-1335: changes liveReload logging config,
disables by default in the simpleapp.
Posted by da...@apache.org.
ISIS-1335: changes liveReload logging config, disables by default in the simpleapp.
Also adds a note in the doc that this plugin can occasionally - it would seem - interfere with Wicket viewer's ajax, making tabs unresponsive.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/4caa85bb
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/4caa85bb
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/4caa85bb
Branch: refs/heads/master
Commit: 4caa85bb26f801ff81f90bfb40f2ff614fbcdfce
Parents: 0d90648
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Jul 5 07:40:02 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Jul 5 07:40:02 2016 +0100
----------------------------------------------------------------------
.../src/main/asciidoc/guides/_dg_ide_intellij.adoc | 7 +++++++
.../webapp/src/main/webapp/WEB-INF/viewer_wicket.properties | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/4caa85bb/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc b/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
index 6fd163d..65e9aa0 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_dg_ide_intellij.adoc
@@ -571,6 +571,13 @@ The framework will automatically notice any changes to `.layout.xml` files, but
the classpath (the `target/classes` directory), not the source path. With IntelliJ these can be copied over manually
by invoking `Run > Reload Changed Classes`. Once the browser is refreshed, the new layout will be rendered.
+[NOTE]
+====
+We've occasionally noticed that this interferes with Wicket's own javascript - switching tabs becomes unresponsive.
+ The work-around is just to reload the page.
+====
+
+
To reduce the turn-around time there are therefore two steps to be automated:
* the copying of the `.layout.xml` files over to the `target/classes` directory
http://git-wip-us.apache.org/repos/asf/isis/blob/4caa85bb/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
index 27b07ca..5ed15f9 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
@@ -102,7 +102,7 @@ isis.viewer.wicket.themes.showChooser=true
#
# enable liveReload. For example, use with gradle -t -b liveReload.gradle --offline &
#
-isis.viewer.wicket.liveReloadUrl=http://localhost:35729/livereload.js?snipver=1
+#isis.viewer.wicket.liveReloadUrl=http://localhost:35729/livereload.js?snipver=1