perfsonar-dev - perfsonar: r4125 - in trunk/geant2-java-rrd-ma: ant conf samples/requests src/main/java/org/perfsonar/service/measurementArchive/rrdType
Subject: perfsonar development work
List archive
perfsonar: r4125 - in trunk/geant2-java-rrd-ma: ant conf samples/requests src/main/java/org/perfsonar/service/measurementArchive/rrdType
Chronological Thread
- From:
- To:
- Subject: perfsonar: r4125 - in trunk/geant2-java-rrd-ma: ant conf samples/requests src/main/java/org/perfsonar/service/measurementArchive/rrdType
- Date: Mon, 7 Jul 2008 09:24:25 -0400
Author: roman
Date: 2008-07-07 09:24:24 -0400 (Mon, 07 Jul 2008)
New Revision: 4125
Added:
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-self-test.xml
Modified:
trunk/geant2-java-rrd-ma/ant/test-targets.xml
trunk/geant2-java-rrd-ma/conf/eventType-map.xml
trunk/geant2-java-rrd-ma/conf/service.properties.template
trunk/geant2-java-rrd-ma/conf/service.properties.template-2
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-random-fetch-test.xml
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-xmldb-access-test.xml
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-xmldb-content-test.xml
trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
Log:
- eventType values for echo test requests changed
- self test request added
Modified: trunk/geant2-java-rrd-ma/ant/test-targets.xml
===================================================================
--- trunk/geant2-java-rrd-ma/ant/test-targets.xml 2008-07-07 11:16:27
UTC (rev 4124)
+++ trunk/geant2-java-rrd-ma/ant/test-targets.xml 2008-07-07 13:24:24
UTC (rev 4125)
@@ -78,6 +78,17 @@
</java>
</target>
+
+ <target name="echo-self-test"
+ depends="init-test">
+ <java classname="org.perfsonar.client.testHarness.SOAPClient"
+ classpathref="classpath"
+ fork="true">
+ <arg value="${ma.local}"/>
+ <arg value="${basedir}/samples/requests/EchoRequest-self-test.xml"/>
+ <arg value="${basedir}/samples/requests/response-1-self-test.xml"/>
+ </java>
+ </target>
<target name="lookup-info-test"
depends="init-test">
Modified: trunk/geant2-java-rrd-ma/conf/eventType-map.xml
===================================================================
--- trunk/geant2-java-rrd-ma/conf/eventType-map.xml 2008-07-07 11:16:27
UTC (rev 4124)
+++ trunk/geant2-java-rrd-ma/conf/eventType-map.xml 2008-07-07 13:24:24
UTC (rev 4125)
@@ -26,17 +26,17 @@
</eventType>
<eventType>
-
<name>http://schemas.perfsonar.net/tools/admin/echo/2.0/xmldb-access-test</name>
+
<name>http://schemas.perfsonar.net/tools/admin/selftest/1.0/xmldb-access-test</name>
<metadataQueryGenerator>org.perfsonar.service.measurementArchive.metadataConfig.queryGenerator.XmlDbAccessTestQueryGenerator</metadataQueryGenerator>
</eventType>
<eventType>
-
<name>http://schemas.perfsonar.net/tools/admin/echo/2.0/xmldb-content-test</name>
+
<name>http://schemas.perfsonar.net/tools/admin/selftest/1.0/xmldb-content-test</name>
<metadataQueryGenerator>org.perfsonar.service.measurementArchive.metadataConfig.queryGenerator.XmlDbContentTestQueryGenerator</metadataQueryGenerator>
</eventType>
<eventType>
-
<name>http://schemas.perfsonar.net/tools/admin/echo/2.0/random-fetch-test</name>
+
<name>http://schemas.perfsonar.net/tools/admin/selftest/1.0/random-fetch-test</name>
<metadataQueryGenerator>org.perfsonar.service.measurementArchive.metadataConfig.queryGenerator.RandomFetchTestQueryGenerator</metadataQueryGenerator>
</eventType>
Modified: trunk/geant2-java-rrd-ma/conf/service.properties.template
===================================================================
--- trunk/geant2-java-rrd-ma/conf/service.properties.template 2008-07-07
11:16:27 UTC (rev 4124)
+++ trunk/geant2-java-rrd-ma/conf/service.properties.template 2008-07-07
13:24:24 UTC (rev 4125)
@@ -1,5 +1,6 @@
service.r.type=ma
+service.name=geant2-java-rrd-ma-3.1
service.ma.class_name=org.perfsonar.service.measurementArchive.rrdType.RRDTypeMAServiceEngine
#service.ma.message_types=MetadataKeyRequest,SetupDataRequest,MeasurementArchiveStoreRequest,EchoRequest,LookupInfoRequest
Modified: trunk/geant2-java-rrd-ma/conf/service.properties.template-2
===================================================================
--- trunk/geant2-java-rrd-ma/conf/service.properties.template-2 2008-07-07
11:16:27 UTC (rev 4124)
+++ trunk/geant2-java-rrd-ma/conf/service.properties.template-2 2008-07-07
13:24:24 UTC (rev 4125)
@@ -14,6 +14,10 @@
service.r.type=ma
# Group=Internal
+# Description=The service name.
+service.name=geant2-java-rrd-ma-3.1
+
+# Group=Internal
# Description=The java class file which implements the ServiceEngine
interface.
service.ma.class_name=org.perfsonar.service.measurementArchive.rrdType.RRDTypeMAServiceEngine
Modified:
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-random-fetch-test.xml
===================================================================
---
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-random-fetch-test.xml
2008-07-07 11:16:27 UTC (rev 4124)
+++
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-random-fetch-test.xml
2008-07-07 13:24:24 UTC (rev 4125)
@@ -7,7 +7,7 @@
<nmwg:metadata id="meta">
-
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/echo/2.0/random-fetch-test</nmwg:eventType>
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/1.0/random-fetch-test</nmwg:eventType>
</nmwg:metadata>
<nmwg:data id="data" metadataIdRef="meta"/>
Added: trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-self-test.xml
Property changes on:
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-self-test.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified:
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-xmldb-access-test.xml
===================================================================
---
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-xmldb-access-test.xml
2008-07-07 11:16:27 UTC (rev 4124)
+++
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-xmldb-access-test.xml
2008-07-07 13:24:24 UTC (rev 4125)
@@ -7,7 +7,7 @@
<nmwg:metadata id="meta">
-
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/echo/2.0/xmldb-access-test</nmwg:eventType>
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/1.0/xmldb-access-test</nmwg:eventType>
</nmwg:metadata>
<nmwg:data id="data" metadataIdRef="meta"/>
Modified:
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-xmldb-content-test.xml
===================================================================
---
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-xmldb-content-test.xml
2008-07-07 11:16:27 UTC (rev 4124)
+++
trunk/geant2-java-rrd-ma/samples/requests/EchoRequest-xmldb-content-test.xml
2008-07-07 13:24:24 UTC (rev 4125)
@@ -7,7 +7,7 @@
<nmwg:metadata id="meta">
-
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/echo/2.0/xmldb-content-test</nmwg:eventType>
+
<nmwg:eventType>http://schemas.perfsonar.net/tools/admin/selftest/1.0/xmldb-content-test</nmwg:eventType>
</nmwg:metadata>
<nmwg:data id="data" metadataIdRef="meta"/>
Modified:
trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
===================================================================
---
trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
2008-07-07 11:16:27 UTC (rev 4124)
+++
trunk/geant2-java-rrd-ma/src/main/java/org/perfsonar/service/measurementArchive/rrdType/RRDTypeMAServiceEngine.java
2008-07-07 13:24:24 UTC (rev 4125)
@@ -13,6 +13,7 @@
import java.util.Set;
import java.util.Vector;
+import org.ggf.ns.nmwg.base.v2_0.Element;
import org.ggf.ns.nmwg.base.v2_0.Data;
import org.ggf.ns.nmwg.base.v2_0.Key;
import org.ggf.ns.nmwg.base.v2_0.Message;
@@ -90,9 +91,10 @@
public static final String SELECT_NAMESPACE =
"http://ggf.org/ns/nmwg/ops/select/2.0";
- public static final String ECHO_XMLDB_ACCESS_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/echo/2.0/xmldb-access-test";
- public static final String ECHO_XMLDB_CONTENT_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/echo/2.0/xmldb-content-test";
- public static final String ECHO_RANDOM_FETCH_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/echo/2.0/random-fetch-test";
+ public static final String ECHO_SELF_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/";
+ public static final String ECHO_XMLDB_ACCESS_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/1.0/xmldb-access-test";
+ public static final String ECHO_XMLDB_CONTENT_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/1.0/xmldb-content-test";
+ public static final String ECHO_RANDOM_FETCH_TEST_NAMESPACE =
"http://schemas.perfsonar.net/tools/admin/selftest/1.0/random-fetch-test";
// ---------------------------------- constructors
@@ -408,7 +410,7 @@
BaseChainingMergerFactory.getBaseChainingMergers(mergerNames);
if (baseChainingMergers == null)
- return message;
+ return message;
BaseChaining baseChaining = null;
@@ -908,13 +910,22 @@
EventType eventType = metadata.getEventType();
String eventTypeStr = eventType.getEventType().trim();
+ String testName = null;
+ try {
+ testName =
eventTypeStr.substring(eventTypeStr.lastIndexOf("/")+1,
eventTypeStr.length());
+ } catch (Exception ex) {
+ testName = "test";
+ }
+
Message response = null;
if (eventTypeStr.equals(ECHO_XMLDB_ACCESS_TEST_NAMESPACE)
|| eventTypeStr.equals(ECHO_XMLDB_CONTENT_TEST_NAMESPACE))
- response = executeXmlDBSimpleTest(request);
+ response = executeXmlDBSimpleTest(request, testName);
else if (eventTypeStr.equals(ECHO_RANDOM_FETCH_TEST_NAMESPACE))
- response = executeRandomFetchTest(request);
+ response = executeRandomFetchTest(request, testName);
+ else if (eventTypeStr.equals(ECHO_SELF_TEST_NAMESPACE + "1.0"))
+ response = executeSelfTest(request);
else
return generateResultCodeResponse(
"error.request", "This eventType in echo request is not
supported");
@@ -923,36 +934,73 @@
}
- protected Message executeXmlDBSimpleTest(Message request) throws
PerfSONARException {
+ protected Message executeXmlDBSimpleTest(Message request, String
testName) throws PerfSONARException {
- Message response = metadataConfig.fetch(request);
+ String serviceType =
configuration.getProperty("service.r.service_type");
+ String serviceName = null;
+ try { serviceName = configuration.getProperty("service.name"); }
catch (Exception ex) {;}
+ if (serviceName == null) serviceName = "pS" + serviceType;
+
+ Message response = null;
+ Data data = null;
+ String eventTypeStr = null;
+
+ try {
+
+ response = metadataConfig.fetch(request);
+ eventTypeStr = ECHO_SELF_TEST_NAMESPACE + serviceType + "/" +
serviceName + "/" + testName + "/success/1.0";
+ data = ((Data[])response.getDataArray())[0];
+
+ } catch (PerfSONARException psEx) {
+
+ eventTypeStr = ECHO_SELF_TEST_NAMESPACE + serviceType + "/" +
serviceName + "/" + testName + "/failure/1.0";
+ return generateResultCodeResponse(eventTypeStr,
psEx.getResultDescription());
+ }
+
+ EventType eventType = new EventType();
+ eventType.setEventType(eventTypeStr);
+
Metadata metadata = new Metadata();
- EventType eventType = new EventType();
- eventType.setEventType("success.echo");
metadata.setEventType(eventType);
+
response.setMetadata(metadata);
- Data data = ((Data[])response.getDataArray())[0];
data.setMetadataIdRef(metadata.getId());
+
return response;
}
- protected Message executeRandomFetchTest(Message request) throws
PerfSONARException {
+ protected Message executeRandomFetchTest(Message request, String
testName) throws PerfSONARException {
- Message keyMessage = metadataConfig.fetch(request);
+ String serviceType =
configuration.getProperty("service.r.service_type");
+ String serviceName = null;
+ try { serviceName = configuration.getProperty("service.name"); }
catch (Exception ex) {;}
+ if (serviceName == null) serviceName = "pS" + serviceType;
+
+ Message keyMessage = null;
+ try {
+ keyMessage = metadataConfig.fetch(request);
+ } catch (PerfSONARException psEx) {
+ return generateResultCodeResponse(
+ ECHO_SELF_TEST_NAMESPACE + serviceType + "/" +
serviceName + "/" + testName + "/failure/1.0",
+ psEx.getResultDescription());
+ }
+
Data keyData = null;
try {
keyData = keyMessage.getDataArray()[0];
} catch (Exception ex) {
return generateResultCodeResponse(
- "error.test", "No data elements in the metadata
configuration");
+ ECHO_SELF_TEST_NAMESPACE + serviceType + "/" +
serviceName + "/" + testName + "/failure/1.0",
+ "No data elements in the metadata configuration");
}
Key key = keyData.getKey();
if (key == null)
- return generateResultCodeResponse("error.test",
- "No key in data element with
id='"
- + keyData.getId()
- + "' in the metadata
configuration");
+ return generateResultCodeResponse(
+ ECHO_SELF_TEST_NAMESPACE + serviceType + "/" +
serviceName + "/" + testName + "/failure/1.0",
+ "No key in data element with id='"
+ + keyData.getId()
+ + "' in the metadata configuration");
Metadata metadata = new Metadata();
metadata.setKey(key);
@@ -962,10 +1010,79 @@
dataRequest.setMetadata(metadata);
dataRequest.setData(data);
- return getData(dataRequest);
+ try {
+ getData(dataRequest);
+ } catch (PerfSONARException psEx) {
+ return generateResultCodeResponse(
+ ECHO_SELF_TEST_NAMESPACE + serviceType + "/" +
serviceName + "/" + testName + "/failure/1.0",
+ psEx.getResultDescription());
+ }
+
+ return generateResultCodeResponse(
+ ECHO_SELF_TEST_NAMESPACE + serviceType + "/" +
serviceName + "/" + testName + "/success/1.0",
+ "Fetching data from rrd file is correct.");
+
+ //return getData(dataRequest);
}
+ protected Message executeSelfTest(Message request) throws
PerfSONARException {
+
+ Message responseMessage = new Message();
+
+ Metadata metadata = new Metadata();
+ EventType eventType = new EventType();
+ eventType.setEventType(ECHO_SELF_TEST_NAMESPACE + "1.0");
+ metadata.setEventType(eventType);
+
+ Data data = new Data();
+ data.setMetadataIdRef(metadata.getId());
+
+ Message testMessage = null;
+ testMessage =
getEcho(getTestEchoRequest(ECHO_XMLDB_ACCESS_TEST_NAMESPACE));
+ buildSelfTestResponseMessage(testMessage.getMetadataIterator(),
data);
+ buildSelfTestResponseMessage(testMessage.getDataIterator(), data);
+
+ testMessage =
getEcho(getTestEchoRequest(ECHO_XMLDB_CONTENT_TEST_NAMESPACE));
+ buildSelfTestResponseMessage(testMessage.getMetadataIterator(),
data);
+ buildSelfTestResponseMessage(testMessage.getDataIterator(), data);
+
+ testMessage =
getEcho(getTestEchoRequest(ECHO_RANDOM_FETCH_TEST_NAMESPACE));
+ buildSelfTestResponseMessage(testMessage.getMetadataIterator(),
data);
+ buildSelfTestResponseMessage(testMessage.getDataIterator(), data);
+
+ responseMessage.setMetadata(metadata);
+ responseMessage.setData(data);
+
+ return responseMessage;
+ }
+
+
+ private Message getTestEchoRequest(String eventType) throws
PerfSONARException {
+
+ Message message = new Message();
+ message.setType("EchoRequest");
+ Metadata m = new Metadata();
+ Data d = new Data();
+ EventType et = new EventType();
+ et.setEventType(eventType);
+ m.setEventType(et);
+ d.setMetadataIdRef(m.getId());
+ message.setMetadata(m);
+ message.setData(d);
+
+ return message;
+ }
+
+
+ private void buildSelfTestResponseMessage(Iterator it, Data data) {
+
+ while (it.hasNext()) {
+ data.setChild((Element)it.next());
+ }
+ }
+
+
/**
* Method used by SQL-MA to store dynamic metadata keys.
*
- perfsonar: r4125 - in trunk/geant2-java-rrd-ma: ant conf samples/requests src/main/java/org/perfsonar/service/measurementArchive/rrdType, svnlog, 07/07/2008
Archive powered by MHonArc 2.6.16.