Skip to Content.
Sympa Menu

perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r6435 - trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar

Subject: perfsonar development work

List archive

[pS-dev] [GEANT/SA2/ps-java-services] r6435 - trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/ps-java-services] r6435 - trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar
  • Date: Mon, 17 Jun 2013 14:13:07 +0100 (BST)
  • Authentication-results: sfpop-ironport04.merit.edu; dkim=neutral (message not signed) header.i=none

Author: psnc.pietrzak
Date: 2013-06-17 14:13:06 +0100 (Mon, 17 Jun 2013)
New Revision: 6435

Added:

trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/DummyService.java
Modified:
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/Handlers.java

trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
Log:
Fixed the test case.

Added:
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/DummyService.java
===================================================================
---
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/DummyService.java
(rev 0)
+++
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/DummyService.java
2013-06-17 13:13:06 UTC (rev 6435)
@@ -0,0 +1,18 @@
+package net.geant.perfsonar;
+
+public class DummyService extends PerfSONAR {
+
+ @Override
+ public ServiceType getServiceType() {
+ return ServiceType.MP;
+ }
+
+ @Override
+ public String getServiceName() {
+ return "SSHTELNET";
+ }
+
+ public int dummyMethod() {
+ return 0;
+ }
+}

Modified:
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/Handlers.java
===================================================================
--- trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/Handlers.java
2013-06-04 19:55:42 UTC (rev 6434)
+++ trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/Handlers.java
2013-06-17 13:13:06 UTC (rev 6435)
@@ -18,7 +18,7 @@
public Handlers() {
try {
logger.info("Configuring the handler for dummyMethod");
-
configure(when("TestRequest").then(net.geant.perfsonar.PerfSONARTest.class).dummyMethod());
+
configure(when("TestRequest").then(net.geant.perfsonar.DummyService.class).dummyMethod());
} catch (Exception ex) {
logger.warn("Problem when trying to configure handler for
dummyMethod ({}): {}", ex.getClass(), ex.getMessage());
}

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-06-04 19:55:42 UTC (rev 6434)
+++
trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar/PerfSONARTest.java
2013-06-17 13:13:06 UTC (rev 6435)
@@ -33,22 +33,10 @@
static final String REQUEST_ID = "request1";
private PerfSONARClient client;

- private PerfSONAR service = new PerfSONAR() {
+ private PerfSONAR service = new DummyService();

- @Override
- public ServiceType getServiceType() {
- return ServiceType.MP;
- }
-
- @Override
- public String getServiceName() {
- return "SSHTELNET";
- }
- };
-
@Before
public void givenPerfSONARClient() {
- logger.debug("Preparing for a unit test for perfSONAR tests");
addSelfTest("constant", "Success Message.",
SampleTests.class).constantTest();
addSelfTest("add test ${index}", "Added ${arg}.",
SampleTests.class).add(any(Integer.class));
configureForType(Integer.class,
selfTestData(SampleTests.class).values());
@@ -63,26 +51,17 @@

@Test
public void shouldLoadConfiguration() throws Exception {
- logger.info("•••• Testing configuration loading.");
Method dM = Configuration.getHandler("TestRequest");
- logger.debug("Method is: {}", dM);
- assertEquals(PerfSONARTest.class.getMethod("dummyMethod"), dM);
+ assertEquals(DummyService.class.getMethod("dummyMethod"), dM);
}
-
- // Needed for above test
- public int dummyMethod() {
- return 0;
- }

@Test
public void checkEchoConfiguration() throws Exception {
- logger.info("•••• Testing echo request configuration.");
assertNotNull(Configuration.getHandler("EchoRequest"));
}

@Test
public void checkEcho() throws Exception {
- logger.info("•••• Testing echo request response.");
assertEquals(new Response(NMWG.toEchoResponse(REQUEST_ID)),
client.echo(REQUEST_ID));
}

@@ -94,7 +73,6 @@
*/
@Test
public void checkEchoLogging() throws Exception {
- logger.info("•••• Testing echo request logging.");
Response expectedResponse = new
Response(NMWG.toEchoResponse(REQUEST_ID));
Response generatedResponse = client.echo(REQUEST_ID);
logger.debug("Expected response: {}", expectedResponse);
@@ -104,18 +82,14 @@

@Test
public void checkSelfTest() throws Throwable {
- logger.info("•••• Testing a simple self test.");
SelfTestResult expectedResult = success("constant", "Success
Message.", service.getServiceName(), service
.getServiceType().toString());
SelfTestResult generatedResult = client.selfTest(REQUEST_ID,
"constant");
- logger.debug("Expected result: {}", expectedResult);
- logger.debug("Generated result: {}", generatedResult);
assertEquals(expectedResult, generatedResult);
}

@Test
public void checkAllSelfTests() throws Throwable {
- logger.info("•••• Testing all self tests.");
assertEquals(
asList(success("add test 0", "Added 1.",
service.getServiceName(), service.getServiceType().toString()),
success("add test 1", "Added 2.",
service.getServiceName(), service.getServiceType().toString()),



  • [pS-dev] [GEANT/SA2/ps-java-services] r6435 - trunk/perfsonar-base/base/src/test/java/net/geant/perfsonar, svn-noreply, 06/17/2013

Archive powered by MHonArc 2.6.16.

Top of Page