perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r5859 - trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/se rvice/measurementArchive/sqlType
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r5859 - trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/se rvice/measurementArchive/sqlType
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r5859 - trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/se rvice/measurementArchive/sqlType
- Date: Wed, 5 Oct 2011 16:44:45 +0100 (BST)
Author: psnc.pikusa
Date: 2011-10-05 16:44:45 +0100 (Wed, 05 Oct 2011)
New Revision: 5859
Added:
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
Log:
Initial commit of store methods tests
Added:
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
===================================================================
---
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
(rev 0)
+++
trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/service/measurementArchive/sqlType/OwampStoreRequestProcessTest.java
2011-10-05 15:44:45 UTC (rev 5859)
@@ -0,0 +1,96 @@
+package org.perfsonar.service.measurementArchive.sqlType;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.ggf.ns.nmwg.tools.owamp.v2_0.Datum;
+import org.junit.Assert;
+import org.junit.Test;
+import
org.perfsonar.service.measurementArchive.sqlType.nmwg.OwampAggregationDatum;
+import
org.perfsonar.service.measurementArchive.sqlType.store.OwampStoreRequestProcess;
+
+public class OwampStoreRequestProcessTest {
+
+ @Test
+ public void shouldReturnIbatisParamsWhenDatumIsGiven() {
+
+ // given
+ Datum datum = new Datum();
+ datum.setSeqNum("1");
+ datum.setSendTime("time1");
+ datum.setSendSynchronized("1");
+ datum.setSendTimeError("1.0");
+ datum.setReceiveTime("time2");
+ datum.setReceiveTimeError("1.0");
+ datum.setReceiveSynchronized("1");
+ datum.setTTL("1");
+
+ Map<String, Object> ibatisParams = new HashMap<String,
Object>();
+ ibatisParams.put("receiveSynchronized", Integer.parseInt(datum
+ .getReceiveSynchronized()));
+ ibatisParams.put("receiveTime", datum.getReceiveTime());
+ ibatisParams.put("receiveTimeError", Float.parseFloat(datum
+ .getReceiveTimeError()));
+ ibatisParams.put("sendSynchronized", Integer.parseInt(datum
+ .getSendSynchronized()));
+ ibatisParams.put("sendTime", datum.getSendTime());
+ ibatisParams.put("sendTimeError", Float.parseFloat(datum
+ .getSendTimeError()));
+ ibatisParams.put("seqNum",
Integer.parseInt(datum.getSeqNum()));
+ ibatisParams.put("ttl", Integer.parseInt(datum.getTTL()));
+
+ // when
+ Map<String, Object> ibatisParamsTest = new
OwampStoreRequestProcess(
+ "test").prepareStoreParameters(datum,
+ new HashMap<String, Object>());
+
+ // then
+ Assert.assertEquals(ibatisParams, ibatisParamsTest);
+
+ }
+
+ @Test
+ public void
shouldReturnIbatisParamsWhenOwampAggregationDatumIsGiven(){
+ OwampAggregationDatum datum = new OwampAggregationDatum();
+ datum.setSender("sender");
+ datum.setReceiver("receiver");
+ datum.setSent("1");
+ datum.setLoss("2");
+ datum.setLostPercent("1.0");
+ datum.setDuplicates("2");
+ datum.setMinDelay("1.0");
+ datum.setMedDelay("2.0");
+ datum.setMaxDelay("3.0");
+ datum.setDelayUnits("mps");
+ datum.setError("1.0");
+ datum.setErrorUnits("mps");
+ datum.setJitter("1.0");
+ datum.setJitterUnits("mps");
+ datum.setHops("10");
+
+
+ Map<String, Object> ibatisParams = new HashMap<String,
Object>();
+ ibatisParams.put("sender" , datum.getSender());
+ ibatisParams.put("receiver" , datum.getReceiver());
+ ibatisParams.put("sent" , Integer.parseInt(datum.getSent()));
+ ibatisParams.put("loss" ,Integer.parseInt(datum.getLoss()));
+ ibatisParams.put("lostPercent" ,
Float.parseFloat(datum.getLostPercent()));
+ ibatisParams.put("duplicates" ,
Integer.parseInt(datum.getDuplicates()));
+ ibatisParams.put("minDelay"
,Float.parseFloat(datum.getMinDelay()));
+ ibatisParams.put("medDelay"
,Float.parseFloat(datum.getMedDelay()));
+ ibatisParams.put("maxDelay"
,Float.parseFloat(datum.getMaxDelay()));
+ ibatisParams.put("delayUnits" , datum.getDelayUnits());
+ ibatisParams.put("error" ,
Float.parseFloat(datum.getError()));
+ ibatisParams.put("errorUnits" , datum.getErrorUnits());
+ ibatisParams.put("jitter"
,Float.parseFloat(datum.getJitter()));
+ ibatisParams.put("jitterUnits" , datum.getJitterUnits());
+ ibatisParams.put("hops" , Integer.parseInt(datum.getHops()));
+
+ // when
+ Map<String, Object> ibatisParamsTest = new
OwampStoreRequestProcess("test").prepareStoreParameters(datum, new
HashMap<String, Object>());
+
+ // then
+ Assert.assertEquals(ibatisParams, ibatisParamsTest);
+
+ }
+}
\ No newline at end of file
- [pS-dev] [GEANT/SA2/ps-java-services] r5859 - trunk/perfsonar-java-sql-ma/src/test/java/org/perfsonar/se rvice/measurementArchive/sqlType, svn-noreply, 10/05/2011
Archive powered by MHonArc 2.6.16.