You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Jeffery Painter <je...@jivecast.com> on 2018/11/29 15:33:29 UTC
Re: svn commit: r1847727 - in /turbine/fulcrum/trunk/testcontainer:
./ src/changes/ src/java/org/apache/fulcrum/testcontainer/ src/test/
src/test/org/apache/fulcrum/testcontainer/ xdocs/
Hi Georg,
I get a build failure.
[INFO]
/home/painter/workspace-turbine/fulcrum/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java:
Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources
(default-testResources) @ fulcrum-testcontainer ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources to
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2.001 s
[INFO] Finished at: 2018-11-29T10:32:11-05:00
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-resources-plugin:3.1.0:testResources
(default-testResources) on project fulcrum-testcontainer: /log4j2.xml
(Permission denied) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the
-e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
-
Jeff
On 11/29/18 10:29 AM, gk@apache.org wrote:
> Author: gk
> Date: Thu Nov 29 15:29:54 2018
> New Revision: 1847727
>
> URL: http://svn.apache.org/viewvc?rev=1847727&view=rev
> Log:
> - add JUnit 5 support, still support JUnit 4 and 3
> - TestEngine with ID 'junit-vintage' failed to discover tests... : was resolved by setting reuseForks = true, which is together with forkCount=1, the default behaviour for surefire - in BaseUnit4Test the container is now with setter set instead of statically with non static setter. Other test may need remove forkMode=always..
> - remove log4j dependency, add log4j2 with log4j1.2 bridge for ECMContainer
>
> Added:
> turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit5Test.java (with props)
> turbine/fulcrum/trunk/testcontainer/src/test/log4j2.xml (with props)
> turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerJunit5Test.java (with props)
> Modified:
> turbine/fulcrum/trunk/testcontainer/pom.xml
> turbine/fulcrum/trunk/testcontainer/src/changes/changes.xml
> turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit4Test.java
> turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java
> turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/EcmContainerTest.java
> turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerTest.java
> turbine/fulcrum/trunk/testcontainer/xdocs/index.xml
>
> Modified: turbine/fulcrum/trunk/testcontainer/pom.xml
> URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/pom.xml?rev=1847727&r1=1847726&r2=1847727&view=diff
> ==============================================================================
> --- turbine/fulcrum/trunk/testcontainer/pom.xml (original)
> +++ turbine/fulcrum/trunk/testcontainer/pom.xml Thu Nov 29 15:29:54 2018
> @@ -30,13 +30,21 @@
> <inceptionYear>2004</inceptionYear>
> <description>A test framework for Avalon components</description>
> <url>http://turbine.apache.org/fulcrum/fulcrum-testcontainer</url>
> -
> +
> <scm>
> <connection>scm:svn:http://svn.apache.org/repos/asf/turbine/fulcrum/trunk/testcontainer</connection>
> <developerConnection>scm:svn:https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/testcontainer</developerConnection>
> <url>http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer</url>
> </scm>
>
> + <distributionManagement>
> + <site>
> + <id>apache.website</id>
> + <name>Fulcrum Website</name>
> + <url>http://turbine.apache.org/fulcrum/fulcrum-testcontainer/</url>
> + </site>
> + </distributionManagement>
> +
> <developers>
> <developer>
> <name>Siegfried Goeschl</name>
> @@ -50,11 +58,46 @@
> </developers>
>
> <dependencies>
> + <!-- we still need this dependency to compile -->
> + <dependency>
> + <groupId>junit</groupId>
> + <artifactId>junit</artifactId>
> + <version>4.12</version>
> + </dependency>
> <dependency>
> - <groupId>junit</groupId>
> - <artifactId>junit</artifactId>
> - <version>4.12</version>
> + <groupId>org.junit.jupiter</groupId>
> + <artifactId>junit-jupiter-api</artifactId>
> + <version>${junit.jupiter.version}</version>
> + <!--scope>test</scope-->
> + </dependency>
> + <dependency>
> + <groupId>org.junit.jupiter</groupId>
> + <artifactId>junit-jupiter-params</artifactId>
> + <version>${junit.jupiter.version}</version>
> + <!--scope>test</scope-->
> + </dependency>
> + <dependency>
> + <groupId>org.junit.jupiter</groupId>
> + <artifactId>junit-jupiter-engine</artifactId>
> + <version>${junit.jupiter.version}</version>
> + </dependency>
> + <!-- use Junit 4 within Junit 5 -->
> + <dependency>
> + <groupId>org.junit.vintage</groupId>
> + <artifactId>junit-vintage-engine</artifactId>
> + <version>${junit.jupiter.version}</version>
> + </dependency>
> + <dependency>
> + <groupId>org.junit.platform</groupId>
> + <artifactId>junit-platform-runner</artifactId>
> + <version>${junit.platform}</version>
> </dependency>
> + <dependency>
> + <groupId>org.junit.platform</groupId>
> + <artifactId>junit-platform-launcher</artifactId>
> + <version>${junit.platform}</version>
> + </dependency>
> +
> <!-- Needed if testing with YAAFI -->
> <dependency>
> <groupId>org.apache.fulcrum</groupId>
> @@ -62,11 +105,11 @@
> <version>1.0.8-SNAPSHOT</version>
> <optional>true</optional>
> </dependency>
> - <dependency>
> - <groupId>javax.servlet</groupId>
> - <artifactId>javax.servlet-api</artifactId>
> - <version>3.1.0</version>
> - </dependency>
> + <dependency>
> + <groupId>javax.servlet</groupId>
> + <artifactId>javax.servlet-api</artifactId>
> + <version>3.1.0</version>
> + </dependency>
> <dependency>
> <groupId>org.mockito</groupId>
> <artifactId>mockito-core</artifactId>
> @@ -80,47 +123,64 @@
> <type>jar</type>
> <optional>true</optional>
> </dependency>
> +
> <dependency>
> - <groupId>log4j</groupId>
> - <artifactId>log4j</artifactId>
> - <version>1.2.15</version>
> - <type>jar</type>
> + <groupId>org.apache.logging.log4j</groupId>
> + <artifactId>log4j-api</artifactId>
> + <version>${log4j2.version}</version>
> <optional>true</optional>
> - <exclusions>
> - <exclusion>
> - <groupId>com.sun.jdmk</groupId>
> - <artifactId>jmxtools</artifactId>
> - </exclusion>
> - <exclusion>
> - <groupId>com.sun.jmx</groupId>
> - <artifactId>jmxri</artifactId>
> - </exclusion>
> - <exclusion>
> - <groupId>javax.jms</groupId>
> - <artifactId>jms</artifactId>
> - </exclusion>
> - </exclusions>
> </dependency>
> + <dependency>
> + <groupId>org.apache.logging.log4j</groupId>
> + <artifactId>log4j-core</artifactId>
> + <version>${log4j2.version}</version>
> + <optional>true</optional>
> + </dependency>
> + <!-- log4j1.2 bridge instead of log4j -->
> + <dependency>
> + <groupId>org.apache.logging.log4j</groupId>
> + <artifactId>log4j-1.2-api</artifactId>
> + <version>${log4j2.version}</version>
> + <optional>true</optional>
> + </dependency>
> +
> </dependencies>
>
> <build>
> <sourceDirectory>${basedir}/src/java</sourceDirectory>
> <testSourceDirectory>${basedir}/src/test</testSourceDirectory>
> + <testResources>
> + <testResource>
> + <targetPath />
> + <directory>${basedir}/src/test</directory>
> + <includes>
> + <include>*.xml</include>
> + </includes>
> + </testResource>
> + </testResources>
> <plugins>
> <plugin>
> + <!-- JUnit 5 requires Surefire version 2.22.0 or higher -->
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-surefire-plugin</artifactId>
> <configuration>
> - <!-- forkMode=always equivalent -->
> + <!-- setting the default: forkCount=1/reuseForks=true -->
> <forkCount>1</forkCount>
> - <reuseForks>false</reuseForks>
> + <!-- setting this to false (highest isolation: each test class has its own jvm process) let maven test ignore all tests? -->
> + <reuseForks>true</reuseForks>
> </configuration>
> + <dependencies>
> + <!-- need no junit-platform-surefire-provider dependency-->
> + </dependencies>
> </plugin>
> </plugins>
> </build>
> -
> +
> <properties>
> <turbine.site.path>fulcrum/fulcrum-testcontainer</turbine.site.path>
> + <junit.jupiter.version>5.3.1</junit.jupiter.version>
> + <junit.platform>1.3.2</junit.platform>
> + <log4j2.version>2.11.1</log4j2.version>
> </properties>
> -
> -</project>
> +
> +</project>
> \ No newline at end of file
>
> Modified: turbine/fulcrum/trunk/testcontainer/src/changes/changes.xml
> URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/changes/changes.xml?rev=1847727&r1=1847726&r2=1847727&view=diff
> ==============================================================================
> --- turbine/fulcrum/trunk/testcontainer/src/changes/changes.xml (original)
> +++ turbine/fulcrum/trunk/testcontainer/src/changes/changes.xml Thu Nov 29 15:29:54 2018
> @@ -25,6 +25,9 @@
> </properties>
> <body>
> <release version="1.0.8" date="in Subversion">
> + <action type="update" dev="gk">
> + Add support for JUnit 5
> + </action>
> </release>
> <release version="1.0.7" date="2015-08-08">
> <action type="update" dev="gk">
>
> Modified: turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit4Test.java
> URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit4Test.java?rev=1847727&r1=1847726&r2=1847727&view=diff
> ==============================================================================
> --- turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit4Test.java (original)
> +++ turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit4Test.java Thu Nov 29 15:29:54 2018
> @@ -54,6 +54,7 @@ import org.mockito.stubbing.Answer;
> * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
> * @version $Id$
> */
> +
> public class BaseUnit4Test
> {
> public static final String CONTAINER_ECM = "CONTAINER_ECM";
> @@ -63,7 +64,7 @@ public class BaseUnit4Test
> public static final String COMPONENT_APP_ROOT = Container.COMPONENT_APP_ROOT;
>
> /** Pick the default container to be YAAFI **/
> - public static String containerType = CONTAINER_YAAFI;
> + private String containerType = CONTAINER_YAAFI;
>
> /** Use INFO for ConsoleLogger */
> public static final int defaultLogLevel = ConsoleLogger.LEVEL_INFO;
> @@ -285,4 +286,14 @@ public class BaseUnit4Test
> when(request.getParameterNames()).thenReturn(v.elements());
> return request;
> }
> +
> + public String getContainerType()
> + {
> + return containerType;
> + }
> +
> + public void setContainerType( String containerType )
> + {
> + this.containerType = containerType;
> + }
> }
>
> Added: turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit5Test.java
> URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit5Test.java?rev=1847727&view=auto
> ==============================================================================
> --- turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit5Test.java (added)
> +++ turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit5Test.java Thu Nov 29 15:29:54 2018
> @@ -0,0 +1,302 @@
> +package org.apache.fulcrum.testcontainer;
> +
> +import static org.mockito.ArgumentMatchers.any;
> +import static org.mockito.ArgumentMatchers.anyInt;
> +import static org.mockito.ArgumentMatchers.anyString;
> +import static org.mockito.Mockito.doAnswer;
> +import static org.mockito.Mockito.mock;
> +import static org.mockito.Mockito.when;
> +
> +import java.util.HashMap;
> +import java.util.Locale;
> +import java.util.Map;
> +import java.util.Vector;
> +
> +import javax.servlet.http.HttpServletRequest;
> +import javax.servlet.http.HttpSession;
> +
> +import org.apache.avalon.framework.component.ComponentException;
> +import org.apache.avalon.framework.logger.ConsoleLogger;
> +// import static org.junit.jupiter.api.Assertions.*;
> +import org.junit.jupiter.api.AfterEach;
> +import org.mockito.invocation.InvocationOnMock;
> +import org.mockito.stubbing.Answer;
> +
> +
> +/*
> + * 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.
> + */
> +
> +/**
> + * Alternative Base class to {@link BaseUnit4Test} for component tests.
> + *
> + * This version doesn't load the container until the
> + * first request for a component. This allows the tester to populate the configurationFileName and
> + * roleFileName, possible one per test.
> + *
> + * JUnit 5 Version of BaseUnitTest class.
> + *
> + * @see {@link BaseUnit4Test}
> + *
> + * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
> + * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
> + * @version $Id$
> + */
> +//@RunWith(JUnitPlatform.class)
> +public class BaseUnit5Test
> +{
> + public static final String CONTAINER_ECM = "CONTAINER_ECM";
> + public static final String CONTAINER_YAAFI = "CONTAINER_YAAFI";
> +
> + /** Key used in the context for defining the application root */
> + public static final String COMPONENT_APP_ROOT = Container.COMPONENT_APP_ROOT;
> +
> + /** Pick the default container to be YAAFI, running in **/
> + private String containerType = CONTAINER_YAAFI;
> +
> + /** Use INFO for ConsoleLogger */
> + public static final int defaultLogLevel = ConsoleLogger.LEVEL_INFO;
> +
> + /** Container for the components */
> + private Container container;
> +
> + /** Setup our default configurationFileName */
> + private String configurationFileName = "src/test/TestComponentConfig.xml";
> +
> + /** Setup our default roleFileName */
> + private String roleFileName = "src/test/TestRoleConfig.xml";
> +
> + /** Setup our default parameterFileName */
> + private String parameterFileName = null;
> +
> + /** Set the log level (only works for YAAFI container) */
> + private int logLevel = defaultLogLevel;
> +
> + /** Hash map to store attributes for the test **/
> + public Map<String,Object> attributes = new HashMap<String,Object>();
> +
> + /** set the Max inactive interval **/
> + public int maxInactiveInterval = 0;
> +
> + /**
> + * Gets the configuration file name for the container should use for this test. By default it
> + * is src/test/TestComponentConfig.
> + *
> + * @param configurationFileName the location of the config file
> + */
> + protected void setConfigurationFileName(String configurationFileName)
> + {
> + this.configurationFileName = configurationFileName;
> + }
> +
> + /**
> + * Override the role file name for the container should use for this test. By default it is
> + * src/test/TestRoleConfig.
> + *
> + * @param roleFileName location of the role file
> + */
> + protected void setRoleFileName(String roleFileName)
> + {
> + this.roleFileName = roleFileName;
> + }
> +
> + /**
> + * Set the console logger level
> + *
> + * @see org.apache.avalon.framework.logger.ConsoleLogger for debugging levels
> + * @param logLevel set valid logging level
> + */
> + protected void setLogLevel(int logLevel) {
> + this.logLevel = logLevel;
> + }
> +
> + /**
> + * Constructor for test.
> + */
> + public BaseUnit5Test()
> + {
> + }
> +
> + /**
> + * Clean up after each test is run.
> + */
> + @AfterEach
> + public void tearDown()
> + {
> + if (container != null)
> + {
> + container.dispose();
> + }
> + container = null;
> + }
> +
> + /**
> + * Gets the configuration file name for the container should use for this test.
> + *
> + * @return The filename of the configuration file
> + */
> + protected String getConfigurationFileName()
> + {
> + return configurationFileName;
> + }
> +
> + /**
> + * Gets the role file name for the container should use for this test.
> + *
> + * @return The filename of the role configuration file
> + */
> + protected String getRoleFileName()
> + {
> + return roleFileName;
> + }
> +
> + /**
> + * Gets the parameter file name for the container should use for this test.
> + *
> + * @return The filename of the role configuration file
> + */
> + protected String getParameterFileName()
> + {
> + return parameterFileName;
> + }
> +
> + /**
> + * Returns an instance of the named component.
> + * This method will also start the container if it
> + * has not been started already
> + *
> + * @param roleName Name of the role the component fills.
> + * @return instance of the component
> + * @throws ComponentException generic exception
> + */
> + protected Object lookup(String roleName) throws ComponentException
> + {
> + if (container == null)
> + {
> + if(containerType.equals(CONTAINER_ECM)){
> + container = new ECMContainer();
> + }
> + else {
> + container = new YAAFIContainer(logLevel);
> + }
> + container.startup(getConfigurationFileName(), getRoleFileName(),getParameterFileName());
> + }
> + return container.lookup(roleName);
> + }
> +
> + /**
> + * Releases the component.
> + *
> + * @param component component to be released
> + */
> + protected void release(Object component)
> + {
> + if (container != null)
> + {
> + container.release(component);
> + }
> + }
> +
> +
> + /**
> + * Get a mock requestion
> + *
> + * @return HttpServletRequest a mock servlet request
> + */
> + protected HttpServletRequest getMockRequest()
> + {
> + HttpServletRequest request = mock(HttpServletRequest.class);
> + HttpSession session = mock(HttpSession.class);
> +
> + doAnswer(new Answer<Object>()
> + {
> + @Override
> + public Object answer(InvocationOnMock invocation) throws Throwable
> + {
> + String key = (String) invocation.getArguments()[0];
> + return attributes.get(key);
> + }
> + }).when(session).getAttribute(anyString());
> +
> + doAnswer(new Answer<Object>()
> + {
> + @Override
> + public Object answer(InvocationOnMock invocation) throws Throwable
> + {
> + String key = (String) invocation.getArguments()[0];
> + Object value = invocation.getArguments()[1];
> + attributes.put(key, value);
> + return null;
> + }
> + }).when(session).setAttribute(anyString(), any());
> +
> + when(session.getMaxInactiveInterval()).thenReturn(maxInactiveInterval);
> +
> + doAnswer(new Answer<Integer>()
> + {
> + @Override
> + public Integer answer(InvocationOnMock invocation) throws Throwable
> + {
> + return Integer.valueOf(maxInactiveInterval);
> + }
> + }).when(session).getMaxInactiveInterval();
> +
> + doAnswer(new Answer<Object>()
> + {
> + @Override
> + public Object answer(InvocationOnMock invocation) throws Throwable
> + {
> + Integer value = (Integer) invocation.getArguments()[0];
> + maxInactiveInterval = value.intValue();
> + return null;
> + }
> + }).when(session).setMaxInactiveInterval(anyInt());
> +
> + when(session.isNew()).thenReturn(true);
> + when(request.getSession()).thenReturn(session);
> +
> + when(request.getServerName()).thenReturn("bob");
> + when(request.getProtocol()).thenReturn("http");
> + when(request.getScheme()).thenReturn("scheme");
> + when(request.getPathInfo()).thenReturn("damn");
> + when(request.getServletPath()).thenReturn("damn2");
> + when(request.getContextPath()).thenReturn("wow");
> + when(request.getContentType()).thenReturn("text/html");
> +
> + when(request.getCharacterEncoding()).thenReturn("US-ASCII");
> + when(request.getServerPort()).thenReturn(8080);
> + when(request.getLocale()).thenReturn(Locale.US);
> +
> + when(request.getHeader("Content-type")).thenReturn("text/html");
> + when(request.getHeader("Accept-Language")).thenReturn("en-US");
> +
> + Vector<String> v = new Vector<String>();
> + when(request.getParameterNames()).thenReturn(v.elements());
> + return request;
> + }
> +
> + public String getContainerType()
> + {
> + return containerType;
> + }
> +
> + public void setContainerType( String containerType )
> + {
> + this.containerType = containerType;
> + }
> +}
>
> Propchange: turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/BaseUnit5Test.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Modified: turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java
> URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java?rev=1847727&r1=1847726&r2=1847727&view=diff
> ==============================================================================
> --- turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java (original)
> +++ turbine/fulcrum/trunk/testcontainer/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java Thu Nov 29 15:29:54 2018
> @@ -53,7 +53,6 @@ public class ECMContainer extends Abstra
> */
> public ECMContainer()
> {
> - org.apache.log4j.BasicConfigurator.configure();
> this.enableLogging(lm.getLoggerForCategory("org.apache.fulcrum.testcontainer.Container"));
> }
> /**
>
> Added: turbine/fulcrum/trunk/testcontainer/src/test/log4j2.xml
> URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/test/log4j2.xml?rev=1847727&view=auto
> ==============================================================================
> --- turbine/fulcrum/trunk/testcontainer/src/test/log4j2.xml (added)
> +++ turbine/fulcrum/trunk/testcontainer/src/test/log4j2.xml Thu Nov 29 15:29:54 2018
> @@ -0,0 +1,43 @@
> +<?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.
> +-->
> +<Configuration>
> + <Appenders>
> + <Console name="console" target="SYSTEM_OUT">
> + <PatternLayout pattern="%d [%t] %-5p %c - %m%n"/>
> + </Console>
> + <File name="logfile" fileName="target/fulcrum-test.log">
> + <PatternLayout pattern="%d [%t] %-5p %c - %m%n"/>
> + </File>
> + </Appenders>
> + <Loggers>
> + <Logger name="org.apache.fulcrum" level="debug" additivity="false">
> + <AppenderRef ref="console"/>
> + </Logger>
> + <Logger name="avalon" level="debug" additivity="false">
> + <AppenderRef ref="console"/>
> + </Logger>
> + <Logger name="org.apache.logging.log4j" level="debug" additivity="false">
> + <AppenderRef ref="logfile"/>
> + </Logger>
> + <Root level="error">
> + <AppenderRef ref="console"/>
> + </Root>
> + </Loggers>
> +</Configuration>
> \ No newline at end of file
>
> Propchange: turbine/fulcrum/trunk/testcontainer/src/test/log4j2.xml
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Modified: turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/EcmContainerTest.java
> URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/EcmContainerTest.java?rev=1847727&r1=1847726&r2=1847727&view=diff
> ==============================================================================
> --- turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/EcmContainerTest.java (original)
> +++ turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/EcmContainerTest.java Thu Nov 29 15:29:54 2018
> @@ -1,4 +1,5 @@
> package org.apache.fulcrum.testcontainer;
> +
> /*
> * Licensed to the Apache Software Foundation (ASF) under one
> * or more contributor license agreements. See the NOTICE file
> @@ -17,22 +18,25 @@ package org.apache.fulcrum.testcontainer
> * specific language governing permissions and limitations
> * under the License.
> */
> +
> +import static org.junit.jupiter.api.Assertions.assertEquals;
> +import static org.junit.jupiter.api.Assertions.assertNotNull;
> +import static org.junit.jupiter.api.Assertions.assertTrue;
> +import static org.junit.jupiter.api.Assertions.fail;
> +
> import java.io.File;
>
> import org.apache.avalon.framework.component.ComponentException;
> import org.junit.Before;
> import org.junit.Test;
>
> -import static org.junit.Assert.assertEquals;
> -import static org.junit.Assert.assertNotNull;
> -import static org.junit.Assert.assertTrue;
> -import static org.junit.Assert.fail;
> /**
> * Basic testing of the Container
> *
> * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
> * @version $Id$
> */
> +
> public class EcmContainerTest extends BaseUnit4Test
> {
> /**
> @@ -44,7 +48,7 @@ public class EcmContainerTest extends Ba
>
> @Before
> public void setUp() throws Exception{
> - containerType=CONTAINER_ECM;
> + setContainerType( CONTAINER_ECM);
> }
>
> @Test
>
> Added: turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerJunit5Test.java
> URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerJunit5Test.java?rev=1847727&view=auto
> ==============================================================================
> --- turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerJunit5Test.java (added)
> +++ turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerJunit5Test.java Thu Nov 29 15:29:54 2018
> @@ -0,0 +1,125 @@
> +package org.apache.fulcrum.testcontainer;
> +
> +
> +import static org.junit.jupiter.api.Assertions.assertEquals;
> +import static org.junit.jupiter.api.Assertions.assertNotNull;
> +import static org.junit.jupiter.api.Assertions.assertTrue;
> +import static org.junit.jupiter.api.Assertions.fail;
> +
> +import java.io.File;
> +
> +import org.apache.avalon.framework.component.ComponentException;
> +import org.apache.avalon.framework.logger.ConsoleLogger;
> +import org.junit.jupiter.api.Test;
> +/*
> + * 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.
> + */
> +
> +
> +/**
> + * Basic testing of the Container
> + *
> + * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
> + * @version $Id: YaafiContainerTest.java 1694570 2015-08-06 20:35:41Z sgoeschl $
> + */
> +public class YaafiContainerJunit5Test extends BaseUnit5Test
> +{
> + /**
> + * Constructor for test.
> + */
> + public YaafiContainerJunit5Test()
> + {
> + }
> +
> + @Test
> + public void testInitialization()
> + {
> + assertTrue(true);
> + }
> +
> + @Test
> + public void testComponentUsage()
> + {
> + SimpleComponent sc = null;
> + try
> + {
> + sc = (SimpleComponent) this.lookup(SimpleComponent.class.getName());
> + }
> + catch (ComponentException e)
> + {
> + e.printStackTrace();
> + fail(e.getMessage());
> + }
> + assertNotNull(sc);
> + sc.test();
> + System.out.println( sc );
> + assertEquals(sc.getAppRoot(),sc.getAppRoot2());
> + this.release(sc);
> + }
> +
> + @Test
> + public void testAlternativeRoles()
> + {
> + SimpleComponent sc = null;
> + File f = new File("src/test/TestAlternativeRoleConfig.xml");
> + assertTrue(f.exists());
> + this.setRoleFileName("src/test/TestAlternativeRoleConfig.xml");
> + try
> + {
> + sc = (SimpleComponent) this.lookup(SimpleComponent.ROLE);
> + }
> + catch (ComponentException e)
> + {
> + e.printStackTrace();
> + fail(e.getMessage());
> + }
> + assertTrue(sc instanceof AlternativeComponentImpl);
> + assertNotNull(sc);
> + sc.test();
> + this.release(sc);
> + }
> +
> + @Test
> + public void testLoadingContainerWithNoRolesfileFails()
> + {
> + this.setLogLevel(ConsoleLogger.LEVEL_DISABLED);
> +
> + this.setRoleFileName(null);
> +
> + try
> + {
> + this.lookup(SimpleComponent.class.getName());
> + fail("We should fail");
> + }
> + catch (ComponentException e)
> + {
> + e.printStackTrace();
> + fail(e.getMessage());
> + }
> + catch (Exception e)
> + {
> + // We expect to fail with a ConfigurationException
> + }
> + }
> + @Test
> + public void testWithLogLevel() throws Exception
> + {
> + this.setLogLevel(ConsoleLogger.LEVEL_ERROR);
> + this.lookup(SimpleComponent.class.getName());
> + }
> +}
>
> Propchange: turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerJunit5Test.java
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Modified: turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerTest.java
> URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerTest.java?rev=1847727&r1=1847726&r2=1847727&view=diff
> ==============================================================================
> --- turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerTest.java (original)
> +++ turbine/fulcrum/trunk/testcontainer/src/test/org/apache/fulcrum/testcontainer/YaafiContainerTest.java Thu Nov 29 15:29:54 2018
> @@ -1,4 +1,5 @@
> package org.apache.fulcrum.testcontainer;
> +
> /*
> * Licensed to the Apache Software Foundation (ASF) under one
> * or more contributor license agreements. See the NOTICE file
> @@ -23,10 +24,11 @@ import org.apache.avalon.framework.compo
> import org.apache.avalon.framework.logger.ConsoleLogger;
> import org.junit.Test;
>
> -import static org.junit.Assert.assertEquals;
> -import static org.junit.Assert.assertNotNull;
> -import static org.junit.Assert.assertTrue;
> -import static org.junit.Assert.fail;
> +import static org.junit.jupiter.api.Assertions.assertEquals;
> +import static org.junit.jupiter.api.Assertions.assertNotNull;
> +import static org.junit.jupiter.api.Assertions.assertTrue;
> +import static org.junit.jupiter.api.Assertions.fail;
> +
> /**
> * Basic testing of the Container
> *
> @@ -62,6 +64,7 @@ public class YaafiContainerTest extends
> fail(e.getMessage());
> }
> assertNotNull(sc);
> + System.out.println( sc );
> sc.test();
> assertEquals(sc.getAppRoot(),sc.getAppRoot2());
> this.release(sc);
>
> Modified: turbine/fulcrum/trunk/testcontainer/xdocs/index.xml
> URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/testcontainer/xdocs/index.xml?rev=1847727&r1=1847726&r2=1847727&view=diff
> ==============================================================================
> --- turbine/fulcrum/trunk/testcontainer/xdocs/index.xml (original)
> +++ turbine/fulcrum/trunk/testcontainer/xdocs/index.xml Thu Nov 29 15:29:54 2018
> @@ -32,8 +32,10 @@
> <p> This component is really just a test container for testing the other components. This
> container is not meant to be used in a production environment. </p>
> <p> In order to save you a little coding, a base class has been provided for your test cases.
> - Simply extend <code>org.apache.fulcrum.testcontainer.BaseUnitTest</code> for JUnit3 or <code>org.apache.fulcrum.testcontainer.BaseUnit4Test</code> for JUnit 4 support and you are ready
> - to go. </p>
> + Simply extend <code>org.apache.fulcrum.testcontainer.BaseUnitTest</code> for JUnit3, <code>org.apache.fulcrum.testcontainer.BaseUnit4Test</code> for JUnit 4 and <code>org.apache.fulcrum.testcontainer.BaseUnit5Test</code> JUnit 5 support and you are ready to go. </p>
> +
> + <p>More Information about the <a href="https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4-running">migration to Junit5:</a>.
> + </p>
> </section>
>
> <section name="Usage">
>
>
--
Jeff Painter
CEO and Founder of JiveCast
Software and analytics, made together
https://jivecast.com
301 Fayetteville St. Unit 2301, Raleigh, NC 27601
(919) 533-9024