use junit5, update doku, add docker profile, update maven compiler plugin
diff --git a/src/main/resources/archetype-resources/docs/DOCKER-README.md b/src/main/resources/archetype-resources/docs/DOCKER-README.md
index b6be1e2..2c4af11 100644
--- a/src/main/resources/archetype-resources/docs/DOCKER-README.md
+++ b/src/main/resources/archetype-resources/docs/DOCKER-README.md
@@ -52,59 +52,14 @@
N.B. You may use the command *docker compose* or *docker-compose*, but will slightly different results.
-- Check database service call in ** target/<projectname>/WEB-INF/jetty-env.xml**. It should reference the service name (db), not localhost - as it is also set in maven docker profile.
+
+- Double check database service call in ** target/<projectname>/WEB-INF/jetty-env.xml**. It should reference the service name (db), not localhost - this was set when using the maven docker profile.
```xml
<Set name="url">jdbc:mysql://db:3306/turbine</Set>
```
-
-- To change velocity templates check webapp in ** src/main/webapp**. Ohter resources might depend on https://www.eclipse.org/jetty/documentation/jetty-9/index.html#jars-scanned-for-annotations.
-
-## Cleanup or restart (optional)
-
-- Optionally Check system or cleanup, e.g. with docker-compose down, docker-compose down -v or docker sytem prune (removes any container on system).
-
-- If services are already installed, activate/start by
- docker-compose up
-
- Example Logs:
-
- [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.25-1debian10 started.
- [Note] [Entrypoint]: Switching to dedicated user 'mysql'
- [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.25-1debian10 started.
-
- [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.25) starting as process 1
- [System] [MY-013576] [InnoDB] InnoDB initialization has started.
- [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
- [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
- [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
- [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
- [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
- [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.25' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
-
- Listening for transport dt_socket at address: 9000
-
- [INFO] Scanning for projects...
- [INFO]
- [INFO] ------< org.apache.turbine.test.integrationtest:integrationtest >-------
- [INFO] Building My Turbine Web Application 1.0.0-SNAPSHOT
- [INFO] --------------------------------[ war ]---------------------------------
- [INFO]
- [INFO] >>> jetty-maven-plugin:9.4.43.v20210629:run (default-cli) > test-compile @ integrationtest >>>
- [INFO]
- [INFO] --- torque-maven-plugin:5.1-SNAPSHOT:generate (torque-om) @ integrationtest ---
- [main] INFO | org.apache.torque.generator.control.Controller - readConfiguration() : Starting to read configuration files
-
-
-- Starting the app service will build the app and start jetty with Maven on port 8081.
-This command is set as a **command** in the app service in docker compose.
-
-Currently the docker-compose is generated once more, if starting the containers, this will overwrite m2repo and may result in errors.
-
-If not yet done, build on the host with mvn clean install -f ../pom.xml -Pdocker.
-
### Build Services
The app service uses later a volume, which maps to the local maven repository, which you may need/not need.
@@ -148,6 +103,51 @@
By default remote debugging is activated (port 9000), which could be removed/commented in docker-compose.yml.
You could follow the logs with docker-compose logs -f app or docker-compose logs -f db.
+
+- To change velocity templates check webapp in ** src/main/webapp** and run in another window *mvn package*. Jetty should restart automatically. Other resources might depend on https://www.eclipse.org/jetty/documentation/jetty-9/index.html#jars-scanned-for-annotations.
+
+### Cleanup or restart (optional)
+
+- Optionally Check system or cleanup, e.g. with docker-compose down, docker-compose down -v or docker sytem prune (removes any container on system).
+
+- If services are already installed, activate/start by
+ docker-compose up
+
+ Example Logs:
+
+ [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.25-1debian10 started.
+ [Note] [Entrypoint]: Switching to dedicated user 'mysql'
+ [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.25-1debian10 started.
+
+ [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.25) starting as process 1
+ [System] [MY-013576] [InnoDB] InnoDB initialization has started.
+ [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
+ [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
+ [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
+ [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
+ [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
+ [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.25' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
+
+ Listening for transport dt_socket at address: 9000
+
+ [INFO] Scanning for projects...
+ [INFO]
+ [INFO] ------< org.apache.turbine.test.integrationtest:integrationtest >-------
+ [INFO] Building My Turbine Web Application 1.0.0-SNAPSHOT
+ [INFO] --------------------------------[ war ]---------------------------------
+ [INFO]
+ [INFO] >>> jetty-maven-plugin:9.4.43.v20210629:run (default-cli) > test-compile @ integrationtest >>>
+ [INFO]
+ [INFO] --- torque-maven-plugin:5.1-SNAPSHOT:generate (torque-om) @ integrationtest ---
+ [main] INFO | org.apache.torque.generator.control.Controller - readConfiguration() : Starting to read configuration files
+
+- Starting the app service will build the app and start jetty with Maven on port 8081.
+This command is set as a **command** in the app service in docker compose.
+
+Currently the docker-compose is generated once more, if starting the containers, this will overwrite m2repo and may result in errors.
+
+If not yet done, build on the host with mvn clean install -f ../pom.xml -Pdocker.
+
#### Lifecycle (developers only)
- If you generate the archetype itself, you might have to stop the services before cleaning up (docker-compose stop).
diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml
index 4a79ce1..03a43d2 100644
--- a/src/main/resources/archetype-resources/pom.xml
+++ b/src/main/resources/archetype-resources/pom.xml
@@ -101,7 +101,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.0</version>
+ <version>3.8.1</version>
<configuration>
<source>#var("maven.compile.source")</source>
<target>#var("maven.compile.target")</target>
@@ -437,7 +437,8 @@
</webApp>
</configuration>
</plugin>
- <!-- aswe call this profile in docker-resources/docker-compose.yml for app, which will replace /m2repo,
+ <!-- we call this profile in docker-resources/docker-compose.yml for app,
+ which should not replace /m2repo,
we want to avoid a second parsing from inside the container -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/src/main/resources/archetype-resources/src/main/docker-resources/docker-compose.yml b/src/main/resources/archetype-resources/src/main/docker-resources/docker-compose.yml
index 8d595a7..13180c9 100644
--- a/src/main/resources/archetype-resources/src/main/docker-resources/docker-compose.yml
+++ b/src/main/resources/archetype-resources/src/main/docker-resources/docker-compose.yml
@@ -12,7 +12,7 @@
- MAVEN_OPTS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9000
# this runs the app server in the container, be sure not to filter resources once again!
- command: mvn -Pjetty
+ command: mvn -Pjetty,docker
ports:
- "8081:8081"
# remote debugging port, uncomment if not needed
diff --git a/src/main/resources/archetype-resources/src/main/webapp/templates/app/layouts/Default.vm b/src/main/resources/archetype-resources/src/main/webapp/templates/app/layouts/Default.vm
index 798ecba..7a5befc 100644
--- a/src/main/resources/archetype-resources/src/main/webapp/templates/app/layouts/Default.vm
+++ b/src/main/resources/archetype-resources/src/main/webapp/templates/app/layouts/Default.vm
@@ -1,58 +1,58 @@
-## 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.
-
-$page.addStyleSheet("http://www.w3schools.com/lib/w3.css")
-$page.addStyleSheet("http://www.w3schools.com/lib/w3-theme-blue-grey.css")
-$page.setTitle("Sample Apache Turbine Application")
-$page.addScript($ui.getScript("page.js"))
-<html>
-
-#TurbineHtmlHead()
-
-<link href="$ui.getStylecss()" rel="stylesheet" type="text/css" />
-
-<body #TurbineHtmlBodyAttributes() class="w3-theme-l4">
-
- <div class="w3-wrapper">
-
- <!-- Header -->
- <header class="w3-container w3-center w3-padding-32 w3-theme">
- <img class="w3-right" src="$ui.image('turbine4-project.png')" />
- #if ( $data.getUser().hasLoggedIn() )
- #set ( $u = $data.getUser() )
- <div class="w3-right">
- <h5>Hello $!u.FirstName</h5>
- </div>
- #end
- </header>
-
- <!-- Default Menu -->
- $navigation.setTemplate("/Menu.vm")
-
- <!-- Content -->
- <div class="w3-left w3-padding" id="content">
- $screen_placeholder
- </div>
-
- <!-- Footer -->
- <footer class="w3-bottom">
- <p>Powered by <img src="$ui.image('pb-turbine100px.png')"/></p>
- </footer>
- </div>
-
-</body>
-</html>
+## 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.
+
+$page.addStyleSheet("http://www.w3schools.com/lib/w3.css")
+$page.addStyleSheet("http://www.w3schools.com/lib/w3-theme-blue-grey.css")
+$page.setTitle("Sample Apache Turbine Application")
+$page.addScript($ui.getScript("page.js"))
+<html>
+
+#TurbineHtmlHead()
+
+<link href="$ui.getStylecss()" rel="stylesheet" type="text/css" />
+
+<body #TurbineHtmlBodyAttributes() class="w3-theme-l4">
+
+ <div class="w3-wrapper">
+
+ <!-- Header -->
+ <header class="w3-container w3-center w3-padding-32 w3-theme">
+ <img class="w3-right" src="$ui.image('turbine4-project.png')" />
+ #if ( $data.getUser().hasLoggedIn() )
+ #set ( $u = $data.getUser() )
+ <div class="w3-right">
+ <h5>Hello $!u.FirstName</h5>
+ </div>
+ #end
+ </header>
+
+ <!-- Default Menu -->
+ $navigation.setTemplate("/Menu.vm")
+
+ <!-- Content -->
+ <div class="w3-left w3-padding" id="content">
+ $screen_placeholder
+ </div>
+
+ <!-- Footer -->
+ <footer class="w3-bottom">
+ <p>Powered by <img src="$ui.image('pb-turbine100px.png')"/></p>
+ </footer>
+ </div>
+
+</body>
+</html>
diff --git a/src/main/resources/archetype-resources/src/main/webapp/templates/app/screens/Index.vm b/src/main/resources/archetype-resources/src/main/webapp/templates/app/screens/Index.vm
index 578e66f..04926f4 100644
--- a/src/main/resources/archetype-resources/src/main/webapp/templates/app/screens/Index.vm
+++ b/src/main/resources/archetype-resources/src/main/webapp/templates/app/screens/Index.vm
@@ -1,45 +1,46 @@
-## 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.
-
-
-
-#if ( $data.getMessage() )
- #info( $data.getMessage() )
-#end
-
-#if ($!success) <div align="center"><h1>$success</h1></div>
- <p>
- You're now successfully running a <a href="http://turbine.apache.org/">Turbine</a> based
- application, deployed to <font color="red">$data.ServerData.ContextPath</a></font> on
- your web container.
- </p>
-
- <p>
- You can (and should!) change or remove this page at any time. It is
- intended to give you immediate feedback if you just deployed an newly
- setup Turbine application.
- </p>
-#end
-
- ## including a secured does not trigger the security check, as it is just handled by velocity, not turbine
- #parse("/screens/TestSecure.vm")
-
- ## trigger the security check, but without all context
- ## <a href="$link.setPage("TestSecure.vm")">Test a secure access without context</a>
- ## trigger the security check
- <a href="$link.setPage("TestSecure.vm").addPathInfo("action","SecureAction")">Test a secure access with context</a>
-
+## 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.
+
+
+
+#if ( $data.getMessage() )
+ #info( $data.getMessage() )
+#end
+
+#if ($!success) <div align="center"><h1>$success</h1></div>
+ <p>
+ You're now successfully running a <a href="http://turbine.apache.org/">Turbine</a> based
+ application, deployed to <font color="red">$data.ServerData.ContextPath</a></font> on
+ your web container.
+ </p>
+
+ <p>
+ You can (and should!) change or remove this page at any time. It is
+ intended to give you immediate feedback if you just deployed an newly
+ setup Turbine application.
+ </p>
+
+#end
+
+ ## including a secured does not trigger the security check, as it is just handled by velocity, not turbine
+ #parse("/screens/TestSecure.vm")
+
+ ## trigger the security check, but without all context
+ ## <a href="$link.setPage("TestSecure.vm")">Test a secure access without context</a>
+ ## trigger the security check
+ <a href="$link.setPage("TestSecure.vm").addPathInfo("action","SecureAction")">Test a secure access with context</a>
+
diff --git a/src/main/resources/archetype-resources/src/test/java/services/security/AbstractFulcrumTorqueModelManagerTest.java b/src/main/resources/archetype-resources/src/test/java/services/security/AbstractFulcrumTorqueModelManagerTest.java
index 2ffc5de..e31ffe9 100644
--- a/src/main/resources/archetype-resources/src/test/java/services/security/AbstractFulcrumTorqueModelManagerTest.java
+++ b/src/main/resources/archetype-resources/src/test/java/services/security/AbstractFulcrumTorqueModelManagerTest.java
@@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
import java.util.Set;
@@ -41,11 +41,13 @@
import org.apache.fulcrum.security.util.EntityExistsException;
import org.apache.fulcrum.security.util.PermissionSet;
import org.apache.fulcrum.security.util.UnknownEntityException;
-import org.apache.fulcrum.testcontainer.BaseUnit4Test;
+import org.apache.fulcrum.testcontainer.BaseUnit5Test;
import org.apache.torque.ConstraintViolationException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,7 +58,7 @@
* @version $Id$
*
*/
-public abstract class AbstractFulcrumTorqueModelManagerTest extends BaseUnit4Test
+public abstract class AbstractFulcrumTorqueModelManagerTest extends BaseUnit5Test
{
protected Role role;
@@ -77,7 +79,7 @@
// By default org.slf4j.LoggerFactory is optional in 4.0, but included in webapp
Logger log = LoggerFactory.getLogger( getClass().getName() );
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
securityService = (SecurityService) lookup(SecurityService.ROLE);
@@ -89,7 +91,7 @@
}
@Override
- @After
+ @AfterEach
public void tearDown()
{
modelManager = null;
diff --git a/src/main/resources/archetype-resources/src/test/java/services/security/FulcrumTorqueDefaultModelManagerTest.java b/src/main/resources/archetype-resources/src/test/java/services/security/FulcrumTorqueDefaultModelManagerTest.java
index 67f5781..c57a51d 100644
--- a/src/main/resources/archetype-resources/src/test/java/services/security/FulcrumTorqueDefaultModelManagerTest.java
+++ b/src/main/resources/archetype-resources/src/test/java/services/security/FulcrumTorqueDefaultModelManagerTest.java
@@ -18,12 +18,13 @@
* under the License.
*/
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.Ignore;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
/**
* Test Fulcrum Integration.
@@ -38,7 +39,7 @@
{
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception
{
try
diff --git a/src/main/resources/archetype-resources/src/test/java/services/security/TurbineSecurityServiceTest.java b/src/main/resources/archetype-resources/src/test/java/services/security/TurbineSecurityServiceTest.java
index aa38651..7a48dae 100644
--- a/src/main/resources/archetype-resources/src/test/java/services/security/TurbineSecurityServiceTest.java
+++ b/src/main/resources/archetype-resources/src/test/java/services/security/TurbineSecurityServiceTest.java
@@ -18,9 +18,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.*;
import org.apache.fulcrum.security.ModelManager;
import org.apache.fulcrum.security.entity.ExtendedUser;
@@ -34,7 +32,7 @@
import org.apache.fulcrum.security.util.DataBackendException;
import org.apache.fulcrum.security.util.EntityExistsException;
import org.apache.fulcrum.security.util.UnknownEntityException;
-import org.apache.fulcrum.testcontainer.BaseUnit4Test;
+import org.apache.fulcrum.testcontainer.BaseUnit5Test;
import org.apache.torque.ConstraintViolationException;
import org.apache.turbine.annotation.AnnotationProcessor;
import org.apache.turbine.annotation.TurbineService;
@@ -44,10 +42,11 @@
import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.services.security.SecurityService;
import org.apache.turbine.util.TurbineConfig;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,7 +59,7 @@
*/
public class TurbineSecurityServiceTest
- extends BaseUnit4Test
+ extends BaseUnit5Test
{
org.apache.fulcrum.security.SecurityService fulcrumSecurityService;
@@ -77,7 +76,7 @@
// By default org.slf4j.LoggerFactory is optional in 4.0, but included in webapp
Logger log = LoggerFactory.getLogger( getClass().getName() );
- @BeforeClass
+ @BeforeAll
public static void init()
throws Exception
{
@@ -85,7 +84,7 @@
tc.initialize();
}
- @Before
+ @BeforeEach
public void setUpBefore()
throws Exception
{
@@ -296,7 +295,7 @@
assertTrue( ugrTest.getUser().equals( user ) );
}
- @AfterClass
+ @AfterAll
public static void setupAfter()
{
ServiceManager serviceManager = TurbineServices.getInstance();