aboutsummaryrefslogtreecommitdiffstats
path: root/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java')
-rw-r--r--sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java59
1 files changed, 56 insertions, 3 deletions
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<TestResult> resultList = new LinkedList<>();
+ resultBuilder.setTestIdentifier("test1");
+ List<String> 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);
+
+ }
}