You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by gk...@apache.org on 2017/12/05 13:25:53 UTC

svn commit: r1817194 - in /turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources: docs/ src/test/conf/torque/turbine/ src/test/java/services/security/ src/test/resources/

Author: gk
Date: Tue Dec  5 13:25:53 2017
New Revision: 1817194

URL: http://svn.apache.org/viewvc?rev=1817194&view=rev
Log:
- added turbine test, renamed test aprropriately

Added:
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/CompleteTurbineResources.properties   (with props)
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/fulcrumContainerConfiguration.xml   (with props)
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/turbine-classic-pipeline.xml   (with props)
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/AbstractFulcrumTorqueModelManagerTest.java   (with props)
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/FulcrumTorqueDefaultModelManagerTest.java   (with props)
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/TurbineSecurityServiceTest.java   (with props)
Removed:
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/AbstractTurbineTorqueModelManagerTest.java
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/TurbineTorqueDefaultModelManagerTest.java
Modified:
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt
    turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/resources/log4j.properties

Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt
URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt?rev=1817194&r1=1817193&r2=1817194&view=diff
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt (original)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/docs/README.txt Tue Dec  5 13:25:53 2017
@@ -123,7 +123,7 @@ action.login=LoginUser in TurbineResourc
 ## Tests
 
 Prerequisites
-- at least Turbine version 4.0.1 
+- ignored tests require at least Turbine version 4.0.1 
 - database was build successfully e.g. with archetype.
 - running mysql
 

Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/CompleteTurbineResources.properties
URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/CompleteTurbineResources.properties?rev=1817194&view=auto
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/CompleteTurbineResources.properties (added)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/CompleteTurbineResources.properties Tue Dec  5 13:25:53 2017
@@ -0,0 +1,631 @@
+# 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 = /src/test/conf/torque/turbine/turbine-classic-pipeline.xml
+# -------------------------------------------------------------------
+#
+#  L O G 4 J - L O G G I N G
+#
+# -------------------------------------------------------------------
+
+log4j.file = /src/test/resources/log4j.properties
+
+# -------------------------------------------------------------------
+#
+#  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
+
+# -------------------------------------------------------------------
+#
+#  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 = /src/test/conf/torque/turbine/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/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/CompleteTurbineResources.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/fulcrumContainerConfiguration.xml
URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/fulcrumContainerConfiguration.xml?rev=1817194&view=auto
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/fulcrumContainerConfiguration.xml (added)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/fulcrumContainerConfiguration.xml Tue Dec  5 13:25:53 2017
@@ -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>/src/test/conf/torque/fulcrumRoleConfiguration.xml</location>
+  </componentRoles>
+  <componentConfiguration>
+    <location>/src/test/conf/torque/fulcrumComponentConfiguration.xml</location>
+  </componentConfiguration>
+</fulcrum-yaafi>

Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/fulcrumContainerConfiguration.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/turbine-classic-pipeline.xml
URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/turbine-classic-pipeline.xml?rev=1817194&view=auto
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/turbine-classic-pipeline.xml (added)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/turbine-classic-pipeline.xml Tue Dec  5 13:25:53 2017
@@ -0,0 +1,32 @@
+<?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.
+-->
+<pipeline name="default">
+  <valves>
+    <valve>org.apache.turbine.pipeline.DetermineActionValve</valve>
+    <valve>org.apache.turbine.pipeline.DetermineTargetValve</valve>
+    <valve>org.apache.turbine.pipeline.DefaultSessionTimeoutValve</valve>
+    <valve>org.apache.turbine.pipeline.DefaultLoginValve</valve>
+    <valve>org.apache.turbine.pipeline.DefaultSessionValidationValve</valve>
+    <valve>org.apache.turbine.pipeline.DefaultACLCreationValve</valve>
+    <valve>org.apache.turbine.pipeline.ExecutePageValve</valve>
+    <valve>org.apache.turbine.pipeline.CleanUpValve</valve>
+    <valve>org.apache.turbine.pipeline.DetermineRedirectRequestedValve</valve>
+  </valves>
+</pipeline>

Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/conf/torque/turbine/turbine-classic-pipeline.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/AbstractFulcrumTorqueModelManagerTest.java
URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/AbstractFulcrumTorqueModelManagerTest.java?rev=1817194&view=auto
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/AbstractFulcrumTorqueModelManagerTest.java (added)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/AbstractFulcrumTorqueModelManagerTest.java Tue Dec  5 13:25:53 2017
@@ -0,0 +1,488 @@
+package ${package}.services.security;
+
+/*
+ * 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.
+ */
+import static org.junit.Assert.*;
+
+import java.util.Set;
+
+import org.apache.fulcrum.security.GroupManager;
+import org.apache.fulcrum.security.PermissionManager;
+import org.apache.fulcrum.security.RoleManager;
+import org.apache.fulcrum.security.SecurityService;
+import org.apache.fulcrum.security.UserManager;
+import org.apache.fulcrum.security.entity.ExtendedUser;
+import org.apache.fulcrum.security.entity.Group;
+import org.apache.fulcrum.security.entity.Permission;
+import org.apache.fulcrum.security.entity.Role;
+import org.apache.fulcrum.security.entity.User;
+import org.apache.fulcrum.security.model.turbine.TurbineModelManager;
+import org.apache.fulcrum.security.model.turbine.entity.TurbineGroup;
+import org.apache.fulcrum.security.model.turbine.entity.TurbineRole;
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUser;
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRole;
+import org.apache.fulcrum.security.util.DataBackendException;
+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.torque.ConstraintViolationException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Initialization of services in implementing tests
+ * 
+ * @author gkallidis
+ * @version $Id$
+ * 
+ */
+public abstract class AbstractFulcrumTorqueModelManagerTest extends BaseUnit4Test
+{
+    protected Role role;
+
+    protected TurbineModelManager modelManager;
+
+    protected RoleManager roleManager;
+
+    protected GroupManager groupManager;
+
+    protected PermissionManager permissionManager;
+
+    protected UserManager userManager;
+
+    protected SecurityService securityService;
+    
+    boolean onDeleteCascade = true;
+    
+     // By default org.slf4j.LoggerFactory is optional in 4.0, but included in webapp 
+    Logger log = LoggerFactory.getLogger( getClass().getName() );
+
+    @Before
+    public void setUp() throws Exception
+    {
+        securityService  = (SecurityService) lookup(SecurityService.ROLE);
+        roleManager = securityService.getRoleManager();
+        userManager = securityService.getUserManager();
+        groupManager = securityService.getGroupManager();
+        permissionManager = securityService.getPermissionManager();
+        modelManager = (TurbineModelManager) securityService.getModelManager();
+    }
+
+    @Override
+    @After
+      public void tearDown()
+    {
+        modelManager = null;
+        securityService = null;
+    }
+
+    @Test
+    public void testGetGlobalGroup() throws Exception
+    {
+        Group global = modelManager.getGlobalGroup();
+        assertNotNull(global);
+        assertEquals(global.getName(), modelManager.getGlobalGroupName());
+    }
+    @Test
+    public void testGrantRolePermission() throws Exception
+    {
+        Permission permission = permissionManager.getPermissionInstance();
+        permission.setName("ANSWER_PHONE");
+        checkAndAddPermission( permission );
+        role = roleManager.getRoleInstance("RECEPTIONIST");
+        checkAndAddRole( role );
+        checkAndGrant( permission );
+        role = roleManager.getRoleById(role.getId());
+        PermissionSet permissions = ((TurbineRole) role).getPermissions();
+        assertEquals(1, permissions.size());
+        assertTrue(((TurbineRole) role).getPermissions().contains(permission));
+        
+        checkAndRevoke( permission );
+        deletePermission( permission );
+        deleteRole();
+    }
+
+    @Test
+    public void testRevokeRolePermission() throws Exception
+    {
+        Permission permission = securityService.getPermissionManager().getPermissionInstance();
+        permission.setName("ANSWER_FAX");
+        checkAndAddPermission( permission );
+        role = roleManager.getRoleInstance("SECRETARY");
+        checkAndAddRole( role );
+        checkAndGrant( permission );
+        role = roleManager.getRoleById(role.getId());
+        PermissionSet permissions = ((TurbineRole) role).getPermissions();
+        assertEquals(1, permissions.size());
+        checkAndRevoke( permission );
+        role = roleManager.getRoleById(role.getId());
+        permissions = ((TurbineRole) role).getPermissions();
+        assertEquals(0, permissions.size());
+        assertFalse(((TurbineRole) role).getPermissions().contains(permission));
+        deletePermission( permission );
+        deleteRole();
+    }
+    @Test
+    public void testRevokeAllRole() throws Exception
+    {
+        Permission permission = securityService.getPermissionManager().getPermissionInstance();
+        Permission permission2 = securityService.getPermissionManager().getPermissionInstance();
+        permission.setName("SEND_SPAM");
+        permission2.setName("ANSWER_EMAIL");
+        checkAndAddPermission( permission );
+        checkAndAddPermission( permission2 );
+        role = roleManager.getRoleInstance("HELPER");
+        checkAndAddRole( role );
+        checkAndGrant( permission );
+        checkAndGrant( permission2);
+        role = roleManager.getRoleById(role.getId());
+        PermissionSet permissions = ((TurbineRole) role).getPermissions();
+        assertEquals(2, permissions.size());
+        try {
+            modelManager.revokeAll(role);
+        } catch (Exception e) {
+            log.info( "Might fail " + e.getMessage() );
+        }
+        role = roleManager.getRoleById(role.getId());
+        permissions = ((TurbineRole) role).getPermissions();
+        assertEquals(0, permissions.size());
+        checkAndRevoke( permission );
+        checkAndRevoke( permission2 );
+        deletePermission( permission );
+        deletePermission( permission2 );
+        deleteRole();
+    }
+
+    @Test
+    public void testRevokeAllUser() throws Exception
+    {
+        Group group = securityService.getGroupManager().getGroupInstance();
+        group.setName("TEST_REVOKEALLUSER_GROUP");
+        group = checkAndAddGroup( group );
+        
+        role = securityService.getRoleManager().getRoleInstance();
+        role.setName("TEST_REVOKEALLUSER_ROLE");
+        checkAndAddRole( role );
+
+        User user = userManager.getUserInstance("calvin");
+        user = checkAndAddUser( user, "calvin" );
+        try {
+            modelManager.grant(user, group, role);
+        } catch (DataBackendException e ){
+            if (e.getCause() != null && e.getCause() instanceof ConstraintViolationException) {
+                log.info( "error due to " + e.getCause().getMessage() );
+            } else {
+                log.info( "error due to " + e.getMessage() );
+            }
+        }
+
+        group = groupManager.getGroupById(group.getId());
+        Set<TurbineUserGroupRole> userGroupRoleSet = ((TurbineGroup) group).getUserGroupRoleSet();
+        assertEquals(1, userGroupRoleSet.size());
+        Set<TurbineUserGroupRole> userGroupRoleSet2 = ((TurbineGroup) group).getUserGroupRoleSet();
+        assertEquals(1, userGroupRoleSet2.size());
+
+        try {
+            modelManager.revokeAll(user);
+        } catch (Exception e) {
+            log.info( "error due to " + e.getMessage() );
+        }
+        group = groupManager.getGroupById(group.getId());
+        assertEquals(0, ((TurbineGroup) group).getUserGroupRoleSet().size());
+        role = securityService.getRoleManager().getRoleByName("TEST_REVOKEALLUSER_ROLE");
+
+        // assertFalse(((TurbineRole) role).getGroups().contains(group));
+        // cleanup ;
+        deleteGroup( group );
+        deleteRole();
+        deleteUser( user );
+
+    }
+
+    @Test
+    public void testGrantUserGroupRole() throws Exception
+    {
+        Group group = securityService.getGroupManager().getGroupInstance();
+        group.setName("TEST_GROUP");
+        group = checkAndAddGroup( group );
+        role = roleManager.getRoleInstance();
+        role.setName("TEST_Role");
+        checkAndAddRole( role );
+        User user = userManager.getUserInstance("Clint");
+       
+        user = checkAndAddUser( user, "clint" );
+
+        try {
+            modelManager.grant(user, group, role);
+        } catch (DataBackendException e ){
+            if (e.getCause() != null && e.getCause() instanceof ConstraintViolationException) {
+                log.info( "error due to " + e.getCause().getMessage() );
+            } else {
+                log.info( "error due to " + e.getMessage() );
+            }
+        }
+        boolean ugrFound = false;
+        TurbineUserGroupRole ugrTest = null;
+        for (TurbineUserGroupRole ugr : ((TurbineUser) user).getUserGroupRoleSet())
+        {
+            if (ugr.getUser().equals(user) && ugr.getGroup().equals(group) && ugr.getRole().equals(role))
+            {
+                ugrFound = true;
+                ugrTest = ugr;
+                break;
+            }
+        }
+        assertTrue(ugrFound);
+        assertTrue(ugrTest.getGroup().equals(group));
+        assertTrue(ugrTest.getUser().equals(user));
+        
+        try {
+            modelManager.revoke(user, group, role);
+        } catch (DataBackendException e ){
+            if (e.getCause() != null && e.getCause() instanceof ConstraintViolationException) {
+                log.info( "error due to " + e.getCause().getMessage() );
+            } else {
+                log.info( "error due to " + e.getMessage() );
+            }
+        }
+        deleteGroup( group );
+        deleteRole();
+        deleteUser( user );
+    }
+    @Test
+    public void testRevokeUserGroupRole() throws Exception
+    {
+        Group group = securityService.getGroupManager().getGroupInstance();
+        group.setName("TEST_REVOKE");
+        group = checkAndAddGroup( group );
+        User user = userManager.getUserInstance("Lima");
+        
+        user = checkAndAddUser( user, "pet" );
+        role = roleManager.getRoleInstance();
+        role.setName("TEST_REVOKE_ROLE");
+        checkAndAddRole( role );
+        try {
+            modelManager.grant(user, group, role);
+        } catch (DataBackendException e ){
+            if (e.getCause() != null && e.getCause() instanceof ConstraintViolationException) {
+                log.info( "error due to " + e.getCause().getMessage() );
+            } else {
+                log.info( "error due to " + e.getMessage() );
+            }
+        }
+        try {
+            modelManager.revoke(user, group, role);
+        } catch (DataBackendException e ){
+            if (e.getCause() != null && e.getCause() instanceof ConstraintViolationException) {
+                log.info( "error due to " + e.getCause().getMessage() );
+            } else {
+                log.info( "error due to " + e.getMessage() );
+            }
+        }
+        boolean ugrFound = false;
+        for (TurbineUserGroupRole ugr : ((TurbineUser) user).getUserGroupRoleSet())
+        {
+            if (ugr.getUser().equals(user) && ugr.getGroup().equals(group) && ugr.getRole().equals(role))
+            {
+                ugrFound = true;
+                break;
+            }
+        }
+        assertFalse(ugrFound);
+        deleteGroup( group );
+        deleteRole();
+        deleteUser( user );
+       
+    }
+
+    private void checkAndAddPermission( Permission permission )
+                    throws DataBackendException, UnknownEntityException, EntityExistsException
+    {
+        // cleanup if using real db
+        Permission dbPermission;
+        if (securityService.getPermissionManager().checkExists( permission )) {
+            dbPermission =  securityService.getPermissionManager().getPermissionByName( permission.getName() );
+            // this might fail as it is referenced
+//            try {
+//                securityService.getPermissionManager().removePermission(  permission );
+//            } catch (Exception e) {
+//                System.out.println("removing permission failed" +  e.getMessage() );
+//            }
+        } else {
+            dbPermission =securityService.getPermissionManager().addPermission(permission);            
+        }
+        permission.setId( dbPermission.getId() );
+
+    }
+    
+    // adds user 
+    private User checkAndAddUser( User user, String password )
+        throws DataBackendException, UnknownEntityException, EntityExistsException
+    {
+        if (user instanceof ExtendedUser) {
+            // set first last name which might be required  (cft. schema definition)
+            ((ExtendedUser)user).setFirstName( user.getName() );
+            ((ExtendedUser)user).setLastName(  user.getName() );
+        }
+        if (userManager.checkExists( user )) {
+            return userManager.getUser( user.getName() );
+            //userManager.removeUser( dbUser );
+        } else {
+            return userManager.addUser(user, password ); 
+        }
+    }
+    
+    private Group checkAndAddGroup( Group group )
+                    throws DataBackendException, UnknownEntityException, EntityExistsException
+    {
+        // cleanup if using real db
+        if (securityService.getGroupManager().checkExists( group )) {
+            return securityService.getGroupManager().getGroupByName( group.getName() );
+            // might fail as it is referenced
+//            try {
+//                securityService.getGroupManager().removeGroup( group );
+//            }  catch (Exception e) {
+//                System.out.println("removing group failed" +  e.getMessage() );
+//            }
+        } else {
+            return securityService.getGroupManager().addGroup(group);
+        }
+    }
+
+
+    private void checkAndAddRole( Role role )
+        throws DataBackendException, UnknownEntityException, EntityExistsException
+    {
+        Role dbRole;
+        // cleanup if using real db
+        if (securityService.getRoleManager().checkExists( role )) {
+            dbRole = securityService.getRoleManager().getRoleByName( role.getName() );
+            // might fail as it is referenced
+//            try {
+//                securityService.getRoleManager().removeRole( role );
+//            } catch (Exception e) {
+//                System.out.println("removing role failed " +  e.getMessage() );
+//            }
+        } else {
+            dbRole = securityService.getRoleManager().addRole(role); 
+        }
+        if (this.role != null) {
+            this.role.setId( dbRole.getId() );
+        } else {
+            this.role =dbRole;
+        }
+    }
+    
+    private void checkAndGrant( Permission permission )
+                    throws UnknownEntityException
+    {
+        // short cut if duplicate entry use acl ...
+        try {
+            modelManager.grant(role, permission);
+        } catch (DataBackendException e) {
+            log.info( "Might be duplicate TODO ACL check" + e.getMessage() );
+        }
+    }
+    
+    private void checkAndRevoke( Permission permission )
+                    throws UnknownEntityException
+    {
+        // short cut if duplicate entry use acl ...
+        try {
+            modelManager.revoke(role, permission);
+        } catch (DataBackendException e) {
+            log.info( "Might be duplicate TODO ACL check" + e.getMessage() );
+        }
+    }
+    
+    private void deleteUser( User user )
+    {
+        if (onDeleteCascade) {
+            try {
+               userManager.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!");
+        }
+    }
+    
+    private void deleteRole()
+    {
+        log.info("deleting role ");
+        if (role != null) {
+            try
+            {
+                log.info("deleting role "+ role.getName());
+                roleManager.removeRole( role );
+                role =null;
+            }
+            catch ( Exception e )
+            {
+                // fail
+                log.error( e.getMessage(),e);
+            }
+        }
+    }
+
+    private void deletePermission(Permission permission)
+    {
+        log.info("deleting permission *");
+        if (role != null) {
+            try
+            {
+                log.info("deleting permission "+ permission.getName());
+                permissionManager.removePermission(  permission );
+            }
+            catch ( Exception e )
+            {
+                // fail
+                log.error( e.getMessage(),e);
+            }
+        }
+    }
+    
+    private void deleteGroup(Group group)
+    {
+        log.info("deleting group *");
+        if (role != null) {
+            try
+            {
+                log.info("deleting group "+ group.getName());
+                groupManager.removeGroup(  group );
+            }
+            catch ( Exception e )
+            {
+                // fail
+                log.error( e.getMessage(),e);
+            }
+        }
+    }
+}

Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/AbstractFulcrumTorqueModelManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/FulcrumTorqueDefaultModelManagerTest.java
URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/FulcrumTorqueDefaultModelManagerTest.java?rev=1817194&view=auto
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/FulcrumTorqueDefaultModelManagerTest.java (added)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/FulcrumTorqueDefaultModelManagerTest.java Tue Dec  5 13:25:53 2017
@@ -0,0 +1,63 @@
+package ${package}.services.security;
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.fail;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.Ignore;
+
+/**
+ * Test Fulcrum Integration.
+ *
+ * Stub for further tests, relying on Fulcrum.
+ *
+ * @author gkallidis
+ * @version $Id$
+ */
+public class FulcrumTorqueDefaultModelManagerTest
+    extends AbstractTurbineTorqueModelManagerTest
+{
+
+    @Override
+    @Before
+    public void setUp() throws Exception
+    {
+        try
+        {
+        	// just Fulcrum
+            setConfigurationFileName("src/test/conf/torque/fulcrumComponentConfiguration.xml");
+            setRoleFileName("src/test/conf/torque/fulcrumRoleConfiguration.xml");
+            super.setUp();
+    
+        }
+        catch (Exception e)
+        {
+            fail(e.toString());
+        }
+    }
+    
+    @Test
+    public void testDummy() {
+    	// all tests in abstract
+    }
+
+}

Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/FulcrumTorqueDefaultModelManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/TurbineSecurityServiceTest.java
URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/TurbineSecurityServiceTest.java?rev=1817194&view=auto
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/TurbineSecurityServiceTest.java (added)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/TurbineSecurityServiceTest.java Tue Dec  5 13:25:53 2017
@@ -0,0 +1,187 @@
+package ${package}.services.security;
+
+/*
+ * 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.
+ */
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.fulcrum.security.SecurityService;
+import org.apache.fulcrum.security.entity.Group;
+import org.apache.fulcrum.security.entity.Role;
+import org.apache.fulcrum.security.model.turbine.TurbineModelManager;
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUser;
+import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRole;
+import org.apache.fulcrum.security.model.turbine.entity.impl.TurbineUserImpl;
+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.turbine.om.security.TurbineUserDelegate;
+import org.apache.turbine.om.security.User;
+import org.apache.turbine.services.ServiceManager;
+import org.apache.turbine.services.TurbineServices;
+import org.apache.turbine.util.TurbineConfig;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Test that the SecurityService works properly by comparing behaviour of Turbine and Fulcrum security services using Torque and Turbine user manager.
+ *
+ *
+ * @author gkallidis
+ * @version $Id$
+ */
+
+public class TurbineSecurityServiceTest extends BaseUnit4Test
+{
+
+    SecurityService fulcrumSecurityService;
+    org.apache.turbine.services.security.SecurityService turbineSecurityService;
+    static TurbineConfig tc;
+
+
+    @BeforeClass
+    public static void init() throws Exception
+    {
+        tc = new TurbineConfig(".", "src/test/conf/torque/turbine/CompleteTurbineResources.properties");
+        tc.initialize();
+    }
+
+    @Before
+    public void setUpBefore() throws Exception
+    {
+    
+        ServiceManager serviceManager = TurbineServices.getInstance();
+        //
+        fulcrumSecurityService = (SecurityService) serviceManager.getService(SecurityService.ROLE);
+    
+        turbineSecurityService = (org.apache.turbine.services.security.SecurityService)
+        		TurbineServices.getInstance().getService(org.apache.turbine.services.security.SecurityService.SERVICE_NAME);
+    }
+    
+    @Test
+    public void testAccountExists() throws Exception
+    {
+    
+        User user = new org.apache.turbine.om.security.DefaultUserImpl(new TurbineUserImpl());
+        user.setAccessCounter(5);
+        assertFalse(turbineSecurityService.accountExists(user));
+        assertFalse(fulcrumSecurityService.getUserManager().checkExists(user));
+    
+    }
+    
+    @Test
+    @Ignore(value="Turbine security service supported requires Turbine 4.0.1")
+    public void testCreateUser() throws Exception
+    {
+    
+    	User user = new org.apache.turbine.om.security.DefaultUserImpl(new TurbineUserImpl());
+    	user.setAccessCounter(5);
+    	user.setName("ringo");
+    	turbineSecurityService.addUser(user,"fakepasswrod");
+    	assertTrue(turbineSecurityService.accountExists(user));
+    	assertTrue(fulcrumSecurityService.getUserManager().checkExists(user));
+    
+    }
+    
+    /**
+     * Tests Turbine and Fulcrum.
+     *
+     * Fulcrum part is similar/duplicated from {@link AbstractTurbineModelManagerTest#testGrantUserGroupRole()}
+     *
+     *
+     * @throws Exception
+     */
+    @Test
+    @Ignore(value="Turbine security service supported requires Turbine 4.0.1")
+    public void testGrantUserGroupRole() throws Exception
+    {
+        Group group = fulcrumSecurityService.getGroupManager().getGroupInstance();
+        group.setName("TEST_GROUP");
+        fulcrumSecurityService.getGroupManager().addGroup(group);
+        Role role = fulcrumSecurityService.getRoleManager().getRoleInstance();
+        role.setName("TEST_Role");
+        fulcrumSecurityService.getRoleManager().addRole(role);
+    
+        //  Turbine security service returns a wrapped instance: org.apache.turbine.om.security.DefaultUserImpl
+        // which implements org.apache.turbine.om.security.User and contains
+        User user = turbineSecurityService.getUserInstance("Clint");
+    	// memory
+        turbineSecurityService.addUser(user, "clint");
+        turbineSecurityService.grant(user, group, role);
+    
+        // this cast may not be required any more in turbine 4.0.1
+    	addUserAndCheck(group, role, ( (TurbineUserDelegate) user).getUserDelegate());
+    
+        // Fulcrum security service returns a raw org.apache.fulcrum.security.model.turbine.entity.impl.TurbineUserImpl,
+    	org.apache.fulcrum.security.UserManager  userManager = fulcrumSecurityService.getUserManager();
+    	TurbineUser fulcrumUser = userManager.getUserInstance("Clint2");
+        userManager.addUser(fulcrumUser, "clint2");         // memory
+        ((TurbineModelManager)fulcrumSecurityService.getModelManager()).grant(fulcrumUser, group, role);
+    
+        addUserAndCheck(group, role, fulcrumUser);
+    
+    }
+
+    /**
+     * Fulcrum contract check
+     *
+     * @param group Fulcrum interface
+     * @param role Fulcrum interface
+     * @param user Fulcrum interface
+     * @throws EntityExistsException
+     * @throws DataBackendException
+     * @throws UnknownEntityException
+     */
+    private void addUserAndCheck(Group group, Role role, TurbineUser user)
+        throws EntityExistsException, DataBackendException,
+        UnknownEntityException
+    {
+    
+        boolean ugrFound = false;
+        TurbineUserGroupRole ugrTest = null;
+        for (TurbineUserGroupRole ugr : ((TurbineUser) user).getUserGroupRoleSet())
+        {
+            if (ugr.getUser().equals(user) && ugr.getGroup().equals(group) && ugr.getRole().equals(role))
+            {
+                ugrFound = true;
+                ugrTest = ugr;
+                break;
+            }
+        }
+        assertTrue(ugrFound);
+        assertTrue(ugrTest.getGroup().equals(group));
+        assertTrue(ugrTest.getUser().equals(user));
+    }
+    
+    
+    @AfterClass
+    public static void setupAfter()
+    {
+        ServiceManager serviceManager = TurbineServices.getInstance();
+        serviceManager.shutdownService(org.apache.turbine.services.security.SecurityService.SERVICE_NAME);
+        serviceManager.shutdownServices();
+        // TODO cleanup added users, roles, permissions ..
+    }
+
+
+}

Propchange: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/java/services/security/TurbineSecurityServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/resources/log4j.properties?rev=1817194&r1=1817193&r2=1817194&view=diff
==============================================================================
--- turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/resources/log4j.properties (original)
+++ turbine/maven/archetypes/trunk/turbine-webapp-4.0/src/main/resources/archetype-resources/src/test/resources/log4j.properties Tue Dec  5 13:25:53 2017
@@ -29,6 +29,11 @@ log4j.additivity.org.apache.torque.util
 log4j.logger.org.apache.torque = DEBUG, torque
 log4j.additivity.org.apache.torque = false
 
+# turbine log
+# allows TRACE
+log4j.logger.org.apache.turbine = INFO, turbine
+log4j.additivity.org.apache.turbine = false
+
 
 # #
 # Logfile definitions
@@ -72,4 +77,13 @@ log4j.appender.torque.layout = org.apach
 log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - %m%n
 log4j.appender.torque.append = false
 
-
+#
+# turbine.log
+#
+log4j.appender.turbine = org.apache.log4j.RollingFileAppender
+log4j.appender.turbine.MaxFileSize=5MB
+log4j.appender.turbine.MaxBackupIndex=5
+log4j.appender.turbine.file = src/test/logs/turbine.log
+log4j.appender.turbine.layout = org.apache.log4j.PatternLayout
+log4j.appender.turbine.layout.conversionPattern = %d [%t] %-5p %c - %m%n
+log4j.appender.turbine.append = false
\ No newline at end of file