2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
22 package org.onap.sdnc.vnfapi;
24 import java.io.FileNotFoundException;
25 import java.io.FileOutputStream;
26 import java.io.InputStream;
27 import java.io.PrintStream;
28 import java.util.Date;
29 import java.util.Properties;
31 import junit.framework.TestCase;
33 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInput;
34 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder;
35 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
36 import org.onap.sdnc.vnfapi.VnfSdnUtil;
37 import org.onap.sdnc.vnfapi.vnfapiProvider;
38 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInput;
39 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder;
40 import org.opendaylight.yang.gen.v1.org.onap.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder;
41 import org.slf4j.Logger;
42 import org.slf4j.LoggerFactory;
44 public class TestPropertyList extends TestCase {
47 private final Logger log = LoggerFactory.getLogger( vnfapiProvider.class );
48 public void testPrintPropertyList() {
49 InputStream propStr = getClass().getResourceAsStream("/proplist.properties");
51 Properties props = new Properties();
58 fail("Could not load proplist.properties");
61 String aptFile = props.getProperty("proplist.aptFile");
63 if ((aptFile == null) || (aptFile.length() == 0))
65 fail("proplist.aptFile unset");
68 PrintStream outStr = null;
71 outStr = new PrintStream(new FileOutputStream(aptFile));
72 } catch (FileNotFoundException e) {
73 fail("Cannot open apt file "+aptFile);
76 Date now = new Date();
79 outStr.print("\n Service Logic Variables");
80 outStr.print("\n ---");
81 outStr.print("\n System generated");
82 outStr.print("\n ---");
83 outStr.print("\n "+now.toString());
84 outStr.print("\n\nSupported service logic variables");
85 outStr.print("\n\n Config/operational tree data for VNF SDN service is passed to the service logic in the following variables");
87 VnfSdnUtil.printPropertyList(outStr, "", ServiceDataBuilder.class);
88 VnfSdnUtil.printPropertyList(outStr, "", PreloadDataBuilder.class);
90 outStr.print("\n\n Input parameters to the vnf-topology-operation RPC are passed to the service logic in the following variables");
92 VnfSdnUtil.printPropertyList(outStr, "", VnfTopologyOperationInputBuilder.class);
94 outStr.print("\n\n Input parameters to the preload-vnf-topology-operation -operation RPC are passed to the service logic in the following variables");
96 VnfSdnUtil.printPropertyList(outStr, "", PreloadVnfTopologyOperationInputBuilder.class);