summaryrefslogtreecommitdiffstats
path: root/ceilometer-model/src/test/java/com
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/src/test/java/com
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/src/test/java/com')
-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
4 files changed, 69 insertions, 111 deletions
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);
}