Skip to Content.
Sympa Menu

perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6182 - in trunk: nmwg-sql-converter perfsonar-base/apt/annotated perfsonar-base/base perfsonar-base/base/src/main/java/net/geant/perfsonar perfsonar-base/base/src/test/java/net/geant/perfsonar perfsonar-base/ls perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls perfsonar-base/messaging/src/test/groovy/net/geant/perfsonar/templates perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates perfsonar-java-rrd-ma-base3 perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma perfsonar-java-rrd-ma-base3/src/test perfsonar-java-rrd-ma-base3/src/test/groovy perfsonar-java-rrd-ma-base3/src/test/groovy/net perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar/templates perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd perfsonar-java-rrd-ma-base3/src/test/resources

Subject: perfsonar development work

List archive

[pS-dev] [GEANT/SA2/ps-java-services] r6182 - in trunk: nmwg-sql-converter perfsonar-base/apt/annotated perfsonar-base/base perfsonar-base/base/src/main/java/net/geant/perfsonar perfsonar-base/base/src/test/java/net/geant/perfsonar perfsonar-base/ls perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls perfsonar-base/messaging/src/test/groovy/net/geant/perfsonar/templates perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates perfsonar-java-rrd-ma-base3 perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma perfsonar-java-rrd-ma-base3/src/test perfsonar-java-rrd-ma-base3/src/test/groovy perfsonar-java-rrd-ma-base3/src/test/groovy/net perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar/templates perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd perfsonar-java-rrd-ma-base3/src/test/resources


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6182 - in trunk: nmwg-sql-converter perfsonar-base/apt/annotated perfsonar-base/base perfsonar-base/base/src/main/java/net/geant/perfsonar perfsonar-base/base/src/test/java/net/geant/perfsonar perfsonar-base/ls perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls perfsonar-base/messaging/src/test/groovy/net/geant/perfsonar/templates perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates perfsonar-java-rrd-ma-base3 perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma perfsonar-java-rrd-ma-base3/src/test perfsonar-java-rrd-ma-base3/src/test/groovy perfsonar-java-rrd-ma-base3/src/test/groovy/net perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar/templates perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd perfsonar-java-rrd-ma-base3/src/test/resources
  • Date: Wed, 6 Mar 2013 21:07:18 +0000 (GMT)
  • Authentication-results: sfpop-ironport01.merit.edu; dkim=neutral (message not signed) header.i=none

Author: dante.delvaux
Date: 2013-03-06 21:07:18 +0000 (Wed, 06 Mar 2013)
New Revision: 6182

Added:
trunk/perfsonar-java-rrd-ma-base3/src/test/groovy/
trunk/perfsonar-java-rrd-ma-base3/src/test/groovy/net/
trunk/perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/
trunk/perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar/

trunk/perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar/templates/

trunk/perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar/templates/NMWGRRDMA.groovy
trunk/perfsonar-java-rrd-ma-base3/src/test/resources/log4j.xml
Modified:
trunk/nmwg-sql-converter/
trunk/perfsonar-base/apt/annotated/
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/src/main/java/net/geant/perfsonar/ls/LSRegistrationTask.java

trunk/perfsonar-base/messaging/src/test/groovy/net/geant/perfsonar/templates/NMWG.groovy

trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates/SelfTestResult.java
trunk/perfsonar-java-rrd-ma-base3/pom.xml

trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAService.java

trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAServiceController.java

trunk/perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd/RRDMATest.java
Log:
psBase3: adding a bit of logging and generalising to test helpers for other
services.
RRD MA with base3: adding simple test cases for the controller.


Property changes on: trunk/nmwg-sql-converter
___________________________________________________________________
Modified: svn:ignore
- target

.settings

.project

+ target

.settings

.project
nmwg-converter.log*



Property changes on: trunk/perfsonar-base/apt/annotated
___________________________________________________________________
Added: svn:ignore
+ net



Property changes on: trunk/perfsonar-base/base
___________________________________________________________________
Modified: svn:ignore
- target
.settings
.project
.classpath

+ target
velocity.log*
.settings
.project
.classpath


Modified: trunk/perfsonar-base/base/pom.xml
===================================================================
--- trunk/perfsonar-base/base/pom.xml 2013-03-04 15:01:48 UTC (rev 6181)
+++ trunk/perfsonar-base/base/pom.xml 2013-03-06 21:07:18 UTC (rev 6182)
@@ -31,7 +31,8 @@
</developers>

<properties>
-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <log4j.version>1.2.16</log4j.version>
+ <slf4j.version>1.6.6</slf4j.version>
</properties>

<dependencies>
@@ -40,18 +41,22 @@
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.6.2</version>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.16</version>
- <type>bundle</type>
- </dependency>
- <dependency>
<groupId>net.geant.perfsonar.base</groupId>
<artifactId>messaging</artifactId>
<version>3.0.0-SNAPSHOT</version>
@@ -80,7 +85,6 @@
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>2.4.2</version>
- <type>bundle</type>
<scope>test</scope>
</dependency>
</dependencies>

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-04 15:01:48 UTC (rev 6181)
+++
trunk/perfsonar-base/base/src/main/java/net/geant/perfsonar/PerfSONAR.java
2013-03-06 21:07:18 UTC (rev 6182)
@@ -27,6 +27,7 @@
import net.geant.perfsonar.messaging.XPathDeserializer;
import net.geant.perfsonar.selftest.SelfTestRunner;

+import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;

@@ -39,13 +40,16 @@
public static final Object ANY = null;

private static int defaultThreadPoolSize = 10;
-
+
+ /* FIXME: do we really need our own Logger?
protected static final net.geant.perfsonar.Logger logger =
new net.geant.perfsonar.Logger() {
public void error(String msg, Throwable ex) {

LoggerFactory.getLogger(PerfSONAR.class).error(msg, ex);
}
};
+ */
+ protected Logger logger = LoggerFactory.getLogger(getClass());

static {
try {
@@ -56,7 +60,9 @@

whenXPath("nmwg:message/@id").then(NMWGMessage.class).setId(any(String.class));

whenXPath("nmwg:message/nmwg:metadata[@id='meta']/nmwg:eventType/text()").then(NMWGMessage.class).setEventType(any(String.class));

whenXPath("nmwg:message/nmwg:metadata/nmwg:key/text()").then(NMWGMessage.class).setKey(any(String.class));
- } catch (Exception ex) { }
+ } catch (Exception ex) {
+ //FIXME: What should we do with this exception?
+ }
}

private static SelfTestResponse response;
@@ -81,13 +87,19 @@
private void loadConfiguration() {
try {

Class.forName("net.geant.perfsonar.XPaths").newInstance();
- } catch (Exception ex) { }
+ } catch (Exception ex) {
+ //FIXME: What should we do with this exception?
+ }
try {

Class.forName("net.geant.perfsonar.Handlers").newInstance();
- } catch (Exception ex) { }
+ } catch (Exception ex) {
+ //FIXME: What should we do with this exception?
+ }
try {

Class.forName("net.geant.perfsonar.LookupServiceRegister").newInstance();
- } catch (Exception ex) { }
+ } catch (Exception ex) {
+ //FIXME: What should we do with this exception?
+ }
}

private static Scheduler createThreadPool() {
@@ -148,9 +160,12 @@
final NMWGMessage msg =
deserializer.getObjects(NMWGMessage.class, objects).get(0);

final StringWriter writer = new StringWriter();
+ logger.debug("Dispatching an incoming message");
if (msg.isEchoRequest()) {
+ logger.debug("We received a echo request");
return handleEcho(msg, writer);
} else if (msg.isSelfTestRequest()) {
+ logger.debug("We received a self test request");
return handleSelfTest(msg, writer);
} else {
try {
@@ -190,14 +205,15 @@
return new InputSource(request.getReader());
}

- private StreamSource handleSelfTest(final NMWGMessage msg,
- final StringWriter writer) {
+ private StreamSource handleSelfTest(final NMWGMessage msg, final
StringWriter writer) {
try {
- response = new SelfTestResponse(getServiceType(),
- getServiceName());
+ logger.debug("Generating self test response.");
+ response = new SelfTestResponse(getServiceType(),
getServiceName());
} catch (Exception ex) {
+ logger.error("Self Test response couldn't be generated.",
ex);
}
try {
+ logger.debug("Now streaming the response.");
response.begin(writer, msg.getId());
newSelfTestRunner().runSuite(scheduler, response);
} catch (Exception ex) {
@@ -205,7 +221,9 @@
} finally {
try {
response.end();
- } catch (IOException ex) { }
+ } catch (IOException ex) {
+ //FIXME: what should we do with this exception?
+ }
}

return new StreamSource(new StringReader(writer.toString()));

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-04 15:01:48 UTC (rev 6181)
+++
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
2013-03-06 21:07:18 UTC (rev 6182)
@@ -43,8 +43,8 @@
new Response(NMWG.toSelfTestResponse(
REQUEST_ID,
new SelfTestResult[] {
-
success("test1", "Test passed."),
-
failure("test2", "Test failed."), })),
+
success("test1", "Test passed.", "SSHTELNET", "MP"),
+
failure("test2", "Test failed.", "SSHTELNET", "MP"), })),
client.selfTest(REQUEST_ID));
}



Property changes on: trunk/perfsonar-base/ls
___________________________________________________________________
Modified: svn:ignore
- .settings
.classpath
.project

target

+ .settings
.classpath
.project

target
velocity.log*


Modified:
trunk/perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls/LSRegistrationTask.java
===================================================================
---
trunk/perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls/LSRegistrationTask.java
2013-03-04 15:01:48 UTC (rev 6181)
+++
trunk/perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls/LSRegistrationTask.java
2013-03-06 21:07:18 UTC (rev 6182)
@@ -21,13 +21,13 @@

import net.geant.perfsonar.Configuration;
import net.geant.perfsonar.HandlerConfiguration;
-import net.geant.perfsonar.Logger;
import net.geant.perfsonar.NMWGMessage;
import net.geant.perfsonar.PerfSONAR;
import net.geant.perfsonar.messaging.XPathDeserializer;
import net.geant.perfsonar.templates.TemplateEngine;
import net.sf.cglib.proxy.Enhancer;

+import org.slf4j.Logger;
import org.xml.sax.InputSource;

/**

Modified:
trunk/perfsonar-base/messaging/src/test/groovy/net/geant/perfsonar/templates/NMWG.groovy
===================================================================
---
trunk/perfsonar-base/messaging/src/test/groovy/net/geant/perfsonar/templates/NMWG.groovy
2013-03-04 15:01:48 UTC (rev 6181)
+++
trunk/perfsonar-base/messaging/src/test/groovy/net/geant/perfsonar/templates/NMWG.groovy
2013-03-06 21:07:18 UTC (rev 6182)
@@ -8,7 +8,14 @@
import java.io.Reader;

import groovy.xml.MarkupBuilder
-
+
+/**
+ * This class is to be used in unit tests to check the behavior of a service
+ * It should be derived by each actual service
+ * @author Blazej Pietrzak -

+ * @author Antoine Delvaux -

+ *
+ */
class NMWG {
private static Reader createRequest(id, eventType, version) {
def writer = new StringWriter()
@@ -82,7 +89,7 @@
'nmwg:data'(id:"data", metadataIdRef:"meta") {
tests.each { test ->
'nmwg:metadata'(id:"${test.name}") {
- 'nmwg:eventType'
"http://schemas.perfsonar.net/tools/admin/selftest/MP/SSHTELNET/${test.name}/${test.status}/1.0";
+ 'nmwg:eventType'
"http://schemas.perfsonar.net/tools/admin/selftest/${test.serviceType}/${test.serviceName}/${test.name}/${test.status}/1.0";
}
'nmwg:data'(id:"data_${test.name}",
metadataIdRef:"${test.name}") {
'nmwg:datum' test.message

Modified:
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates/SelfTestResult.java
===================================================================
---
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates/SelfTestResult.java
2013-03-04 15:01:48 UTC (rev 6181)
+++
trunk/perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates/SelfTestResult.java
2013-03-06 21:07:18 UTC (rev 6182)
@@ -1,21 +1,31 @@
package net.geant.perfsonar.templates;

+/**
+ * This class is used in unit tests to check the behavior of a service wrt
self tests
+ * @author Blazej Pietrzak -

+ * @author Antoine Delvaux -

+ *
+ */
public class SelfTestResult {
protected String name;
protected String message;
protected String status;
+ protected String serviceName;
+ protected String serviceType;

- private SelfTestResult(String name, String message, String status) {
+ private SelfTestResult(String name, String message, String status,
String serviceName, String serviceType) {
this.name = name;
this.message = message;
this.status = status;
+ this.serviceName = serviceName;
+ this.serviceType = serviceType;
}

- public static SelfTestResult failure(String name, String message) {
- return new SelfTestResult(name, message, "failure");
+ public static SelfTestResult failure(String name, String message, String
serviceName, String serviceType) {
+ return new SelfTestResult(name, message, "failure", serviceName,
serviceType);
}

- public static SelfTestResult success(String name, String message) {
- return new SelfTestResult(name, message, "success");
+ public static SelfTestResult success(String name, String message, String
serviceName, String serviceType) {
+ return new SelfTestResult(name, message, "success", serviceName,
serviceType);
}
}

Modified: trunk/perfsonar-java-rrd-ma-base3/pom.xml
===================================================================
--- trunk/perfsonar-java-rrd-ma-base3/pom.xml 2013-03-04 15:01:48 UTC (rev
6181)
+++ trunk/perfsonar-java-rrd-ma-base3/pom.xml 2013-03-06 21:07:18 UTC (rev
6182)
@@ -75,21 +75,37 @@
<version>3.0.0-SNAPSHOT</version>
</dependency>

+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.6.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.6.6</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.geant.perfsonar.base</groupId>
+ <artifactId>base</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.geant.perfsonar.base</groupId>
+ <artifactId>messaging</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
<dependency>
- <groupId>net.geant.perfsonar.base</groupId>
- <artifactId>base</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.geant.perfsonar.base</groupId>
- <artifactId>messaging</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
@@ -99,14 +115,12 @@
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.3</version>
- <type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>2.4.2</version>
- <type>bundle</type>
<scope>test</scope>
</dependency>


Modified:
trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAService.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAService.java
2013-03-04 15:01:48 UTC (rev 6181)
+++
trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAService.java
2013-03-06 21:07:18 UTC (rev 6182)
@@ -23,7 +23,7 @@

@Override
public String getServiceName() {
- return "RRD MA";
+ return "RRD_MA";
}

}

Modified:
trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAServiceController.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAServiceController.java
2013-03-04 15:01:48 UTC (rev 6181)
+++
trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAServiceController.java
2013-03-06 21:07:18 UTC (rev 6182)
@@ -14,16 +14,20 @@
protected Logger logger = LoggerFactory.getLogger(getClass());
public RRDMAServiceController() { }

- /**
@MetadataKey
public String listRRDFiles(Interface iface) {
- logger.warn("Request received");
+ logger.debug("Request received");
return "return an RRD files list";
}
- */

+ /*
@MetadataKey
public void testAnnotations(Interface iface) {
logger.warn("Request received");
}
+
+ @MetadataKey
+ public void invalidHandler() {
+ }
+*/
}

Added:
trunk/perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar/templates/NMWGRRDMA.groovy
===================================================================
---
trunk/perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar/templates/NMWGRRDMA.groovy
(rev 0)
+++
trunk/perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar/templates/NMWGRRDMA.groovy
2013-03-06 21:07:18 UTC (rev 6182)
@@ -0,0 +1,33 @@
+package net.geant.perfsonar.templates
+
+import groovy.xml.MarkupBuilder
+
+/**
+ * @author Antoine Delvaux -

+ *
+ */
+class NMWGRRDMA extends NMWG {
+
+ @Override
+ static Reader toMetadataKeyRequest(String id) {
+ def writer = new StringWriter()
+ MarkupBuilder xml = new MarkupBuilder(writer)
+ xml.'nmwg:message'(id:id, type:"MetadataKeyRequest",
+ 'xmlns:nmwg':'http://ggf.org/ns/nmwg/base/2.0/',
+ 'xmlns:nmwgt':'http://ggf.org/ns/nmwg/topology/2.0/',
+
'xmlns:netutil':'http://ggf.org/ns/nmwg/characteristic/utilization/2.0/') {
+ 'nmwg:metadata'(id:"meta") {
+ 'netutil:subject'(id:"subj1") {
+ 'nmwgt:interface' {
+ 'nmwgt:ifAdress'(type:"ipv4", "10.1.2.3")
+ 'nmwgt:hostName'("test-hostName")
+ }
+ }
+ }
+ 'nmwg:data'(id:"data", metadataIdRef:"meta")
+ }
+
+ new StringReader(writer.toString())
+ }
+
+}

Modified:
trunk/perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd/RRDMATest.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd/RRDMATest.java
2013-03-04 15:01:48 UTC (rev 6181)
+++
trunk/perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd/RRDMATest.java
2013-03-06 21:07:18 UTC (rev 6182)
@@ -7,7 +7,7 @@
import java.io.IOException;
import java.io.Reader;

-import net.geant.perfsonar.templates.NMWG;
+import net.geant.perfsonar.templates.NMWGRRDMA;
import net.geant.perfsonar.helpers.PerfSONARClient;
import net.geant.perfsonar.helpers.Response;
import net.geant.perfsonar.ma.RRDMAService;
@@ -15,12 +15,16 @@

import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;

public class RRDMATest {

- static final String REQUEST_ID = "request1";
+ protected Logger logger = LoggerFactory.getLogger(getClass());

+ static final String REQUEST_ID = "request1";
+
private PerfSONARClient client;

private RRDMAService service = new RRDMAService();
@@ -33,23 +37,25 @@

@Test
public void checkEcho() throws SAXException {
- assertEquals(new Response(NMWG.toEchoResponse(REQUEST_ID)),
client.echo(REQUEST_ID));
+ logger.info("•••• Checking echo request");
+ assertEquals(new
Response(NMWGRRDMA.toEchoResponse(REQUEST_ID)), client.echo(REQUEST_ID));
}

@Test
public void checkSelfTest() throws SAXException {
- assertEquals(
- new Response(NMWG.toSelfTestResponse(
- REQUEST_ID,
- new SelfTestResult[] {
-
success("test1", "Test passed."),
-
failure("test2", "Test failed."), })),
- client.selfTest(REQUEST_ID));
+ logger.info("•••• Checking self-test request");
+ Response resp = new Response(NMWGRRDMA.toSelfTestResponse(
+ REQUEST_ID,
+ new SelfTestResult[] {
+ success("test1", "Test passed.", "RRD_MA", "MA"),
+ failure("test2", "Test failed.", "RRD_MA", "MA"),
}));
+ assertEquals(resp, client.selfTest(REQUEST_ID));
}

@Test
public void checkMetadataKey() throws SAXException, IOException {
- Response resp = new
Response(client.invoke(NMWG.toMetadataKeyRequest(REQUEST_ID)));
+ logger.info("•••• Checking metadata key request");
+ Response resp = new
Response(client.invoke(NMWGRRDMA.toMetadataKeyRequest(REQUEST_ID)));
print(resp.getReader());
}


Added: trunk/perfsonar-java-rrd-ma-base3/src/test/resources/log4j.xml
===================================================================
--- trunk/perfsonar-java-rrd-ma-base3/src/test/resources/log4j.xml
(rev 0)
+++ trunk/perfsonar-java-rrd-ma-base3/src/test/resources/log4j.xml
2013-03-06 21:07:18 UTC (rev 6182)
@@ -0,0 +1,86 @@
+<?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 development 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 the WebAdmin -->
+ <appender name="webadmin" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="logs/webadmin.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="perfsonar-base"
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"/>
+ </category>
+
+ <!-- perfSONAR WebAdmin -->
+ <category name="org.perfsonar.webadmin" additivity="true">
+ <level value="debug"/>
+ <appender-ref ref="webadmin"/>
+ </category>
+
+ <!-- perfSONAR MA -->
+ <category name="net.geant.perfsonar.ma" additivity="true">
+ <level value="debug"/>
+ <appender-ref ref="perfsonar"/>
+ </category>
+
+ <!-- perfSONAR base -->
+ <category name="net.geant.perfsonar.base">
+ <priority value="debug"/>
+ <appender-ref ref="perfsonar-base"/>
+ </category>
+
+
+ <!-- All other messages are going to the perfsonar log (root logger) -->
+ <root>
+ <level value="debug"/>
+ <appender-ref ref="console"/>
+ </root>
+
+</log4j:configuration>


Property changes on:
trunk/perfsonar-java-rrd-ma-base3/src/test/resources/log4j.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain



  • [pS-dev] [GEANT/SA2/ps-java-services] r6182 - in trunk: nmwg-sql-converter perfsonar-base/apt/annotated perfsonar-base/base perfsonar-base/base/src/main/java/net/geant/perfsonar perfsonar-base/base/src/test/java/net/geant/perfsonar perfsonar-base/ls perfsonar-base/ls/src/main/java/net/geant/perfsonar/ls perfsonar-base/messaging/src/test/groovy/net/geant/perfsonar/templates perfsonar-base/messaging/src/test/java/net/geant/perfsonar/templates perfsonar-java-rrd-ma-base3 perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma perfsonar-java-rrd-ma-base3/src/test perfsonar-java-rrd-ma-base3/src/test/groovy perfsonar-java-rrd-ma-base3/src/test/groovy/net perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar perfsonar-java-rrd-ma-base3/src/test/groovy/net/geant/perfsonar/templates perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd perfsonar-java-rrd-ma-base3/src/test/resources, svn-noreply, 03/06/2013

Archive powered by MHonArc 2.6.16.

Top of Page