You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2021/03/13 11:10:23 UTC
[isis-app-helloworld] branch jdo updated: makes docker build same
as simpleapp; delete tests
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch jdo
in repository https://gitbox.apache.org/repos/asf/isis-app-helloworld.git
The following commit(s) were added to refs/heads/jdo by this push:
new aaeb09c makes docker build same as simpleapp; delete tests
aaeb09c is described below
commit aaeb09c3ea03f33b6583689a1ced32542b4f535f
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sat Mar 13 11:10:03 2021 +0000
makes docker build same as simpleapp; delete tests
---
pom.xml | 315 ++++++++++-----------
.../modules/hello/dom/hwo/HelloWorldObject.java | 2 +-
.../hello/dom/hwo/HelloWorldObject_Test.java | 71 -----
.../hello/dom/hwo/HelloWorldObjects_Test.java | 79 ------
4 files changed, 150 insertions(+), 317 deletions(-)
diff --git a/pom.xml b/pom.xml
index c1e7f4b..b9dd697 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,171 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<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.isis.app</groupId>
- <artifactId>isis-app-starter-parent</artifactId>
- <version>2.0.0-M5</version>
- <relativePath/>
- </parent>
-
- <groupId>org.apache.isis.starters</groupId>
- <artifactId>helloworld-jdo</artifactId>
- <version>1.0.0-SNAPSHOT</version>
-
- <name>HelloWorld (JDO)</name>
-
- <packaging>jar</packaging>
-
- <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>
- <!-- running: mvn spring-boot:run -->
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.isis.mavendeps</groupId>
- <artifactId>isis-mavendeps-webapp</artifactId>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.mavendeps</groupId>
- <artifactId>isis-mavendeps-jdo</artifactId>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.mavendeps</groupId>
- <artifactId>isis-mavendeps-jdk11</artifactId>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-actuator-autoconfigure</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.testing</groupId>
- <artifactId>isis-testing-h2console-ui</artifactId>
- </dependency>
-
-
- <!-- TEST DEPENDENCIES -->
- <dependency>
- <groupId>org.apache.isis.mavendeps</groupId>
- <artifactId>isis-mavendeps-unittests</artifactId>
- <scope>test</scope>
- <type>pom</type>
- </dependency>
-
- </dependencies>
-
- <profiles>
- <profile>
- <id>docker</id>
- <activation>
- <property>
- <name>docker</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>com.google.cloud.tools</groupId>
- <artifactId>jib-maven-plugin</artifactId>
- <configuration>
- <from>
- <image>openjdk:8-alpine</image>
- </from>
- <container>
- <jvmFlags>
- <jvmFlag>-Xmx512m</jvmFlag>
- </jvmFlags>
- <mainClass>domainapp.webapp.HelloWorldApp</mainClass>
- <ports>
- <port>8080</port>
- </ports>
- <workingDirectory>/run/secrets</workingDirectory>
- </container>
- <to>
- <image>docker.io/apacheisis/helloworld:latest</image>
-<!--
-will use default credentials, eg in ~/.docker/config.json.
-Uncomment to override.
-
- <auth>
- <username>${env.DOCKER_REGISTRY_USERNAME}</username>
- <password>${env.DOCKER_REGISTRY_PASSWORD}</password>
- </auth>
--->
- </to>
- </configuration>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>staging</id>
- <activation>
- <property>
- <name>!skip.staging</name>
- </property>
- </activation>
- <repositories>
- <repository>
- <id>staging</id>
- <url>https://repository.apache.org/content/groups/staging/</url>
- </repository>
- </repositories>
- </profile>
- <profile>
- <id>nightly</id>
- <activation>
- <property>
- <name>!skip.nightly</name>
- </property>
- </activation>
- <repositories>
- <repository>
- <id>nightly-builds</id>
- <url>https://nexus.incode.work/repository/nightly-builds/</url>
- </repository>
- </repositories>
- </profile>
- </profiles>
+ 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.isis.app</groupId>
+ <artifactId>isis-app-starter-parent</artifactId>
+ <version>2.0.0-M5</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.apache.isis.starters</groupId>
+ <artifactId>helloworld-jdo</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <name>HelloWorld (JDO)</name>
+
+ <packaging>jar</packaging>
+
+ <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>
+ <!-- running: mvn spring-boot:run -->
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <classifier>exec</classifier>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.isis.mavendeps</groupId>
+ <artifactId>isis-mavendeps-webapp</artifactId>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.mavendeps</groupId>
+ <artifactId>isis-mavendeps-jdo</artifactId>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.mavendeps</groupId>
+ <artifactId>isis-mavendeps-jdk11</artifactId>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-actuator-autoconfigure</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.testing</groupId>
+ <artifactId>isis-testing-h2console-ui</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>deploy-to-docker-io</id>
+ <activation>
+ <property>
+ <name>docker</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <configuration>
+ <from>
+ <image>openjdk:8-alpine</image>
+ </from>
+ <container>
+ <jvmFlags>
+ <jvmFlag>-Xmx512m</jvmFlag>
+ </jvmFlags>
+ <mainClass>domainapp.webapp.HelloWorldApp</mainClass>
+ <ports>
+ <port>8080</port>
+ </ports>
+ </container>
+ <to>
+ <image>docker.io/apacheisis/helloworld</image>
+ <tags>
+ <tag>${env.REVISION}</tag>
+ </tags>
+ <auth>
+ <username>${env.DOCKER_REGISTRY_USERNAME}</username>
+ <password>${env.DOCKER_REGISTRY_PASSWORD}</password>
+ </auth>
+ </to>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>staging</id>
+ <activation>
+ <property>
+ <name>!skip.staging</name>
+ </property>
+ </activation>
+ <repositories>
+ <repository>
+ <id>staging</id>
+ <url>https://repository.apache.org/content/groups/staging/</url>
+ </repository>
+ </repositories>
+ </profile>
+ <profile>
+ <id>nightly</id>
+ <activation>
+ <property>
+ <name>!skip.nightly</name>
+ </property>
+ </activation>
+ <repositories>
+ <repository>
+ <id>nightly-builds</id>
+ <url>https://nexus.incode.work/repository/nightly-builds/</url>
+ </repository>
+ </repositories>
+ </profile>
+ </profiles>
</project>
diff --git a/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.java b/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.java
index c4afa18..5ccce46 100644
--- a/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.java
+++ b/src/main/java/domainapp/modules/hello/dom/hwo/HelloWorldObject.java
@@ -28,7 +28,7 @@ import domainapp.modules.hello.types.Notes;
name = "findByName",
value = "SELECT " +
"FROM domainapp.modules.hello.dom.hwo.HelloWorldObject " +
- "WHERE name.indexOf(:name) > 0"
+ "WHERE name.indexOf(:name) >= 0"
)
)
@javax.jdo.annotations.Version(strategy= VersionStrategy.DATE_TIME, column ="version")
diff --git a/src/test/java/domainapp/modules/hello/dom/hwo/HelloWorldObject_Test.java b/src/test/java/domainapp/modules/hello/dom/hwo/HelloWorldObject_Test.java
deleted file mode 100644
index fa236a5..0000000
--- a/src/test/java/domainapp/modules/hello/dom/hwo/HelloWorldObject_Test.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package domainapp.modules.hello.dom.hwo;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Nested;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import org.apache.isis.applib.services.message.MessageService;
-import org.apache.isis.applib.services.repository.RepositoryService;
-import org.apache.isis.applib.services.title.TitleService;
-
-@ExtendWith(MockitoExtension.class)
-class HelloWorldObject_Test {
-
- @Mock TitleService mockTitleService;
- @Mock MessageService mockMessageService;
- @Mock RepositoryService mockRepositoryService;
-
- HelloWorldObject object;
-
- @BeforeEach
- void setup() {
- object = new HelloWorldObject("Foo");
- object.titleService = mockTitleService;
- object.messageService = mockMessageService;
- object.repositoryService = mockRepositoryService;
- }
-
- @Nested
- public class updateName {
-
- @Test
- void happy_case() {
- // given
- assertThat(object.getName()).isEqualTo("Foo");
-
- // when
- object.updateName("Bar");
-
- // then
- assertThat(object.getName()).isEqualTo("Bar");
- }
-
- }
- @Nested
- class delete {
-
- @Test
- void happy_case() throws Exception {
-
- // given
- assertThat(object).isNotNull();
-
- // expecting
- when(mockTitleService.titleOf(object)).thenReturn("Foo");
-
- // when
- object.delete();
-
- // then
- verify(mockMessageService).informUser("'Foo' deleted");
- verify(mockRepositoryService).removeAndFlush(object);
- }
- }
-}
\ No newline at end of file
diff --git a/src/test/java/domainapp/modules/hello/dom/hwo/HelloWorldObjects_Test.java b/src/test/java/domainapp/modules/hello/dom/hwo/HelloWorldObjects_Test.java
deleted file mode 100644
index 5683e13..0000000
--- a/src/test/java/domainapp/modules/hello/dom/hwo/HelloWorldObjects_Test.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package domainapp.modules.hello.dom.hwo;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Nested;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentMatcher;
-import org.mockito.Mock;
-import org.mockito.junit.jupiter.MockitoExtension;
-import org.mockito.stubbing.Answer;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.argThat;
-import static org.mockito.Mockito.when;
-
-import org.apache.isis.applib.services.repository.RepositoryService;
-import org.apache.isis.persistence.jdo.applib.services.JdoSupportService;
-
-@ExtendWith(MockitoExtension.class)
-class HelloWorldObjects_Test {
-
- @Mock RepositoryService mockRepositoryService;
- @Mock JdoSupportService mockJdoSupportService;
-
- HelloWorldObjects objects;
-
- @BeforeEach
- public void setUp() {
- objects = new HelloWorldObjects(mockRepositoryService);
- }
-
- @Nested
- class create {
-
- @Test
- void happyCase() {
-
- // given
- final String someName = "Foobar";
-
- // expect
- when(mockRepositoryService.persist(
- argThat((ArgumentMatcher<HelloWorldObject>) simpleObject -> Objects.equals(simpleObject.getName(), someName)))
- ).then((Answer<HelloWorldObject>) invocation -> invocation.getArgument(0));
-
- // when
- final HelloWorldObject obj = objects.create(someName);
-
- // then
- assertThat(obj).isNotNull();
- assertThat(obj.getName()).isEqualTo(someName);
- }
- }
-
- @Nested
- class ListAll {
-
- @Test
- void happyCase() {
-
- // given
- final List<HelloWorldObject> all = new ArrayList<>();
-
- // expecting
- when(mockRepositoryService.allInstances(HelloWorldObject.class))
- .thenReturn(all);
-
- // when
- final List<HelloWorldObject> list = objects.listAll();
-
- // then
- assertThat(list).isEqualTo(all);
- }
- }
-}