From 185f296a5b03f16edb62d0023441e89ad4365501 Mon Sep 17 00:00:00 2001 From: Ilkka Seppala Date: Thu, 6 Aug 2015 20:17:26 +0300 Subject: [PATCH] #189 Updated Naked Objects example with the code generated by the latest Apache Isis snapshot --- naked-objects/dom/pom.xml | 2 +- .../dom/modules/simple/SimpleObjects.java | 2 +- .../fixture/DomainAppFixturesProvider.java | 44 ++++++++ .../fixture/DomainAppFixturesService.java | 76 ------------- .../modules/simple/SimpleObjectsTearDown.java | 2 +- naked-objects/integtests/pom.xml | 41 +++++-- naked-objects/pom.xml | 101 ++++++++---------- naked-objects/webapp/pom.xml | 9 +- 8 files changed, 127 insertions(+), 150 deletions(-) create mode 100644 naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java delete mode 100644 naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesService.java diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml index 73cfd6a73..620efa9d7 100644 --- a/naked-objects/dom/pom.xml +++ b/naked-objects/dom/pom.xml @@ -72,7 +72,7 @@ true - 4.0.0-release + 4.0.1 diff --git a/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java b/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java index 47ab6c160..0634dd16a 100644 --- a/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java +++ b/naked-objects/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java @@ -70,7 +70,7 @@ public class SimpleObjects { final String name ) { return container.allMatches( - new QueryDefault( + new QueryDefault<>( SimpleObject.class, "findByName", "name", name)); diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java b/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java new file mode 100644 index 000000000..ab6b6b4be --- /dev/null +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesProvider.java @@ -0,0 +1,44 @@ +/* + * 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.fixture; + +import org.apache.isis.applib.annotation.DomainService; +import org.apache.isis.applib.annotation.NatureOfService; +import org.apache.isis.applib.fixturescripts.FixtureScripts; +import org.apache.isis.applib.services.fixturespec.FixtureScriptsSpecification; +import org.apache.isis.applib.services.fixturespec.FixtureScriptsSpecificationProvider; + +import domainapp.fixture.scenarios.RecreateSimpleObjects; + +/** + * Specifies where to find fixtures, and other settings. + */ +@DomainService(nature = NatureOfService.DOMAIN) +public class DomainAppFixturesProvider implements FixtureScriptsSpecificationProvider { + @Override + public FixtureScriptsSpecification getSpecification() { + return FixtureScriptsSpecification + .builder(DomainAppFixturesProvider.class) + .with(FixtureScripts.MultipleExecutionStrategy.EXECUTE) + .withRunScriptDefault(RecreateSimpleObjects.class) + .withRunScriptDropDown(FixtureScriptsSpecification.DropDownPolicy.CHOICES) + .withRecreate(RecreateSimpleObjects.class) + .build(); + } +} diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesService.java b/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesService.java deleted file mode 100644 index 751bad316..000000000 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/DomainAppFixturesService.java +++ /dev/null @@ -1,76 +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.fixture; - -import java.util.List; - -import org.apache.isis.applib.annotation.Action; -import org.apache.isis.applib.annotation.ActionLayout; -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.RestrictTo; -import org.apache.isis.applib.fixturescripts.FixtureResult; -import org.apache.isis.applib.fixturescripts.FixtureScript; -import org.apache.isis.applib.fixturescripts.FixtureScripts; - -import domainapp.fixture.scenarios.RecreateSimpleObjects; - -/** - * Enables fixtures to be installed from the application. - */ -@DomainService -@DomainServiceLayout( - named="Prototyping", - menuBar = DomainServiceLayout.MenuBar.SECONDARY, - menuOrder = "500" -) -public class DomainAppFixturesService extends FixtureScripts { - - public DomainAppFixturesService() { - super(DomainAppFixturesService.class.getPackage().getName(), MultipleExecutionStrategy.EXECUTE); - } - - @Override - public FixtureScript default0RunFixtureScript() { - return findFixtureScriptFor(RecreateSimpleObjects.class); - } - - @Override - public List choices0RunFixtureScript() { - return super.choices0RunFixtureScript(); - } - - - // ////////////////////////////////////// - - @Action( - restrictTo = RestrictTo.PROTOTYPING - ) - @ActionLayout( - cssClassFa="fa fa-refresh" - ) - @MemberOrder(sequence="20") - public Object recreateObjectsAndReturnFirst() { - final List run = findFixtureScriptFor(RecreateSimpleObjects.class).run(null); - return run.get(0).getObject(); - } - - -} diff --git a/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java b/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java index 8767b6fb8..cc06eb4ac 100644 --- a/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java +++ b/naked-objects/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java @@ -26,7 +26,7 @@ public class SimpleObjectsTearDown extends FixtureScript { @Override protected void execute(ExecutionContext executionContext) { - isisJdoSupport.executeUpdate("delete from simple.\"SimpleObject\""); + isisJdoSupport.executeUpdate("delete from \"simple\".\"SimpleObject\""); } diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml index 9e595f7b9..f479896cc 100644 --- a/naked-objects/integtests/pom.xml +++ b/naked-objects/integtests/pom.xml @@ -84,17 +84,38 @@ hsqldb - - + + + net.masterthought + cucumber-reporting + 0.0.21 + + + net.masterthought + maven-cucumber-reporting + 0.0.4 + + --> + + + diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index 56acd4a15..8860815af 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -240,61 +240,52 @@ **/translations*.po - - AL2 - Apache License 2.0 - - - Licensed to the Apache Software Foundation (ASF) under - one - - - - JQRY - MIT - - - Dual licensed under the MIT or GPL Version 2 licenses. - - - - JMOCK - JMock - - - Copyright (c) 2000-2007, jMock.org - - - - DOCBK - DocBook 4.5 - - - Permission to copy in any form is granted for use - Permission to use, copy, modify and distribute the - DocBook DTD - is hereby granted in perpetuity, provided that the - above copyright - This is the catalog data file for DocBook XML V4.5. It - is provided as - XML Catalog data for DocBook XML V4.5 - DocBook additional general entities V4.5 - XML EXCHANGE TABLE MODEL DECLARATION MODULE - - - - W3C - XHTML - - - Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio), - - + + AL2 + Apache License 2.0 + + + Licensed to the Apache Software Foundation (ASF) under one + + + + JQRY + MIT + + + Dual licensed under the MIT or GPL Version 2 licenses. + + + + JMOCK + JMock + + + Copyright (c) 2000-2007, jMock.org + + + + DOCBK + DocBook 4.5 + + + Permission to copy in any form is granted for use + Permission to use, copy, modify and distribute the DocBook DTD + is hereby granted in perpetuity, provided that the above copyright + This is the catalog data file for DocBook XML V4.5. It is provided as + XML Catalog data for DocBook XML V4.5 + DocBook additional general entities V4.5 + XML EXCHANGE TABLE MODEL DECLARATION MODULE + + + + W3C + XHTML + + + Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio), + + diff --git a/naked-objects/webapp/pom.xml b/naked-objects/webapp/pom.xml index fb80173f2..9873589c7 100644 --- a/naked-objects/webapp/pom.xml +++ b/naked-objects/webapp/pom.xml @@ -236,8 +236,7 @@ - + @@ -303,10 +302,8 @@ - - + +