http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/ident/title/TitleFacetViaMethodTest.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/ident/title/TitleFacetViaMethodTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/ident/title/TitleFacetViaMethodTest.java index 73a4d10..e703f48 100644 --- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/ident/title/TitleFacetViaMethodTest.java +++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/ident/title/TitleFacetViaMethodTest.java @@ -19,11 +19,7 @@ package org.apache.isis.core.metamodel.facets.object.ident.title; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - import java.lang.reflect.Method; - import org.jmock.Expectations; import org.jmock.Mockery; import org.jmock.integration.junit4.JMock; @@ -32,11 +28,13 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; - import org.apache.isis.core.metamodel.adapter.ObjectAdapter; import org.apache.isis.core.metamodel.facetapi.FacetHolder; import org.apache.isis.core.metamodel.facets.object.title.methods.TitleFacetViaTitleMethod; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + @RunWith(JMock.class) public class TitleFacetViaMethodTest { @@ -62,7 +60,7 @@ public class TitleFacetViaMethodTest { mockFacetHolder = mockery.mock(FacetHolder.class); mockOwningAdapter = mockery.mock(ObjectAdapter.class); final Method iconNameMethod = DomainObjectWithProblemInItsTitleMethod.class.getMethod("title"); - facet = new TitleFacetViaTitleMethod(iconNameMethod, mockFacetHolder); + facet = new TitleFacetViaTitleMethod(iconNameMethod, null, null, mockFacetHolder); mockery.checking(new Expectations() { {
http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/core/wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject.java ---------------------------------------------------------------------- diff --git a/core/wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject.java b/core/wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject.java index ad033bd..76a46f2 100644 --- a/core/wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject.java +++ b/core/wrapper/src/test/java/org/apache/isis/progmodel/wrapper/WrapperFactoryAbstractTest_wrappedObject.java @@ -317,8 +317,8 @@ public abstract class WrapperFactoryAbstractTest_wrappedObject { FacetUtil.addFacet(new PropertySetterFacetViaModifyMethod(modify, facetedMethod)); FacetUtil.addFacet(new PropertyClearFacetViaClearMethod(clear, facetedMethod)); FacetUtil.addFacet(new HideForContextFacetViaMethod(hide, facetedMethod)); - FacetUtil.addFacet(new DisableForContextFacetViaMethod(disable, facetedMethod)); - FacetUtil.addFacet(new PropertyValidateFacetViaMethod(validate, facetedMethod)); + FacetUtil.addFacet(new DisableForContextFacetViaMethod(disable, null, null, facetedMethod)); + FacetUtil.addFacet(new PropertyValidateFacetViaMethod(validate, null, null, facetedMethod)); FacetUtil.addFacet(new NamedFacetInferred(accessor.getName(), facetedMethod)); return facetedMethod; } http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/dom/src/main/java/dom/simple/SimpleObject.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/dom/src/main/java/dom/simple/SimpleObject.java b/example/application/simpleapp/dom/src/main/java/dom/simple/SimpleObject.java index b0cbb46..11d0d80 100644 --- a/example/application/simpleapp/dom/src/main/java/dom/simple/SimpleObject.java +++ b/example/application/simpleapp/dom/src/main/java/dom/simple/SimpleObject.java @@ -21,10 +21,18 @@ package dom.simple; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.VersionStrategy; import org.apache.isis.applib.DomainObjectContainer; +import org.apache.isis.applib.Identifier; +import org.apache.isis.applib.annotation.Action; import org.apache.isis.applib.annotation.BookmarkPolicy; import org.apache.isis.applib.annotation.DomainObject; import org.apache.isis.applib.annotation.DomainObjectLayout; +import org.apache.isis.applib.annotation.Editing; +import org.apache.isis.applib.annotation.Parameter; +import org.apache.isis.applib.annotation.ParameterLayout; +import org.apache.isis.applib.annotation.Property; import org.apache.isis.applib.annotation.Title; +import org.apache.isis.applib.services.eventbus.ActionDomainEvent; +import org.apache.isis.applib.services.i18n.TranslatableString; import org.apache.isis.applib.util.ObjectContracts; @javax.jdo.annotations.PersistenceCapable(identityType=IdentityType.DATASTORE) @@ -43,12 +51,20 @@ import org.apache.isis.applib.util.ObjectContracts; ) public class SimpleObject implements Comparable<SimpleObject> { + + public TranslatableString title() { + return TranslatableString.tr("Title is: {name}", "name", getName()); + } + //region > name (property) private String name; - @javax.jdo.annotations.Column(allowsNull="false") + @javax.jdo.annotations.Column(allowsNull="false", length = 40) @Title(sequence="1") + @Property( + editing = Editing.DISABLED + ) public String getName() { return name; } @@ -57,6 +73,35 @@ public class SimpleObject implements Comparable<SimpleObject> { this.name = name; } + // endregion + + //region > updateName (action) + + public static class UpdateNameDomainEvent extends ActionDomainEvent<SimpleObject> { + public UpdateNameDomainEvent(final SimpleObject source, final Identifier identifier, final Object... arguments) { + super(source, identifier, arguments); + } + } + + @Action( + domainEvent = UpdateNameDomainEvent.class + ) + public SimpleObject updateName( + @Parameter(maxLength = 40) + @ParameterLayout(named = "New name") + final String name) { + setName(name); + return this; + } + + public String default0UpdateName() { + return getName(); + } + + public TranslatableString validateUpdateName(final String name) { + return name.contains("!")? TranslatableString.tr("Exclamation mark is not allowed"): null; + } + //endregion //region > compareTo http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/dom/src/main/java/dom/simple/SimpleObject.layout.json ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/dom/src/main/java/dom/simple/SimpleObject.layout.json b/example/application/simpleapp/dom/src/main/java/dom/simple/SimpleObject.layout.json index 35f57bb..d84e88c 100644 --- a/example/application/simpleapp/dom/src/main/java/dom/simple/SimpleObject.layout.json +++ b/example/application/simpleapp/dom/src/main/java/dom/simple/SimpleObject.layout.json @@ -15,30 +15,34 @@ * limitations under the License. */ { - "columns": [ - { - "span": 6, - "memberGroups": { - "General": { - "members": { - "name": {} - } + "columns": [ + { + "span": 6, + "memberGroups": { + "General": { + "members": { + "name": { + "actions": { + "updateName": {} + } + } + } + } + } + }, + { + "span": 0, + "memberGroups": {} + }, + { + "span": 0, + "memberGroups": {} + }, + { + "span": 6, + "collections": {} } - } - }, - { - "span": 0, - "memberGroups": {} - }, - { - "span": 0, - "memberGroups": {} - }, - { - "span": 6, - "collections": {} - } - ], - "actions": {} + ], + "actions": {} } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/fixture/src/main/java/fixture/simple/SimpleObjectsFixturesService.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/fixture/src/main/java/fixture/simple/SimpleObjectsFixturesService.java b/example/application/simpleapp/fixture/src/main/java/fixture/simple/SimpleObjectsFixturesService.java index 242d934..f2c16ea 100644 --- a/example/application/simpleapp/fixture/src/main/java/fixture/simple/SimpleObjectsFixturesService.java +++ b/example/application/simpleapp/fixture/src/main/java/fixture/simple/SimpleObjectsFixturesService.java @@ -18,7 +18,7 @@ */ package fixture.simple; -import fixture.simple.scenario.SimpleObjectsFixture; +import fixture.simple.scenario.RecreateSimpleObjects; import java.util.List; import org.apache.isis.applib.annotation.Action; @@ -44,7 +44,7 @@ import org.apache.isis.applib.fixturescripts.SimpleFixtureScript; public class SimpleObjectsFixturesService extends FixtureScripts { public SimpleObjectsFixturesService() { - super("fixture.simple"); + super("fixture.simple", MultipleExecutionStrategy.EXECUTE); } @Override @@ -68,7 +68,7 @@ public class SimpleObjectsFixturesService extends FixtureScripts { ) @MemberOrder(sequence="20") public Object recreateObjectsAndReturnFirst() { - final List<FixtureResult> run = findFixtureScriptFor(SimpleObjectsFixture.class).run(null); + final List<FixtureResult> run = findFixtureScriptFor(RecreateSimpleObjects.class).run(null); return run.get(0).getObject(); } http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectAbstract.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectAbstract.java b/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectAbstract.java deleted file mode 100644 index 0edd80b..0000000 --- a/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectAbstract.java +++ /dev/null @@ -1,36 +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 fixture.simple.objects; - -import dom.simple.SimpleObject; -import dom.simple.SimpleObjects; - -import org.apache.isis.applib.fixturescripts.FixtureScript; - -public abstract class SimpleObjectAbstract extends FixtureScript { - - protected SimpleObject create(final String name, ExecutionContext executionContext) { - return executionContext.addResult(this, simpleObjects.create(name)); - } - - @javax.inject.Inject - private SimpleObjects simpleObjects; - -} http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectCreate.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectCreate.java b/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectCreate.java new file mode 100644 index 0000000..8f747eb --- /dev/null +++ b/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectCreate.java @@ -0,0 +1,70 @@ +/* + * 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 fixture.simple.objects; + +import dom.simple.SimpleObjects; + +import org.apache.isis.applib.fixturescripts.FixtureScript; + +public class SimpleObjectCreate extends FixtureScript { + + //region > name (input) + private String name; + /** + * Name of the object (required) + */ + public String getName() { + return name; + } + + public SimpleObjectCreate setName(final String name) { + this.name = name; + return this; + } + //endregion + + + //region > simpleObject (output) + private dom.simple.SimpleObject simpleObject; + + /** + * The created simple object (output). + * @return + */ + public dom.simple.SimpleObject getSimpleObject() { + return simpleObject; + } + //endregion + + @Override + protected void execute(final ExecutionContext ec) { + + String name = checkParam("name", ec, String.class); + + this.simpleObject = simpleObjects.create(name); + + // also make available to UI + ec.addResult(this, simpleObject); + } + + @javax.inject.Inject + private SimpleObjects simpleObjects; + +} http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForBar.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForBar.java b/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForBar.java deleted file mode 100644 index a59aea4..0000000 --- a/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForBar.java +++ /dev/null @@ -1,31 +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 fixture.simple.objects; - -public class SimpleObjectForBar extends SimpleObjectAbstract { - - @Override - protected void execute(ExecutionContext executionContext) { - - create("Bar", executionContext); - } - - -} http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForBaz.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForBaz.java b/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForBaz.java deleted file mode 100644 index b71baeb..0000000 --- a/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForBaz.java +++ /dev/null @@ -1,31 +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 fixture.simple.objects; - -public class SimpleObjectForBaz extends SimpleObjectAbstract { - - @Override - protected void execute(ExecutionContext executionContext) { - - create("Baz", executionContext); - } - - -} http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForFoo.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForFoo.java b/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForFoo.java deleted file mode 100644 index fa3d488..0000000 --- a/example/application/simpleapp/fixture/src/main/java/fixture/simple/objects/SimpleObjectForFoo.java +++ /dev/null @@ -1,31 +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 fixture.simple.objects; - -public class SimpleObjectForFoo extends SimpleObjectAbstract { - - @Override - protected void execute(ExecutionContext executionContext) { - - create("Foo", executionContext); - } - - -} http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/fixture/src/main/java/fixture/simple/scenario/RecreateSimpleObjects.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/fixture/src/main/java/fixture/simple/scenario/RecreateSimpleObjects.java b/example/application/simpleapp/fixture/src/main/java/fixture/simple/scenario/RecreateSimpleObjects.java new file mode 100644 index 0000000..ce8fcae --- /dev/null +++ b/example/application/simpleapp/fixture/src/main/java/fixture/simple/scenario/RecreateSimpleObjects.java @@ -0,0 +1,91 @@ +/* + * 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 fixture.simple.scenario; + +import dom.simple.SimpleObject; +import fixture.simple.SimpleObjectsTearDownFixture; +import fixture.simple.objects.SimpleObjectCreate; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import com.google.common.collect.Lists; +import org.apache.isis.applib.fixturescripts.FixtureScript; + +public class RecreateSimpleObjects extends FixtureScript { + + public final List<String> NAMES = Collections.unmodifiableList(Arrays.asList( + "Foo", "Bar", "Baz", "Frodo", "Froyo", "Fizz", "Bip", "Bop", "Bang", "Boo")); + + public RecreateSimpleObjects() { + withDiscoverability(Discoverability.DISCOVERABLE); + } + + //region > number (optional input) + private Integer number; + + /** + * The number of objects to create, up to 10; optional, defaults to 3. + * @return + */ + public Integer getNumber() { + return number; + } + + public RecreateSimpleObjects setNumber(final Integer number) { + this.number = number; + return this; + } + //endregion + + //region > simpleObjects (output) + private final List<SimpleObject> simpleObjects = Lists.newArrayList(); + + /** + * The simpleobjects created by this fixture (output). + */ + public List<SimpleObject> getSimpleObjects() { + return simpleObjects; + } + //endregion + + @Override + protected void execute(final ExecutionContext ec) { + + // defaults + final int number = defaultParam("number", ec, 3); + + // validate + if(number < 0 || number > NAMES.size()) { + throw new IllegalArgumentException(String.format("number must be in range [0,%d)", NAMES.size())); + } + + // + // execute + // + ec.executeChild(this, new SimpleObjectsTearDownFixture()); + + for (int i = 0; i < number; i++) { + final SimpleObjectCreate fs = new SimpleObjectCreate().setName(NAMES.get(i)); + ec.executeChild(this, fs.getName(), fs); + simpleObjects.add(fs.getSimpleObject()); + } + } +} http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/fixture/src/main/java/fixture/simple/scenario/SimpleObjectsFixture.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/fixture/src/main/java/fixture/simple/scenario/SimpleObjectsFixture.java b/example/application/simpleapp/fixture/src/main/java/fixture/simple/scenario/SimpleObjectsFixture.java deleted file mode 100644 index 608a13a..0000000 --- a/example/application/simpleapp/fixture/src/main/java/fixture/simple/scenario/SimpleObjectsFixture.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package fixture.simple.scenario; - -import fixture.simple.SimpleObjectsTearDownFixture; -import fixture.simple.objects.SimpleObjectForBar; -import fixture.simple.objects.SimpleObjectForBaz; -import fixture.simple.objects.SimpleObjectForFoo; - -import org.apache.isis.applib.fixturescripts.FixtureScript; - -public class SimpleObjectsFixture extends FixtureScript { - - public SimpleObjectsFixture() { - withDiscoverability(Discoverability.DISCOVERABLE); - } - - @Override - protected void execute(final ExecutionContext executionContext) { - - executionContext.executeChild(this, new SimpleObjectsTearDownFixture()); - - executionContext.executeChild(this, new SimpleObjectForFoo()); - executionContext.executeChild(this, new SimpleObjectForBar()); - executionContext.executeChild(this, new SimpleObjectForBaz()); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java b/example/application/simpleapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java index 1950881..29870e9 100644 --- a/example/application/simpleapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java +++ b/example/application/simpleapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java @@ -25,12 +25,6 @@ import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; public class BootstrappingGlue extends CukeGlueAbstract { - // ////////////////////////////////////// - - @Before(value={"@unit"}, order=100) - public void beforeScenarioUnitScope() { - before(ScenarioExecutionScope.UNIT); - } @Before(value={"@integration"}, order=100) public void beforeScenarioIntegrationScope() { @@ -45,9 +39,4 @@ public class BootstrappingGlue extends CukeGlueAbstract { assertMocksSatisfied(); after(sc); } - - // ////////////////////////////////////// - - - } http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java b/example/application/simpleapp/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java index 508a3a0..d714e28 100644 --- a/example/application/simpleapp/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java +++ b/example/application/simpleapp/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java @@ -17,30 +17,15 @@ package integration.glue; import cucumber.api.java.Before; -import dom.simple.SimpleObject; -import fixture.simple.scenario.SimpleObjectsFixture; +import fixture.simple.scenario.RecreateSimpleObjects; -import org.apache.isis.core.specsupport.scenarios.InMemoryDB; import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; public class CatalogOfFixturesGlue extends CukeGlueAbstract { - - @Before(value={"@unit", "@SimpleObjectsFixture"}, order=20000) - public void unitFixtures() throws Throwable { - final InMemoryDB inMemoryDB = new InMemoryDBForSimpleApp(this.scenarioExecution()); - inMemoryDB.getElseCreate(SimpleObject.class, "Foo"); - inMemoryDB.getElseCreate(SimpleObject.class, "Bar"); - inMemoryDB.getElseCreate(SimpleObject.class, "Baz"); - putVar("isis", "in-memory-db", inMemoryDB); - } - - // ////////////////////////////////////// - @Before(value={"@integration", "@SimpleObjectsFixture"}, order=20000) public void integrationFixtures() throws Throwable { - scenarioExecution().install(new SimpleObjectsFixture()); + scenarioExecution().install(new RecreateSimpleObjects()); } - } http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/integtests/src/test/java/integration/glue/InMemoryDBForSimpleApp.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/integtests/src/test/java/integration/glue/InMemoryDBForSimpleApp.java b/example/application/simpleapp/integtests/src/test/java/integration/glue/InMemoryDBForSimpleApp.java deleted file mode 100644 index e3ef0d5..0000000 --- a/example/application/simpleapp/integtests/src/test/java/integration/glue/InMemoryDBForSimpleApp.java +++ /dev/null @@ -1,40 +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 integration.glue; - -import dom.simple.SimpleObject; - -import org.apache.isis.core.specsupport.scenarios.InMemoryDB; -import org.apache.isis.core.specsupport.scenarios.ScenarioExecution; - -public class InMemoryDBForSimpleApp extends InMemoryDB { - - public InMemoryDBForSimpleApp(ScenarioExecution scenarioExecution) { - super(scenarioExecution); - } - - /** - * Hook to initialize if possible. - */ - @Override - protected void init(Object obj, String str) { - if(obj instanceof SimpleObject) { - SimpleObject simpleObject = (SimpleObject) obj; - simpleObject.setName(str); - } - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/integtests/src/test/java/integration/glue/simple/SimpleObjectGlue.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/integtests/src/test/java/integration/glue/simple/SimpleObjectGlue.java b/example/application/simpleapp/integtests/src/test/java/integration/glue/simple/SimpleObjectGlue.java index 13831ae..ad91b12 100644 --- a/example/application/simpleapp/integtests/src/test/java/integration/glue/simple/SimpleObjectGlue.java +++ b/example/application/simpleapp/integtests/src/test/java/integration/glue/simple/SimpleObjectGlue.java @@ -23,11 +23,6 @@ import dom.simple.SimpleObjects; import java.util.List; import java.util.UUID; -import org.hamcrest.Description; -import org.jmock.Expectations; -import org.jmock.api.Action; -import org.jmock.api.Invocation; -import org.apache.isis.core.specsupport.scenarios.InMemoryDB; import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; import static org.hamcrest.CoreMatchers.is; @@ -37,14 +32,6 @@ public class SimpleObjectGlue extends CukeGlueAbstract { @Given("^there are.* (\\d+) simple objects$") public void there_are_N_simple_objects(int n) throws Throwable { - if(supportsMocks()) { - checking(new Expectations() { - { - allowing(service(SimpleObjects.class)).listAll(); - will(returnValue(allSimpleObjects())); - } - }); - } try { final List<SimpleObject> findAll = service(SimpleObjects.class).listAll(); assertThat(findAll.size(), is(n)); @@ -57,40 +44,7 @@ public class SimpleObjectGlue extends CukeGlueAbstract { @When("^I create a new simple object$") public void I_create_a_new_simple_object() throws Throwable { - if(supportsMocks()) { - checking(new Expectations() { - { - oneOf(service(SimpleObjects.class)).create(with(any(String.class))); - will(addToInMemoryDB()); - } - }); - } service(SimpleObjects.class).create(UUID.randomUUID().toString()); } - private Action addToInMemoryDB() { - return new Action() { - - @Override - public Object invoke(Invocation invocation) throws Throwable { - final InMemoryDB inMemoryDB = getVar("isis", "in-memory-db", InMemoryDB.class); - final String name = (String)invocation.getParameter(0); - final SimpleObject obj = new SimpleObject(); - obj.setName(name); - inMemoryDB.put(SimpleObject.class, name, obj); - return obj; - } - - @Override - public void describeTo(Description description) { - description.appendText("add to database"); - } - }; - } - - // helper - private List<SimpleObject> allSimpleObjects() { - final InMemoryDB inMemoryDB = getVar("isis", "in-memory-db", InMemoryDB.class); - return inMemoryDB.findAll(SimpleObject.class); - } } http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/integtests/src/test/java/integration/specs/simple/SimpleObjectSpec_listAllAndCreate.feature ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/integtests/src/test/java/integration/specs/simple/SimpleObjectSpec_listAllAndCreate.feature b/example/application/simpleapp/integtests/src/test/java/integration/specs/simple/SimpleObjectSpec_listAllAndCreate.feature index aa7aeb6..88f26e6 100644 --- a/example/application/simpleapp/integtests/src/test/java/integration/specs/simple/SimpleObjectSpec_listAllAndCreate.feature +++ b/example/application/simpleapp/integtests/src/test/java/integration/specs/simple/SimpleObjectSpec_listAllAndCreate.feature @@ -17,17 +17,6 @@ @SimpleObjectsFixture Feature: List and Create New Simple Objectts - # the scenario is listed twice here just to demonstrate that it - # can be run either at @unit-level scope (using mocks) or - # at @integration-level scope (against the running system). - - @unit - Scenario: Existing simple objects can be listed and new ones created - Given there are initially 3 simple objects - When I create a new simple object - Then there are 4 simple objects - - @integration Scenario: Existing simple objects can be listed and new ones created Given there are initially 3 simple objects http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectIntegTest.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectIntegTest.java b/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectIntegTest.java new file mode 100644 index 0000000..0055242 --- /dev/null +++ b/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectIntegTest.java @@ -0,0 +1,132 @@ +/* + * 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 integration.tests.smoke; + +import dom.simple.SimpleObject; +import dom.simple.SimpleObjects; +import fixture.simple.scenario.RecreateSimpleObjects; +import integration.tests.SimpleAppIntegTest; + +import javax.inject.Inject; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.apache.isis.applib.fixturescripts.FixtureScripts; +import org.apache.isis.applib.services.i18n.TranslationService; +import org.apache.isis.applib.services.wrapper.DisabledException; +import org.apache.isis.applib.services.wrapper.InvalidException; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.junit.Assert.assertThat; + +public class SimpleObjectIntegTest extends SimpleAppIntegTest { + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Inject + FixtureScripts fixtureScripts; + @Inject + SimpleObjects simpleObjects; + @Inject + TranslationService translationService; + + 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, is(not(nullValue()))); + simpleObjectWrapped = wrap(simpleObjectPojo); + } + + public static class Name extends SimpleObjectIntegTest { + + @Test + public void accessible() throws Exception { + + // when + final String name = simpleObjectWrapped.getName(); + // + // then + assertThat(name, is(fs.NAMES.get(0))); + } + + @Test + public void cannotBeUpdatedDirectly() throws Exception { + + // expect + expectedExceptions.expect(DisabledException.class); + + // when + simpleObjectWrapped.setName("new name"); + } + } + + public static class UpdateName extends SimpleObjectIntegTest { + + @Test + public void happyCase() throws Exception { + + // when + simpleObjectWrapped.updateName("new name"); + + // then + assertThat(simpleObjectWrapped.getName(), is("new name")); + } + + @Test + public void failsValidation() throws Exception { + + // expect + expectedExceptions.expect(InvalidException.class); + expectedExceptions.expectMessage("Exclamation mark is not allowed"); + + // when + simpleObjectWrapped.updateName("new name!"); + } + } + + + public static class Title extends SimpleObjectIntegTest { + + @Test + public void interpolatesName() throws Exception { + + // given + final String name = simpleObjectWrapped.getName(); + + // when + final String title = container().titleOf(simpleObjectWrapped); + + // then + assertThat(title, is("Title is: " + name)); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectTest.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectTest.java b/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectTest.java deleted file mode 100644 index 13e24f9..0000000 --- a/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package integration.tests.smoke; - -import dom.simple.SimpleObject; -import dom.simple.SimpleObjects; -import fixture.simple.scenario.SimpleObjectsFixture; -import fixture.simple.SimpleObjectsTearDownFixture; -import integration.tests.SimpleAppIntegTest; - -import javax.inject.Inject; -import org.junit.Test; -import org.apache.isis.applib.fixturescripts.FixtureScript; -import org.apache.isis.applib.fixturescripts.FixtureScripts; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.junit.Assert.assertThat; - -public class SimpleObjectTest extends SimpleAppIntegTest { - - @Inject - FixtureScripts fixtureScripts; - @Inject - SimpleObjects simpleObjects; - - FixtureScript fixtureScript; - - public static class Name extends SimpleObjectTest { - - @Test - public void exists() throws Exception { - - // given - fixtureScript = new SimpleObjectsFixture(); - fixtureScripts.runFixtureScript(fixtureScript, null); - - final SimpleObject simpleObjectPojo = - fixtureScript.lookup("simple-objects-fixture/simple-object-for-foo/item-1", SimpleObject.class); - - // when - assertThat(simpleObjectPojo, is(not(nullValue()))); - final SimpleObject simpleObjectWrapped = wrap(simpleObjectPojo); - - // then - assertThat(simpleObjectWrapped.getName(), is("Foo")); - } - - @Test - public void doesNotExist() throws Exception { - - // given - fixtureScript = new SimpleObjectsTearDownFixture(); - fixtureScripts.runFixtureScript(fixtureScript, null); - - // when - SimpleObject simpleObjectPojo = fixtureScript.lookup("non-existent", SimpleObject.class); - - // then - assertThat(simpleObjectPojo, is(nullValue())); - - } - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectsIntegTest.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectsIntegTest.java b/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectsIntegTest.java new file mode 100644 index 0000000..066e910 --- /dev/null +++ b/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectsIntegTest.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 integration.tests.smoke; + +import dom.simple.SimpleObject; +import dom.simple.SimpleObjects; +import fixture.simple.SimpleObjectsTearDownFixture; +import fixture.simple.scenario.RecreateSimpleObjects; +import integration.tests.SimpleAppIntegTest; + +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.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.apache.isis.applib.fixturescripts.FixtureScript; +import org.apache.isis.applib.fixturescripts.FixtureScripts; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +public class SimpleObjectsIntegTest extends SimpleAppIntegTest { + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @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.size(), is(fs.getSimpleObjects().size())); + + SimpleObject simpleObject = wrap(all.get(0)); + assertThat(simpleObject.getName(), is(fs.getSimpleObjects().get(0).getName())); + } + + @Test + public void whenNone() throws Exception { + + // given + FixtureScript fs = new SimpleObjectsTearDownFixture(); + fixtureScripts.runFixtureScript(fs, null); + nextTransaction(); + + // when + final List<SimpleObject> all = wrap(simpleObjects).listAll(); + + // then + assertThat(all.size(), is(0)); + } + } + + public static class Create extends SimpleObjectsIntegTest { + + @Test + public void happyCase() throws Exception { + + // given + FixtureScript fs = new SimpleObjectsTearDownFixture(); + fixtureScripts.runFixtureScript(fs, null); + nextTransaction(); + + // when + wrap(simpleObjects).create("Faz"); + + // then + final List<SimpleObject> all = wrap(simpleObjects).listAll(); + assertThat(all.size(), is(1)); + } + + @Test + public void whenAlreadyExists() throws Exception { + + // given + FixtureScript fs = new SimpleObjectsTearDownFixture(); + fixtureScripts.runFixtureScript(fs, null); + nextTransaction(); + wrap(simpleObjects).create("Faz"); + nextTransaction(); + + // then + expectedException.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 http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectsTest.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectsTest.java b/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectsTest.java deleted file mode 100644 index 3963c8c..0000000 --- a/example/application/simpleapp/integtests/src/test/java/integration/tests/smoke/SimpleObjectsTest.java +++ /dev/null @@ -1,148 +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 integration.tests.smoke; - -import dom.simple.SimpleObject; -import dom.simple.SimpleObjects; -import fixture.simple.scenario.SimpleObjectsFixture; -import fixture.simple.SimpleObjectsTearDownFixture; -import integration.tests.SimpleAppIntegTest; - -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.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.apache.isis.applib.fixturescripts.FixtureScript; -import org.apache.isis.applib.fixturescripts.FixtureScripts; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -public class SimpleObjectsTest extends SimpleAppIntegTest { - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Inject - FixtureScripts fixtureScripts; - @Inject - SimpleObjects simpleObjects; - - FixtureScript fixtureScript; - - public static class ListAll extends SimpleObjectsTest { - - @Test - public void happyCase() throws Exception { - - // given - fixtureScript = new SimpleObjectsFixture(); - fixtureScripts.runFixtureScript(fixtureScript, null); - nextTransaction(); - - // when - final List<SimpleObject> all = wrap(simpleObjects).listAll(); - - // then - assertThat(all.size(), is(3)); - - SimpleObject simpleObject = wrap(all.get(0)); - assertThat(simpleObject.getName(), is("Foo")); - } - - @Test - public void whenNone() throws Exception { - - // given - fixtureScript = new SimpleObjectsTearDownFixture(); - fixtureScripts.runFixtureScript(fixtureScript, null); - nextTransaction(); - - // when - final List<SimpleObject> all = wrap(simpleObjects).listAll(); - - // then - assertThat(all.size(), is(0)); - } - } - - public static class Create extends SimpleObjectsTest { - - @Test - public void happyCase() throws Exception { - - // given - fixtureScript = new SimpleObjectsTearDownFixture(); - fixtureScripts.runFixtureScript(fixtureScript, null); - nextTransaction(); - - // when - wrap(simpleObjects).create("Faz"); - - // then - final List<SimpleObject> all = wrap(simpleObjects).listAll(); - assertThat(all.size(), is(1)); - } - - @Test - public void whenAlreadyExists() throws Exception { - - // given - fixtureScript = new SimpleObjectsTearDownFixture(); - fixtureScripts.runFixtureScript(fixtureScript, null); - nextTransaction(); - wrap(simpleObjects).create("Faz"); - nextTransaction(); - - // then - expectedException.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 http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties index c37c570..f0c1287 100644 --- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties +++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties @@ -191,7 +191,7 @@ isis.services = \ # in-memory object store, the fixtures are installed on every run. For other # object stores, they are used only when the object store is first initialized. # -isis.fixtures=fixture.simple.scenario.SimpleObjectsFixture +isis.fixtures=fixture.simple.scenario.RecreateSimpleObjects # @@ -272,7 +272,7 @@ isis.fixtures=fixture.simple.scenario.SimpleObjectsFixture # # force read translations, even if running in prototype mode # -#isis.services.translation.po.mode=read +isis.services.translation.po.mode=read http://git-wip-us.apache.org/repos/asf/isis/blob/3f5fbc44/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/translations.po ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/translations.po b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/translations.po index e1a1d7d..a5c4afa 100644 --- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/translations.po +++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/translations.po @@ -2,9 +2,6 @@ # # .pot file # -# generated at: 2015-02-17 16:21:01 -# generated by: TranslationServicePo -# # Translate this file to each required language and place in WEB-INF, eg: # # /WEB-INF/translations_en-US.po @@ -15,40 +12,18 @@ # ############################################################################## -#: org.apache.isis.core.metamodel.services.i18n.TranslationServicePoMenu#downloadPotFile(java.lang.String) -msgid ".pot file name" -msgstr "" - - #: dom.simple.SimpleObjects#create() msgid "Create" -msgstr "Create simple object" - - -#: org.apache.isis.core.metamodel.services.i18n.TranslationServicePoMenu#downloadPotFile() -msgid "Download Pot File" msgstr "" -#: org.apache.isis.applib.fixturescripts.FixtureResult#fixtureScriptClassName -msgid "Fixture script" -msgstr "" - - -#: org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault#isViewModel() -msgid "Is View Model" +#: dom.simple.SimpleObject#updateName() +msgid "Exclamation mark is not allowed" msgstr "" #: dom.simple.SimpleObjects#listAll() msgid "List All" -msgstr "List all objects" - - -#: fixture.simple.scenario.SimpleObjectsFixture#lookup() -#: org.apache.isis.applib.fixturescripts.FixtureScript#lookup() -#: org.apache.isis.applib.services.bookmark.BookmarkHolderActionContributions#lookup() -msgid "Lookup" msgstr "" @@ -57,69 +32,18 @@ msgid "Name" msgstr "" -#: org.apache.isis.applib.services.bookmark.BookmarkHolderAssociationContributions#object() -msgid "Object" +#: dom.simple.SimpleObject#updateName(java.lang.String) +msgid "New name" msgstr "" -#: fixture.simple.SimpleObjectsFixturesService#runFixtureScript(org.apache.isis.applib.fixturescripts.FixtureScript,java.lang.String) -#: org.apache.isis.applib.fixturescripts.FixtureScripts#runFixtureScript(org.apache.isis.applib.fixturescripts.FixtureScript,java.lang.String) -msgid "Parameters" -msgstr "" - - -#: fixture.simple.SimpleObjectsFixturesService -#: org.apache.isis.core.metamodel.services.i18n.TranslationServicePoMenu -msgid "Prototyping" -msgstr "" +#: dom.simple.SimpleObject#title() +msgid "Title is: {name}" +msgstr "'{name}' is the title" -#: fixture.simple.SimpleObjectsFixturesService#recreateObjectsAndReturnFirst() -msgid "Recreate Objects And Return First" -msgstr "" - - -#: org.apache.isis.applib.fixturescripts.FixtureResult#object -msgid "Result" -msgstr "" - - -#: org.apache.isis.applib.fixturescripts.FixtureResult#className -msgid "Result class" -msgstr "" - - -#: org.apache.isis.applib.fixturescripts.FixtureResult#key -msgid "Result key" -msgstr "" - - -#: fixture.simple.SimpleObjectsFixturesService#runFixtureScript() -#: org.apache.isis.applib.fixturescripts.FixtureScripts#runFixtureScript() -msgid "Run Fixture Script" -msgstr "" - - -#: fixture.simple.scenario.SimpleObjectsFixture -#: org.apache.isis.applib.fixturescripts.FixtureScript -msgid "Script" -msgstr "" - - -#: fixture.simple.SimpleObjectsFixturesService#runFixtureScript(org.apache.isis.applib.fixturescripts.FixtureScript,java.lang.String) -#: org.apache.isis.applib.fixturescripts.FixtureScripts#runFixtureScript(org.apache.isis.applib.fixturescripts.FixtureScript,java.lang.String) -msgid "Script-specific parameters (if any). The format depends on the script implementation (eg key=value, CSV, JSON, XML etc)" -msgstr "" - - -#: org.apache.isis.core.metamodel.services.i18n.po.TranslationServicePo#toPo() -msgid "To Po" -msgstr "" - - -#: fixture.simple.scenario.SimpleObjectsFixture#withDiscoverability() -#: org.apache.isis.applib.fixturescripts.FixtureScript#withDiscoverability() -msgid "With Discoverability" +#: dom.simple.SimpleObject#updateName() +msgid "Update Name" msgstr "" @@ -127,9 +51,5 @@ msgstr "" ############################################################################## -# # end of .pot file -# ############################################################################## - -
