Author: gk
Date: Fri Oct 11 11:51:54 2019
New Revision: 1868287
URL: http://svn.apache.org/viewvc?rev=1868287&view=rev
Log:
- add Java Testcontainers with minimal impact for default build, profile
docker-testcontainer has to be activated.
- UserManagerWithContainerTest.java currently disabled without Torque 4.1
enabled
Added:
turbine/core/trunk/conf/docker-resources/
turbine/core/trunk/conf/docker-resources/db/
turbine/core/trunk/conf/docker-resources/db/Dockerfile
turbine/core/trunk/conf/docker-resources/db/mysql/
turbine/core/trunk/conf/docker-resources/db/mysql/initdb.d/
turbine/core/trunk/conf/docker-resources/db/mysql/initdb.d/data.sql (with
props)
turbine/core/trunk/conf/docker-resources/docker-java.properties.template
turbine/core/trunk/conf/docker-resources/testcontainers.properties (with
props)
turbine/core/trunk/conf/test/docker-manager/
turbine/core/trunk/conf/test/docker-manager/CompleteTurbineResources.properties
(with props)
turbine/core/trunk/conf/test/docker-manager/TorqueTest.properties (with
props)
turbine/core/trunk/conf/test/docker-manager/fulcrumComponentConfiguration.xml
(with props)
turbine/core/trunk/conf/test/docker-manager/fulcrumContainerConfiguration.xml
(with props)
turbine/core/trunk/conf/test/docker-manager/fulcrumRoleConfiguration.xml
(with props)
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/BuildContainerWithDockerfileTest.java
(with props)
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/UserManagerWithContainerTest.java
(with props)
Modified:
turbine/core/trunk/conf/log4j2.xml
turbine/core/trunk/conf/test/TorqueTest.properties
turbine/core/trunk/conf/test/log4j2-test.xml
turbine/core/trunk/pom.xml
turbine/core/trunk/src/java/org/apache/turbine/Turbine.java
turbine/core/trunk/src/java/org/apache/turbine/services/security/DefaultSecurityService.java
turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java
turbine/core/trunk/src/test/org/apache/turbine/ConfigurationTest.java
Added: turbine/core/trunk/conf/docker-resources/db/Dockerfile
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/docker-resources/db/Dockerfile?rev=1868287&view=auto
==============================================================================
--- turbine/core/trunk/conf/docker-resources/db/Dockerfile (added)
+++ turbine/core/trunk/conf/docker-resources/db/Dockerfile Fri Oct 11 11:51:54
2019
@@ -0,0 +1,17 @@
+# no multi-stage
+# mariadb use docker-entrypoint
+
+FROM mysql:8.0.17
+
+# copy from path where dockerfile is
+COPY ./mysql/initdb.d /docker-entrypoint-initdb.d
+
+
+# required, to create
+#ENV DB_CONTEXT ${DB_CONTEXT}
+ENV MYSQL_DATABASE ${MYSQL_DATABASE}
+ENV MYSQL_USER=${MYSQL_USER}
+ENV MYSQL_PASSWORD=${MYSQL_PASSWORD}
+ENV MYSQL_HOST=%
+# important container will not start without setting it:
+ENV MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
Added: turbine/core/trunk/conf/docker-resources/db/mysql/initdb.d/data.sql
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/docker-resources/db/mysql/initdb.d/data.sql?rev=1868287&view=auto
==============================================================================
--- turbine/core/trunk/conf/docker-resources/db/mysql/initdb.d/data.sql (added)
+++ turbine/core/trunk/conf/docker-resources/db/mysql/initdb.d/data.sql Fri Oct
11 11:51:54 2019
@@ -0,0 +1,206 @@
+-- already exists
+-- CREATE DATABASE /*!32312 IF NOT EXISTS*/ `turbine`;
+
+-- use default;
+
+SET FOREIGN_KEY_CHECKS=0;
+
+-- database should be creates, if MYSQL_DATABASE is provided
+
+-- -----------------------------------------------------------------------
+-- mysql SQL script for schema turbine
+-- -----------------------------------------------------------------------
+
+drop table if exists TURBINE_PERMISSION;
+drop table if exists TURBINE_ROLE;
+drop table if exists TURBINE_GROUP;
+drop table if exists TURBINE_ROLE_PERMISSION;
+drop table if exists TURBINE_USER;
+drop table if exists TURBINE_USER_GROUP_ROLE;
+
+CREATE TABLE TURBINE_PERMISSION
+(
+ PERMISSION_ID INTEGER NOT NULL AUTO_INCREMENT,
+ PERMISSION_NAME VARCHAR(64) NOT NULL,
+ PRIMARY KEY(PERMISSION_ID),
+ UNIQUE TURBINE_PERMISSION_UQ_1 (PERMISSION_NAME)
+);
+
+
+-- -----------------------------------------------------------------------
+-- TURBINE_ROLE
+-- -----------------------------------------------------------------------
+CREATE TABLE TURBINE_ROLE
+(
+ ROLE_ID INTEGER NOT NULL AUTO_INCREMENT,
+ ROLE_NAME VARCHAR(64) NOT NULL,
+ PRIMARY KEY(ROLE_ID),
+ UNIQUE TURBINE_ROLE_UQ_1 (ROLE_NAME)
+);
+
+
+-- -----------------------------------------------------------------------
+-- TURBINE_GROUP
+-- -----------------------------------------------------------------------
+CREATE TABLE TURBINE_GROUP
+(
+ GROUP_ID INTEGER NOT NULL AUTO_INCREMENT,
+ GROUP_NAME VARCHAR(64) NOT NULL,
+ PRIMARY KEY(GROUP_ID),
+ UNIQUE TURBINE_GROUP_UQ_1 (GROUP_NAME)
+);
+
+
+-- -----------------------------------------------------------------------
+-- TURBINE_ROLE_PERMISSION
+-- -----------------------------------------------------------------------
+CREATE TABLE TURBINE_ROLE_PERMISSION
+(
+ ROLE_ID INTEGER NOT NULL,
+ PERMISSION_ID INTEGER NOT NULL,
+ PRIMARY KEY(ROLE_ID, PERMISSION_ID)
+);
+
+
+-- -----------------------------------------------------------------------
+-- TURBINE_USER
+-- -----------------------------------------------------------------------
+CREATE TABLE TURBINE_USER
+(
+ USER_ID INTEGER NOT NULL AUTO_INCREMENT,
+ LOGIN_NAME VARCHAR(64) NOT NULL,
+ PASSWORD_VALUE VARCHAR(16) NOT NULL,
+ FIRST_NAME VARCHAR(64) NOT NULL,
+ LAST_NAME VARCHAR(64) NOT NULL,
+ EMAIL VARCHAR(64),
+ CONFIRM_VALUE VARCHAR(16),
+ MODIFIED_DATE DATETIME,
+ CREATED DATETIME,
+ LAST_LOGIN DATETIME,
+ OBJECTDATA MEDIUMBLOB,
+ PRIMARY KEY(USER_ID),
+ UNIQUE TURBINE_USER_UQ_1 (LOGIN_NAME)
+);
+
+
+-- -----------------------------------------------------------------------
+-- TURBINE_USER_GROUP_ROLE
+-- -----------------------------------------------------------------------
+CREATE TABLE TURBINE_USER_GROUP_ROLE
+(
+ USER_ID INTEGER NOT NULL,
+ GROUP_ID INTEGER NOT NULL,
+ ROLE_ID INTEGER NOT NULL,
+ PRIMARY KEY(USER_ID, GROUP_ID, ROLE_ID)
+);
+
+/* ALTER TABLE TURBINE_ROLE_PERMISSION
+ ADD CONSTRAINT TURBINE_ROLE_PERMISSION_FK_1
+ FOREIGN KEY (ROLE_ID)
+ REFERENCES TURBINE_ROLE (ROLE_ID);
+
+ALTER TABLE TURBINE_ROLE_PERMISSION
+ ADD CONSTRAINT TURBINE_ROLE_PERMISSION_FK_2
+ FOREIGN KEY (PERMISSION_ID)
+ REFERENCES TURBINE_PERMISSION (PERMISSION_ID);
+
+ALTER TABLE TURBINE_USER_GROUP_ROLE
+ ADD CONSTRAINT TURBINE_USER_GROUP_ROLE_FK_1
+ FOREIGN KEY (USER_ID)
+ REFERENCES TURBINE_USER (USER_ID);
+
+ALTER TABLE TURBINE_USER_GROUP_ROLE
+ ADD CONSTRAINT TURBINE_USER_GROUP_ROLE_FK_2
+ FOREIGN KEY (GROUP_ID)
+ REFERENCES TURBINE_GROUP (GROUP_ID);
+
+ALTER TABLE TURBINE_USER_GROUP_ROLE
+ ADD CONSTRAINT TURBINE_USER_GROUP_ROLE_FK_3
+ FOREIGN KEY (ROLE_ID)
+ REFERENCES TURBINE_ROLE (ROLE_ID);
+*/
+
+-- -----------------------------------------------------------------------
+-- mysql SQL script for schema turbine
+-- -----------------------------------------------------------------------
+
+
+drop table if exists AUTHOR;
+drop table if exists BOOK;
+
+
+
+-- -----------------------------------------------------------------------
+-- AUTHOR
+-- -----------------------------------------------------------------------
+CREATE TABLE AUTHOR
+(
+ AUTH_ID INTEGER NOT NULL,
+ FIRST_NAME VARCHAR(64) NOT NULL,
+ LAST_NAME VARCHAR(64) NOT NULL,
+ PRIMARY KEY(AUTH_ID)
+);
+
+
+-- -----------------------------------------------------------------------
+-- BOOK
+-- -----------------------------------------------------------------------
+CREATE TABLE BOOK
+(
+ BOOK_ID INTEGER NOT NULL,
+ AUTH_ID INTEGER NOT NULL,
+ TITLE VARCHAR(64) NOT NULL,
+ SUBJECT VARCHAR(64) NOT NULL,
+ PRIMARY KEY(BOOK_ID)
+);
+
+
+ALTER TABLE BOOK
+ ADD CONSTRAINT BOOK_FK_1
+ FOREIGN KEY (AUTH_ID)
+ REFERENCES AUTHOR (AUTH_ID);
+
+
+SET FOREIGN_KEY_CHECKS=0;
+
+INSERT INTO TURBINE_USER
(USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
+ VALUES (1,'admin','password','','Admin');
+
+INSERT INTO TURBINE_USER
(USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
+ VALUES (2,'user','password','','User');
+
+INSERT INTO TURBINE_USER
(USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME)
+ VALUES (3,'anon','nopw','','Anon');
+
+INSERT INTO TURBINE_PERMISSION (`PERMISSION_ID`, `PERMISSION_NAME`) VALUES
+(2, 'Turbine'),
+(1, 'TurbineAdmin');
+
+INSERT INTO TURBINE_ROLE (`ROLE_ID`, `ROLE_NAME`) VALUES
+(1, 'turbineadmin'),
+(2, 'turbineuser');
+
+INSERT INTO TURBINE_GROUP (`GROUP_ID`, `GROUP_NAME`) VALUES
+(1, 'global'),
+(2, 'Turbine');
+
+INSERT INTO TURBINE_ROLE_PERMISSION (`ROLE_ID`, `PERMISSION_ID`) VALUES
+(1, 1),
+(2, 2);
+
+INSERT INTO TURBINE_USER_GROUP_ROLE (`USER_ID`, `GROUP_ID`, `ROLE_ID`) VALUES
+(1, 1, 1),
+(1, 2, 1),
+(2, 2, 2),
+(2, 1, 2);
+
+--
+ALTER TABLE TURBINE_USER MODIFY COLUMN USER_ID INT auto_increment;
+ALTER TABLE TURBINE_PERMISSION MODIFY COLUMN PERMISSION_ID INT auto_increment;
+ALTER TABLE TURBINE_ROLE MODIFY COLUMN ROLE_ID INT auto_increment;
+ALTER TABLE TURBINE_GROUP MODIFY COLUMN GROUP_ID INT auto_increment;
+
+-- mysql SQL script for schema default / turbine
+-- -----------------------------------------------------------------------
+
+SET foreign_key_checks=1;
\ No newline at end of file
Propchange: turbine/core/trunk/conf/docker-resources/db/mysql/initdb.d/data.sql
------------------------------------------------------------------------------
svn:eol-style = native
Added: turbine/core/trunk/conf/docker-resources/docker-java.properties.template
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/docker-resources/docker-java.properties.template?rev=1868287&view=auto
==============================================================================
--- turbine/core/trunk/conf/docker-resources/docker-java.properties.template
(added)
+++ turbine/core/trunk/conf/docker-resources/docker-java.properties.template
Fri Oct 11 11:51:54 2019
@@ -0,0 +1,18 @@
+# This file should contain the environment variables as
+# further info here:
https://www.testcontainers.org/supported_docker_environment/
+
+# UNIX by default uses unix sockets
+#DOCKER_HOST=unix:///var/run/docker.sock
+# to override default
+#DOCKER_TLS_VERIFY=0
+
+# WINDOWS uses external network, use only secure connection
+# docker.io might use username and password encrypted in ~/.docker/config.json
+# use result of 'docker-machine env <nameOfVirtualMachine>'
+#DOCKER_TLS_VERIFY=1
+#DOCKER_HOST=tcp://<hostip>:2376
+#DOCKER_CERT_PATH=<path-to-cert>
+#DOCKER_MACHINE_NAME=nameofvirtualmachine (e.g. type virtualbox in Windows 7
or hyperv in Windows 10)
+#COMPOSE_CONVERT_WINDOWS_PATHS=true
+
+#api.version=1.39
Added: turbine/core/trunk/conf/docker-resources/testcontainers.properties
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/docker-resources/testcontainers.properties?rev=1868287&view=auto
==============================================================================
--- turbine/core/trunk/conf/docker-resources/testcontainers.properties (added)
+++ turbine/core/trunk/conf/docker-resources/testcontainers.properties Fri Oct
11 11:51:54 2019
@@ -0,0 +1 @@
+checks.disable = true
\ No newline at end of file
Propchange: turbine/core/trunk/conf/docker-resources/testcontainers.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: turbine/core/trunk/conf/log4j2.xml
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/log4j2.xml?rev=1868287&r1=1868286&r2=1868287&view=diff
==============================================================================
--- turbine/core/trunk/conf/log4j2.xml (original)
+++ turbine/core/trunk/conf/log4j2.xml Fri Oct 11 11:51:54 2019
@@ -53,7 +53,7 @@
<Logger name="scheduler" level="info" additivity="false">
<AppenderRef ref="scheduler"/>
</Logger>
- <Logger name="org.apache.turbine" level="info" additivity="false">
+ <Logger name="org.apache.turbine" level="info" additivity="false">
<AppenderRef ref="turbine"/>
<AppenderRef ref="console"/>
</Logger>
Modified: turbine/core/trunk/conf/test/TorqueTest.properties
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/test/TorqueTest.properties?rev=1868287&r1=1868286&r2=1868287&view=diff
==============================================================================
--- turbine/core/trunk/conf/test/TorqueTest.properties (original)
+++ turbine/core/trunk/conf/test/TorqueTest.properties Fri Oct 11 11:51:54 2019
@@ -38,6 +38,3 @@ torque.dsfactory.default.connection.driv
torque.dsfactory.default.connection.url = jdbc:hsqldb:.
torque.dsfactory.default.connection.user = sa
torque.dsfactory.default.connection.password =
-
-
-
Added:
turbine/core/trunk/conf/test/docker-manager/CompleteTurbineResources.properties
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/test/docker-manager/CompleteTurbineResources.properties?rev=1868287&view=auto
==============================================================================
---
turbine/core/trunk/conf/test/docker-manager/CompleteTurbineResources.properties
(added)
+++
turbine/core/trunk/conf/test/docker-manager/CompleteTurbineResources.properties
Fri Oct 11 11:51:54 2019
@@ -0,0 +1,636 @@
+# 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.
+
+# resource relative to context
+pipeline.default.descriptor = /conf/turbine-classic-pipeline.xml
+# -------------------------------------------------------------------
+#
+# L O G 4 J 2 - L O G G I N G
+#
+# log4j2 may loads automatically if found on classpath, cf.
https://logging.apache.org/log4j/2.x
+#
+# -------------------------------------------------------------------
+log4j2.file = log4j2.xml
+
+# -------------------------------------------------------------------
+#
+# M A I L S E R V E R
+#
+# -------------------------------------------------------------------
+# Your mail server for outgoing email.
+#
+# Default: null
+# -------------------------------------------------------------------
+
+mail.server=
+
+# -------------------------------------------------------------------
+# SMTP-From header for your outgoing messages
+#
+# All failed delivery messages will be returned to this address.
+# If unset, these messages will be sent to the address in the
+# From header (standard behaviour)
+#
+# Default: null
+# -------------------------------------------------------------------
+
+mail.smtp.from=
+
+# -------------------------------------------------------------------
+#
+# S E R V E R D A T A
+#
+# -------------------------------------------------------------------
+# Default ServerData that can be used if asked for before the first
+# request is made.
+#
+# Defaults:
+#
+# serverdata.default.serverName=
+# serverdata.default.serverPort=80
+# serverdata.default.serverScheme=http
+# serverdata.default.scriptName=
+# serverdata.default.contextPath=
+# -------------------------------------------------------------------
+
+serverdata.default.serverName=
+serverdata.default.serverPort=80
+serverdata.default.serverScheme=http
+serverdata.default.scriptName=
+serverdata.default.contextPath=
+
+# -------------------------------------------------------------------
+#
+# M O D U L E C A C H I N G
+#
+# -------------------------------------------------------------------
+# This determines whether or not to cache the modules in memory. For
+# development, turn this off. For production, turn this on.
+#
+# Default: false
+# -------------------------------------------------------------------
+
+module.cache=false
+
+# If module.cache=true, then how large should we make the hashtables
+# by default.
+
+action.cache.size=20
+layout.cache.size=10
+navigation.cache.size=10
+page.cache.size=5
+screen.cache.size=50
+scheduledjob.cache.size=10
+
+# -------------------------------------------------------------------
+#
+# M O D U L E P A C K A G E S
+#
+# -------------------------------------------------------------------
+# This is the "classpath" for Turbine. In order to locate your own
+# modules, you should add them to this path. For example, if you have
+# com.company.actions, com.company.screens, com.company.navigations,
+# then this setting would be "com.company,org.apache.turbine.modules".
+# This path is searched in order. For example, Turbine comes with a
+# screen module named "Login". If you wanted to have your own screen
+# module named "Login", then you would specify the path to your
+# modules before the others.
+#
+# Note: org.apache.turbine.modules will always be added to the search
+# path. If it is not explictly added here, it will be added to the
+# end.
+#
+# Default: org.apache.turbine.modules
+# -------------------------------------------------------------------
+
+module.packages=org.apache.turbine.modules,
org.apache.turbine.services.template.modules,
org.apache.turbine.services.template.modules.screens.existing.dflt
+
+# -------------------------------------------------------------------
+#
+# F R A M E W O R K S E T T I N G S
+#
+# -------------------------------------------------------------------
+# These are settings that control the behavior of the framework,
+# such as determining whether a template system is in use, what
+# the default templates and screens are and session handling settings.
+# -------------------------------------------------------------------
+
+# Used to set the template homepage if you are using a template
+# layout. This is the template that will be displayed to the user
+# when no specific template is requested. This is normally executed
+# as the first template the user sees when they access the system.
+#
+# Default: Index.vm
+
+template.homepage=Index.vm
+
+# This is the default screen to show to people when they first access
+# the system. This is only used if there is no value for
+# template.homepage. This is for use when you are not using a
+# templating system such as Velocity or JSP.
+#
+# Default: Login
+
+screen.homepage=
+
+# This is the template that is shown on an incorrect login attempt.
+# Setting this property will override any value of screen.login specified
+# below.
+#
+# Default: Login.vm
+
+template.login=Login.vm
+
+# This is the page that is shown on an incorrect login attempt. It is
+# referenced in the LoginUser action. This is only used if there is no value
+# for template.login. This is for use when you are not using a
+# templating system such as Velocity or JSP.
+#
+# Default: Login
+
+screen.login=
+
+# This is the template that is used by the respective Template based
+# ErrorScreen for displaying the error. If you are not using a Template based
+# ErrorScreen, then this is ignored.
+#
+# Default: Error.vm
+
+template.error=Error.vm
+
+# This is the default error screen.
+#
+# Default: VelocityErrorScreen
+
+screen.error=VelocityErrorScreen
+
+# This is the screen that is displayed when the user's web page is in
+# an invalid state.
+#
+# Default: error.InvalidState
+
+screen.invalidstate=error.InvalidState
+
+# Set the components of the default Doctype for use in html documents.
+#
+# Defaults: There are no defaults - if default.html.doctype.root.element is not
+# set then no default doctype will be available.
+
+default.html.doctype.root.element=HTML
+default.html.doctype.identifier=-//W3C//DTD HTML 4.01 Transitional//EN
+default.html.doctype.url=http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd
+
+# This is the default action to log a user in. If you write your own
+# implementation of the login action, make sure that you change this
+# to reflect the new name.
+
+action.login=LoginUser
+
+# This is the default action to log a user out. If you write your own
+# implementation of the logout action, make sure that you change this
+# to reflect the new name.
+
+action.logout=LogoutUser
+
+# This is the default action to validate whether or not a session is
+# valid. For example, if you want to make sure if a user has already
+# logged in or not.
+#
+# Default: SessionValidator
+
+action.sessionvalidator=sessionvalidator.TemplateSessionValidator
+
+# This is the timeout in seconds for sessions. If left commented out, the
+# servlet container's default timeout will be left as is.
+
+# session.timeout=1800
+
+# This is the default action that builds up the AccessControlList for
+# the individual users session.
+
+action.accesscontroller=AccessController
+
+#
+# Set this value to true if you want to be able to submit multiple
+# events to an Action by doing eventSubmit_do<action> and consider
+# only events that have a non-empty, non-zero value. This is useful
+# if you submit your form with JavaScript
+#
+action.eventsubmit.needsvalue = false
+
+# -------------------------------------------------------------------
+#
+# J N D I C O N T E X T S
+#
+# -------------------------------------------------------------------
+
+# This indicates whether Turbine should try to create JNDI contexts.
+#
+# Default: false
+#
+# contexts=true
+
+# These are the JNDI context properties. Each context's properties
+# are defined by the properties beginning with context.name.
+#
+# Default: none
+#
+# Example: The following will create a JNDI context named "name" in
+# the data.contexts Hashtable. It will point at the RMI registry on
+# localhost running on port 1099, and will use
+# com.sun.jndi.rmi.registry.RegistryContextFactory as the initial
+# context factory:
+#
+# context.name.java.naming.provider.url=rmi://localhost:1099
+#
context.name.java.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory
+
+# -------------------------------------------------------------------
+#
+# M E S S A G E S
+#
+# -------------------------------------------------------------------
+# Note that strings containing "," (comma) characters must backslash
+# escape the comma (i.e. '\,')
+
+# The message that can be displayed before a user logs in.
+
+login.message=Thank you for your visit. Please log into the system.
+
+# The message that can be displayed when no screen is defined.
+
+login.message.noscreen=There has been an error. Your session is valid but the
screen variable is not defined.
+
+# The message that can be displayed when a user enters an incorrect
+# password or username.
+
+login.error=Sorry your username or password is incorrect!
+
+# The message that can be displayed when a user logs out.
+
+logout.message=Thank you for using the system. Please come back soon.
+
+# -------------------------------------------------------------------
+#
+# S E C U R E S O C K E T S L A Y E R
+#
+# -------------------------------------------------------------------
+# Whether the web server is able to use SSL. Links in Turbine can
+# check this property to determine if SSL can be used.
+#
+# Default: true
+# -------------------------------------------------------------------
+
+use.ssl=true
+
+# -------------------------------------------------------------------
+#
+# S E R V I C E S
+#
+# -------------------------------------------------------------------
+# Classes for Turbine Services should be defined here.
+# Format: services.[name].classname=[implementing class]
+#
+# To specify properties of a service use the following syntax:
+# service.[name].[property]=[value]
+#
+# The order that these services is listed is important! The
+# order that is stated here is the order in which the services
+# will be initialized. Keep this is mind if you have services
+# that depend on other services during initialization.
+# -------------------------------------------------------------------
+
+# Choose between the two available implementations of an Avalon container -
ECM or YAAFI
+
+#
services.AvalonComponentService.classname=org.apache.turbine.services.avaloncomponent.TurbineAvalonComponentService
+services.AvalonComponentService.classname=org.apache.turbine.services.avaloncomponent.TurbineYaafiComponentService
+
+services.RunDataService.classname=org.apache.turbine.services.rundata.TurbineRunDataService
+services.ServletService.classname=org.apache.turbine.services.servlet.TurbineServletService
+services.AssemblerBrokerService.classname=org.apache.turbine.services.assemblerbroker.TurbineAssemblerBrokerService
+services.UniqueIdService.classname=org.apache.turbine.services.uniqueid.TurbineUniqueIdService
+# Default
+services.SecurityService.classname=org.apache.turbine.services.security.DefaultSecurityService
+services.PullService.classname=org.apache.turbine.services.pull.TurbinePullService
+services.TemplateService.classname=org.apache.turbine.services.template.TurbineTemplateService
+services.UIService.classname = org.apache.turbine.services.ui.TurbineUIService
+#
services.SessionService.classname=org.apache.turbine.services.session.TurbineSessionService
+
+# Turn on the appropriate template service.
+services.VelocityService.classname=org.apache.turbine.services.velocity.TurbineVelocityService
+
+# -------------------------------------------------------------------
+#
+# R U N D A T A S E R V I C E
+#
+# -------------------------------------------------------------------
+# Default implementations of base interfaces for request processing.
+# Additional configurations can be defined by using other keys
+# in the place of the <default> key.
+# -------------------------------------------------------------------
+
+services.RunDataService.default.run.data=org.apache.turbine.services.rundata.DefaultTurbineRunData
+services.RunDataService.default.parameter.parser=org.apache.fulcrum.parser.DefaultParameterParser
+services.RunDataService.default.cookie.parser=org.apache.fulcrum.parser.DefaultCookieParser
+
+# -------------------------------------------------------------------
+#
+# A S S E M B L E R B R O K E R S E R V I C E
+#
+# -------------------------------------------------------------------
+# A list of AssemblerFactory classes that will be registered
+# with TurbineAssemblerBrokerService
+# -------------------------------------------------------------------
+
+services.AssemblerBrokerService.screen=org.apache.turbine.services.assemblerbroker.util.java.JavaScreenFactory
+#
services.AssemblerBrokerService.screen=org.apache.turbine.services.assemblerbroker.util.python.PythonScreenFactory
+services.AssemblerBrokerService.action=org.apache.turbine.services.assemblerbroker.util.java.JavaActionFactory
+services.AssemblerBrokerService.layout=org.apache.turbine.services.assemblerbroker.util.java.JavaLayoutFactory
+services.AssemblerBrokerService.page=org.apache.turbine.services.assemblerbroker.util.java.JavaPageFactory
+services.AssemblerBrokerService.navigation=org.apache.turbine.services.assemblerbroker.util.java.JavaNavigationFactory
+#services.AssemblerBrokerService.scheduledjob=org.apache.turbine.services.assemblerbroker.util.java.JavaScheduledJobFactory
+
+# -------------------------------------------------------------------
+#
+# T E M P L A T E S E R V I C E
+#
+# -------------------------------------------------------------------
+
+# Roughly, the number of templates in each category.
+#
+# Defaults: layout=2, navigation=10, screen=50
+
+services.TemplateService.layout.cache.size=2
+services.TemplateService.navigation.cache.size=10
+services.TemplateService.screen.cache.size=50
+
+#
+# These are the mapper classes responsible for the lookup of Page, Screen,
Layout and Navigation classes according
+# to the supplied template Name. They also map template names on the Layout
and Screen file names to be used.
+#
+# services.TemplateService.mapper.page.class =
org.apache.turbine.services.template.mapper.DirectTemplateMapper
+# services.TemplateService.mapper.screen.class =
org.apache.turbine.services.template.mapper.ClassMapper
+# services.TemplateService.mapper.layout.class =
org.apache.turbine.services.template.mapper.ClassMapper
+# services.TemplateService.mapper.navigation.class =
org.apache.turbine.services.template.mapper.ClassMapper
+# services.TemplateService.mapper.layout.template.class =
org.apache.turbine.services.template.mapper.LayoutTemplateMapper
+# services.TemplateService.mapper.screen.template.class =
org.apache.turbine.services.template.mapper.ScreenTemplateMapper
+
+# -------------------------------------------------------------------
+#
+# P U L L S E R V I C E
+#
+# -------------------------------------------------------------------
+# These are the properties for the Pull Service, the service
+# that works in conjuction with the Turbine Pull Model API.
+# -------------------------------------------------------------------
+
+services.PullService.earlyInit= true
+
+# This determines whether the non-request tools are refreshed
+# on each request (request tools aren't ever, because they're
+# instantiated for the request only anyway).
+services.PullService.tools.per.request.refresh=true
+
+# Path to the resources of the application tools, relative to the
+# application root
+services.PullService.tools.resources.dir=/conf/test/turbine-resources/
+
+# These are tools that are placed in the context by the service
+# These tools will be made available to all your
+# templates. You list the tools in the following way:
+#
+# tool.<scope>.<id> = <classname>
+#
+# <scope> is the tool scope: global, request, session
+# or persistent (see below for more details)
+# <id> is the name of the tool in the context
+#
+# You can configure the tools in this way:
+# tool.<id>.<parameter> = <value>
+#
+# So if you find "global", "request", "session" or "persistent" as second
+# part, it is a configuration to put a tool into the toolbox, else it is a
+# tool specific configuration.
+#
+# For example:
+#
+# tool.global.ui = org.apache.turbine.util.pull.tools.UITool
+# tool.global.mm = org.apache.turbine.util.pull.MessageManager
+# tool.request.link = org.apache.turbine.services.pull.tools.TemplateLink
+# tool.request.page = org.apache.turbine.util.template.TemplatePageAttributes
+#
+# Then:
+#
+# tool.ui.skin = default
+#
+# configures the value of "skin" for the "ui" tool.
+#
+# Tools are accessible in all templates by the <id> given
+# to the tool. So for the above listings the UIManager would
+# be available as $ui, the MessageManager as $mm, the TemplateLink
+# as $link and the TemplatePageAttributes as $page.
+#
+# You should avoid using tool names called "global", "request",
+# or "session" because of clashes with the possible Scopes.
+#
+# Scopes:
+#
+# global: tool is instantiated once and that instance is available
+# to all templates for all requests. Tool must be threadsafe.
+#
+# request: tool is instantiated once for each request (although the
+# PoolService is used to recycle instances). Tool need not
+# be threadsafe.
+#
+# session: tool is instantiated once for each user session, and is
+# stored in the user's temporary hashtable. Tool should be
+# threadsafe.
+#
+# authorized: tool is instantiated once for each user session once the
+# user logs in. After this, it is a normal session tool.
+#
+# Defaults: none
+
+tool.request.link=org.apache.turbine.services.pull.tools.TemplateLink
+tool.request.page=org.apache.turbine.util.template.HtmlPageAttributes
+tool.request.content=org.apache.turbine.services.pull.tools.ContentTool
+tool.request.l10n=org.apache.turbine.services.localization.LocalizationTool
+
+# This pull tool is to allow for easy formatting of Date object into Strings
+tool.request.dateFormatter=org.apache.turbine.services.pull.util.DateFormatter
+
+# Use this tool if you need a place to store data that will persist between
+# requests. Any data stored using this tool will be stored in the session.
+tool.session.sessionData=org.apache.turbine.services.pull.util.SessionData
+
+# These are intake tools.
+# tool.request.intake=org.apache.turbine.services.intake.IntakeTool
+
+# This is a tool that allows access to the scheduler service.
+# tool.request.scheduler=org.apache.turbine.services.SchedulerTool
+
+# This pull tool can be used to provide skins to an application
+tool.global.ui = org.apache.turbine.services.pull.tools.UITool
+
+# # These properties apply to both the old UIManager and the newer UIService
+tool.ui.dir.skin = /turbine-skins/
+tool.ui.dir.image = /turbine-images/
+tool.ui.skin = myskin
+tool.ui.css = skins.css
+
+#
+# The content tool can put its URIs through the Servlet container,
+# which might attach things like the jsessionid even to URIs that
+# are not served by the container.
+#
+# The default behavior was not to put these through the container.
+#
+# Set this to true if you need things like jsessionid attached to all
+# links generated from the $content pull tool.
+#
+tool.content.want.encoding = false
+
+#
+# Both the link and the content tool normally return absolute URIs
+# You can change this by exchanging the tool classes but this is not
+# really recommended. Setting these properties to true allow you
+# to change the behavior if you want only relative URIs (e.g. if you
+# run behind a reverse proxy or a load balancer).
+#
+tool.content.want.relative = false
+tool.link.want.relative = false
+
+# Set the retriever factory for OMTool
+tool.om.factory=org.apache.turbine.om.MockRetrieverFactory
+
+# -------------------------------------------------------------------
+#
+# V E L O C I T Y S E R V I C E
+#
+# -------------------------------------------------------------------
+
+
+services.VelocityService.earlyInit = true
+services.VelocityService.template.extension = vm
+
+services.VelocityService.default.page = VelocityPage
+services.VelocityService.default.screen = VelocityScreen
+services.VelocityService.default.layout = VelocityOnlyLayout
+services.VelocityService.default.navigation = VelocityNavigation
+services.VelocityService.default.layout.template = Default.vm
+
+services.VelocityService.resource.loader = file
+services.VelocityService.file.resource.loader.description = Velocity File
Resource Loader
+services.VelocityService.file.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
+services.VelocityService.file.resource.loader.path = src/templates/test
+services.VelocityService.file.resource.loader.cache = false
+services.VelocityService.file.resource.loader.modificationCheckInterval = 2
+# backward compatibility with Velocity 1.x
+services.VelocityService.runtime.conversion.handler = none
+services.VelocityService.space.gobbling = bc
+services.VelocityService.directive.if.emptycheck = false
+
+# -------------------------------------------------------------------
+#
+# J S P S E R V I C E
+#
+# -------------------------------------------------------------------
+
+services.JspService.template.extension=jsp
+services.JspService.default.page = JspPage
+services.JspService.default.screen=BaseJspScreen
+services.JspService.default.layout = JspLayout
+services.JspService.default.navigation=BaseJspNavigation
+services.JspService.default.error.screen = JspErrorScreen
+services.JspService.default.layout.template = Default.jsp
+
+services.JspService.templates = /templates/app
+services.JspService.buffer.size = 8192
+
+# -------------------------------------------------------------------
+#
+# S C H E D U L E R S E R V I C E
+#
+# -------------------------------------------------------------------
+
+#
+# Set enabled to true to start the scheduler. The scheduler can be
+# stopped and started after Turbine has been intialized. See the
+# javadocs for org.apache.turbine.services.schedule.TurbineScheduler
+# for the methods calls.
+#
+# Default = false
+#
+
+#services.SchedulerService.enabled=false
+
+# Determines if the scheduler service should be initialized early. This
+# Should always be set to true!!!!
+
+#services.SchedulerService.earlyInit=true
+
+# -------------------------------------------------------------------
+#
+# S E C U R I T Y S E R V I C E
+#
+# -------------------------------------------------------------------
+
+#
+# This is the class that implements the UserManager interface to
+# manage User objects. Default is the PassiveUserManager
+#
+# Override this setting if you want your User information stored
+# on a different medium (LDAP directory is a good example).
+#
+# Adjust this setting if you change the Setting of the SecurityService class
(see above).
+
+# Default: org.apache.turbine.services.security.passive.PassiveUserManager
+# The MockUserManager is used in testing...
+services.SecurityService.user.manager =
org.apache.turbine.services.security.DefaultUserManager
+
+# -------------------------------------------------------------------
+#
+# A V A L O N C O M P O N E N T S E R V I C E
+#
+# -------------------------------------------------------------------
+# Components implementing the Avalon lifecycle interfaces can be loaded,
+# configured and initialized by Turbine
+# -------------------------------------------------------------------
+
+#
+# Name and location to the configuration file for the container.
+#
+services.AvalonComponentService.containerConfiguration =
conf/test/docker-manager/fulcrumContainerConfiguration.xml
+
+# -------------------------------------------------------------------
+#
+# S E S S I O N S E R V I C E
+#
+# -------------------------------------------------------------------
+
+services.SessionService.earlyInit=true
+
+# -------------------------------------------------------------------
+#
+# A D D I T I O N A L P R O P E R T I E S
+#
+# -------------------------------------------------------------------
+# The full path name to an additional properties file. Properties in
+# this file will be included in this property set. Duplicate name
+# values will be replaced, so be careful.
+#
+# Default: none
+# -------------------------------------------------------------------
Propchange:
turbine/core/trunk/conf/test/docker-manager/CompleteTurbineResources.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: turbine/core/trunk/conf/test/docker-manager/TorqueTest.properties
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/test/docker-manager/TorqueTest.properties?rev=1868287&view=auto
==============================================================================
--- turbine/core/trunk/conf/test/docker-manager/TorqueTest.properties (added)
+++ turbine/core/trunk/conf/test/docker-manager/TorqueTest.properties Fri Oct
11 11:51:54 2019
@@ -0,0 +1,43 @@
+# 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.
+
+torque.applicationRoot = .
+
+torque.defaults.pool.testOnBorrow=true
+torque.defaults.pool.validationQuery=SELECT 1
+
+torque.database.schema =
+
+# -------------------------------------------------------------------
+#
+# Shared Pool Data Source Factory
+#
+# -------------------------------------------------------------------
+torque.database.default.adapter=auto
+torque.dsfactory.default.connection.driver = com.mysql.cj.jdbc.Driver
+
+# mapped port for 3306
+torque.dsfactory.default.connection.url =
jdbc:mysql://192.168.99.101:32815/default?serverTimeZone=UTC
+torque.dsfactory.default.connection.user = root
+torque.dsfactory.default.connection.password = test1234
+torque.dsfactory.default.factory=org.apache.torque.dsfactory.SharedPoolDataSourceFactory
+# -------------------------------------------------------------------
+
+# Comment if not using shared data source factory
+torque.database.default=default
+
+
Propchange: turbine/core/trunk/conf/test/docker-manager/TorqueTest.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added:
turbine/core/trunk/conf/test/docker-manager/fulcrumComponentConfiguration.xml
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/test/docker-manager/fulcrumComponentConfiguration.xml?rev=1868287&view=auto
==============================================================================
---
turbine/core/trunk/conf/test/docker-manager/fulcrumComponentConfiguration.xml
(added)
+++
turbine/core/trunk/conf/test/docker-manager/fulcrumComponentConfiguration.xml
Fri Oct 11 11:51:54 2019
@@ -0,0 +1,87 @@
+<?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.
+-->
+<!--
+ This configuration file for Avalon components is used for testing the
Fulcrum components
+ with Turbine.
+-->
+
+<componentConfig>
+ <!-- Torque Component -->
+ <torque>
+ <configfile>conf/test/docker-manager/TorqueTest.properties</configfile>
+ </torque>
+ <cache cacheInitialSize="20" cacheCheckFrequency="5"/>
+ <mimetype/>
+ <crypto>
+ <algorithm>
+ <unix>org.apache.fulcrum.crypto.provider.UnixCrypt</unix>
+ <clear>org.apache.fulcrum.crypto.provider.ClearCrypt</clear>
+ <java>org.apache.fulcrum.crypto.provider.JavaCrypt</java>
+ <oldjava>org.apache.fulcrum.crypto.provider.OldJavaCrypt</oldjava>
+ </algorithm>
+ </crypto>
+ <localization>
+ <bundles>
+ <bundle>org.apache.turbine.services.localization.BarBundle</bundle>
+ </bundles>
+ </localization>
+ <intake>
+ <serialDataPath>target/appData.ser</serialDataPath>
+ <xmlPaths>
+ <xmlPath>conf/test/intake.xml</xmlPath>
+ </xmlPaths>
+ </intake>
+ <factory/>
+ <pool/>
+ <parser>
+ <parameterEncoding>utf-8</parameterEncoding>
+ <automaticUpload>true</automaticUpload>
+ </parser>
+
+ <!-- These components belong to the Fulcrum-Security services -->
+ <securityService/>
+ <authenticator/>
+ <modelManager/>
+ <aclFactory/>
+
+ <!-- example implementation, use torque mapper -->
+ <userManager>
+
<className>org.apache.fulcrum.security.torque.om.TurbineUser</className>
+
<peerClassName>org.apache.fulcrum.security.torque.om.TurbineUserPeerImpl</peerClassName>
+ <userGroupRoleManager>
+
<!--className>org.apache.fulcrum.security.torque.om.TurbineUserGroupRole</className-->
+
<peerClassName>org.apache.fulcrum.security.torque.om.TurbineUserGroupRolePeerImpl</peerClassName>
+ </userGroupRoleManager>
+ </userManager>
+ <groupManager>
+
<className>org.apache.fulcrum.security.torque.om.TurbineGroup</className>
+
<peerClassName>org.apache.fulcrum.security.torque.om.TurbineGroupPeerImpl</peerClassName>
+ </groupManager>
+ <roleManager>
+
<className>org.apache.fulcrum.security.torque.om.TurbineRole</className>
+
<peerClassName>org.apache.fulcrum.security.torque.om.TurbineRolePeerImpl</peerClassName>
+ </roleManager>
+ <permissionManager>
+
<className>org.apache.fulcrum.security.torque.om.TurbinePermission</className>
+
<peerClassName>org.apache.fulcrum.security.torque.om.TurbinePermissionPeerImpl</peerClassName>
+ </permissionManager>
+
+
+</componentConfig>
Propchange:
turbine/core/trunk/conf/test/docker-manager/fulcrumComponentConfiguration.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
turbine/core/trunk/conf/test/docker-manager/fulcrumContainerConfiguration.xml
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/test/docker-manager/fulcrumContainerConfiguration.xml?rev=1868287&view=auto
==============================================================================
---
turbine/core/trunk/conf/test/docker-manager/fulcrumContainerConfiguration.xml
(added)
+++
turbine/core/trunk/conf/test/docker-manager/fulcrumContainerConfiguration.xml
Fri Oct 11 11:51:54 2019
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<fulcrum-yaafi>
+ <componentRoles>
+ <location>conf/test/docker-manager/fulcrumRoleConfiguration.xml</location>
+ </componentRoles>
+ <componentConfiguration>
+
<location>conf/test/docker-manager/fulcrumComponentConfiguration.xml</location>
+ </componentConfiguration>
+</fulcrum-yaafi>
Propchange:
turbine/core/trunk/conf/test/docker-manager/fulcrumContainerConfiguration.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: turbine/core/trunk/conf/test/docker-manager/fulcrumRoleConfiguration.xml
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/test/docker-manager/fulcrumRoleConfiguration.xml?rev=1868287&view=auto
==============================================================================
--- turbine/core/trunk/conf/test/docker-manager/fulcrumRoleConfiguration.xml
(added)
+++ turbine/core/trunk/conf/test/docker-manager/fulcrumRoleConfiguration.xml
Fri Oct 11 11:51:54 2019
@@ -0,0 +1,125 @@
+<?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.
+-->
+<!--
+ This configuration file for Avalon components is used for testing the
Fulcrum Components with
+ Turbine.
+-->
+
+<role-list>
+ <!-- Torque Component Role Configuration -->
+ <role name="org.apache.torque.avalon.Torque"
+ shorthand="torque"
+ default-class="org.apache.torque.avalon.TorqueComponent" />
+
+ <role
+ name="org.apache.fulcrum.cache.GlobalCacheService"
+ shorthand="cache"
+
default-class="org.apache.fulcrum.cache.impl.DefaultGlobalCacheService"/>
+
+ <role
+ name="org.apache.fulcrum.mimetype.MimeTypeService"
+ shorthand="mimetype"
+ default-class="org.apache.fulcrum.mimetype.DefaultMimeTypeService"/>
+
+ <role
+ name="org.apache.fulcrum.crypto.CryptoService"
+ shorthand="crypto"
+ default-class="org.apache.fulcrum.crypto.DefaultCryptoService"/>
+
+ <role
+ name="org.apache.fulcrum.localization.LocalizationService"
+ shorthand="localization"
+
default-class="org.apache.fulcrum.localization.DefaultLocalizationService"/>
+
+ <role
+ name="org.apache.fulcrum.intake.IntakeService"
+ shorthand="intake"
+ default-class="org.apache.fulcrum.intake.IntakeServiceImpl"/>
+
+ <role
+ name="org.apache.fulcrum.factory.FactoryService"
+ shorthand="factory"
+ default-class="org.apache.fulcrum.factory.DefaultFactoryService"/>
+
+ <role
+ name="org.apache.fulcrum.pool.PoolService"
+ shorthand="pool"
+ default-class="org.apache.fulcrum.pool.DefaultPoolService"/>
+
+ <role
+ name="org.apache.fulcrum.parser.ParserService"
+ shorthand="parser"
+ default-class="org.apache.fulcrum.parser.DefaultParserService"/>
+
+ <role
+ name="org.apache.fulcrum.xslt.XSLTService"
+ shorthand="xslt"
+ default-class="org.apache.fulcrum.xslt.DefaultXSLTService"/>
+
+ <!-- These components belong to the Fulcrum-Security services -->
+ <role
+ name="org.apache.fulcrum.security.SecurityService"
+ shorthand="securityService"
+ default-class="org.apache.fulcrum.security.BaseSecurityService"/>
+
+ <role
+ name="org.apache.fulcrum.security.UserManager"
+ shorthand="userManager"
+ early-init="true"
+
default-class="org.apache.fulcrum.security.torque.turbine.TorqueTurbineUserManagerImpl"/>
+
+ <role
+ name="org.apache.fulcrum.security.GroupManager"
+ shorthand="groupManager"
+
default-class="org.apache.fulcrum.security.torque.turbine.TorqueTurbineGroupManagerImpl"/>
+
+ <role
+ name="org.apache.fulcrum.security.RoleManager"
+ shorthand="roleManager"
+
default-class="org.apache.fulcrum.security.torque.turbine.TorqueTurbineRoleManagerImpl"/>
+
+ <role
+ name="org.apache.fulcrum.security.PermissionManager"
+ shorthand="permissionManager"
+
default-class="org.apache.fulcrum.security.torque.turbine.TorqueTurbinePermissionManagerImpl"/>
+
+ <role
+ name="org.apache.fulcrum.security.torque.peer.PeerManager"
+ shorthand="peerManager"
+
default-class="org.apache.fulcrum.security.torque.peer.PeerManagerDefaultImpl"/>
+
+ <role
+ name="org.apache.fulcrum.security.ModelManager"
+ shorthand="modelManager"
+
default-class="org.apache.fulcrum.security.torque.turbine.TorqueTurbineModelManagerImpl"/>
+
+ <role
+ name="org.apache.fulcrum.security.authenticator.Authenticator"
+ shorthand="authenticator"
+
default-class="org.apache.fulcrum.security.authenticator.TextMatchAuthenticator"/>
+
+
+ <role
+ name="org.apache.fulcrum.security.model.ACLFactory"
+ shorthand="aclFactory"
+
default-class="org.apache.fulcrum.security.model.turbine.TurbineACLFactory"/>
+
+</role-list>
+
Propchange:
turbine/core/trunk/conf/test/docker-manager/fulcrumRoleConfiguration.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: turbine/core/trunk/conf/test/log4j2-test.xml
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/conf/test/log4j2-test.xml?rev=1868287&r1=1868286&r2=1868287&view=diff
==============================================================================
--- turbine/core/trunk/conf/test/log4j2-test.xml (original)
+++ turbine/core/trunk/conf/test/log4j2-test.xml Fri Oct 11 11:51:54 2019
@@ -20,11 +20,11 @@
<Configuration status="info" verbose="true">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
- <PatternLayout pattern="%d [%t] %-5p %c - %m%n"/>
- </Console>
- <File name="logfile" fileName="target/turbine-test.log">
- <PatternLayout pattern="%d [%t] %-5p %c - %m%n"/>
- </File>
+ <PatternLayout pattern="%d [%t] %-5p %c - %m%n"/>
+ </Console>
+ <File name="logfile" fileName="target/turbine-test.log">
+ <PatternLayout pattern="%d [%t] %-5p %c - %m%n"/>
+ </File>
</Appenders>
<Loggers>
<Logger name="org.apache.fulcrum" level="info" additivity="false">
@@ -35,13 +35,27 @@
<AppenderRef ref="console" level="info"/>
</Logger>
<Logger name="avalon" level="info" additivity="false">
- <AppenderRef ref="logfile"/>
- </Logger>
+ <AppenderRef ref="logfile"/>
+ </Logger>
<Logger name="org.apache.logging.log4j" level="debug" additivity="false">
- <AppenderRef ref="logfile"/>
- </Logger>
- <Root level="error">
- <AppenderRef ref="logfile"/>
- </Root>
+ <AppenderRef ref="logfile"/>
+ </Logger>
+ <Logger name="org.testcontainers" level="debug" additivity="false">
+ <AppenderRef ref="console"/>
+ </Logger>
+ <Logger name="org.testcontainers.utility.RegistryAuthLocator"
level="debug" additivity="false">
+ <AppenderRef ref="console"/>
+ </Logger>
+ <Logger name="com.github.dockerjava" level="debug" additivity="false">
+ <AppenderRef ref="console"/>
+ </Logger>
+ <Logger name="org.apache.turbine.testcontainer" level="debug"
additivity="false">
+ <AppenderRef ref="console"/>
+ <AppenderRef ref="logfile"/>
+ </Logger>
+ <Root level="error">
+ <AppenderRef ref="console"/>
+ <AppenderRef ref="logfile"/>
+ </Root>
</Loggers>
</Configuration>
\ No newline at end of file
Modified: turbine/core/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/pom.xml?rev=1868287&r1=1868286&r2=1868287&view=diff
==============================================================================
--- turbine/core/trunk/pom.xml (original)
+++ turbine/core/trunk/pom.xml Fri Oct 11 11:51:54 2019
@@ -19,11 +19,11 @@
-->
<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.turbine</groupId>
- <artifactId>turbine-parent</artifactId>
- <version>6</version>
- </parent>
+ <parent>
+ <groupId>org.apache.turbine</groupId>
+ <artifactId>turbine-parent</artifactId>
+ <version>6</version>
+ </parent>
<artifactId>turbine</artifactId>
<name>Apache Turbine</name>
<version>5.1-SNAPSHOT</version>
@@ -566,7 +566,7 @@
<!--default setting is forkCount=1/reuseForks=true -->
<reuseForks>false</reuseForks>
<forkCount>1</forkCount>
- <groups>!performance</groups>
+ <excludedGroups>performance,docker</excludedGroups>
</configuration>
</plugin>
<plugin>
@@ -925,12 +925,12 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>1.11</version>
+ <version>1.13</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
- <version>2.4</version>
+ <version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
@@ -940,22 +940,22 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- <version>3.8.1</version>
+ <version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
- <version>1.6</version>
+ <version>1.7</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
- <version>1.9.3</version>
+ <version>1.9.4</version>
</dependency>
<dependency>
<groupId>nl.basjes.parse.useragent</groupId>
<artifactId>yauaa</artifactId>
- <version>5.8</version>
+ <version>5.11</version>
</dependency>
<dependency>
<groupId>org.apache.fulcrum</groupId>
@@ -1130,7 +1130,7 @@
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
- <version>2.0</version>
+ <version>2.1</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
@@ -1141,8 +1141,22 @@
<dependency>
<groupId>org.apache.fulcrum</groupId>
<artifactId>fulcrum-testcontainer</artifactId>
- <version>1.0.8</version>
+ <version>1.0.9-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>testcontainers</artifactId>
+ <version>1.12.2</version>
+ <scope>test</scope>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <version>1.12.2</version>
<scope>test</scope>
+ <optional>true</optional>
</dependency>
</dependencies>
@@ -1214,20 +1228,89 @@
<doclint>none</doclint><!-- since javadoc v.3 this is the required
instead of -Xdoclint:none, remove if turbine parent (v6) is correct again using
profile java8 -->
</properties>
</profile>
+ <profile>
+ <id>docker-testcontainer</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>conf/docker-resources</directory>
+ <includes>
+ <include>db/mysql/initdb.d/data.sql</include>
+ <include>*.properties</include>
+ </includes>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <configuration>
+ <groups>docker</groups>
+ <excludedGroups>performance</excludedGroups>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <!-- docker testcontainer deps start here -->
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>testcontainers</artifactId>
+ <version>1.12.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <version>1.12.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>mysql</artifactId>
+ <version>1.12.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.fulcrum</groupId>
+ <artifactId>fulcrum-security-torque</artifactId>
+ <version>${fulcrum.security}</version>
+ <exclusions>
+ <exclusion><!-- will we mapped in jcl-over-slf4j -->
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>8.0.17</version>
+ </dependency>
+ </dependencies>
+ </profile>
</profiles>
-
- <properties>
- <!-- maven.compiler setting in turbine parent -->
- <!-- TODO: Change for release: remove development part in path
"/turbine/development" -->
- <turbine.site.path>turbine/development/turbine-5.1</turbine.site.path>
- <fulcrum.intake>2.0.0</fulcrum.intake>
- <fulcrum.parser>2.0.1</fulcrum.parser>
- <fulcrum.security>2.0.0-SNAPSHOT</fulcrum.security>
- <slf4j.version>1.7.26</slf4j.version>
- <dependency.check.skip>true</dependency.check.skip>
- <torque.version>4.0</torque.version>
- <jacoco.skip>true</jacoco.skip>
- <doclint>none</doclint>
- </properties>
-
+
+ <properties>
+ <!-- maven.compiler setting in turbine parent -->
+ <!-- TODO: Change for release: remove development part in path
"/turbine/development" -->
+ <turbine.site.path>turbine/development/turbine-5.1</turbine.site.path>
+ <fulcrum.intake>2.0.0</fulcrum.intake>
+ <fulcrum.parser>2.0.1</fulcrum.parser>
+ <fulcrum.security>2.0.0-SNAPSHOT</fulcrum.security>
+ <slf4j.version>1.7.26</slf4j.version>
+ <dependency.check.skip>true</dependency.check.skip>
+ <torque.version>4.0</torque.version>
+ <jacoco.skip>true</jacoco.skip>
+ <doclint>none</doclint>
+ </properties>
+
</project>
Modified: turbine/core/trunk/src/java/org/apache/turbine/Turbine.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/Turbine.java?rev=1868287&r1=1868286&r2=1868287&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/Turbine.java (original)
+++ turbine/core/trunk/src/java/org/apache/turbine/Turbine.java Fri Oct 11
11:51:54 2019
@@ -365,6 +365,8 @@ public class Turbine extends HttpServlet
* Checks configuraton style, resolves the location of the configuration
and
* loads it to internal {@link Configuration} object
* ({@link #configuration}).
+ *
+ * Allows reading from a {@link CombinedConfigurationBuilder} xml
configuration file.
*
* @param config
* the Servlet Configuration
@@ -463,6 +465,7 @@ public class Turbine extends HttpServlet
.setFileName(confFile)
.setListDelimiterHandler(new
DefaultListDelimiterHandler(','))
.setLocationStrategy(new
HomeDirectoryLocationStrategy(confPath.getCanonicalPath(), false)));
+ // meta configuration : this may contain any commons
configuration: system<>, jndi, env
configuration = propertiesBuilder.getConfiguration();
break;
case JSON:
Modified:
turbine/core/trunk/src/java/org/apache/turbine/services/security/DefaultSecurityService.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/services/security/DefaultSecurityService.java?rev=1868287&r1=1868286&r2=1868287&view=diff
==============================================================================
---
turbine/core/trunk/src/java/org/apache/turbine/services/security/DefaultSecurityService.java
(original)
+++
turbine/core/trunk/src/java/org/apache/turbine/services/security/DefaultSecurityService.java
Fri Oct 11 11:51:54 2019
@@ -40,6 +40,8 @@ import org.apache.fulcrum.security.util.
import org.apache.fulcrum.security.util.UnknownEntityException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.apache.torque.avalon.Torque;
+import org.apache.torque.avalon.TorqueComponent;
import org.apache.turbine.om.security.User;
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.ServiceManager;
@@ -89,6 +91,8 @@ public class DefaultSecurityService
/** The instance of ModelManager the SecurityService uses */
private TurbineModelManager modelManager;
+ private TorqueComponent backend;
+
/**
* The Group object that represents the <a href="#global">global group</a>.
*/
@@ -114,6 +118,8 @@ public class DefaultSecurityService
this.roleManager = (RoleManager)manager.getService(RoleManager.ROLE);
this.permissionManager =
(PermissionManager)manager.getService(PermissionManager.ROLE);
this.modelManager =
(TurbineModelManager)manager.getService(TurbineModelManager.ROLE);
+ // to ensure that it is initialized, non local
+ this.backend = (TorqueComponent)manager.getService(Torque.ROLE);
Configuration conf = getConfiguration();
Modified: turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java?rev=1868287&r1=1868286&r2=1868287&view=diff
==============================================================================
--- turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java
(original)
+++ turbine/core/trunk/src/java/org/apache/turbine/util/TurbineConfig.java Fri
Oct 11 11:51:54 2019
@@ -179,6 +179,8 @@ public class TurbineConfig
*
* This is a specialized constructor that allows to configure
* Turbine easily in the common setups.
+ *
+ * Check also {@link TurbineXmlConfig} to load a {@link
#CONFIGURATION_PATH_KEY}.
*
* @param path The web application root (i.e. the path for file lookup).
* @param properties the relative path to TurbineResources.properties file
Modified: turbine/core/trunk/src/test/org/apache/turbine/ConfigurationTest.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/ConfigurationTest.java?rev=1868287&r1=1868286&r2=1868287&view=diff
==============================================================================
--- turbine/core/trunk/src/test/org/apache/turbine/ConfigurationTest.java
(original)
+++ turbine/core/trunk/src/test/org/apache/turbine/ConfigurationTest.java Fri
Oct 11 11:51:54 2019
@@ -167,7 +167,6 @@ public class ConfigurationTest extends B
}
}
- @SuppressWarnings("boxing")
@Test
public void testCreateTurbineWithXMLBuilderConfiguration() throws Exception
{
Added:
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/BuildContainerWithDockerfileTest.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/testcontainer/BuildContainerWithDockerfileTest.java?rev=1868287&view=auto
==============================================================================
---
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/BuildContainerWithDockerfileTest.java
(added)
+++
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/BuildContainerWithDockerfileTest.java
Fri Oct 11 11:51:54 2019
@@ -0,0 +1,201 @@
+package org.apache.turbine.testcontainer;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertTrue;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.images.builder.ImageFromDockerfile;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+
+/**
+ * Steps to run this
+ *
+ * Requirements:
+ * <li>Unix: (Debian stretch tested):set
<code>DOCKER_HOST=unix:///var/run/docker.sock</code> in docker-java.properties
+ * (find the template in conf/docker-resources/db/dj.p.template) and comment
all other environment keys.
+ * <li>Windows 10: Docker Desktop should provide all required configuration by
default or
+ * you need to create local machine, e.g. with <code>docker-machine -d hyperv
<vmname-default></code>
+ * For more information https://docs.docker.com/machine/get-started/,
https://docs.docker.com/machine/drivers/hyper-v/.
+ * <li>Windows 7/VirtualBox: copy DOCKER_* properties to
~/.docker-java.properties or docker-java.properties in classpath..
+ * To get the environment run <code>docker-machine env default</code>, if your
default docker machine is named default.
+ * Verify the name with <code>docker-machine ls</code>.
+ *
+ * Turbine pom.xml has folder conf/docker-resources enabled as test-resource,
you may put the files there.
+ * You may need to copy machines/<docker-machine-name>/certs from
DOCKER_CERT_PATH to local path ~/.docker/machine/certs
+ *
+ * Note/Hints:
+ * <li>Testcontainers starts docker-machine, if not started.
+ * <li>Windows 7: Before running manually any docker-machine command, you must
close the VirtualBox GUI if opened.
+ * <li>To get results from <code>docker images</code>, you have to set the
environment variables, see output from <code>docker-machine env <vmname></code>.
+ *
+ * Lookup of repository:
+ *
+ * Testcontainers checks
+ * <li>~/.testcontainers.properties, then
<code>classpath/testcontainers.properties</code>
+ * <li>~/.docker-java.properties, then docker-java.properties -> set DOCKER_*
properties,
+ * may set DOCKER_CERT_PATHalways with forward slashes.
+ * <li>At last also ~/.docker/config.json is checked for username/password for
docker.io
+ * Additional
+ * More info for database init sql:
+ * <li>https://www.testcontainers.org/modules/databases/mysql/
+ *
<li>https://www.testcontainers.org/modules/databases/#using-an-init-script-from-a-file
+ *
+ * bugs: docker virtualbox vm seems to auto pause.
+ * Check your docker vm with <code>docker-machine ls</code> and
<code>docker-machine start <vmname></code>.
+ *
+ * @author gkallidis
+ *
+ */
+@TestMethodOrder(OrderAnnotation.class)
+@Testcontainers
+@Tag("docker")
+class BuildContainerWithDockerfileTest {
+
+
+ public static final String DOCKERFILE =
"conf/docker-resources/db/Dockerfile";
+
+ private static Logger log = LogManager.getLogger();
+
+ public static int SERVICEPORT = 3306;
+
+ public static String DATABASE_NAME = "default";
+
+ Connection connection;
+
+ @Container
+ //@ClassRule
+ public static GenericContainer MY_SQL_CONTAINER = new GenericContainer<>(
+ new ImageFromDockerfile()
+// .withFileFromPath(
+// ".",
+// new
File("./conf/docker-resources/db/mysql/initdb.d").toPath())
+// .withDockerfileFromBuilder(
+// builder -> builder.from( "mysql:5.7.26" )
+// .add( "data.sql","/docker-entrypoint-initdb.d" )
+// )
+ .withDockerfile(new File(DOCKERFILE).toPath())
+ ).withExposedPorts( SERVICEPORT ) //.withStartupAttempts( 2 )
+ .withEnv( "MYSQL_DATABASE", DATABASE_NAME )
+ .withEnv( "MYSQL_USER", "userdb" )
+ .withEnv( "MYSQL_PASSWORD", "test1234" )
+ .withEnv( "MYSQL_ROOT_PASSWORD","test1234" );
+
+// reduce dependencies, but might use for debugging
+// MY_SQL_CONTAINER = new MySQLContainer<>()
+// .withDatabaseName( DATABASE_NAME).withUsername( "userdb" ).withPassword(
"test1234" )
+// .withInitScript( "./db/mysql/initdb.d/data.sql" )
+// .withExposedPorts( SERVICEPORT )
+
+ @BeforeAll
+ public static void init() {
+
+ MY_SQL_CONTAINER.setStartupAttempts( 3 ); // see MySQLContainer
+ }
+
+ @BeforeEach
+ public void before() throws Exception {
+ connection = getConnection();
+ }
+
+ @Test
+ @Order(2)
+ void createUser() throws SQLException {
+ if (connection == null) return;
+ try (PreparedStatement preparedStatement =
+ connection.prepareStatement(
+ "INSERT INTO TURBINE_USER
(USER_ID,LOGIN_NAME,PASSWORD_VALUE,FIRST_NAME,LAST_NAME) values (?,?,?,?,?)")) {
+ preparedStatement.setString(1, "4");
+ preparedStatement.setString(2, "kzipfel");
+ preparedStatement.setString(3, "kzipfel");
+ preparedStatement.setString(4, "Konrad");
+ preparedStatement.setString(5, "Zipfel");
+ assertFalse(preparedStatement.execute());
+ Assertions.assertEquals(1, preparedStatement.getUpdateCount());
+ }
+ }
+
+ @Test
+ @Order(1)
+ void selectExistingUser() throws SQLException {
+ if (connection == null) return;
+ try (PreparedStatement preparedStatement =
+ connection.prepareStatement(
+ "select USER_ID, LAST_NAME, FIRST_NAME from TURBINE_USER
where USER_ID=?")) {
+ preparedStatement.setString(1, "1");
+ ResultSet resultSet = preparedStatement.executeQuery();
+ assertTrue(resultSet.next());
+ assertEquals("Admin", resultSet.getString("LAST_NAME"));
+ assertEquals("", resultSet.getString("FIRST_NAME"));
+ resultSet.close();
+ }
+ }
+
+ @Test
+ @Order(3)
+ void selectNewUser() throws SQLException {
+ if (connection == null) return;
+ try (PreparedStatement preparedStatement =
+ connection.prepareStatement(
+ "select USER_ID, LAST_NAME, FIRST_NAME from TURBINE_USER
where USER_ID=?")) {
+ preparedStatement.setString(1, "4");
+ ResultSet resultSet = preparedStatement.executeQuery();
+ assertTrue(resultSet.next());
+ assertEquals("Zipfel", resultSet.getString("LAST_NAME"));
+ assertEquals("Konrad", resultSet.getString("FIRST_NAME"));
+ }
+ }
+
+ public static Connection getConnection() throws SQLException {
+ String jdbcStr = generateJdbcUrl();
+ if (jdbcStr == null) {
+ return null;
+ }
+ return DriverManager
+ .getConnection(jdbcStr, "userdb", "test1234");
+ }
+
+ // https://www.testcontainers.org/modules/databases/
+ // String.format("jdbc:tc:mysql:5.7.22://%s/%s", "dummy_host",
+ // "test"); this will use database test, but allows e.g. custom cfg:
?TC_MY_CNF=x.cfg
+ // TODO inform torque about mapped port, use overriding configuration in
torque 4.1
+ private static String generateJdbcUrl() {
+ if (MY_SQL_CONTAINER == null) { return null; }
+ if (!MY_SQL_CONTAINER.isRunning()) {
+ MY_SQL_CONTAINER.start();
+ }
+
+ String serviceHost = MY_SQL_CONTAINER.getContainerIpAddress();
+ Integer mappedPort = MY_SQL_CONTAINER.getMappedPort(SERVICEPORT);// e.g.
32811
+ log.info("generate jdbc url from {}, mapped Port: {}, bounded port: {}",
serviceHost, mappedPort, MY_SQL_CONTAINER.getBoundPortNumbers());
+
+// if (MY_SQL_CONTAINER instanceof MySQLContainer) {
+// String genJDBC = ((MySQLContainer)MY_SQL_CONTAINER).getJdbcUrl();
+// log.info( "generated connect url: {}", genJDBC);
+// }
+ String targetJDBC = //genJDBC;
+ String.format("jdbc:mysql://%s:%d/%s?loggerLevel=OFF", serviceHost,
+ mappedPort, DATABASE_NAME);
+ log.info( "used connect url: {}", targetJDBC);
+ return targetJDBC;
+ }
+
+}
Propchange:
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/BuildContainerWithDockerfileTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/UserManagerWithContainerTest.java
URL:
http://svn.apache.org/viewvc/turbine/core/trunk/src/test/org/apache/turbine/testcontainer/UserManagerWithContainerTest.java?rev=1868287&view=auto
==============================================================================
---
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/UserManagerWithContainerTest.java
(added)
+++
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/UserManagerWithContainerTest.java
Fri Oct 11 11:51:54 2019
@@ -0,0 +1,160 @@
+package org.apache.turbine.testcontainer;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertTrue;
+import static junit.framework.TestCase.fail;
+
+import org.apache.fulcrum.security.entity.ExtendedUser;
+import org.apache.fulcrum.security.util.UnknownEntityException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.torque.ConstraintViolationException;
+import org.apache.turbine.annotation.AnnotationProcessor;
+import org.apache.turbine.annotation.TurbineService;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.services.security.SecurityService;
+import org.apache.turbine.util.TurbineConfig;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestMethodOrder;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+
+/**
+ * Steps to run this @see {@link BuildContainerWithDockerfileTest}
+ *
+ * TODO
+ * This test might be more useful in a running turbine environment,
+ * e.g. created by archetypes. Only one problem remains the mapped port, which
is known only at runtime.
+ *
+ * @author gkallidis
+ *
+ */
+@TestMethodOrder(OrderAnnotation.class)
+@Testcontainers
+@Tag("docker")
+// TODO disabled. requires manual port mapping in
docker-manager/TorqueTest.properties,
+// until not using Torque4.1 with xml configuration and overwriting
user.settings.
+@Disabled
+class UserManagerWithContainerTest {
+
+ @TurbineService
+ SecurityService turbineSecurityService;
+
+ static TurbineConfig tc;
+
+ boolean onDeleteCascade = true;
+
+ private static Logger log = LogManager.getLogger();
+
+ @Container
+ private static GenericContainer MY_SQL_CONTAINER =
BuildContainerWithDockerfileTest.MY_SQL_CONTAINER;
+
+ @BeforeAll
+ public static void init() {
+
+ MY_SQL_CONTAINER.setStartupAttempts( 3 ); // see MySQLContainer
+ tc = new TurbineConfig(".",
+ "/conf/test/docker-manager/CompleteTurbineResources.properties");
+ try {
+ // TODO get Torque component configuration and override
torque.dsfactory.default.connection.url with url mapped port.
+ BuildContainerWithDockerfileTest.getConnection();
+ tc.initialize();
+ } catch (Exception e) {
+ fail();
+ }
+
+ //Torque.getInstance();
+ }
+
+ /**
+ * executes as designed even if tests are disabled
+ * @throws Exception
+ */
+ @BeforeEach
+ public void before() throws Exception {
+ AnnotationProcessor.process(this);
+ }
+
+ @Test
+ @Order(1)
+ @Tag("docker")
+ @Disabled
+ public void testCreateManagedUser()
+ throws Exception
+ {
+ User user = turbineSecurityService.getUserInstance();
+ user.setAccessCounter( 5 );
+ user.setName( "ringo" );
+ // required not null constraint
+ ( (ExtendedUser) user ).setFirstName( user.getName() );
+ ( (ExtendedUser) user ).setLastName( user.getName() );
+ turbineSecurityService.addUser( user, "fakepassword" );
+ assertTrue( turbineSecurityService.accountExists( user ) );
+ //assertTrue( turbineSecurityService.getUserManager().checkExists( user
) );
+ }
+
+ @Test
+ @Order(2)
+ @Tag("docker")
+ @Disabled
+ void selectNewUser() {
+ User ringo;
+ try {
+ ringo = turbineSecurityService.getUser("ringo");
+ assertEquals("ringo", ringo.getFirstName());
+ deleteUser(ringo);
+ } catch (Exception sqle) {
+ log.error( "new user error",sqle);
+ fail();
+ }
+
+ try {
+ ringo = turbineSecurityService.getUser("ringo");
+ fail("Should throw UnknownEntity");
+ } catch (UnknownEntityException sqle) {
+ log.info( "correct entity unknown",sqle);
+ } catch (Exception sqle) {
+ log.error( "new user error",sqle);
+ fail();
+ }
+ }
+
+ private void deleteUser( User user )
+ {
+ if ( onDeleteCascade )
+ {
+ try
+ {
+ // revokeAll is called before user delete
+ turbineSecurityService.removeUser( user );
+ log.info( "try to delete user " + user.getName() );
+ }
+ catch ( Exception e )
+ {
+ log.error( "deleting user " + user.getName() + " failed. "
+ + e.getMessage() );
+ if ( e.getCause() != null &&
+ e.getCause() instanceof ConstraintViolationException)
+ {
+ log.info( "error due to " + e.getCause().getMessage() );
+ }
+ else
+ {
+ log.info( "error due to " + e.getMessage() );
+ }
+ }
+ }
+ else
+ {
+ log.info( "onDeleteCascade false, user " + user.getName()
+ + " not deleted!" );
+ }
+ }
+}
Propchange:
turbine/core/trunk/src/test/org/apache/turbine/testcontainer/UserManagerWithContainerTest.java
------------------------------------------------------------------------------
svn:eol-style = native