From a1482e86dfea4360b1d8338ca7a0f1c5dee52b1a Mon Sep 17 00:00:00 2001 From: Joss Armstrong Date: Fri, 11 Jan 2019 10:41:59 +0000 Subject: Add code coverage for metric-service-policy code Increased line coverage from 0% to 79% Issue-ID: APPC-1321 Change-Id: I79f65d97055248b73da875e9591bd2c6e86afca4 Signed-off-by: Joss Armstrong --- .../metric/impl/DispatchingFunctionCounterBuilderImpl.java | 12 +++++++----- .../metric/impl/DispatchingFuntionMetricImpl.java | 4 +++- .../metric/impl/DmaapRequestCounterBuilderImpl.java | 12 +++++++----- .../metric/impl/DmaapRequestCounterMetricImpl.java | 4 +++- .../metric/impl/PrimitiveCounterBuilderImpl.java | 8 +++++--- .../policy/impl/ScheduledPublishingPolicyImpl.java | 9 +++++---- 6 files changed, 30 insertions(+), 19 deletions(-) (limited to 'appc-metric/appc-metric-bundle/src/main/java') diff --git a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DispatchingFunctionCounterBuilderImpl.java b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DispatchingFunctionCounterBuilderImpl.java index f2d00e987..f4c3e1914 100644 --- a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DispatchingFunctionCounterBuilderImpl.java +++ b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DispatchingFunctionCounterBuilderImpl.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,28 +38,28 @@ public class DispatchingFunctionCounterBuilderImpl implements DispatchingFunctio @Override public DispatchingFunctionCounterBuilder withName(String name) { - this.name=name; + this.name = name; return this; } @Override public DispatchingFunctionCounterBuilder withAcceptRequestValue(long value) { - this.acceptedRequested=value; + this.acceptedRequested = value; return this; } @Override public DispatchingFunctionCounterBuilder withRejectRequestValue(long value) { - this.rejectedRequest=value; + this.rejectedRequest = value; return this; } @Override public DispatchingFunctionCounterBuilder withType(MetricType type) { - this.metricType=type; + this.metricType = type; return this; } @Override public DispatchingFuntionMetric build() { - return new DispatchingFuntionMetricImpl(this.name,this.metricType,this.acceptedRequested,this.rejectedRequest); + return new DispatchingFuntionMetricImpl(this.name, this.metricType, this.acceptedRequested, this.rejectedRequest); } } diff --git a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DispatchingFuntionMetricImpl.java b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DispatchingFuntionMetricImpl.java index 3d9f383ca..b985c6791 100644 --- a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DispatchingFuntionMetricImpl.java +++ b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DispatchingFuntionMetricImpl.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,7 +80,7 @@ public class DispatchingFuntionMetricImpl implements DispatchingFuntionMetric { return value; } catch (Exception e) { - logger.debug("Cant format the date.",e); + logger.debug("Cant format the date.", e); } return null; diff --git a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DmaapRequestCounterBuilderImpl.java b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DmaapRequestCounterBuilderImpl.java index 366ba2409..7507e4251 100644 --- a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DmaapRequestCounterBuilderImpl.java +++ b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DmaapRequestCounterBuilderImpl.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,31 +38,31 @@ public class DmaapRequestCounterBuilderImpl implements DmaapRequestCounterBuilde @Override public DmaapRequestCounterBuilder withName(String name) { - this.name=name; + this.name = name; return this; } @Override public DmaapRequestCounterBuilder withRecievedMessage(long value) { - this.recievedMessage=value; + this.recievedMessage = value; return this; } @Override public DmaapRequestCounterBuilder withPublishedMessage(long value) { - this.publishedMessage=value; + this.publishedMessage = value; return this; } @Override public DmaapRequestCounterBuilder withType(MetricType type) { - this.metricType=type; + this.metricType = type; return this; } @Override public DmaapRequestCounterMetric build() { - return new DmaapRequestCounterMetricImpl(this.name,this.metricType,this.recievedMessage,this.publishedMessage); + return new DmaapRequestCounterMetricImpl(this.name, this.metricType, this.recievedMessage, this.publishedMessage); } } diff --git a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DmaapRequestCounterMetricImpl.java b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DmaapRequestCounterMetricImpl.java index 5243e72ce..c6e2eea3b 100644 --- a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DmaapRequestCounterMetricImpl.java +++ b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/DmaapRequestCounterMetricImpl.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +79,7 @@ public class DmaapRequestCounterMetricImpl implements DmaapRequestCounterMetric logger.debug("Current value of the metric " + this.name + " :" + value); return value; } catch (Exception e) { - logger.debug("Cant format the date.",e); + logger.debug("Cant format the date.", e); } return null; } diff --git a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/PrimitiveCounterBuilderImpl.java b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/PrimitiveCounterBuilderImpl.java index bc745ce54..a6491c3e9 100644 --- a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/PrimitiveCounterBuilderImpl.java +++ b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/metric/impl/PrimitiveCounterBuilderImpl.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,19 +37,19 @@ public class PrimitiveCounterBuilderImpl implements PrimitiveCounterBuilder { @Override public PrimitiveCounterBuilder withName(String name) { - this.name=name; + this.name = name; return this; } @Override public PrimitiveCounterBuilder withValue(long value) { - this.counter=value; + this.counter = value; return this; } @Override public PrimitiveCounterBuilder withType(MetricType type) { - this.metricType=type; + this.metricType = type; return this; } diff --git a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/policy/impl/ScheduledPublishingPolicyImpl.java b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/policy/impl/ScheduledPublishingPolicyImpl.java index 0dd76b866..593c9ffa0 100644 --- a/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/policy/impl/ScheduledPublishingPolicyImpl.java +++ b/appc-metric/appc-metric-bundle/src/main/java/org/onap/appc/metricservice/policy/impl/ScheduledPublishingPolicyImpl.java @@ -5,19 +5,21 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * ============LICENSE_END========================================================= */ @@ -35,7 +37,6 @@ import org.onap.appc.configuration.Configuration; import org.onap.appc.configuration.ConfigurationFactory; import org.onap.appc.exceptions.APPCException; import org.onap.appc.metricservice.MetricRegistry; -import org.onap.appc.metricservice.MetricService; import org.onap.appc.metricservice.Publisher; import org.onap.appc.metricservice.metric.Metric; import org.onap.appc.metricservice.policy.ScheduledPublishingPolicy; -- cgit 1.2.3-korg