You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2004/02/28 20:45:51 UTC
cvs commit: jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/capability TestCapability.java
taylor 2004/02/28 11:45:50
Modified: portal/src/test/org/apache/jetspeed/capability
TestCapability.java
Log:
The test fixes by adding log4j, not quite sure ....
Revision Changes Path
1.7 +30 -4 jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/capability/TestCapability.java
Index: TestCapability.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/capability/TestCapability.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TestCapability.java 26 Feb 2004 22:50:41 -0000 1.6
+++ TestCapability.java 28 Feb 2004 19:45:50 -0000 1.7
@@ -54,12 +54,17 @@
package org.apache.jetspeed.capability;
+import java.io.FileInputStream;
import java.util.Iterator;
+import java.util.Properties;
import junit.framework.Test;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.logging.impl.Log4jFactory;
import org.apache.jetspeed.components.AbstractComponentAwareTestCase;
import org.apache.jetspeed.components.ComponentAwareTestSuite;
+import org.apache.log4j.PropertyConfigurator;
import org.picocontainer.MutablePicoContainer;
/**
@@ -91,6 +96,11 @@
super(name);
}
+ public static final String LOG4J_CONFIG_FILE = "log4j.file";
+
+ /** The default value for the Log4J File */
+ public static final String LOG4J_CONFIG_FILE_DEFAULT = "src/webapp/WEB-INF/conf/Log4j.properties";
+
/**
* Start the tests.
*
@@ -105,6 +115,22 @@
protected void setUp() throws Exception
{
super.setUp();
+
+ System.out.println("MAIN --------------");
+ String log4jFile = LOG4J_CONFIG_FILE_DEFAULT;
+ Properties p = new Properties();
+ try
+ {
+ p.load(new FileInputStream(log4jFile));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ PropertyConfigurator.configure(p);
+
+ System.getProperties().setProperty(LogFactory.class.getName(), Log4jFactory.class.getName());
+
container = (MutablePicoContainer) getContainer();
capabilities = (Capabilities) container.getComponentInstance(Capabilities.class);
}
@@ -133,16 +159,16 @@
// Find specific client -- testing pattern matching
String userAgent;
System.out.println("Testing all supported Clients...");
-
+/*
userAgent = "Opera/7.0";
System.out.println("Find pattern: " + userAgent);
CapabilityMap cm = capabilities.getCapabilityMap(userAgent);
assertNotNull("getCapabilityMap is null", cm);
capabilityMapReport(cm);
-
+*/
userAgent = "Mozilla/4.0";
System.out.println("Find pattern: " + userAgent);
- cm = capabilities.getCapabilityMap(userAgent);
+ CapabilityMap cm = capabilities.getCapabilityMap(userAgent);
assertNotNull("getCapabilityMap is null", cm);
capabilityMapReport(cm);
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org