2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
20 * ============LICENSE_END=========================================================
23 package org.onap.ccsdk.ali.adaptors.ansible.impl;
26 import java.util.Properties;
27 import org.junit.Test;
28 import org.onap.ccsdk.sli.adaptors.ansible.impl.AnsibleAdaptorPropertiesProviderImpl;
30 import static org.junit.Assert.assertEquals;
31 import static org.onap.ccsdk.sli.adaptors.ansible.AnsibleAdaptorConstants.*;
33 public class TestAnsibleAdaptorPropertiesProviderImpl {
36 public void testGetProperties() throws IllegalStateException, IllegalArgumentException {
37 Properties prop = new AnsibleAdaptorPropertiesProviderImpl().getProperties();
39 assertEquals("TRUST_ALL", prop.getProperty(CLIENT_TYPE_PROPERTY_NAME));
40 assertEquals("org.onap.appc.appc_ansible_adaptor", prop.getProperty("org.onap.appc.provider.adaptor.name"));
41 assertEquals("changeit", prop.getProperty(TRUSTSTORE_PASS_PROPERTY_NAME));
42 assertEquals("${user.home},/opt/opendaylight/current/properties,.", prop.getProperty("org.onap.appc.bootstrap.path"));
43 assertEquals("APPC", prop.getProperty("appc.application.name"));
44 assertEquals("appc.properties", prop.getProperty("org.onap.appc.bootstrap.file"));
45 assertEquals("org/onap/appc/i18n/MessageResources", prop.getProperty("org.onap.appc.resources"));
46 assertEquals("/opt/opendaylight/tls-client/mykeystore.js", prop.getProperty(TRUSTSTORE_PROPERTY_NAME));
50 public void testGetTestProperties() throws IllegalStateException, IllegalArgumentException {
51 final String configFilePath = "src/test/resources/properties/ansible-adaptor-test.properties".replace("/", File.separator);
52 Properties prop = new AnsibleAdaptorPropertiesProviderImpl(configFilePath).getProperties();
54 assertEquals("appc", prop.getProperty(CLIENT_TYPE_PROPERTY_NAME));
55 assertEquals("org.onap.appc.appc_ansible_adaptor", prop.getProperty("org.onap.appc.provider.adaptor.name"));
56 assertEquals("Aa123456", prop.getProperty(TRUSTSTORE_PASS_PROPERTY_NAME));
57 assertEquals("${user.home},/opt/opendaylight/current/properties,.", prop.getProperty("org.onap.appc.bootstrap.path"));
58 assertEquals("APPC", prop.getProperty("appc.application.name"));
59 assertEquals("appc.properties", prop.getProperty("org.onap.appc.bootstrap.file"));
60 assertEquals("org/onap/appc/i18n/MessageResources", prop.getProperty("org.onap.appc.resources"));
61 assertEquals("src/test/resources/org/onap/appc/asdc-client.jks", prop.getProperty(TRUSTSTORE_PROPERTY_NAME));