http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/pom.xml ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/pom.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/pom.xml deleted file mode 100644 index fa907a3..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/pom.xml +++ /dev/null @@ -1,138 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>${groupId}</groupId> - <artifactId>${rootArtifactId}</artifactId> - <version>${version}</version> - </parent> - - <artifactId>${artifactId}</artifactId> - <name>SimpleApp Simple Module</name> - - <properties> - <isis-maven-plugin.validate.appManifest>domainapp.modules.simple.SimpleModuleManifest</isis-maven-plugin.validate.appManifest> - - <maven-checkstyle-plugin.configLocation>${project.parent.basedir}/_checks/checkstyle.xml</maven-checkstyle-plugin.configLocation> - <maven-pmd-plugin.ruleset>${project.parent.basedir}/_checks/pmd.xml</maven-pmd-plugin.ruleset> - - </properties> - - <build> - <resources> - <resource> - <directory>src/main/resources</directory> - </resource> - <resource> - <directory>src/main/java</directory> - <includes> - <include>**</include> - </includes> - <excludes> - <exclude>**/*.java</exclude> - </excludes> - </resource> - </resources> - <testResources> - <testResource> - <directory>src/test/resources</directory> - </testResource> - <testResource> - <directory>src/test/java</directory> - <includes> - <include>**</include> - </includes> - <excludes> - <exclude>**/*.java</exclude> - </excludes> - </testResource> - </testResources> - <plugins> - <plugin> - <groupId>com.github.odavid.maven.plugins</groupId> - <artifactId>mixin-maven-plugin</artifactId> - <version>0.1-alpha-39</version> - <extensions>true</extensions> - <configuration> - <mixins> - <mixin> - <groupId>com.danhaywood.mavenmixin</groupId> - <artifactId>standard</artifactId> - <version>${mavenmixin-standard.version}</version> - </mixin> - <mixin> - <groupId>com.danhaywood.mavenmixin</groupId> - <artifactId>enforcerrelaxed</artifactId> - <version>${mavenmixin-enforcerrelaxed.version}</version> - </mixin> - <mixin> - <groupId>com.danhaywood.mavenmixin</groupId> - <artifactId>datanucleusenhance</artifactId> - <version>${mavenmixin-datanucleusenhance.version}</version> - </mixin> - <mixin> - <groupId>com.danhaywood.mavenmixin</groupId> - <artifactId>isisvalidate</artifactId> - <version>${mavenmixin-isisvalidate.version}</version> - </mixin> - <mixin> - <groupId>com.danhaywood.mavenmixin</groupId> - <artifactId>surefire</artifactId> - <version>${mavenmixin-surefire.version}</version> - </mixin> - <mixin> - <groupId>com.danhaywood.mavenmixin</groupId> - <artifactId>sourceandjavadoc</artifactId> - <version>${mavenmixin-sourceandjavadoc.version}</version> - </mixin> - <mixin> - <groupId>com.danhaywood.mavenmixin</groupId> - <artifactId>staticanalysis</artifactId> - <version>${mavenmixin-staticanalysis.version}</version> - </mixin> - </mixins> - </configuration> - </plugin> - </plugins> - </build> - - <dependencies> - <dependency> - <groupId>org.apache.isis.core</groupId> - <artifactId>isis-core-applib</artifactId> - </dependency> - - <dependency> - <groupId>com.danhaywood.mavendeps</groupId> - <artifactId>isistesting</artifactId> - <version>${mavendeps-isistesting.version}</version> - <type>pom</type> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.hsqldb</groupId> - <artifactId>hsqldb</artifactId> - </dependency> - - </dependencies> - -</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/META-INF/persistence.xml ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/META-INF/persistence.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/META-INF/persistence.xml deleted file mode 100644 index c5d8e78..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/META-INF/persistence.xml +++ /dev/null @@ -1,29 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - 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. ---> -<persistence xmlns="http://java.sun.com/xml/ns/persistence" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> - - <persistence-unit name="simple"> - </persistence-unit> -</persistence> http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/SimpleModuleManifest.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/SimpleModuleManifest.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/SimpleModuleManifest.java deleted file mode 100644 index 3be4554..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/SimpleModuleManifest.java +++ /dev/null @@ -1,76 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.isis.applib.AppManifest; -import org.apache.isis.applib.fixturescripts.FixtureScript; - -import domainapp.modules.simple.dom.SimpleModuleDomSubmodule; -import domainapp.modules.simple.fixture.SimpleModuleFixtureSubmodule; - -/** - * Used by <code>isis-maven-plugin</code> (build-time validation of the module) and also by module-level integration tests. - */ -public class SimpleModuleManifest implements AppManifest { - - @Override - public List<Class<?>> getModules() { - return Arrays.<Class<?>>asList( - SimpleModuleDomSubmodule.class, - SimpleModuleFixtureSubmodule.class - ); - } - - @Override - public List<Class<?>> getAdditionalServices() { - return Collections.emptyList(); - } - - @Override - public String getAuthenticationMechanism() { - return null; - } - - @Override - public String getAuthorizationMechanism() { - return null; - } - - @Override - public List<Class<? extends FixtureScript>> getFixtures() { - return null; - } - - /** - * No overrides. - */ - @Override - public Map<String, String> getConfigurationProperties() { - return null; - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/SimpleModuleDomSubmodule.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/SimpleModuleDomSubmodule.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/SimpleModuleDomSubmodule.java deleted file mode 100644 index 9d82337..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/SimpleModuleDomSubmodule.java +++ /dev/null @@ -1,33 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.dom; - -public final class SimpleModuleDomSubmodule { - private SimpleModuleDomSubmodule(){} - - public static class PropertyDomainEvent<S,T> - extends org.apache.isis.applib.services.eventbus.PropertyDomainEvent<S,T> {} - public static class CollectionDomainEvent<S,T> - extends org.apache.isis.applib.services.eventbus.CollectionDomainEvent<S,T> {} - public static class ActionDomainEvent<S> extends - org.apache.isis.applib.services.eventbus.ActionDomainEvent<S> {} -} http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java deleted file mode 100644 index 95da22a..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.java +++ /dev/null @@ -1,133 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.dom.impl; - -import javax.jdo.annotations.IdentityType; -import javax.jdo.annotations.VersionStrategy; - -import org.apache.isis.applib.annotation.Action; -import org.apache.isis.applib.annotation.DomainObject; -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.SemanticsOf; -import org.apache.isis.applib.annotation.Title; -import org.apache.isis.applib.services.i18n.TranslatableString; -import org.apache.isis.applib.services.message.MessageService; -import org.apache.isis.applib.services.repository.RepositoryService; -import org.apache.isis.applib.services.title.TitleService; -import org.apache.isis.applib.util.ObjectContracts; - -import lombok.Getter; -import lombok.Setter; - -@javax.jdo.annotations.PersistenceCapable( - identityType=IdentityType.DATASTORE, - schema = "simple" -) -@javax.jdo.annotations.DatastoreIdentity( - strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY, - column="id") -@javax.jdo.annotations.Version( - strategy= VersionStrategy.DATE_TIME, - column="version") -@javax.jdo.annotations.Queries({ - @javax.jdo.annotations.Query( - name = "findByName", - value = "SELECT " - + "FROM domainapp.modules.simple.dom.impl.SimpleObject " - + "WHERE name.indexOf(:name) >= 0 ") -}) -@javax.jdo.annotations.Unique(name="SimpleObject_name_UNQ", members = {"name"}) -@DomainObject() // objectType inferred from @PersistenceCapable${symbol_pound}schema -public class SimpleObject implements Comparable<SimpleObject> { - - public SimpleObject(final String name) { - setName(name); - } - - @javax.jdo.annotations.Column(allowsNull = "false", length = 40) - @Property() // editing disabled by default, see isis.properties - @Getter @Setter - @Title(prepend = "Object: ") - private String name; - - @javax.jdo.annotations.Column(allowsNull = "true", length = 4000) - @Property(editing = Editing.ENABLED) - @Getter @Setter - private String notes; - - - //region > updateName (action) - @Action(semantics = SemanticsOf.IDEMPOTENT) - public SimpleObject updateName( - @Parameter(maxLength = 40) - @ParameterLayout(named = "Name") - final String name) { - setName(name); - return this; - } - - public String default0UpdateName() { - return getName(); - } - - public TranslatableString validate0UpdateName(final String name) { - return name != null && name.contains("!") ? TranslatableString.tr("Exclamation mark is not allowed") : null; - } - //endregion - - //region > delete (action) - @Action(semantics = SemanticsOf.NON_IDEMPOTENT_ARE_YOU_SURE) - public void delete() { - final String title = titleService.titleOf(this); - messageService.informUser(String.format("'%s' deleted", title)); - repositoryService.remove(this); - } - //endregion - - - //region > toString, compareTo - @Override - public String toString() { - return ObjectContracts.toString(this, "name"); - } - - @Override - public int compareTo(final SimpleObject other) { - return ObjectContracts.compare(this, other, "name"); - } - //endregion - - //region > injected services - @javax.inject.Inject - RepositoryService repositoryService; - - @javax.inject.Inject - TitleService titleService; - - @javax.inject.Inject - MessageService messageService; - //endregion - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.layout.xml ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.layout.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.layout.xml deleted file mode 100644 index 963c3e3..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.layout.xml +++ /dev/null @@ -1,69 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<!-- - 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. ---> -<bs3:grid xsi:schemaLocation="http://isis.apache.org/applib/layout/component http://isis.apache.org/applib/layout/component/component.xsd http://isis.apache.org/applib/layout/grid/bootstrap3 http://isis.apache.org/applib/layout/grid/bootstrap3/bootstrap3.xsd" xmlns:c="http://isis.apache.org/applib/layout/component" xmlns:bs3="http://isis.apache.org/applib/layout/grid/bootstrap3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - <bs3:row> - <bs3:col span="12" unreferencedActions="true"> - <c:domainObject bookmarking="AS_ROOT"/> - </bs3:col> - </bs3:row> - <bs3:row> - <bs3:col span="6"> - <bs3:tabGroup> - <bs3:tab name="General"> - <bs3:row> - <bs3:col span="12"> - <c:fieldSet name="Name"> - <c:action id="delete"/> - <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> - </bs3:tab> - <bs3:tab name="Metadata"> - <bs3:row> - <bs3:col span="12"> - <c:fieldSet name="Metadata"/> - </bs3:col> - </bs3:row> - </bs3:tab> - <bs3:tab name="Other"> - <bs3:row> - <bs3:col span="12"> - <c:fieldSet name="Other" unreferencedProperties="true"/> - </bs3:col> - </bs3:row> - </bs3:tab> - </bs3:tabGroup> - <bs3:tabGroup> - </bs3:tabGroup> - </bs3:col> - <bs3:col span="6"> - <bs3:tabGroup unreferencedCollections="true"> - </bs3:tabGroup> - </bs3:col> - </bs3:row> -</bs3:grid> http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.png ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.png b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.png deleted file mode 100644 index 0bd6f57..0000000 Binary files a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObject.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectMenu.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectMenu.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectMenu.java deleted file mode 100644 index 9114be5..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectMenu.java +++ /dev/null @@ -1,80 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.dom.impl; - -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; - -@DomainService( - nature = NatureOfService.VIEW_MENU_ONLY, - objectType = "simple.SimpleObjectMenu", - repositoryFor = SimpleObject.class -) -@DomainServiceLayout( - named = "Simple Objects", - menuOrder = "10" -) -public class SimpleObjectMenu { - - @Action(semantics = SemanticsOf.SAFE) - @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT) - @MemberOrder(sequence = "1") - public List<SimpleObject> listAll() { - return simpleObjectRepository.listAll(); - } - - - @Action(semantics = SemanticsOf.SAFE) - @ActionLayout(bookmarking = BookmarkPolicy.AS_ROOT) - @MemberOrder(sequence = "2") - public List<SimpleObject> findByName( - @ParameterLayout(named="Name") - final String name - ) { - return simpleObjectRepository.findByName(name); - } - - - 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); - } - - - @javax.inject.Inject - SimpleObjectRepository simpleObjectRepository; - -} http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectRepository.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectRepository.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectRepository.java deleted file mode 100644 index c6ee82b..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjectRepository.java +++ /dev/null @@ -1,61 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.dom.impl; - -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( - 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 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/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleModuleFixtureSubmodule.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleModuleFixtureSubmodule.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleModuleFixtureSubmodule.java deleted file mode 100644 index 3e70432..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/SimpleModuleFixtureSubmodule.java +++ /dev/null @@ -1,26 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.fixture; - -public final class SimpleModuleFixtureSubmodule { - private SimpleModuleFixtureSubmodule(){} -} http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/scenario/CreateSimpleObjects.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/scenario/CreateSimpleObjects.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/scenario/CreateSimpleObjects.java deleted file mode 100644 index e6ce665..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/scenario/CreateSimpleObjects.java +++ /dev/null @@ -1,80 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.fixture.scenario; - -import java.util.List; - -import javax.annotation.Nullable; - -import com.google.common.collect.Lists; - -import org.apache.isis.applib.fixturescripts.FixtureScript; - -import domainapp.modules.simple.dom.impl.SimpleObject; -import domainapp.modules.simple.dom.impl.SimpleObjectMenu; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; - -@Accessors(chain = true) -public class CreateSimpleObjects extends FixtureScript { - - /** - * The number of objects to create, up to 10; optional, defaults to 3. - */ - @Nullable - @Getter @Setter - private Integer number; - - /** - * The objects created by this fixture (output). - */ - @Getter - private final List<SimpleObject> simpleObjects = Lists.newArrayList(); - - @Override - protected void execute(final ExecutionContext ec) { - - int max = SimpleObjectData.values().length; - - // defaults - final int number = defaultParam("number", ec, 3); - - // validate - if(number < 0 || number > max) { - throw new IllegalArgumentException(String.format("number must be in range [0,%d)", max)); - } - - // execute - for (int i = 0; i < number; i++) { - final SimpleObjectData data = SimpleObjectData.values()[i]; - final SimpleObject simpleObject = data.createWith(wrap(simpleObjectMenu)); - ec.addResult(this, simpleObject); - simpleObjects.add(simpleObject); - } - } - - @javax.inject.Inject - SimpleObjectMenu simpleObjectMenu; - -} http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/scenario/SimpleObjectData.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/scenario/SimpleObjectData.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/scenario/SimpleObjectData.java deleted file mode 100644 index 9aa8017..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/scenario/SimpleObjectData.java +++ /dev/null @@ -1,52 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.fixture.scenario; - -import domainapp.modules.simple.dom.impl.SimpleObject; -import domainapp.modules.simple.dom.impl.SimpleObjectMenu; -import lombok.AllArgsConstructor; - -@AllArgsConstructor -public enum SimpleObjectData { - - FOO("Foo"), - BAR("Bar"), - BAZ("Baz"), - FRODO("Frodo"), - FROYO("Froyo"), - FIZZ("Fizz"), - BIP("Bip"), - BOP("Bop"), - BANG("Bang"), - BOO("Boo"); - - private final String name; - - public SimpleObject createWith(final SimpleObjectMenu menu) { - return menu.create(name); - } - - public SimpleObject findWith(final SimpleObjectMenu menu) { - return menu.findByName(name).get(0); - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/teardown/SimpleModuleTearDown.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/teardown/SimpleModuleTearDown.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/teardown/SimpleModuleTearDown.java deleted file mode 100644 index a5033a1..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/main/java/domainapp/modules/simple/fixture/teardown/SimpleModuleTearDown.java +++ /dev/null @@ -1,39 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.fixture.teardown; - -import org.apache.isis.applib.fixturescripts.FixtureScript; -import org.apache.isis.applib.services.jdosupport.IsisJdoSupport; - -public class SimpleModuleTearDown extends FixtureScript { - - @Override - protected void execute(ExecutionContext executionContext) { - isisJdoSupport.executeUpdate("delete from ${symbol_escape}"simple${symbol_escape}".${symbol_escape}"SimpleObject${symbol_escape}""); - } - - - @javax.inject.Inject - private IsisJdoSupport isisJdoSupport; - -} http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/dom/impl/SimpleObjectRepository_Test.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/dom/impl/SimpleObjectRepository_Test.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/dom/impl/SimpleObjectRepository_Test.java deleted file mode 100644 index 0b6a050..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/dom/impl/SimpleObjectRepository_Test.java +++ /dev/null @@ -1,128 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/** - * 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.modules.simple.dom.impl; - -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; -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; - -import static org.assertj.core.api.Assertions.assertThat; - -public class SimpleObjectRepository_Test { - - @Rule - public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES); - - @Mock - 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 SimpleObjectRepository_Test { - - @Test - public void happyCase() throws Exception { - - final String someName = "Foobar"; - - // given - final Sequence seq = context.sequence("create"); - context.checking(new Expectations() { - { - oneOf(mockServiceRegistry).injectServicesInto(with(any(SimpleObject.class))); - inSequence(seq); - - oneOf(mockRepositoryService).persist(with(nameOf(someName))); - inSequence(seq); - } - - }); - - // when - final SimpleObject obj = simpleObjectRepository.create(someName); - - // then - 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 SimpleObjectRepository_Test { - - @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/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/dom/impl/SimpleObject_Test.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/dom/impl/SimpleObject_Test.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/dom/impl/SimpleObject_Test.java deleted file mode 100644 index 43180a2..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/dom/impl/SimpleObject_Test.java +++ /dev/null @@ -1,52 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/** - * 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.modules.simple.dom.impl; - -import org.junit.Before; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class SimpleObject_Test { - - SimpleObject simpleObject; - - @Before - public void setUp() throws Exception { - simpleObject = new SimpleObject("Foobar"); - } - - public static class Name extends SimpleObject_Test { - - @Test - public void happyCase() throws Exception { - // given - assertThat(simpleObject.getName()).isEqualTo("Foobar"); - - // when - String name = "Foobar - updated"; - simpleObject.setName(name); - - // then - assertThat(simpleObject.getName()).isEqualTo(name); - } - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/SimpleModuleIntegTestAbstract.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/SimpleModuleIntegTestAbstract.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/SimpleModuleIntegTestAbstract.java deleted file mode 100644 index 97ba16e..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/SimpleModuleIntegTestAbstract.java +++ /dev/null @@ -1,86 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.integtests; - -import java.util.List; -import java.util.Map; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; - -import org.junit.BeforeClass; - -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 org.apache.isis.core.integtestsupport.IntegrationTestAbstract; -import org.apache.isis.core.integtestsupport.IsisSystemForTest; -import org.apache.isis.core.integtestsupport.scenarios.ScenarioExecutionForIntegration; - -import domainapp.modules.simple.SimpleModuleManifest; - -public abstract class SimpleModuleIntegTestAbstract extends IntegrationTestAbstract { - - @BeforeClass - public static void initSystem() { - org.apache.log4j.PropertyConfigurator.configure("logging-integtest.properties"); - IsisSystemForTest isft = IsisSystemForTest.getElseNull(); - if(isft == null) { - isft = new IsisSystemForTest.Builder() - .withLoggingAt(org.apache.log4j.Level.INFO) - .with(new SimpleModuleManifest() { - @Override - public Map<String, String> getConfigurationProperties() { - final Map<String, String> map = Maps.newHashMap(); - Util.withJavaxJdoRunInMemoryProperties(map); - Util.withDataNucleusProperties(map); - Util.withIsisIntegTestProperties(map); - // same as in isis.properties - map.put("isis.objects.editing","false"); - return map; - } - - @Override public List<Class<?>> getAdditionalServices() { - return (List)Lists.newArrayList(ModuleFixtureScriptsSpecificationProvider.class); - } - }) - - .build(); - isft.setUpSystem(); - IsisSystemForTest.set(isft); - } - - // instantiating will install onto ThreadLocal - new ScenarioExecutionForIntegration(); - } - - @DomainService(nature = NatureOfService.DOMAIN) - public static class ModuleFixtureScriptsSpecificationProvider implements FixtureScriptsSpecificationProvider { - @Override - public FixtureScriptsSpecification getSpecification() { - return FixtureScriptsSpecification.builder("domainapp.modules.simple").with( - FixtureScripts.MultipleExecutionStrategy.EXECUTE_ONCE_BY_VALUE).build(); - } - } -} http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/tests/SimpleObjectMenu_IntegTest.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/tests/SimpleObjectMenu_IntegTest.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/tests/SimpleObjectMenu_IntegTest.java deleted file mode 100644 index 635edfe..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/tests/SimpleObjectMenu_IntegTest.java +++ /dev/null @@ -1,150 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.integtests.tests; - -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.modules.simple.dom.impl.SimpleObject; -import domainapp.modules.simple.dom.impl.SimpleObjectMenu; -import domainapp.modules.simple.fixture.scenario.CreateSimpleObjects; -import domainapp.modules.simple.fixture.teardown.SimpleModuleTearDown; -import domainapp.modules.simple.integtests.SimpleModuleIntegTestAbstract; -import static org.assertj.core.api.Assertions.assertThat; - -public class SimpleObjectMenu_IntegTest extends SimpleModuleIntegTestAbstract { - - @Inject - FixtureScripts fixtureScripts; - @Inject - TransactionService transactionService; - @Inject - SimpleObjectMenu menu; - - public static class ListAll extends SimpleObjectMenu_IntegTest { - - @Test - public void happyCase() throws Exception { - - // given - fixtureScripts.runFixtureScript(new SimpleModuleTearDown(), null); - CreateSimpleObjects fs = new CreateSimpleObjects(); - 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 SimpleModuleTearDown(); - 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 SimpleModuleTearDown(); - 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 SimpleModuleTearDown(); - 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/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/tests/SimpleObject_IntegTest.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/tests/SimpleObject_IntegTest.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/tests/SimpleObject_IntegTest.java deleted file mode 100644 index 887c5d1..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/integtests/tests/SimpleObject_IntegTest.java +++ /dev/null @@ -1,162 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/* - * 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.modules.simple.integtests.tests; - -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.modules.simple.dom.impl.SimpleObject; -import domainapp.modules.simple.dom.impl.SimpleObjectMenu; -import domainapp.modules.simple.fixture.scenario.CreateSimpleObjects; -import domainapp.modules.simple.fixture.scenario.SimpleObjectData; -import domainapp.modules.simple.fixture.teardown.SimpleModuleTearDown; -import domainapp.modules.simple.integtests.SimpleModuleIntegTestAbstract; -import static org.assertj.core.api.Assertions.assertThat; - -public class SimpleObject_IntegTest extends SimpleModuleIntegTestAbstract { - - @Inject - FixtureScripts fixtureScripts; - @Inject - SimpleObjectMenu simpleObjectMenu; - @Inject - TransactionService transactionService; - - SimpleObject simpleObject; - - @Before - public void setUp() throws Exception { - // given - fixtureScripts.runFixtureScript(new SimpleModuleTearDown(), null); - CreateSimpleObjects fs = new CreateSimpleObjects().setNumber(1); - fixtureScripts.runFixtureScript(fs, null); - transactionService.nextTransaction(); - - simpleObject = SimpleObjectData.FOO.findWith(wrap(simpleObjectMenu)); - - 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).exec(); - - // 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).exec(); - // then - assertThat(timestamp).isNotNull(); - } - } - - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/specglue/SimpleObjectMenuGlue.java ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/specglue/SimpleObjectMenuGlue.java b/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/specglue/SimpleObjectMenuGlue.java deleted file mode 100644 index e5fd971..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/module-simple/src/test/java/domainapp/modules/simple/specglue/SimpleObjectMenuGlue.java +++ /dev/null @@ -1,56 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -/** - * 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.modules.simple.specglue; - -import java.util.List; -import java.util.UUID; - -import org.apache.isis.core.specsupport.specs.CukeGlueAbstract; - -import cucumber.api.java.en.Given; -import cucumber.api.java.en.When; -import domainapp.modules.simple.dom.impl.SimpleObject; -import domainapp.modules.simple.dom.impl.SimpleObjectMenu; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -public class SimpleObjectMenuGlue extends CukeGlueAbstract { - - @Given("^there are.* (${symbol_escape}${symbol_escape}d+) simple objects${symbol_dollar}") - public void there_are_N_simple_objects(int n) throws Throwable { - try { - final List<SimpleObject> list = simpleObjectMenu().listAll(); - assertThat(list.size(), is(n)); - putVar("java.util.List", "simpleObjects", list); - } finally { - assertMocksSatisfied(); - } - } - - @When("^.*create a .*simple object${symbol_dollar}") - public void create_a_simple_object() throws Throwable { - simpleObjectMenu().create(UUID.randomUUID().toString()); - } - - private SimpleObjectMenu simpleObjectMenu() { - return service(SimpleObjectMenu.class); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/f349adea/example/archetype/simpleapp/src/main/resources/archetype-resources/pom-jdo-enhance-all.xml ---------------------------------------------------------------------- diff --git a/example/archetype/simpleapp/src/main/resources/archetype-resources/pom-jdo-enhance-all.xml b/example/archetype/simpleapp/src/main/resources/archetype-resources/pom-jdo-enhance-all.xml deleted file mode 100644 index 6c9ba36..0000000 --- a/example/archetype/simpleapp/src/main/resources/archetype-resources/pom-jdo-enhance-all.xml +++ /dev/null @@ -1,92 +0,0 @@ -#set( $symbol_pound = '#' ) -#set( $symbol_dollar = '$' ) -#set( $symbol_escape = '\' ) -<?xml version="1.0" encoding="UTF-8"?> -<!-- 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. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache</groupId> - <artifactId>apache</artifactId> - <version>13</version> - <relativePath /> - </parent> - - <groupId>${package}</groupId> - <artifactId>${artifactId}-enhance-all</artifactId> - <version>0.0.1-SNAPSHOT</version> - - <packaging>pom</packaging> - - <name>Enhance All DOM Modules</name> - - <description> - Utility to enhance all Maven projects containing JDO entities with a single command: - mvn -f pom-jdo-enhance-all.xml datanucleus:enhance -o - </description> - - <properties> - <datanucleus-maven-plugin.version>4.0.1</datanucleus-maven-plugin.version> - </properties> - - <build> - <resources> - <resource> - <filtering>false</filtering> - <directory>src/main/resources</directory> - </resource> - <resource> - <filtering>false</filtering> - <directory>src/main/java</directory> - <includes> - <include>**</include> - </includes> - <excludes> - <exclude>**/*.java</exclude> - </excludes> - </resource> - </resources> - <plugins> - <plugin> - <groupId>org.datanucleus</groupId> - <artifactId>datanucleus-maven-plugin</artifactId> - <version>${symbol_dollar}{datanucleus-maven-plugin.version}</version> - <configuration> - <fork>false</fork> - <verbose>true</verbose> - </configuration> - <executions> - <execution> - <phase>compile</phase> - <goals> - <goal>enhance</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - - <profiles> - <profile> - <id>core</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> - <modules> - <module>module-simple</module> - </modules> - </profile> - </profiles> - -</project>