From b7a047c328bfd62139ec753580d64a650da28879 Mon Sep 17 00:00:00 2001 From: Gokul Singaraju Date: Tue, 1 May 2018 00:07:10 -0400 Subject: Add code coverage Issue-ID: VNFSDK-217 Change-Id: I745563f7e5fb534f64476ad3343f5943453bf695 Signed-Off-by: Gokul Singaraju --- .../att/com/EvelScalingMeasurement.java | 32 +---------- .../evel_javalib2/src/test/java/TestJunit.java | 62 ++++++++++++++++++++++ 2 files changed, 63 insertions(+), 31 deletions(-) (limited to 'veslibrary/ves_javalibrary/evel_javalib2') diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java index 6c39d13..df143ff 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/main/java/evel_javalibrary/att/com/EvelScalingMeasurement.java @@ -2073,36 +2073,6 @@ public class EvelScalingMeasurement extends EvelHeader { EVEL_EXIT(); } - /**************************************************************************//** - * Set the VNFC Scaling Metric property of the Measurement. - * - * @note The property is treated as immutable: it is only valid to call - * the setter once. However, we don't assert if the caller tries to - * overwrite, just ignoring the update instead. - * - * - * @param scaling_metric The scaling metric to set. - *****************************************************************************/ - public void evel_measurement_vnfc_scaling_metric_set(EvelScalingMeasurement measurement, - int scaling_metric) - { - EVEL_ENTER(); - - LOGGER.warn("Called evel_measurement_vnfc_scaling_metric_set with 2 arguments. The first argument is unused and callers should use the single-parameter version instead"); - - /***************************************************************************/ - /* Check preconditions. */ - /***************************************************************************/ - assert(measurement != null); - assert(event_domain == EvelHeader.DOMAINS.EVEL_DOMAIN_MEASUREMENT); - assert(scaling_metric >= 0.0); - - vnfc_scaling_metric.SetValuePr( - scaling_metric, - "VNFC Scaling Metric"); - EVEL_EXIT(); - } - public void evel_measurement_vnfc_scaling_metric_set(int scaling_metric) { EVEL_ENTER(); @@ -3281,7 +3251,7 @@ public class EvelScalingMeasurement extends EvelHeader { if( vnic_usage == null ){ vnic_usage = new ArrayList(); - if( vnic_usage == null )LOGGER.error("Unable to allocate new file system usage"); + LOGGER.debug("Allocate new file system usage"); } vnic_usage.add(vnic_performance); diff --git a/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java b/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java index f565c69..77c9b0d 100644 --- a/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java +++ b/veslibrary/ves_javalibrary/evel_javalib2/src/test/java/TestJunit.java @@ -58,6 +58,10 @@ import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.Date; +import javax.json.Json; +import javax.json.JsonObject; +import javax.json.JsonObjectBuilder; + @PrepareForTest({AgentMain.class}) @RunWith(PowerMockRunner.class) @@ -183,6 +187,44 @@ public class TestJunit { sm.evel_measurement_custom_measurement_add("group1","name2","val2"); sm.evel_measurement_custom_measurement_add("group2","name1","val1"); sm.evel_measurement_custom_measurement_add("group2","name2","val2"); + + JsonObjectBuilder jsonObjBld1 = + Json.createObjectBuilder() + .add("trackIdentifier", 12345) + .add("remoteSource", "vm1235") + .add("ended", "12:45:67") + .add("detached", 633453) + .add("frameWidth", 765765) + .add("frameHeight", 767867) + .add("framesPerSecond", 334343) + .add("framesSent", 8976786) + .add("framesReceived", 233423) + .add("frameHeight", 8897896) + .add("framesDecoded", 3434533) + .add("framesDropped", 87867676) + .add("framesCorrupted", 3345342) + .add("audioLevel", "-45dBm"); + JsonObject custom1 = jsonObjBld1.build(); + sm.evel_measurement_add_jsonobj(custom1); + JsonObjectBuilder jsonObjBld2 = + Json.createObjectBuilder() + .add("trackIdentifier", 12345) + .add("remoteSource", "vm1235") + .add("ended", "12:45:67") + .add("detached", 633453) + .add("frameWidth", 765765) + .add("frameHeight", 767867) + .add("framesPerSecond", 334343) + .add("framesSent", 8976786) + .add("framesReceived", 233423) + .add("frameHeight", 8897896) + .add("framesDecoded", 3434533) + .add("framesDropped", 87867676) + .add("framesCorrupted", 3345342) + .add("audioLevel", "-45dBm"); + JsonObject custom2 = jsonObjBld2.build(); + sm.evel_measurement_add_jsonobj(custom2); + sm.evel_measurement_cpu_use_idle_set(my1,0.5); sm.evel_measurement_cpu_use_interrupt_set(my1,0.5); sm.evel_measurement_cpu_use_nice_set(my1,0.5); @@ -379,6 +421,26 @@ public class TestJunit { ev.evel_other_field_add_namedarray("a1", "b2", "c2"); ev.evel_other_field_add_namedarray("a2", "b1", "c1"); ev.evel_other_field_add_namedarray("a2", "b1", "c1"); + + JsonObjectBuilder jsonObjBld = + Json.createObjectBuilder() + .add("trackIdentifier", 12345) + .add("remoteSource", "vm1235") + .add("ended", "12:45:67") + .add("detached", 633453) + .add("frameWidth", 765765) + .add("frameHeight", 767867) + .add("framesPerSecond", 334343) + .add("framesSent", 8976786) + .add("framesReceived", 233423) + .add("frameHeight", 8897896) + .add("framesDecoded", 3434533) + .add("framesDropped", 87867676) + .add("framesCorrupted", 3345342) + .add("audioLevel", "-45dBm"); + JsonObject custom = jsonObjBld.build(); + + ev.evel_other_field_add_jsonobj(custom); when(mymainmock.evel_post_event(ev)).thenReturn(true); boolean ret = mymainmock.evel_post_event(ev); -- cgit 1.2.3-korg