- fixing relativePath in poms cache, intake, quartz, parser, security, testcontainer
- intake: update parser, use in test pool2, add log4j2 for next testcontainer
- parser: formatting, dependency fixes, site skin update
- testcontainer: add and use log4j2 avalon adapter in yaafi testcontainer, use more JUnit 5
- moved README.txt to READMe.md in root
git-svn-id: https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/testcontainer@1890285 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index 8ea392e..a3ef515 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,151 +10,152 @@
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>turbine-parent</artifactId>
- <groupId>org.apache.turbine</groupId>
- <version>8</version>
- </parent>
+ <parent>
+ <artifactId>turbine-parent</artifactId>
+ <groupId>org.apache.turbine</groupId>
+ <version>8</version>
+ <relativePath></relativePath>
+ </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.fulcrum</groupId>
- <artifactId>fulcrum-testcontainer</artifactId>
- <version>1.0.10-SNAPSHOT</version>
- <name>Fulcrum Test Container</name>
- <inceptionYear>2004</inceptionYear>
- <description>A test framework for Avalon components</description>
- <url>https://turbine.apache.org/fulcrum/fulcrum-testcontainer</url>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.fulcrum</groupId>
+ <artifactId>fulcrum-testcontainer</artifactId>
+ <version>1.0.10-SNAPSHOT</version>
+ <name>Fulcrum Test Container</name>
+ <inceptionYear>2004</inceptionYear>
+ <description>A test framework for Avalon components</description>
+ <url>https://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>
+ <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>
+ <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>
- <id>sgoeschl</id>
- <email>sgoeschl@apache.org</email>
- <organization />
- <roles>
- <role>Java Developer</role>
- </roles>
- </developer>
- </developers>
+ <developers>
+ <developer>
+ <name>Siegfried Goeschl</name>
+ <id>sgoeschl</id>
+ <email>sgoeschl@apache.org</email>
+ <organization />
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+ </developers>
- <dependencies>
- <!-- we still need this dependency to compile -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.13.1</version>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <version>${junit.jupiter.version}</version>
- <!--scope>test</scope -->
- </dependency>
- <!-- use Junit 4 within Junit 5 -->
- <dependency>
- <groupId>org.junit.vintage</groupId>
- <artifactId>junit-vintage-engine</artifactId>
- <version>${junit.jupiter.version}</version>
- <scope>test</scope>
- </dependency>
+ <dependencies>
+ <!-- we still need this dependency to compile -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.13.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <!--scope>test</scope -->
+ </dependency>
+ <!-- use Junit 4 within Junit 5 -->
+ <dependency>
+ <groupId>org.junit.vintage</groupId>
+ <artifactId>junit-vintage-engine</artifactId>
+ <version>${junit.jupiter.version}</version>
+ <scope>test</scope>
+ </dependency>
- <!-- Needed if testing with YAAFI -->
- <dependency>
- <groupId>org.apache.fulcrum</groupId>
- <artifactId>fulcrum-yaafi</artifactId>
- <version>1.0.8</version>
- <optional>true</optional>
- </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>
- <version>3.5.13</version>
- </dependency>
- <!-- Needed if testing with ECM -->
- <dependency>
- <groupId>org.apache.excalibur.component</groupId>
- <artifactId>excalibur-component</artifactId>
- <version>2.2.1</version>
- <type>jar</type>
- <optional>true</optional>
- </dependency>
- <!-- Log4j2 may be better used by default -->
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api</artifactId>
- <version>${turbine.log4j2.version}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${turbine.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>${turbine.log4j2.version}</version>
- <optional>true</optional>
- </dependency>
+ <!-- Needed if testing with YAAFI -->
+ <dependency>
+ <groupId>org.apache.fulcrum</groupId>
+ <artifactId>fulcrum-yaafi</artifactId>
+ <version>1.0.8</version>
+ <optional>true</optional>
+ </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>
+ <version>3.5.13</version>
+ </dependency>
+ <!-- Needed if testing with ECM -->
+ <dependency>
+ <groupId>org.apache.excalibur.component</groupId>
+ <artifactId>excalibur-component</artifactId>
+ <version>2.2.1</version>
+ <type>jar</type>
+ <optional>true</optional>
+ </dependency>
+ <!-- Log4j2 may be better used by default -->
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <version>${turbine.log4j2.version}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <version>${turbine.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>${turbine.log4j2.version}</version>
+ <optional>true</optional>
+ </dependency>
- </dependencies>
+ </dependencies>
- <build>
- <sourceDirectory>${basedir}/src/java</sourceDirectory>
- <testSourceDirectory>${basedir}/src/test</testSourceDirectory>
- <testResources>
- <testResource>
- <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>
- <!-- setting the default: forkCount=1/reuseForks=true -->
- <forkCount>1</forkCount>
- <!-- 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>
+ <build>
+ <sourceDirectory>${basedir}/src/java</sourceDirectory>
+ <testSourceDirectory>${basedir}/src/test</testSourceDirectory>
+ <testResources>
+ <testResource>
+ <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>
+ <!-- setting the default: forkCount=1/reuseForks=true -->
+ <forkCount>1</forkCount>
+ <!-- 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>
- <turbine.scmPubCheckoutDirectory>${turbine.site.cache}/fulcrum/testcontainer</turbine.scmPubCheckoutDirectory>
- <junit.jupiter.version>5.7.1</junit.jupiter.version>
- <junit.platform>1.7.1</junit.platform>
- </properties>
+ <properties>
+ <turbine.site.path>fulcrum/fulcrum-testcontainer</turbine.site.path>
+ <turbine.scmPubCheckoutDirectory>${turbine.site.cache}/fulcrum/testcontainer</turbine.scmPubCheckoutDirectory>
+ <junit.jupiter.version>5.7.1</junit.jupiter.version>
+ <junit.platform>1.7.1</junit.platform>
+ </properties>
</project>
diff --git a/src/java/org/apache/fulcrum/testcontainer/BaseUnit5Test.java b/src/java/org/apache/fulcrum/testcontainer/BaseUnit5Test.java
index 9a241e1..82af43c 100644
--- a/src/java/org/apache/fulcrum/testcontainer/BaseUnit5Test.java
+++ b/src/java/org/apache/fulcrum/testcontainer/BaseUnit5Test.java
@@ -29,13 +29,16 @@
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+import java.util.Objects;
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.AbstractLogEnabled;
import org.apache.avalon.framework.logger.ConsoleLogger;
+import org.apache.avalon.framework.logger.Logger;
import org.junit.jupiter.api.AfterEach;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -121,6 +124,11 @@
{
this.logLevel = logLevel;
}
+
+ public int getLogLevel()
+ {
+ return logLevel;
+ }
/**
* Constructor for test.
diff --git a/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java b/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java
index c29c2e0..a8256c2 100644
--- a/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java
+++ b/src/java/org/apache/fulcrum/testcontainer/ECMContainer.java
@@ -64,6 +64,7 @@
public void startup(String configFileName, String roleFileName,String parametersFileName)
{
getLogger().debug("Starting container...");
+ getLogger().debug( "with logger: " + getLogger().getClass().getSimpleName());
this.configFileName = configFileName;
this.roleFileName = roleFileName;
File configFile = new File(configFileName);
diff --git a/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java b/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java
index 686e9fd..6523163 100644
--- a/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java
+++ b/src/java/org/apache/fulcrum/testcontainer/YAAFIContainer.java
@@ -25,9 +25,13 @@
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.logger.ConsoleLogger;
+import org.apache.fulcrum.testcontainer.avalon.logger.Log4J2Logger;
import org.apache.fulcrum.yaafi.framework.container.ServiceContainer;
import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerConfiguration;
import org.apache.fulcrum.yaafi.framework.factory.ServiceContainerFactory;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.config.Configurator;
/**
* This is a simple YAAFI based container that can be used in unit test
@@ -44,26 +48,50 @@
private ServiceContainer manager;
/** The log level for the ConsoleLogger */
- private int logLevel = ConsoleLogger.LEVEL_DEBUG;
+ //private int logLevel = ConsoleLogger.LEVEL_DEBUG;
+ private Level logLevel = Level.DEBUG;
+
+ org.apache.logging.log4j.Logger logger;
/**
* Constructor.
*/
public YAAFIContainer()
{
- this.enableLogging( new ConsoleLogger( logLevel ) );
+ //this.enableLogging( new ConsoleLogger( logLevel ) );
+ logger = LogManager.getLogger( "avalon" );
+ Configurator.setLevel( "avalon",logLevel );
+ this.enableLogging( new Log4J2Logger( logger ) );
this.config = new ServiceContainerConfiguration();
}
/**
* Constructor.
*
- * @param logLevel the log level to be used
+ * @param logLevel the log level to be used: {@link ConsoleLogger} LEVEL_*.
*/
public YAAFIContainer(int logLevel)
{
- this.logLevel = logLevel;
- this.enableLogging( new ConsoleLogger( logLevel ) );
+ logger = LogManager.getLogger( "avalon" );
+ if (logLevel == ConsoleLogger.LEVEL_DEBUG) {
+ this.logLevel = Level.DEBUG;
+ } else if (logLevel == ConsoleLogger.LEVEL_DEBUG) {
+ this.logLevel = Level.DEBUG;
+ } else if (logLevel == ConsoleLogger.LEVEL_INFO) {
+ this.logLevel = Level.INFO;
+ } else if (logLevel == ConsoleLogger.LEVEL_WARN) {
+ this.logLevel = Level.WARN;
+ } else if (logLevel == ConsoleLogger.LEVEL_ERROR) {
+ this.logLevel = Level.ERROR;
+ } else if (logLevel == ConsoleLogger.LEVEL_FATAL) {
+ this.logLevel = Level.FATAL;
+ } else if (logLevel == ConsoleLogger.LEVEL_DISABLED) {
+ this.logLevel = Level.OFF;
+ } else {
+ this.logLevel = Level.INFO;
+ }
+ Configurator.setLevel( "avalon", this.logLevel );
+ this.enableLogging( new Log4J2Logger( logger ) );
this.config = new ServiceContainerConfiguration();
}
@@ -78,12 +106,13 @@
String roleFileName,
String parametersFileName )
{
- getLogger().debug("Starting container...");
+ getLogger().debug("Starting YAAFI container... ");
+ getLogger().debug( "with logger: " + getLogger().getClass().getName());
this.config.setComponentConfigurationLocation( configFileName );
this.config.setComponentRolesLocation( roleFileName );
this.config.setParametersLocation( parametersFileName );
- this.config.setLogger( new ConsoleLogger( logLevel ) );
+ this.config.setLogger( new Log4J2Logger( logger ) );
File configFile = new File(configFileName);
diff --git a/src/java/org/apache/fulcrum/testcontainer/avalon/logger/Log4J2Logger.java b/src/java/org/apache/fulcrum/testcontainer/avalon/logger/Log4J2Logger.java
new file mode 100644
index 0000000..0391f37
--- /dev/null
+++ b/src/java/org/apache/fulcrum/testcontainer/avalon/logger/Log4J2Logger.java
@@ -0,0 +1,221 @@
+package org.apache.fulcrum.testcontainer.avalon.logger;
+
+import java.util.Objects;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.logging.log4j.Level;
+
+/*
+ * 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 org.apache.logging.log4j.LogManager;
+
+/**
+ * A Log4J2 wrapper class for Logger.
+ *
+ * - supports only minimal logging mechanism, without suppliers or objects.
+ *
+ * @author <a href="mailto:dev@turbine.apache.org">Turbine Development Team</a>
+ * @version $Id$
+ */
+public final class Log4J2Logger
+ implements Logger
+{
+
+ //underlying implementation
+ private final org.apache.logging.log4j.Logger m_logger;
+
+ /**
+ * Create a logger that delegates to specified category.
+ *
+ * @param logImpl the category to delegate to
+ */
+ public Log4J2Logger( final org.apache.logging.log4j.Logger logImpl )
+ {
+ Objects.requireNonNull( logImpl, "Log4J2 logger must not be null" );
+ m_logger = logImpl;
+ }
+
+ /**
+ * Log a debug message.
+ *
+ * @param message the message
+ */
+ public final void debug( final String message )
+ {
+ m_logger.log( Level.DEBUG, message );
+ }
+
+ /**
+ * Log a debug message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ public final void debug( final String message, final Throwable throwable )
+ {
+ m_logger.log( Level.DEBUG, message, throwable );
+ }
+
+ /**
+ * Determine if messages of priority "debug" will be logged.
+ *
+ * @return true if "debug" messages will be logged
+ */
+ public final boolean isDebugEnabled()
+ {
+ return m_logger.isDebugEnabled();
+ }
+
+ /**
+ * Log a info message.
+ *
+ * @param message the message
+ */
+ public final void info( final String message )
+ {
+ m_logger.log( Level.INFO, message );
+ }
+
+ /**
+ * Log a info message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ public final void info( final String message, final Throwable throwable )
+ {
+ m_logger.log( Level.INFO, message, throwable );
+ }
+
+ /**
+ * Determine if messages of priority "info" will be logged.
+ *
+ * @return true if "info" messages will be logged
+ */
+ public final boolean isInfoEnabled()
+ {
+ return m_logger.isInfoEnabled();
+ }
+
+ /**
+ * Log a warn message.
+ *
+ * @param message the message
+ */
+ public final void warn( final String message )
+ {
+ m_logger.log( Level.WARN, message );
+ }
+
+ /**
+ * Log a warn message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ public final void warn( final String message, final Throwable throwable )
+ {
+ m_logger.log( Level.WARN, message, throwable );
+ }
+
+ /**
+ * Determine if messages of priority "warn" will be logged.
+ *
+ * @return true if "warn" messages will be logged
+ */
+ public final boolean isWarnEnabled()
+ {
+ return m_logger.isEnabled( Level.WARN );
+ }
+
+ /**
+ * Log a error message.
+ *
+ * @param message the message
+ */
+ public final void error( final String message )
+ {
+ m_logger.log( Level.ERROR, message );
+ }
+
+ /**
+ * Log a error message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ public final void error( final String message, final Throwable throwable )
+ {
+ m_logger.log( Level.ERROR, message, throwable );
+ }
+
+ /**
+ * Determine if messages of priority "error" will be logged.
+ *
+ * @return true if "error" messages will be logged
+ */
+ public final boolean isErrorEnabled()
+ {
+ return m_logger.isEnabled( Level.ERROR );
+ }
+
+ /**
+ * Log a fatalError message.
+ *
+ * @param message the message
+ */
+ public final void fatalError( final String message )
+ {
+ m_logger.log( Level.FATAL, message );
+ }
+
+ /**
+ * Log a fatalError message.
+ *
+ * @param message the message
+ * @param throwable the throwable
+ */
+ public final void fatalError( final String message, final Throwable throwable )
+ {
+ m_logger.log( Level.ERROR, message, throwable );
+ }
+
+ /**
+ * Determine if messages of priority "fatalError" will be logged.
+ *
+ * @return true if "fatalError" messages will be logged
+ */
+ public final boolean isFatalErrorEnabled()
+ {
+ return m_logger.isEnabled( Level.FATAL );
+ }
+
+ /**
+ * Create a new child logger.
+ * The name of the child logger is [current-loggers-name].[passed-in-name]
+ * Throws <code>IllegalArgumentException</code> if name has an empty element name
+ *
+ * @param name the subname of this logger
+ * @return the new logger
+ */
+ public final Logger getChildLogger( final String name )
+ {
+ return new Log4J2Logger( LogManager.getLogger( m_logger.getName() + "." + name ) );
+ }
+}
diff --git a/src/test/log4j2.xml b/src/test/log4j2.xml
index 3c007f1..3098f77 100644
--- a/src/test/log4j2.xml
+++ b/src/test/log4j2.xml
@@ -25,8 +25,13 @@
<Logger name="org.apache.fulcrum" level="debug"
additivity="false">
<AppenderRef ref="console" />
- <AppenderRef ref="avalonfile" />
+ <AppenderRef ref="logfile" />
</Logger>
+ <Logger name="org.apache.fulcrum.yaafi" level="debug"
+ additivity="false">
+ <AppenderRef ref="console" />
+ <AppenderRef ref="avalonfile" />
+ </Logger>
<Logger name="avalon" level="debug" additivity="false">
<AppenderRef ref="avalonfile" />
</Logger>
diff --git a/src/test/org/apache/fulcrum/testcontainer/EcmContainerTest.java b/src/test/org/apache/fulcrum/testcontainer/EcmContainerTest.java
index 121458d..050415d 100644
--- a/src/test/org/apache/fulcrum/testcontainer/EcmContainerTest.java
+++ b/src/test/org/apache/fulcrum/testcontainer/EcmContainerTest.java
@@ -27,8 +27,9 @@
import java.io.File;
import org.apache.avalon.framework.component.ComponentException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
/**
* Basic testing of the Container
@@ -37,7 +38,7 @@
* @version $Id$
*/
-public class EcmContainerTest extends BaseUnit4Test
+public class EcmContainerTest extends BaseUnit5Test
{
/**
* Constructor for test.
@@ -46,7 +47,7 @@
{
}
- @Before
+ @BeforeEach
public void setUp() throws Exception{
setContainerType( CONTAINER_ECM);
}
diff --git a/src/test/org/apache/fulcrum/testcontainer/YaafiContainerJunit5Test.java b/src/test/org/apache/fulcrum/testcontainer/YaafiContainerJunit5Test.java
index 6749584..1c4b3a5 100644
--- a/src/test/org/apache/fulcrum/testcontainer/YaafiContainerJunit5Test.java
+++ b/src/test/org/apache/fulcrum/testcontainer/YaafiContainerJunit5Test.java
@@ -28,6 +28,7 @@
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.logger.ConsoleLogger;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@@ -40,12 +41,20 @@
@DisplayName("Yaafi Container Test JUnit5")
public class YaafiContainerJunit5Test extends BaseUnit5Test
{
+
/**
* Constructor for test.
*/
public YaafiContainerJunit5Test()
{
}
+
+ @BeforeEach
+ public void setup() {
+ setContainerType( CONTAINER_YAAFI);
+ this.setLogLevel(ConsoleLogger.LEVEL_INFO);
+ }
+
@Test
public void testInitialization()
@@ -56,6 +65,7 @@
@Test
public void testComponentUsage()
{
+ this.setLogLevel(ConsoleLogger.LEVEL_DEBUG);
SimpleComponent sc = null;
try
{
diff --git a/src/test/org/apache/fulcrum/testcontainer/YaafiContainerTest.java b/src/test/org/apache/fulcrum/testcontainer/YaafiContainerTest.java
index 4e4cb93..917f9fa 100644
--- a/src/test/org/apache/fulcrum/testcontainer/YaafiContainerTest.java
+++ b/src/test/org/apache/fulcrum/testcontainer/YaafiContainerTest.java
@@ -2,6 +2,7 @@
/*
* 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