perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6180 - in trunk/perfsonar-java-rrd-ma-base3/src: main/java/net/geant/perfsonar/ma main/resources main/resources/net main/resources/net/geant main/resources/net/geant/perfsonar main/resources/net/geant/perfsonar/ma test/java/net/geant/perfsonar/ma/rrd
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r6180 - in trunk/perfsonar-java-rrd-ma-base3/src: main/java/net/geant/perfsonar/ma main/resources main/resources/net main/resources/net/geant main/resources/net/geant/perfsonar main/resources/net/geant/perfsonar/ma test/java/net/geant/perfsonar/ma/rrd
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6180 - in trunk/perfsonar-java-rrd-ma-base3/src: main/java/net/geant/perfsonar/ma main/resources main/resources/net main/resources/net/geant main/resources/net/geant/perfsonar main/resources/net/geant/perfsonar/ma test/java/net/geant/perfsonar/ma/rrd
- Date: Mon, 4 Mar 2013 14:59:22 +0000 (GMT)
- Authentication-results: sfpop-ironport03.merit.edu; dkim=neutral (message not signed) header.i=none
Author: dante.delvaux
Date: 2013-03-04 14:59:22 +0000 (Mon, 04 Mar 2013)
New Revision: 6180
Added:
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/main/resources/net/
trunk/perfsonar-java-rrd-ma-base3/src/main/resources/net/geant/
trunk/perfsonar-java-rrd-ma-base3/src/main/resources/net/geant/perfsonar/
trunk/perfsonar-java-rrd-ma-base3/src/main/resources/net/geant/perfsonar/ma/
trunk/perfsonar-java-rrd-ma-base3/src/main/resources/net/geant/perfsonar/ma/MetadataKeyResponse.template
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/RRDMAWebServiceTest.java
Log:
RRD MA with base3: first draft of Service Controller.
Added:
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
(rev 0)
+++
trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAService.java
2013-03-04 14:59:22 UTC (rev 6180)
@@ -0,0 +1,29 @@
+package net.geant.perfsonar.ma;
+
+import javax.xml.ws.WebServiceProvider;
+
+import net.geant.perfsonar.PerfSONAR;
+import net.geant.perfsonar.ServiceType;
+
+/**
+ * RRD MA perfSONAR service implementation
+ * Based on psBase3 streaming framework
+ *
+ * @author Antoine Delvaux
<>
+ *
+ */
+
+@WebServiceProvider
+public class RRDMAService extends PerfSONAR {
+
+ @Override
+ public ServiceType getServiceType() {
+ return ServiceType.MA;
+ }
+
+ @Override
+ public String getServiceName() {
+ return "RRD MA";
+ }
+
+}
Property changes on:
trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAService.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
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
(rev 0)
+++
trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAServiceController.java
2013-03-04 14:59:22 UTC (rev 6180)
@@ -0,0 +1,29 @@
+package net.geant.perfsonar.ma;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import net.geant.perfsonar.annotations.request.MetadataKey;
+import net.geant.perfsonar.ma.rrd.Interface;
+
+/**
+ * @author Antoine Delvaux -
+ *
+ */
+public class RRDMAServiceController {
+ protected Logger logger = LoggerFactory.getLogger(getClass());
+ public RRDMAServiceController() { }
+
+ /**
+ @MetadataKey
+ public String listRRDFiles(Interface iface) {
+ logger.warn("Request received");
+ return "return an RRD files list";
+ }
+ */
+
+ @MetadataKey
+ public void testAnnotations(Interface iface) {
+ logger.warn("Request received");
+ }
+}
Property changes on:
trunk/perfsonar-java-rrd-ma-base3/src/main/java/net/geant/perfsonar/ma/RRDMAServiceController.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/perfsonar-java-rrd-ma-base3/src/main/resources/net/geant/perfsonar/ma/MetadataKeyResponse.template
===================================================================
---
trunk/perfsonar-java-rrd-ma-base3/src/main/resources/net/geant/perfsonar/ma/MetadataKeyResponse.template
(rev 0)
+++
trunk/perfsonar-java-rrd-ma-base3/src/main/resources/net/geant/perfsonar/ma/MetadataKeyResponse.template
2013-03-04 14:59:22 UTC (rev 6180)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<nmwg:message id="${requestId}_resp" messageIdRef="${requestId}"
type="MetadataKeyResponse" xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
+#set( $idx = 0 )
+#foreach ($router in $result)
+ <nmwg:metadata id="metadata${idx}">
+ <nmwg:subject id="subject${idx}">${router.name}</nmwg:subject>
+ <nmwg:parameters id="metaParams${idx}">
+ <nmwg:parameter name="url" value="${router.address.hostAddress}"
/>
+ </nmwg:parameters>
+ </nmwg:metadata>
+ <nmwg:metadata id="resultCodeMeta_${idx}">
+ <nmwg:subject id="resultCodeSubj_${idx}"
metadataIdRef="metadata${idx}" />
+ <nmwg:eventType>success.mp.sshtelnet</nmwg:eventType>
+ </nmwg:metadata>
+ <nmwg:data id="resultCodeData_${idx}"
metadataIdRef="resultCodeMeta_${idx}">
+ <nmwgr:datum
xmlns:nmwgr="http://ggf.org/ns/nmwg/result/2.0/">Successfully executed
MetaDataKeyRequest</nmwgr:datum>
+ </nmwg:data>
+#set( $idx = $idx + 1 )
+#end
+#set( $idx = 0 )
+#foreach ($router in $result)
+ <nmwg:data id="data${idx}" metadataIdRef="metadata${idx}">
+#foreach ($command in $router.commands)
+ <nmwgr:datum xmlns:nmwgr="http://ggf.org/ns/nmwg/result/2.0/">
+ <nmwg:parameters id="params${idx}">
+ <nmwg:parameter name="command" value="${command.name}" />
+ <nmwg:parameter name="description"
value="${command.description}" />
+#if (${command.syntax})
+ <nmwg:parameter name="syntax" />
+#else
+ <nmwg:parameter name="syntax" value="${command.syntax} />
+#end
+ </nmwg:parameters>
+ <nmwg:eventType>${command.eventType}</nmwg:eventType>
+ </nmwgr:datum>
+#end
+ </nmwg:data>
+#set( $idx = $idx + 1 )
+#end
+</nmwg:message>
\ No newline at end of file
Added:
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
(rev 0)
+++
trunk/perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd/RRDMATest.java
2013-03-04 14:59:22 UTC (rev 6180)
@@ -0,0 +1,73 @@
+package net.geant.perfsonar.ma.rrd;
+
+import static net.geant.perfsonar.templates.SelfTestResult.failure;
+import static net.geant.perfsonar.templates.SelfTestResult.success;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import net.geant.perfsonar.templates.NMWG;
+import net.geant.perfsonar.helpers.PerfSONARClient;
+import net.geant.perfsonar.helpers.Response;
+import net.geant.perfsonar.ma.RRDMAService;
+import net.geant.perfsonar.templates.SelfTestResult;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+public class RRDMATest {
+
+ static final String REQUEST_ID = "request1";
+
+ private PerfSONARClient client;
+
+ private RRDMAService service = new RRDMAService();
+
+ @Before
+ public void givenPerfSONARClient() {
+ client = new PerfSONARClient(service);
+ }
+
+
+ @Test
+ public void checkEcho() throws SAXException {
+ assertEquals(new Response(NMWG.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));
+ }
+
+ @Test
+ public void checkMetadataKey() throws SAXException, IOException {
+ Response resp = new
Response(client.invoke(NMWG.toMetadataKeyRequest(REQUEST_ID)));
+ print(resp.getReader());
+ }
+
+ /*
+ @Test
+ public void checkSetupDataRequest() throws Exception {
+ final Command command1 = (Command) Command.SHOW_ENVIRONMENT
+ .newInstance();
+ command1.setRouterName("host1");
+ final Command command2 = (Command)
Command.PING_IPV6.newInstance();
+ command2.setRouterName("host2");
+ print(client.executeCommands(REQUEST_ID, command1, command2)
+ .getReader());
+ }
+ */
+
+ private void print(Reader reader) throws IOException {
+ for (int i = reader.read(); i != -1; i = reader.read())
+ System.out.print((char) i);
+ }
+}
Property changes on:
trunk/perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd/RRDMATest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd/RRDMAWebServiceTest.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd/RRDMAWebServiceTest.java
(rev 0)
+++
trunk/perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd/RRDMAWebServiceTest.java
2013-03-04 14:59:22 UTC (rev 6180)
@@ -0,0 +1,56 @@
+package net.geant.perfsonar.ma.rrd;
+
+import static org.junit.Assert.*;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import net.geant.perfsonar.helpers.PerfSONARServiceClient;
+import net.geant.perfsonar.helpers.Response;
+import net.geant.perfsonar.ma.RRDMAService;
+import net.geant.perfsonar.templates.NMWG;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+/**
+ * RRD MA Web service tests.
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class RRDMAWebServiceTest {
+ private static final String REQUEST_ID = "request1";
+ private static final String SERVICE_URL =
"http://localhost:9000/perfsonar-java-rrd-ma";
+ private final PerfSONARServiceClient client = new
PerfSONARServiceClient(SERVICE_URL);
+ private RRDMAService service = new RRDMAService();
+ private Endpoint endpoint;
+
+ @Before
+ public void givenRrdMAService() throws InterruptedException,
IOException {
+ endpoint = Endpoint.publish(SERVICE_URL, service);
+ }
+
+ @After
+ public void stopServices() {
+ endpoint.stop();
+ service.stop();
+ endpoint = null;
+ service = null;
+ }
+
+ @Test
+ public void shouldSayEcho() throws SAXException, InterruptedException
{
+ assertEquals(new Response(NMWG.toEchoResponse(REQUEST_ID)),
client.echo(REQUEST_ID));
+ }
+
+ @Test(expected=SOAPFaultException.class)
+ public void shouldFail() throws FileNotFoundException, SAXException {
+ client.invoke(new
FileReader("samples/requests/MetadataKeyRequest-Discards-1.xml"));
+ }
+}
Property changes on:
trunk/perfsonar-java-rrd-ma-base3/src/test/java/net/geant/perfsonar/ma/rrd/RRDMAWebServiceTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
- [pS-dev] [GEANT/SA2/ps-java-services] r6180 - in trunk/perfsonar-java-rrd-ma-base3/src: main/java/net/geant/perfsonar/ma main/resources main/resources/net main/resources/net/geant main/resources/net/geant/perfsonar main/resources/net/geant/perfsonar/ma test/java/net/geant/perfsonar/ma/rrd, svn-noreply, 03/04/2013
Archive powered by MHonArc 2.6.16.