perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6185 - in trunk/perfsonar-base: annotations/src/main/java/net/geant/perfsonar/annotations/selftest base base/src/main/java/net/geant/perfsonar base/src/test/java/net/geant/perfsonar base/src/test/resources ls ls/src/test/resources messaging
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r6185 - in trunk/perfsonar-base: annotations/src/main/java/net/geant/perfsonar/annotations/selftest base base/src/main/java/net/geant/perfsonar base/src/test/java/net/geant/perfsonar base/src/test/resources ls ls/src/test/resources messaging
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6185 - in trunk/perfsonar-base: annotations/src/main/java/net/geant/perfsonar/annotations/selftest base base/src/main/java/net/geant/perfsonar base/src/test/java/net/geant/perfsonar base/src/test/resources ls ls/src/test/resources messaging
- Date: Tue, 12 Mar 2013 16:58:31 +0000 (GMT)
- Authentication-results: sfpop-ironport04.merit.edu; dkim=neutral (message not signed) header.i=none
Author: dante.delvaux
Date: 2013-03-12 16:58:31 +0000 (Tue, 12 Mar 2013)
New Revision: 6185
Added:
trunk/perfsonar-base/base/src/test/resources/log4j.xml
trunk/perfsonar-base/ls/src/test/resources/log4j.xml
Modified:
trunk/perfsonar-base/annotations/src/main/java/net/geant/perfsonar/annotations/selftest/SelfTestData.java
trunk/perfsonar-base/base/
trunk/perfsonar-base/base/pom.xml
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/PerfSONAR.java
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
trunk/perfsonar-base/ls/
trunk/perfsonar-base/ls/pom.xml
trunk/perfsonar-base/messaging/pom.xml
Log:
psBase3: configuring tests logging and output.
Modified:
trunk/perfsonar-base/annotations/src/main/java/net/geant/perfsonar/annotations/selftest/SelfTestData.java
===================================================================
---
trunk/perfsonar-base/annotations/src/main/java/net/geant/perfsonar/annotations/selftest/SelfTestData.java
2013-03-06 21:34:16 UTC (rev 6184)
+++
trunk/perfsonar-base/annotations/src/main/java/net/geant/perfsonar/annotations/selftest/SelfTestData.java
2013-03-12 16:58:31 UTC (rev 6185)
@@ -6,7 +6,7 @@
import java.lang.annotation.Target;
/**
- * Annotated a method as a self test data provider.
+ * Annotates a method as a self test data provider.
*
* Self test methods may be optionally parameterized. It is necessary
* when the number of tests depends on dynamic behavior of the system e.g.
Property changes on: trunk/perfsonar-base/base
___________________________________________________________________
Modified: svn:ignore
- target
velocity.log*
.settings
.project
.classpath
+ target
velocity.log*
.settings
.project
.classpath
logs
Modified: trunk/perfsonar-base/base/pom.xml
===================================================================
--- trunk/perfsonar-base/base/pom.xml 2013-03-06 21:34:16 UTC (rev 6184)
+++ trunk/perfsonar-base/base/pom.xml 2013-03-12 16:58:31 UTC (rev 6185)
@@ -30,11 +30,6 @@
</developer>
</developers>
- <properties>
- <log4j.version>1.2.16</log4j.version>
- <slf4j.version>1.6.6</slf4j.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>cglib</groupId>
@@ -50,16 +45,19 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>net.geant.perfsonar.base</groupId>
<artifactId>messaging</artifactId>
<version>3.0.0-SNAPSHOT</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>net.geant.perfsonar.base</groupId>
@@ -78,7 +76,6 @@
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.3</version>
- <type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
Modified:
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/PerfSONAR.java
===================================================================
---
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/PerfSONAR.java
2013-03-06 21:34:16 UTC (rev 6184)
+++
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/PerfSONAR.java
2013-03-12 16:58:31 UTC (rev 6185)
@@ -162,16 +162,18 @@
final StringWriter writer = new StringWriter();
logger.debug("Dispatching an incoming message");
if (msg.isEchoRequest()) {
- logger.debug("We received a echo request");
+ logger.debug("We received an echo request");
return handleEcho(msg, writer);
} else if (msg.isSelfTestRequest()) {
logger.debug("We received a self test request");
return handleSelfTest(msg, writer);
} else {
try {
- final Method m =
Configuration.getHandler(msg.getType());
+ String msgType = msg.getType();
+ logger.debug(msgType);
+ final Method m =
Configuration.getHandler(msgType);
if (m.getParameterTypes().length > 1)
- throw new RuntimeException(m + ":
Controller methods can have zero or one argument.");
+ throw new RuntimeException(m + ":
Controller methods must have zero or one argument.");
TemplateEngine.put("requestId", msg.getId());
Modified:
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
===================================================================
---
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
2013-03-06 21:34:16 UTC (rev 6184)
+++
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
2013-03-12 16:58:31 UTC (rev 6185)
@@ -16,14 +16,16 @@
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
public class PerfSONARTest {
+ protected Logger logger = LoggerFactory.getLogger(getClass());
+
static final String REQUEST_ID = "request1";
-
- private PerfSONARClient client;
-
+ private PerfSONARClient client;
private SSHTelnetMPService service = new SSHTelnetMPService();
@Before
@@ -65,7 +67,11 @@
}
private void print(Reader reader) throws IOException {
- for (int i = reader.read(); i != -1; i = reader.read())
- System.out.print((char) i);
+ String printed = "";
+ for (int i = reader.read(); i != -1; i = reader.read()) {
+ printed += (char) i;
+ }
+
+ logger.debug(printed);
}
}
Added: trunk/perfsonar-base/base/src/test/resources/log4j.xml
===================================================================
--- trunk/perfsonar-base/base/src/test/resources/log4j.xml
(rev 0)
+++ trunk/perfsonar-base/base/src/test/resources/log4j.xml 2013-03-12
16:58:31 UTC (rev 6185)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+
+<!-- This is the configuration for LOG4J for perfSONAR testing purposes -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <!-- Section: APPENDERS -->
+
+ <!--
+ writes log messages to the console. It outputs file name,
+ method name and line number of the caller. This is slow,
+ so just use it for debugging.
+ -->
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d - [%p] %c{1}[%M]:%L -
%m %n"/>
+ </layout>
+ </appender>
+
+ <!-- We have a log file for pSbase -->
+ <appender name="psbase" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/psbase.log"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="MaxBackupIndex" value="7"/>
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
+ </layout>
+ </appender>
+
+ <!-- Disabling verbose logging from included libs -->
+ <category name="org" additivity="false">
+ <priority value="warn"/>
+ <appender-ref ref="console"/>
+ <appender-ref ref="psbase"/>
+ </category>
+
+ <!-- psBase logging, including test output -->
+ <category name="net.geant.perfsonar" additivity="false">
+ <priority value="debug"/>
+ <appender-ref ref="psbase"/>
+ </category>
+
+
+ <!-- Console logging -->
+ <root>
+ <priority value="info"/>
+ <appender-ref ref="console"/>
+ </root>
+
+</log4j:configuration>
Property changes on: trunk/perfsonar-base/base/src/test/resources/log4j.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Property changes on: trunk/perfsonar-base/ls
___________________________________________________________________
Modified: svn:ignore
- .settings
.classpath
.project
target
velocity.log*
+ .settings
.classpath
.project
target
velocity.log*
logs
Modified: trunk/perfsonar-base/ls/pom.xml
===================================================================
--- trunk/perfsonar-base/ls/pom.xml 2013-03-06 21:34:16 UTC (rev 6184)
+++ trunk/perfsonar-base/ls/pom.xml 2013-03-12 16:58:31 UTC (rev 6185)
@@ -39,6 +39,7 @@
<groupId>net.geant.perfsonar.base</groupId>
<artifactId>base</artifactId>
<version>3.0.0-SNAPSHOT</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>net.geant.perfsonar.base</groupId>
@@ -47,6 +48,12 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>net.geant.perfsonar.base</groupId>
+ <artifactId>messaging</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>net.geant.perfsonar.base</groupId>
<artifactId>messaging</artifactId>
@@ -67,6 +74,18 @@
<version>4.9</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Added: trunk/perfsonar-base/ls/src/test/resources/log4j.xml
===================================================================
--- trunk/perfsonar-base/ls/src/test/resources/log4j.xml
(rev 0)
+++ trunk/perfsonar-base/ls/src/test/resources/log4j.xml 2013-03-12
16:58:31 UTC (rev 6185)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
+
+<!-- This is the configuration for LOG4J for perfSONAR testing purposes -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <!-- Section: APPENDERS -->
+
+ <!--
+ writes log messages to the console. It outputs file name,
+ method name and line number of the caller. This is slow,
+ so just use it for debugging.
+ -->
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d - [%p] %c{1}[%M]:%L -
%m %n"/>
+ </layout>
+ </appender>
+
+ <!-- We have a log file for perfSONAR -->
+ <appender name="perfsonar" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/perfsonar.log"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="MaxBackupIndex" value="7"/>
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
+ </layout>
+ </appender>
+
+ <!-- We have a log file for pSbase -->
+ <appender name="psbase" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/psbase.log"/>
+ <param name="MaxFileSize" value="10MB"/>
+ <param name="MaxBackupIndex" value="7"/>
+ <param name="Encoding" value="UTF-8"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d [%t] %-5p (%F [%M]:%L)
- %m %n"/>
+ </layout>
+ </appender>
+
+ <!-- Disabling verbose logging from included libs -->
+ <category name="org" additivity="true">
+ <priority value="warn"/>
+ <appender-ref ref="console"/>
+ <appender-ref ref="psbase"/>
+ </category>
+
+ <!-- perfSONAR base -->
+ <category name="net.geant.perfsonar.base" additivity="false">
+ <priority value="debug"/>
+ <appender-ref ref="psbase"/>
+ </category>
+
+ <!-- perfSONAR, including test output -->
+ <category name="net.geant.perfsonar" additivity="false">
+ <priority value="info"/>
+ <appender-ref ref="perfsonar"/>
+ </category>
+
+
+ <!-- All other messages are going to the perfsonar log (root logger) -->
+ <root>
+ <level value="info"/>
+ <appender-ref ref="console"/>
+ </root>
+
+</log4j:configuration>
Property changes on: trunk/perfsonar-base/ls/src/test/resources/log4j.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/perfsonar-base/messaging/pom.xml
===================================================================
--- trunk/perfsonar-base/messaging/pom.xml 2013-03-06 21:34:16 UTC (rev
6184)
+++ trunk/perfsonar-base/messaging/pom.xml 2013-03-12 16:58:31 UTC (rev
6185)
@@ -35,13 +35,31 @@
</properties>
<dependencies>
+ <dependency>
+ <groupId>jlibs</groupId>
+ <artifactId>jlibs-xml</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ <version>1.1.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>1.3.02</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xmlParserAPIs</artifactId>
+ <version>2.6.2</version>
+ <scope>compile</scope>
+ </dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.9</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
@@ -60,8 +78,13 @@
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.2</version>
- <type>jar</type>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.9</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
- [pS-dev] [GEANT/SA2/ps-java-services] r6185 - in trunk/perfsonar-base: annotations/src/main/java/net/geant/perfsonar/annotations/selftest base base/src/main/java/net/geant/perfsonar base/src/test/java/net/geant/perfsonar base/src/test/resources ls ls/src/test/resources messaging, svn-noreply, 03/12/2013
Archive powered by MHonArc 2.6.16.