From 23ff887d1e61e490b48f735a49c434d50efa1639 Mon Sep 17 00:00:00 2001 From: "Timoney, Dan (dt5972)" Date: Wed, 20 Feb 2019 20:10:35 -0500 Subject: Increase code coverage Added junit test cases, and updated jacoco config in provider/base to include provider tests as well Change-Id: I8f384b3a4dd7362f004eaa959cd0c634edf0ddbe Issue-ID: CCSDK-1096 Signed-off-by: Timoney, Dan (dt5972) --- .../ccsdk/sli/core/sli/PrintYangToPropTest.java | 59 ++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) (limited to 'sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java') diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java index d639c28d..14b4dcb7 100644 --- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java +++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java @@ -1,6 +1,25 @@ -/** - * - */ +/*- + 2 * ============LICENSE_START======================================================= + 3 * ONAP CCSDK + 4 * ================================================================================ + 5 * Copyright (C) 2019 AT&T Intellectual Property. All rights + 6 * reserved. + 7 * ================================================================================ + 8 * Licensed under the Apache License, Version 2.0 (the "License"); + 9 * you may not use this file except in compliance with the License. + 10 * You may obtain a copy of the License at + 11 * + 12 * http://www.apache.org/licenses/LICENSE-2.0 + 13 * + 14 * Unless required by applicable law or agreed to in writing, software + 15 * distributed under the License is distributed on an "AS IS" BASIS, + 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + 17 * See the License for the specific language governing permissions and + 18 * limitations under the License. + 19 * ============LICENSE_END============================================ + 20 * =================================================================== + 21 * + 22 */ package org.onap.ccsdk.sli.core.sli; import java.util.Enumeration; @@ -11,8 +30,11 @@ import java.util.Properties; import org.junit.Test; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResultsBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResult; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder; import org.slf4j.Logger; @@ -82,7 +104,38 @@ public class PrintYangToPropTest { // Generate builder from properties just generated PrintYangToProp.toBuilder(props, pBuilder); + } + + @Test + public void testWithList() { + TestResultsBuilder resultsBuilder = new TestResultsBuilder(); + TestResultBuilder resultBuilder = new TestResultBuilder(); + + // Set builder with values + List resultList = new LinkedList<>(); + resultBuilder.setTestIdentifier("test1"); + List results = new LinkedList<>(); + results.add("pass"); + resultBuilder.setResults(results); + resultList.add(resultBuilder.build()); + resultsBuilder.setTestResult(resultList); + + // Generate properties + Properties props = new Properties(); + props = PrintYangToProp.toProperties(props, resultsBuilder); + + Enumeration propNames = props.propertyNames(); + + while (propNames.hasMoreElements()) { + String propName = (String) propNames.nextElement(); + LOG.info("Property {} = {}", propName, props.getProperty(propName)); + } + + // Generate builder from properties just generated + PrintYangToProp.toBuilder(props, resultsBuilder); + + } } -- cgit 1.2.3-korg