diff options
author | 2019-05-02 09:42:55 -0400 | |
---|---|---|
committer | 2019-05-07 10:02:17 -0400 | |
commit | 3f9a0c3183480d150089c0d5a6e507c877f7d121 (patch) | |
tree | b3db04cbe2cef23f81503177a50edc5360ffa486 /ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java | |
parent | e153f0adfbed711ce1e215748594a4d04fd1edaf (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/woorea/openstack/ceilometer/v2/model/SampleTest.java')
-rw-r--r-- | ceilometer-model/src/test/java/com/woorea/openstack/ceilometer/v2/model/SampleTest.java | 60 |
1 files changed, 24 insertions, 36 deletions
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); } |