summaryrefslogtreecommitdiffstats
path: root/ceilometer-model
diff options
context:
space:
mode:
authorSmokowski, Steve (ss835w) <ss835w@us.att.com>2019-05-02 09:42:55 -0400
committerSmokowski, Steve (ss835w) <ss835w@us.att.com>2019-05-07 10:02:17 -0400
commit3f9a0c3183480d150089c0d5a6e507c877f7d121 (patch)
treeb3db04cbe2cef23f81503177a50edc5360ffa486 /ceilometer-model
parente153f0adfbed711ce1e215748594a4d04fd1edaf (diff)
Enhance Openstack Client
Update Openstack Client to support additional fields Updat all formatting issues Issue-ID: SO-1844 Change-Id: I1369e0c18cc25274db8df7e12855a020b8da38da Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'ceilometer-model')
-rw-r--r--ceilometer-model/pom.xml47
-rw-r--r--ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java17
-rw-r--r--ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java18
-rw-r--r--ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java31
-rw-r--r--ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java33
-rw-r--r--ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/MeterTest.java32
-rw-r--r--ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/ResourceTest.java36
-rw-r--r--ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java60
-rw-r--r--ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/StatisticsTest.java52
9 files changed, 138 insertions, 188 deletions
diff --git a/ceilometer-model/pom.xml b/ceilometer-model/pom.xml
index 21d9a7a..bd6277a 100644
--- a/ceilometer-model/pom.xml
+++ b/ceilometer-model/pom.xml
@@ -1,25 +1,26 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so.libs</groupId>
- <artifactId>openstack-java-sdk</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
- <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
- <artifactId>ceilometer-model</artifactId>
- <name>OpenStack Ceilometer Model</name>
- <description>OpenStack Ceilometer Model</description>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so.libs</groupId>
+ <artifactId>openstack-java-sdk</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.libs.openstack-java-sdk</groupId>
+ <artifactId>ceilometer-model</artifactId>
+ <name>OpenStack Ceilometer Model</name>
+ <description>OpenStack Ceilometer Model</description>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.skyscreamer</groupId>
- <artifactId>jsonassert</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.skyscreamer</groupId>
+ <artifactId>jsonassert</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
</project>
diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java
index 6faafc0..7041a78 100644
--- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java
+++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Meter.java
@@ -22,18 +22,18 @@ public class Meter {
@JsonProperty("user_id")
private String user;
-
-
+
+
private String name;
-
+
@JsonProperty("resource_id")
private String resource;
-
+
@JsonProperty("project_id")
private String project;
-
+
private String type;
-
+
private String unit;
public String getUser() {
@@ -62,9 +62,8 @@ public class Meter {
@Override
public String toString() {
- return "Meter [user=" + user + ", name=" + name + ", resource="
- + resource + ", project=" + project + ", type=" + type
- + ", unit=" + unit + "]";
+ return "Meter [user=" + user + ", name=" + name + ", resource=" + resource + ", project=" + project + ", type="
+ + type + ", unit=" + unit + "]";
}
}
diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java
index 2a2c0de..6b8988b 100644
--- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java
+++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Resource.java
@@ -17,22 +17,21 @@
package com.woorea.openstack.ceilometer.v2.model;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Resource {
-
+
@JsonProperty("resource_id")
private String resource;
-
+
private String timestamp;
-
+
@JsonProperty("project_id")
private String project;
-
+
@JsonProperty("user_id")
private String user;
-
+
private Map<String, Object> metadata;
public String getResource() {
@@ -57,9 +56,8 @@ public class Resource {
@Override
public String toString() {
- return "Resource [resource=" + resource + ", timestamp=" + timestamp
- + ", project=" + project + ", user=" + user + ", metadata="
- + metadata + "]";
+ return "Resource [resource=" + resource + ", timestamp=" + timestamp + ", project=" + project + ", user=" + user
+ + ", metadata=" + metadata + "]";
}
-
+
}
diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java
index 2808113..aad3359 100644
--- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java
+++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Sample.java
@@ -17,7 +17,6 @@
package com.woorea.openstack.ceilometer.v2.model;
import java.util.Map;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Sample {
@@ -27,29 +26,29 @@ public class Sample {
@JsonProperty("counter_name")
private String counterName;
-
+
@JsonProperty("counter_unit")
private String counterUnit;
-
+
@JsonProperty("counter_volume")
private String counterVolume;
-
+
private String source;
-
+
@JsonProperty("project_id")
private String project;
-
+
@JsonProperty("user_id")
private String user;
-
+
@JsonProperty("resource_id")
private String resource;
-
+
private String timestamp;
-
+
@JsonProperty("message_id")
private String message;
-
+
@JsonProperty("resource_metadata")
private Map<String, Object> metadata;
@@ -99,12 +98,10 @@ public class Sample {
@Override
public String toString() {
- return "Sample [counterType=" + counterType + ", counterName="
- + counterName + ", counterUnit=" + counterUnit
- + ", counterVolume=" + counterVolume + ", source=" + source
- + ", project=" + project + ", user=" + user + ", resource="
- + resource + ", timestamp=" + timestamp + ", message="
- + message + ", metadata=" + metadata + "]";
+ return "Sample [counterType=" + counterType + ", counterName=" + counterName + ", counterUnit=" + counterUnit
+ + ", counterVolume=" + counterVolume + ", source=" + source + ", project=" + project + ", user=" + user
+ + ", resource=" + resource + ", timestamp=" + timestamp + ", message=" + message + ", metadata="
+ + metadata + "]";
}
-
+
}
diff --git a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java
index 747c9f0..2fd7b3e 100644
--- a/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java
+++ b/ceilometer-model/src/main/java/com/woorea/openstack/ceilometer/v2/model/Statistics.java
@@ -17,35 +17,34 @@
package com.woorea.openstack.ceilometer.v2.model;
import java.math.BigDecimal;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Statistics {
-
+
private BigDecimal avg;
-
+
private BigDecimal count;
-
+
private BigDecimal duration;
-
+
@JsonProperty("duration_start")
private String durationStart;
-
+
@JsonProperty("duration_end")
private String durationEnd;
-
+
private BigDecimal max;
-
+
private BigDecimal min;
-
+
private BigDecimal period;
-
+
@JsonProperty("period_start")
private String periodStart;
-
+
@JsonProperty("period_end")
private String periodEnd;
-
+
private BigDecimal sum;
public BigDecimal getAvg() {
@@ -94,11 +93,9 @@ public class Statistics {
@Override
public String toString() {
- return "Statistics [avg=" + avg + ", count=" + count + ", duration="
- + duration + ", durationStart=" + durationStart
- + ", durationEnd=" + durationEnd + ", max=" + max + ", min="
- + min + ", period=" + period + ", periodStart=" + periodStart
- + ", periodEnd=" + periodEnd + ", sum=" + sum + "]";
+ return "Statistics [avg=" + avg + ", count=" + count + ", duration=" + duration + ", durationStart="
+ + durationStart + ", durationEnd=" + durationEnd + ", max=" + max + ", min=" + min + ", period="
+ + period + ", periodStart=" + periodStart + ", periodEnd=" + periodEnd + ", sum=" + sum + "]";
}
-
+
}
diff --git a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/MeterTest.java b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/MeterTest.java
index 361bf9c..953ef03 100644
--- a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/MeterTest.java
+++ b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/MeterTest.java
@@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -34,20 +33,13 @@ public class MeterTest {
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"type\" : \"type\"," + EOL
- + " \"unit\" : \"unit\"," + EOL
- + " \"user_id\" : \"user\"," + EOL
- + " \"resource_id\" : \"resource\"," + EOL
- + " \"project_id\" : \"project\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"," + EOL + " \"type\" : \"type\"," + EOL
+ + " \"unit\" : \"unit\"," + EOL + " \"user_id\" : \"user\"," + EOL + " \"resource_id\" : \"resource\","
+ + EOL + " \"project_id\" : \"project\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
@@ -63,22 +55,22 @@ public class MeterTest {
public void testMethods() throws Exception {
Meter meter = objectMapper.readValue(JSON_FULL, Meter.class);
meter.toString();
-
+
String unit = meter.getUnit();
Assert.assertNotNull(unit);
-
+
String resource = meter.getResource();
Assert.assertNotNull(resource);
-
+
String name = meter.getName();
Assert.assertNotNull(name);
-
+
String project = meter.getProject();
Assert.assertNotNull(project);
-
+
String type = meter.getType();
Assert.assertNotNull(type);
-
+
String user = meter.getUser();
Assert.assertNotNull(user);
}
diff --git a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/ResourceTest.java b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/ResourceTest.java
index 08cbcd5..7605321 100644
--- a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/ResourceTest.java
+++ b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/ResourceTest.java
@@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -36,22 +34,14 @@ public class ResourceTest {
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"timestamp\" : \"timestamp\"," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"resource_id\" : \"resource\"," + EOL
- + " \"project_id\" : \"project\"," + EOL
- + " \"user_id\" : \"user\"" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"timestamp\" : \"timestamp\"," + EOL + " \"metadata\" : {"
+ + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"resource_id\" : \"resource\"," + EOL + " \"project_id\" : \"project\"," + EOL
+ + " \"user_id\" : \"user\"" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
@@ -67,20 +57,20 @@ public class ResourceTest {
public void testMethods() throws Exception {
Resource resource = objectMapper.readValue(JSON_FULL, Resource.class);
resource.toString();
-
- Map<String,Object> metadata = resource.getMetadata();
+
+ Map<String, Object> metadata = resource.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
-
+
String resourceProperty = resource.getResource();
Assert.assertNotNull(resourceProperty);
-
+
String project = resource.getProject();
Assert.assertNotNull(project);
-
+
String user = resource.getUser();
Assert.assertNotNull(user);
-
+
String timestamp = resource.getTimestamp();
Assert.assertNotNull(timestamp);
}
diff --git a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java
index e647f42..5084c93 100644
--- a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java
+++ b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java
@@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.Map;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -36,28 +34,18 @@ public class SampleTest {
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"source\" : \"source\"," + EOL
- + " \"timestamp\" : \"timestamp\"," + EOL
- + " \"counter_type\" : \"countertype\"," + EOL
- + " \"counter_name\" : \"countername\"," + EOL
- + " \"counter_unit\" : \"counterunit\"," + EOL
- + " \"counter_volume\" : \"countervolume\"," + EOL
- + " \"project_id\" : \"project\"," + EOL
- + " \"user_id\" : \"user\"," + EOL
- + " \"resource_id\" : \"resource\"," + EOL
- + " \"message_id\" : \"message\"," + EOL
- + " \"resource_metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL =
+ "{" + EOL + " \"source\" : \"source\"," + EOL + " \"timestamp\" : \"timestamp\"," + EOL
+ + " \"counter_type\" : \"countertype\"," + EOL + " \"counter_name\" : \"countername\"," + EOL
+ + " \"counter_unit\" : \"counterunit\"," + EOL + " \"counter_volume\" : \"countervolume\"," + EOL
+ + " \"project_id\" : \"project\"," + EOL + " \"user_id\" : \"user\"," + EOL
+ + " \"resource_id\" : \"resource\"," + EOL + " \"message_id\" : \"message\"," + EOL
+ + " \"resource_metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL
+ + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
@@ -73,38 +61,38 @@ public class SampleTest {
public void testMethods() throws Exception {
Sample sample = objectMapper.readValue(JSON_FULL, Sample.class);
sample.toString();
-
+
String counterName = sample.getCounterName();
Assert.assertNotNull(counterName);
-
- Map<String,Object> metadata = sample.getMetadata();
+
+ Map<String, Object> metadata = sample.getMetadata();
Assert.assertNotNull(metadata);
Assert.assertEquals(2, metadata.size());
-
+
String resource = sample.getResource();
Assert.assertNotNull(resource);
-
+
String counterVolume = sample.getCounterVolume();
Assert.assertNotNull(counterVolume);
-
+
String project = sample.getProject();
Assert.assertNotNull(project);
-
+
String counterUnit = sample.getCounterUnit();
Assert.assertNotNull(counterUnit);
-
+
String source = sample.getSource();
Assert.assertNotNull(source);
-
+
String counterType = sample.getCounterType();
Assert.assertNotNull(counterType);
-
+
String message = sample.getMessage();
Assert.assertNotNull(message);
-
+
String user = sample.getUser();
Assert.assertNotNull(user);
-
+
String timestamp = sample.getTimestamp();
Assert.assertNotNull(timestamp);
}
diff --git a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/StatisticsTest.java b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/StatisticsTest.java
index 741e53b..78b4293 100644
--- a/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/StatisticsTest.java
+++ b/ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/StatisticsTest.java
@@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.math.BigDecimal;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -36,25 +34,15 @@ public class StatisticsTest {
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"avg\" : 79," + EOL
- + " \"count\" : 14," + EOL
- + " \"duration\" : 31," + EOL
- + " \"max\" : 87," + EOL
- + " \"min\" : 85," + EOL
- + " \"period\" : 4," + EOL
- + " \"sum\" : 2," + EOL
- + " \"duration_start\" : \"durationstart\"," + EOL
- + " \"duration_end\" : \"durationend\"," + EOL
- + " \"period_start\" : \"periodstart\"," + EOL
- + " \"period_end\" : \"periodend\"" + EOL
- + "}";
-
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private static final String JSON_FULL = "{" + EOL + " \"avg\" : 79," + EOL + " \"count\" : 14," + EOL
+ + " \"duration\" : 31," + EOL + " \"max\" : 87," + EOL + " \"min\" : 85," + EOL + " \"period\" : 4,"
+ + EOL + " \"sum\" : 2," + EOL + " \"duration_start\" : \"durationstart\"," + EOL
+ + " \"duration_end\" : \"durationend\"," + EOL + " \"period_start\" : \"periodstart\"," + EOL
+ + " \"period_end\" : \"periodend\"" + EOL + "}";
+
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
@@ -70,37 +58,37 @@ public class StatisticsTest {
public void testMethods() throws Exception {
Statistics statistics = objectMapper.readValue(JSON_FULL, Statistics.class);
statistics.toString();
-
+
BigDecimal duration = statistics.getDuration();
Assert.assertNotNull(duration);
-
+
BigDecimal period = statistics.getPeriod();
Assert.assertNotNull(period);
-
+
BigDecimal avg = statistics.getAvg();
Assert.assertNotNull(avg);
-
+
BigDecimal min = statistics.getMin();
Assert.assertNotNull(min);
-
+
String durationStart = statistics.getDurationStart();
Assert.assertNotNull(durationStart);
-
+
BigDecimal max = statistics.getMax();
Assert.assertNotNull(max);
-
+
String durationEnd = statistics.getDurationEnd();
Assert.assertNotNull(durationEnd);
-
+
BigDecimal count = statistics.getCount();
Assert.assertNotNull(count);
-
+
BigDecimal sum = statistics.getSum();
Assert.assertNotNull(sum);
-
+
String periodStart = statistics.getPeriodStart();
Assert.assertNotNull(periodStart);
-
+
String periodEnd = statistics.getPeriodEnd();
Assert.assertNotNull(periodEnd);
}