OSAM infra seed code - merge with osam-core side-by-side - fixed warnings in onap-enabler POMs
Change-Id: I0cd9ea39d4b7c1dc088ab0ecd6fb787c7f490e5e
Signed-off-by: Aharoni, Pavel (pa0916) <pavel.aharoni@intl.att.com>
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/AaiClientTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/AaiClientTest.java
new file mode 100644
index 0000000..0a3536a
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/AaiClientTest.java
@@ -0,0 +1,469 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.ImmutableList;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.commons.lang3.reflect.FieldUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.mockito.Mockito;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.osam.aai.model.AaiGetTenatns.GetTenantsResponse;
+import org.onap.osam.aai.model.AaiNodeQueryResponse;
+import org.onap.osam.aai.model.ResourceType;
+import org.onap.osam.aai.util.AAIRestInterface;
+import org.onap.osam.aai.util.HttpsAuthClient;
+import org.onap.osam.aai.util.ServletRequestHelper;
+import org.onap.osam.aai.util.SystemPropertyHelper;
+import org.onap.osam.controllers.LocalWebConfig;
+import org.onap.osam.exceptions.GenericUncheckedException;
+import org.onap.osam.model.Subscriber;
+import org.onap.osam.model.SubscriberList;
+import org.onap.osam.model.probes.ExternalComponentStatus;
+import org.onap.osam.model.probes.HttpRequestMetadata;
+import org.onap.osam.model.probes.StatusMetadata;
+import org.onap.osam.testUtils.TestUtils;
+import org.springframework.http.HttpMethod;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import sun.security.provider.certpath.SunCertPathBuilderException;
+import sun.security.validator.ValidatorException;
+
+import javax.crypto.BadPaddingException;
+import javax.net.ssl.SSLHandshakeException;
+import javax.servlet.ServletContext;
+import javax.ws.rs.ProcessingException;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.core.Response;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.security.cert.CertificateException;
+import java.util.ArrayList;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalToIgnoringCase;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.*;
+
+@ContextConfiguration(classes = {LocalWebConfig.class, SystemProperties.class})
+@WebAppConfiguration
+public class AaiClientTest {
+
+ private AaiClient aaiClientMock;
+ private ServletContext servletContext;
+
+ @BeforeMethod
+ public void initMocks(){
+ aaiClientMock = mock(AaiClient.class);
+ aaiClientMock.logger = mock(EELFLoggerDelegate.class);
+ servletContext = mock(ServletContext.class);
+
+ when(servletContext.getRealPath(any(String.class))).thenReturn("");
+
+ when(aaiClientMock.doAaiGet(any(String.class),any(Boolean.class))).thenReturn(null);
+ }
+
+ @DataProvider
+ public static Object[][] logicalLinkData() {
+ return new Object[][] {
+ {"", "network/logical-links/logical-link/"},
+ {"link", "network/logical-links/logical-link/link"}
+ };
+ }
+
+ @Test(dataProvider = "logicalLinkData")
+ public void getLogicalLink_Link_Is_Empty(String link, String expectedUrl) {
+
+ when(aaiClientMock.getLogicalLink(any(String.class))).thenCallRealMethod();
+ aaiClientMock.getLogicalLink(link);
+ Mockito.verify(aaiClientMock).doAaiGet(argThat(equalToIgnoringCase(expectedUrl)),any(Boolean.class));
+ }
+
+ @DataProvider
+ public static Object[][] subscribersResults() {
+ return new Object[][] {
+ {new SubscriberList(new ArrayList<Subscriber>() {{ add(new Subscriber()); add(new Subscriber()); }}), true},
+ {new SubscriberList(new ArrayList<Subscriber>() {{ add(new Subscriber()); }}), true},
+ {new SubscriberList(new ArrayList<Subscriber>()), false}
+ };
+ }
+
+ @Test(dataProvider = "subscribersResults")
+ public void testProbeAaiGetAllSubscribers_returnsTwoToZeroSubscribers_ResultsAsExpected(SubscriberList subscribers, boolean isAvailable){
+ ExternalComponentStatus expectedStatus = new ExternalComponentStatus(ExternalComponentStatus.Component.AAI,isAvailable, new HttpRequestMetadata(
+ HttpMethod.GET,
+ 200,
+ "url",
+ "rawData",
+ isAvailable ? "OK" : "No subscriber received",
+ 0
+ ));
+ Mockito.when(aaiClientMock.getAllSubscribers(true)).thenReturn(
+ new AaiResponseWithRequestInfo<>(
+ HttpMethod.GET, "url", new AaiResponse<>(subscribers, null, 200),
+ "rawData"));
+ Mockito.when(aaiClientMock.probeAaiGetAllSubscribers()).thenCallRealMethod();
+ ExternalComponentStatus result = aaiClientMock.probeAaiGetAllSubscribers();
+ assertThat(statusDataReflected(result),is(statusDataReflected(expectedStatus)));
+ assertThat(requestMetadataReflected(result.getMetadata()),is(requestMetadataReflected(expectedStatus.getMetadata())));
+ }
+
+ //serialize fields except of fields we cannot know ahead of time
+ private static String requestMetadataReflected(StatusMetadata metadata) {
+ return new ReflectionToStringBuilder(metadata, ToStringStyle.SHORT_PREFIX_STYLE)
+ .setExcludeFieldNames("duration")
+ .toString();
+ }
+
+ private static String statusDataReflected(ExternalComponentStatus status) {
+ return new ReflectionToStringBuilder(status, ToStringStyle.SHORT_PREFIX_STYLE)
+ .setExcludeFieldNames("metadata")
+ .toString();
+ }
+
+ @DataProvider
+ public static Object[][] rawData() {
+ return new Object[][]{
+ {"errorMessage", }, {""}, {null}
+ };
+ }
+
+ @Test(dataProvider = "rawData")
+ public void testProbeAaiGetFullSubscribersWithNullResponse_returnsNotAvailableWithErrorRawData(String rawData){
+ Mockito.when(aaiClientMock.getAllSubscribers(true)).thenReturn(
+ new AaiResponseWithRequestInfo<>(HttpMethod.GET, "url", null,
+ rawData));
+ ExternalComponentStatus result = callProbeAaiGetAllSubscribersAndAssertNotAvailable();
+ assertThat(result.getMetadata(), instanceOf(HttpRequestMetadata.class));
+ assertEquals(((HttpRequestMetadata) result.getMetadata()).getRawData(), rawData);
+ }
+
+ @DataProvider
+ public static Object[][] exceptions() {
+ return new Object[][] {
+ {"NullPointerException", "errorMessage",
+ new ExceptionWithRequestInfo(HttpMethod.GET, "url",
+ "errorMessage", null, new NullPointerException())},
+ {"RuntimeException", null,
+ new ExceptionWithRequestInfo(HttpMethod.GET, "url",
+ null, null, new RuntimeException())},
+ {"RuntimeException", null,
+ new RuntimeException()},
+ };
+ }
+
+ @Test(dataProvider = "exceptions")
+ public void testProbeAaiGetFullSubscribersWithNullResponse_returnsNotAvailableWithErrorRawData(String description, String expectedRawData, Exception exception){
+ Mockito.when(aaiClientMock.getAllSubscribers(true)).thenThrow(exception);
+ ExternalComponentStatus result = callProbeAaiGetAllSubscribersAndAssertNotAvailable();
+ if (exception instanceof ExceptionWithRequestInfo) {
+ assertThat(result.getMetadata(), instanceOf(HttpRequestMetadata.class));
+ assertEquals(((HttpRequestMetadata) result.getMetadata()).getRawData(), expectedRawData);
+ }
+ assertThat(result.getMetadata().getDescription(), containsString(description));
+ }
+
+ private ExternalComponentStatus callProbeAaiGetAllSubscribersAndAssertNotAvailable() {
+ Mockito.when(aaiClientMock.probeAaiGetAllSubscribers()).thenCallRealMethod();
+ ExternalComponentStatus result = aaiClientMock.probeAaiGetAllSubscribers();
+ assertFalse(result.isAvailable());
+ return result;
+ }
+
+
+ @Test
+ public void getTenants_Arguments_Are_Null_Or_Empty() {
+
+ when(aaiClientMock.getTenants(any(String.class), any(String.class))).thenCallRealMethod();
+
+ AaiResponse response = aaiClientMock.getTenants("", "");
+
+ assertEquals(response.getErrorMessage(), "{\"statusText\":\" Failed to retrieve LCP Region & Tenants from A&AI, Subscriber ID or Service Type is missing.\"}");
+
+
+ response = aaiClientMock.getTenants(null, null);
+
+ assertEquals(response.getErrorMessage(), "{\"statusText\":\" Failed to retrieve LCP Region & Tenants from A&AI, Subscriber ID or Service Type is missing.\"}");
+ }
+
+ @Test
+ public void getTenants_Arguments_Are_Valid_But_Tenants_Not_Exist() {
+
+ when(aaiClientMock.getTenants(any(String.class), any(String.class))).thenCallRealMethod();
+
+ Response generalEmptyResponse = mock(Response.class);
+ when(aaiClientMock.doAaiGet(any(String.class),any(Boolean.class))).thenReturn(generalEmptyResponse);
+
+ AaiResponse response = aaiClientMock.getTenants("subscriberId", "serviceType");
+
+ assertEquals(response.getErrorMessage(), "{\"statusText\":\" A&AI has no LCP Region & Tenants associated to subscriber 'subscriberId' and service type 'serviceType'\"}");
+
+ }
+
+ @Test
+ public void getTenants_Arguments_Are_Valid_Get_The_Tenanats() {
+
+ when(aaiClientMock.getTenants(any(String.class), any(String.class))).thenCallRealMethod();
+
+
+ Response generalEmptyResponse = mock(Response.class);
+
+ when(generalEmptyResponse.readEntity(String.class)).thenReturn(tenantResponseRaw);
+ when(generalEmptyResponse.getStatus()).thenReturn(200);
+ when(generalEmptyResponse.getStatusInfo()).thenReturn(new Response.StatusType() {
+ @Override
+ public int getStatusCode() {
+ return 200;
+ }
+
+ @Override
+ public Response.Status.Family getFamily() {
+ return Response.Status.Family.SUCCESSFUL;
+ }
+
+ @Override
+ public String getReasonPhrase() {
+ return null;
+ }
+ });
+
+
+ when(aaiClientMock.doAaiGet(any(String.class),any(Boolean.class))).thenReturn(generalEmptyResponse);
+
+ AaiResponse<GetTenantsResponse[]> response = aaiClientMock.getTenants("subscriberId", "serviceType");
+
+ Assert.assertTrue(response.t.length> 0);
+ }
+
+ final String tenantResponseRaw ="" +
+ "{" +
+ "\"service-type\": \"VIRTUAL USP\"," +
+ "\"resource-version\": \"1494001841964\"," +
+ "\"relationship-list\": {" +
+ "\"relationship\": [{" +
+ "\"related-to\": \"tenant\"," +
+ "\"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/092eb9e8e4b7412e8787dd091bc58e86\"," +
+ "\"relationship-data\": [{" +
+ "\"relationship-key\": \"cloud-region.cloud-owner\"," +
+ "\"relationship-value\": \"att-aic\"" +
+ "}," +
+ "{" +
+ "\"relationship-key\": \"cloud-region.cloud-region-id\"," +
+ "\"relationship-value\": \"AAIAIC25\"" +
+ "}," +
+ "{" +
+ "\"relationship-key\": \"tenant.tenant-id\"," +
+ "\"relationship-value\": \"092eb9e8e4b7412e8787dd091bc58e86\"" +
+ "}" +
+ "]," +
+ "\"related-to-property\": [{" +
+ "\"property-key\": \"tenant.tenant-name\"," +
+ "\"property-value\": \"USP-SIP-IC-24335-T-01\"" +
+ "}]" +
+ "}]" +
+ "}" +
+ "}";
+
+ @DataProvider
+ public static Object[][] resourceTypesProvider() {
+ return new Object[][] {
+ {"service-instance", ResourceType.SERVICE_INSTANCE},
+ {"generic-vnf", ResourceType.GENERIC_VNF},
+ {"vf-module", ResourceType.VF_MODULE}
+ };
+ }
+
+ @Test(dataProvider = "resourceTypesProvider")
+ public void aaiNodeQueryResponseDeserializationTest(String resourceType, ResourceType expectedResourceType) throws IOException {
+ String link = "/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Nimbus/service-instances/service-instance/7131d483-b450-406f-8e30-0c650645fc67";
+ String json =
+ "{\"result-data\": [{" +
+ "\"resource-type\": \""+resourceType+"\"," +
+ "\"resource-link\": \""+ link+ "\"" +
+ "}]}";
+
+ AaiNodeQueryResponse nodeQueryResponse = new ObjectMapper().readValue(json, AaiNodeQueryResponse.class);
+ assertThat(nodeQueryResponse.resultData.get(0).resourceLink, equalTo(link));
+ assertThat(nodeQueryResponse.resultData.get(0).resourceType, is(expectedResourceType));
+ }
+
+ @Test
+ public void aaiNodeQueryEmptyResponseDeserializationTest() throws IOException{
+ String json = "{}";
+ AaiNodeQueryResponse nodeQueryResponse = new ObjectMapper().readValue(json, AaiNodeQueryResponse.class);
+ assertNull(nodeQueryResponse.resultData);
+ }
+
+ @DataProvider
+ public static Object[][] nameAndResourceTypeProvider() {
+ return new Object[][] {
+ {"SRIOV_SVC", ResourceType.SERVICE_INSTANCE, "search/nodes-query?search-node-type=service-instance&filter=service-instance-name:EQUALS:SRIOV_SVC"},
+ {"b1707vidnf", ResourceType.GENERIC_VNF, "search/nodes-query?search-node-type=generic-vnf&filter=vnf-name:EQUALS:b1707vidnf"},
+ {"connectivity_test", ResourceType.VF_MODULE, "search/nodes-query?search-node-type=vf-module&filter=vf-module-name:EQUALS:connectivity_test"},
+ {"MjVg1234", ResourceType.VOLUME_GROUP, "search/nodes-query?search-node-type=volume-group&filter=volume-group-name:EQUALS:MjVg1234"}
+ };
+ }
+
+ @Test(dataProvider = "nameAndResourceTypeProvider")
+ public void whenSearchNodeTypeByName_callRightAaiPath(String name, ResourceType type, String expectedUrl) {
+ when(aaiClientMock.searchNodeTypeByName(any(String.class), any(ResourceType.class))).thenCallRealMethod();
+ aaiClientMock.searchNodeTypeByName(name, type);
+ Mockito.verify(aaiClientMock).doAaiGet(eq(expectedUrl), eq(false));
+ }
+
+ @DataProvider
+ public static Object[][] aaiClientInternalExceptions() {
+ return Stream.<Pair<Class<? extends Throwable>, UncheckedBiConsumer<HttpsAuthClient, Client>>>of(
+
+ // Exception out of httpsAuthClientMock
+ Pair.of(CertificateException.class, (httpsAuthClientMock, javaxClientMock) -> {
+ final CertificateException e0 = new CertificateException("No X509TrustManager implementation available");
+ SSLHandshakeException e = new SSLHandshakeException(e0.toString());
+ e.initCause(e0);
+
+ when(httpsAuthClientMock.getClient(any())).thenThrow(e);
+ }),
+
+ Pair.of(StringIndexOutOfBoundsException.class, mockExceptionOnClientProvider(new StringIndexOutOfBoundsException(4))),
+
+ Pair.of(NullPointerException.class, mockExceptionOnClientProvider(new NullPointerException("null"))),
+
+ Pair.of(FileNotFoundException.class, mockExceptionOnClientProvider(new FileNotFoundException("vid/WEB-INF/cert/aai-client-cert.p12"))),
+
+ Pair.of(BadPaddingException.class, mockExceptionOnClientProvider(
+ new IOException("keystore password was incorrect", new BadPaddingException("Given final block not properly padded")))
+ ),
+ Pair.of(GenericUncheckedException.class, mockExceptionOnClientProvider(new GenericUncheckedException("basa"))),
+
+ Pair.of(NullPointerException.class, (httpsAuthClientMock, javaxClientMock) ->
+ when(httpsAuthClientMock.getClient(any())).thenReturn(null)),
+
+
+ // Exception out of javax's Client
+ Pair.of(SSLHandshakeException.class, (httpsAuthClientMock, javaxClientMock) -> {
+ when(javaxClientMock.target(anyString())).thenThrow(
+ new ProcessingException(new SSLHandshakeException("Received fatal alert: certificate_expired"))
+ );
+ }),
+
+ Pair.of(SunCertPathBuilderException.class, (httpsAuthClientMock, javaxClientMock) -> {
+ SunCertPathBuilderException e0 = new SunCertPathBuilderException("unable to find valid certification path to requested target");
+ when(javaxClientMock.target(anyString())).thenThrow(
+ new ProcessingException(new ValidatorException("PKIX path building failed: " + e0.toString(), e0))
+ );
+ }),
+
+ Pair.of(GenericUncheckedException.class, (httpsAuthClientMock, javaxClientMock) ->
+ when(javaxClientMock.target(anyString())).thenThrow(new GenericUncheckedException("basa")))
+
+ ).flatMap(l -> Stream.of(
+ // double each case to propagateExceptions = true/false, to verify that "don't propagate" really still work
+ ImmutableList.of(l.getLeft(), l.getRight(), true).toArray(),
+ ImmutableList.of(l.getLeft(), l.getRight(), false).toArray()
+ )).collect(Collectors.toList()).toArray(new Object[][]{});
+ }
+
+ private static UncheckedBiConsumer<HttpsAuthClient, Client> mockExceptionOnClientProvider(Exception e) {
+ return (httpsAuthClientMock, javaxClientMock) ->
+ when(httpsAuthClientMock.getClient(any())).thenThrow(e);
+ }
+
+ @Test(dataProvider = "aaiClientInternalExceptions")
+ public void propagateExceptions_internalsThrowException_ExceptionRethrown(Class<? extends Throwable> expectedType, BiConsumer<HttpsAuthClient, Client> setupMocks, boolean propagateExceptions) throws Exception {
+
+ // prepare mocks
+ HttpsAuthClient httpsAuthClientMock = mock(HttpsAuthClient.class);
+ TestUtils.JavaxRsClientMocks mocks = new TestUtils.JavaxRsClientMocks();
+ Client javaxClientMock = mocks.getFakeClient();
+ Response responseMock = mocks.getFakeResponse();
+
+ // prepare real AAIRestInterface and AaiClient, and wire mocks
+ AAIRestInterface aaiRestInterface = new AAIRestInterface(httpsAuthClientMock, new ServletRequestHelper(), new SystemPropertyHelper());
+ final AaiClient aaiClient = new AaiClient(aaiRestInterface, null);
+ when(httpsAuthClientMock.getClient(any())).thenReturn(javaxClientMock);
+
+ // define atomic method under test, including reset of "aaiRestInterface.client"
+ final Function<Boolean, Response> doAaiGet = (propagateExceptions1) -> {
+ try {
+ FieldUtils.writeField(aaiRestInterface, "client", null, true);
+ return aaiClient.doAaiGet("uri", false, propagateExceptions1).getResponse();
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ };
+
+ // verify setup again
+ assertThat("mocks setup should make doAaiGet return our responseMock", doAaiGet.apply(true), is(sameInstance(responseMock)));
+
+
+ /// TEST:
+ setupMocks.accept(httpsAuthClientMock, javaxClientMock);
+
+ try {
+ final Response response = doAaiGet.apply(propagateExceptions);
+ } catch (Exception e) {
+ if (propagateExceptions) {
+ assertThat("root cause incorrect for " + ExceptionUtils.getStackTrace(e), ExceptionUtils.getRootCause(e), instanceOf(expectedType));
+ return; // ok, done
+ } else {
+ // Verify that "don't propagate" really still work
+ Assert.fail("calling doAaiGet when propagateExceptions is false must result with no exception", e);
+ }
+ }
+
+ // If no exception caught
+ // We're asserting that the legacy behaviour is still in place. Hopefully
+ // one day we will remove the non-propagateExceptions case
+ assertFalse(propagateExceptions, "calling doAaiGet when propagateExceptions is 'true' must result with an exception (in this test)");
+ }
+
+ @FunctionalInterface
+ public interface UncheckedBiConsumer<T, U> extends BiConsumer<T, U> {
+ @Override
+ default void accept(T t, U u) {
+ try {
+ acceptThrows(t, u);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ void acceptThrows(T t, U u) throws Exception;
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/AaiGetVnfResponseTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/AaiGetVnfResponseTest.java
new file mode 100644
index 0000000..78509b5
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/AaiGetVnfResponseTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai;
+
+import java.util.Map;
+
+import org.junit.Test;
+
+public class AaiGetVnfResponseTest {
+
+ private AaiGetVnfResponse createTestSubject() {
+ return new AaiGetVnfResponse();
+ }
+
+ @Test
+ public void testGetAdditionalProperties() throws Exception {
+ AaiGetVnfResponse testSubject;
+ Map<String, Object> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getAdditionalProperties();
+ }
+
+ @Test
+ public void testSetAdditionalProperty() throws Exception {
+ AaiGetVnfResponse testSubject;
+ String name = "";
+ Object value = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setAdditionalProperty(name, value);
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/OperationalEnvironmentTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/OperationalEnvironmentTest.java
new file mode 100644
index 0000000..b358eb8
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/OperationalEnvironmentTest.java
@@ -0,0 +1,211 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai;
+
+import org.junit.Test;
+import org.onap.osam.aai.model.RelationshipList;
+
+public class OperationalEnvironmentTest {
+
+ private OperationalEnvironment createTestSubject() {
+ return new OperationalEnvironment();
+ }
+
+ @Test
+ public void testGetOperationalEnvironmentId() throws Exception {
+ OperationalEnvironment testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOperationalEnvironmentId();
+ }
+
+ @Test
+ public void testSetOperationalEnvironmentId() throws Exception {
+ OperationalEnvironment testSubject;
+ String operationalEnvironmentId = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOperationalEnvironmentId(operationalEnvironmentId);
+ }
+
+ @Test
+ public void testGetOperationalEnvironmentName() throws Exception {
+ OperationalEnvironment testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOperationalEnvironmentName();
+ }
+
+ @Test
+ public void testSetOperationalEnvironmentName() throws Exception {
+ OperationalEnvironment testSubject;
+ String operationalEnvironmentName = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOperationalEnvironmentName(operationalEnvironmentName);
+ }
+
+ @Test
+ public void testGetOperationalEnvironmentType() throws Exception {
+ OperationalEnvironment testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOperationalEnvironmentType();
+ }
+
+ @Test
+ public void testSetOperationalEnvironmentType() throws Exception {
+ OperationalEnvironment testSubject;
+ String operationalEnvironmentType = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOperationalEnvironmentType(operationalEnvironmentType);
+ }
+
+ @Test
+ public void testGetOperationalEnvironmentStatus() throws Exception {
+ OperationalEnvironment testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getOperationalEnvironmentStatus();
+ }
+
+ @Test
+ public void testSetOperationalEnvironmentStatus() throws Exception {
+ OperationalEnvironment testSubject;
+ String operationalEnvironmentStatus = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setOperationalEnvironmentStatus(operationalEnvironmentStatus);
+ }
+
+ @Test
+ public void testGetTenantContext() throws Exception {
+ OperationalEnvironment testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getTenantContext();
+ }
+
+ @Test
+ public void testSetTenantContext() throws Exception {
+ OperationalEnvironment testSubject;
+ String tenantContext = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setTenantContext(tenantContext);
+ }
+
+ @Test
+ public void testGetWorkloadContext() throws Exception {
+ OperationalEnvironment testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getWorkloadContext();
+ }
+
+ @Test
+ public void testSetWorkloadContext() throws Exception {
+ OperationalEnvironment testSubject;
+ String workloadContext = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setWorkloadContext(workloadContext);
+ }
+
+ @Test
+ public void testGetResourceVersion() throws Exception {
+ OperationalEnvironment testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getResourceVersion();
+ }
+
+ @Test
+ public void testSetResourceVersion() throws Exception {
+ OperationalEnvironment testSubject;
+ String resourceVersion = "";
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setResourceVersion(resourceVersion);
+ }
+
+ @Test
+ public void testGetRelationshipList() throws Exception {
+ OperationalEnvironment testSubject;
+ RelationshipList result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getRelationshipList();
+ }
+
+ @Test
+ public void testSetRelationshipList() throws Exception {
+ OperationalEnvironment testSubject;
+ RelationshipList relationshipList = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setRelationshipList(relationshipList);
+ }
+
+ @Test
+ public void testOperationalEnvironment() throws Exception {
+ OperationalEnvironment testSubject;
+ String operationalEnvironmentId = "";
+ String operationalEnvironmentName = "";
+ String operationalEnvironmentType = "";
+ String operationalEnvironmentStatus = "";
+ String tenantContext = "";
+ String workloadContext = "";
+ String resourceVersion = "";
+ RelationshipList relationshipList = null;
+
+ // default test
+ testSubject = new OperationalEnvironment(operationalEnvironmentId, operationalEnvironmentName,
+ operationalEnvironmentType, operationalEnvironmentStatus, tenantContext, workloadContext,
+ resourceVersion, relationshipList);
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/ServicePropertiesTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/ServicePropertiesTest.java
new file mode 100644
index 0000000..b651049
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/ServicePropertiesTest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai;
+
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.osam.aai.model.ServiceProperties;
+
+public class ServicePropertiesTest {
+
+ private ServiceProperties createTestSubject() {
+ return new ServiceProperties();
+ }
+
+ @Test
+ public void testGetAdditionalProperties() throws Exception {
+ ServiceProperties testSubject;
+ Map<String, Object> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getAdditionalProperties();
+ }
+
+ @Test
+ public void testSetAdditionalProperty() throws Exception {
+ ServiceProperties testSubject;
+ String name = "";
+ Object value = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setAdditionalProperty(name, value);
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/SubscriberAaiResponseTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/SubscriberAaiResponseTest.java
new file mode 100644
index 0000000..8adf9c2
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/SubscriberAaiResponseTest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai;
+
+import org.junit.Test;
+import org.onap.osam.model.SubscriberList;
+
+public class SubscriberAaiResponseTest {
+
+ private SubscriberAaiResponse createTestSubject() {
+ return new SubscriberAaiResponse(new SubscriberList(), "", 0);
+ }
+
+
+ @Test
+ public void testGetSubscriberList() throws Exception {
+ SubscriberAaiResponse testSubject;
+ SubscriberList result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getSubscriberList();
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/SubscriberFilteredResultsTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/SubscriberFilteredResultsTest.java
new file mode 100644
index 0000000..e7cf380
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/SubscriberFilteredResultsTest.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai;
+
+import java.util.ArrayList;
+
+import org.junit.Test;
+import org.onap.osam.model.SubscriberList;
+import org.onap.osam.roles.EcompRole;
+import org.onap.osam.roles.Role;
+import org.onap.osam.roles.RoleValidator;
+
+public class SubscriberFilteredResultsTest {
+
+ private SubscriberFilteredResults createTestSubject() {
+ ArrayList<Role> list = new ArrayList<Role>();
+ list.add(new Role(EcompRole.READ, "a", "a", "a"));
+ RoleValidator rl=new RoleValidator(list);
+ SubscriberList sl = new SubscriberList();
+ sl.customer = new ArrayList<org.onap.osam.model.Subscriber>();
+ sl.customer.add(new org.onap.osam.model.Subscriber());
+ return new SubscriberFilteredResults(rl, sl, "OK", 200);
+ }
+
+ @Test
+ public void testGetSubscriberList() throws Exception {
+ SubscriberFilteredResults testSubject;
+ SubscriberListWithFilterData result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getSubscriberList();
+ }
+
+ @Test
+ public void testSetSubscriberList() throws Exception {
+ SubscriberFilteredResults testSubject;
+ SubscriberListWithFilterData subscriberList = null;
+
+ // default test
+ testSubject = createTestSubject();
+ //testSubject.setSubscriberList(subscriberList);
+ testSubject.getSubscriberList();
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/SubscriberWithFilterTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/SubscriberWithFilterTest.java
new file mode 100644
index 0000000..5b6ddcc
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/SubscriberWithFilterTest.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai;
+
+import org.junit.Test;
+
+public class SubscriberWithFilterTest {
+
+ private SubscriberWithFilter createTestSubject() {
+ return new SubscriberWithFilter();
+ }
+
+ @Test
+ public void testGetIsPermitted() throws Exception {
+ SubscriberWithFilter testSubject;
+ boolean result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getIsPermitted();
+ }
+
+ @Test
+ public void testSetIsPermitted() throws Exception {
+ SubscriberWithFilter testSubject;
+ boolean isPermitted = false;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setIsPermitted(isPermitted);
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/VnfResultTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/VnfResultTest.java
new file mode 100644
index 0000000..3f06e6c
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/VnfResultTest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai;
+
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.osam.aai.model.VnfResult;
+
+public class VnfResultTest {
+
+ private VnfResult createTestSubject() {
+ return new VnfResult();
+ }
+
+ @Test
+ public void testGetAdditionalProperties() throws Exception {
+ VnfResult testSubject;
+ Map<String, Object> result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getAdditionalProperties();
+ }
+
+ @Test
+ public void testSetAdditionalProperty() throws Exception {
+ VnfResult testSubject;
+ String name = "";
+ Object value = null;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.setAdditionalProperty(name, value);
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentListTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentListTest.java
new file mode 100644
index 0000000..4bc64ab
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentListTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model.AaiGetOperationalEnvironments;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+import org.junit.Test;
+
+public class OperationalEnvironmentListTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(OperationalEnvironmentList.class, hasValidGettersAndSetters());
+ }
+
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiGetPnfResponseTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiGetPnfResponseTest.java
new file mode 100644
index 0000000..c74fe37
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiGetPnfResponseTest.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.StringContains.containsString;
+import static org.hamcrest.core.IsEqual.equalTo;
+
+public class AaiGetPnfResponseTest {
+
+ private AaiGetPnfResponse aaiGetPnfResponse;
+
+ @Before
+ public void setUp(){
+ aaiGetPnfResponse = new AaiGetPnfResponse();
+ aaiGetPnfResponse.results = new ArrayList<>();
+ aaiGetPnfResponse.setAdditionalProperty("key1", "value1");
+ aaiGetPnfResponse.setAdditionalProperty("key2", "value2");
+ }
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() throws IOException {
+ String result = new ObjectMapper().writeValueAsString(aaiGetPnfResponse);
+ assertThat(result, containsString("key1"));
+ assertThat(result, containsString("value2"));
+ assertThat(result, containsString("key2"));
+ assertThat(result, containsString("value2"));
+ }
+
+ @Test
+ public void shouldHaveValidToString(){
+ assertThat(aaiGetPnfResponse.toString(),
+ equalTo("AaiGetPnfResponse{results=[], additionalProperties={key1=value1, key2=value2}}"));
+ }
+
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiGetPnfs/PnfTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiGetPnfs/PnfTest.java
new file mode 100644
index 0000000..ec25225
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiGetPnfs/PnfTest.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model.AaiGetPnfs;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class PnfTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(Pnf.class, hasValidGettersAndSetters());
+ }
+
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiRelationResponseTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiRelationResponseTest.java
new file mode 100644
index 0000000..d139936
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/AaiRelationResponseTest.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class AaiRelationResponseTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(AaiRelationResponse.class, hasValidGettersAndSetters());
+ }
+
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/GetServiceModelsByDistributionStatusResponseTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/GetServiceModelsByDistributionStatusResponseTest.java
new file mode 100644
index 0000000..a0b4ac2
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/GetServiceModelsByDistributionStatusResponseTest.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class GetServiceModelsByDistributionStatusResponseTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(GetServiceModelsByDistributionStatusResponse.class, hasValidGettersAndSetters());
+ }
+
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/LogicalLinkResponseTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/LogicalLinkResponseTest.java
new file mode 100644
index 0000000..607ea78
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/LogicalLinkResponseTest.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class LogicalLinkResponseTest {
+
+ private LogicalLinkResponse createTestSubject() {
+ return new LogicalLinkResponse();
+ }
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(LogicalLinkResponse.class, hasValidGettersAndSetters());
+ }
+
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ModelTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ModelTest.java
new file mode 100644
index 0000000..13d6ea2
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ModelTest.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class ModelTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(Model.class, hasValidGettersAndSetters());
+ }
+
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ModelVerTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ModelVerTest.java
new file mode 100644
index 0000000..d0944c1
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ModelVerTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class ModelVerTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(ModelVer.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ModelVersTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ModelVersTest.java
new file mode 100644
index 0000000..3d32f87
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ModelVersTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class ModelVersTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(ModelVers.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/OwningEntityTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/OwningEntityTest.java
new file mode 100644
index 0000000..a38bdc6
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/OwningEntityTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class OwningEntityTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(OwningEntity.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/PnfPropertiesTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/PnfPropertiesTest.java
new file mode 100644
index 0000000..80989ef
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/PnfPropertiesTest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.StringContains.containsString;
+
+public class PnfPropertiesTest {
+
+ private PnfProperties pnfProperties;
+
+ @Before
+ public void setUp(){
+ pnfProperties = new PnfProperties();
+ pnfProperties.setAdditionalProperty("key1", "value1");
+ pnfProperties.setAdditionalProperty("key2", "value2");
+ }
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() throws IOException {
+ String result = new ObjectMapper().writeValueAsString(pnfProperties);
+ assertThat(result, containsString("key1"));
+ assertThat(result, containsString("value2"));
+ assertThat(result, containsString("key2"));
+ assertThat(result, containsString("value2"));
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/PnfResultTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/PnfResultTest.java
new file mode 100644
index 0000000..027c47e
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/PnfResultTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import java.io.IOException;
+
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.StringContains.containsString;
+
+public class PnfResultTest {
+
+ private PnfResult pnfResult;
+
+ @Before
+ public void setUp(){
+ pnfResult = new PnfResult();
+ pnfResult.setAdditionalProperty("key1", "value1");
+ pnfResult.setAdditionalProperty("key2", "value2");
+ }
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() throws IOException {
+ String result = new ObjectMapper().writeValueAsString(pnfResult);
+ assertThat(result, containsString("key1"));
+ assertThat(result, containsString("value2"));
+ assertThat(result, containsString("key2"));
+ assertThat(result, containsString("value2"));
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ProjectResponseTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ProjectResponseTest.java
new file mode 100644
index 0000000..85719b7
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ProjectResponseTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class ProjectResponseTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(ProjectResponse.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ProjectTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ProjectTest.java
new file mode 100644
index 0000000..15d5ad4
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ProjectTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class ProjectTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(Project.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/RelatedToPropertyTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/RelatedToPropertyTest.java
new file mode 100644
index 0000000..9f7358c
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/RelatedToPropertyTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class RelatedToPropertyTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(RelatedToProperty.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/RelationshipDataTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/RelationshipDataTest.java
new file mode 100644
index 0000000..401e2f5
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/RelationshipDataTest.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+
+public class RelationshipDataTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(RelationshipData.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/RelationshipTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/RelationshipTest.java
new file mode 100644
index 0000000..6ec55e5
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/RelationshipTest.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+
+public class RelationshipTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(Relationship.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ResultTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ResultTest.java
new file mode 100644
index 0000000..f5e8a24
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ResultTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class ResultTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(Result.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ServiceRelationshipsTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ServiceRelationshipsTest.java
new file mode 100644
index 0000000..3b3f616
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/model/ServiceRelationshipsTest.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+
+public class ServiceRelationshipsTest {
+
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ServiceRelationships.class, hasValidGettersAndSetters());
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/util/AAIRestInterfaceTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/util/AAIRestInterfaceTest.java
new file mode 100644
index 0000000..ce038c3
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/util/AAIRestInterfaceTest.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.util;
+
+public class AAIRestInterfaceTest {
+
+ /*
+ TO BE IMPLEMENTED
+
+ private AAIRestInterface createTestSubject() {
+ return new AAIRestInterface("");
+ }
+
+ @Test
+ public void testEncodeURL() throws Exception {
+ AAIRestInterface testSubject;
+ String nodeKey = "";
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.encodeURL(nodeKey);
+ }
+
+ @Test
+ public void testSetRestSrvrBaseURL() throws Exception {
+ AAIRestInterface testSubject;
+ String baseURL = "";
+
+ // test 1
+ testSubject = createTestSubject();
+ baseURL = null;
+ testSubject.SetRestSrvrBaseURL(baseURL);
+
+ // test 2
+ testSubject = createTestSubject();
+ baseURL = "";
+ testSubject.SetRestSrvrBaseURL(baseURL);
+ }
+
+ @Test
+ public void testGetRestSrvrBaseURL() throws Exception {
+ AAIRestInterface testSubject;
+ String result;
+
+ // default test
+ testSubject = createTestSubject();
+ result = testSubject.getRestSrvrBaseURL();
+ }
+
+
+ @Test
+ public void testRestPut() throws Exception {
+ AAIRestInterface testSubject;
+ String fromAppId = "";
+ String transId = "";
+ String path = "";
+ String payload = "";
+ boolean xml = false;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.RestPut(fromAppId, transId, path, payload, xml);
+ }
+
+ @Test
+ public void testRestPost() throws Exception {
+ AAIRestInterface testSubject;
+ String fromAppId = "";
+ String transId = "";
+ String path = "";
+ String payload = "";
+ boolean xml = false;
+
+ // default test
+ testSubject = createTestSubject();
+ testSubject.RestPost(fromAppId, transId, path, payload, xml);
+ }*/
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/util/CustomJacksonJaxBJsonProviderTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/util/CustomJacksonJaxBJsonProviderTest.java
new file mode 100644
index 0000000..6b1029e
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/util/CustomJacksonJaxBJsonProviderTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.util;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.DeserializationConfig;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.SerializationConfig;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class CustomJacksonJaxBJsonProviderTest {
+
+ private CustomJacksonJaxBJsonProvider createTestSubject() {
+ return new CustomJacksonJaxBJsonProvider();
+ }
+
+ @Test
+ public void testMapperHasCorrectConfig() throws Exception {
+ CustomJacksonJaxBJsonProvider testSubject = createTestSubject();
+ DeserializationConfig deserializationConfig = testSubject.getMapper().getDeserializationConfig();
+ SerializationConfig serializationConfig = testSubject.getMapper().getSerializationConfig();
+
+ Assert.assertFalse(serializationConfig.hasSerializationFeatures(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS.getMask()));
+ Assert.assertFalse(serializationConfig.hasSerializationFeatures(SerializationFeature.INDENT_OUTPUT.getMask()));
+ Assert.assertFalse(serializationConfig.hasSerializationFeatures(SerializationFeature.WRAP_ROOT_VALUE.getMask()));
+ Assert.assertFalse(serializationConfig.hasSerializationFeatures(SerializationFeature.CLOSE_CLOSEABLE.getMask()));
+
+ Assert.assertFalse(deserializationConfig.hasDeserializationFeatures(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES.getMask()));
+ Assert.assertFalse(deserializationConfig.hasDeserializationFeatures(DeserializationFeature.UNWRAP_ROOT_VALUE.getMask()));
+
+ Assert.assertEquals(serializationConfig.getSerializationInclusion(), JsonInclude.Include.NON_NULL);
+ }
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/util/HttpsAuthClientTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/util/HttpsAuthClientTest.java
new file mode 100644
index 0000000..9883e11
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/util/HttpsAuthClientTest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.util;
+
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import javax.net.ssl.SSLContext;
+
+import static org.mockito.Mockito.verify;
+
+@RunWith(MockitoJUnitRunner.class)
+public class HttpsAuthClientTest {
+ @Mock
+ private SystemPropertyHelper systemPropertyHelper;
+ @Mock
+ private SSLContextProvider sslContextProvider;
+ @Mock
+ private SSLContext sslContext;
+
+ public static final String CERT_FILE_PATH = "any_path";
+
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/util/ParametrizedAAIRestInterfaceTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/util/ParametrizedAAIRestInterfaceTest.java
new file mode 100644
index 0000000..b33aacf
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/util/ParametrizedAAIRestInterfaceTest.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.util;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.osam.aai.exceptions.InvalidPropertyException;
+import org.testng.Assert;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.Response;
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.UUID;
+
+import static javax.ws.rs.core.Response.Status.NO_CONTENT;
+import static javax.ws.rs.core.Response.Status.OK;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@RunWith(Parameterized.class)
+public class ParametrizedAAIRestInterfaceTest {
+
+ private static final String PATH = "path";
+ private static final String HTTP_LOCALHOST = "http://localhost/";
+ @Mock
+ private Client client;
+ @Mock
+ private WebTarget webTarget;
+ @Mock
+ private Invocation.Builder builder;
+ @Mock
+ private ServletRequestHelper servletRequestHelper;
+ @Mock
+ private HttpsAuthClient httpsAuthClient;
+ @Mock
+ private HttpServletRequest httpServletRequest;
+ @Mock
+ private Response response;
+ @Mock
+ private SystemPropertyHelper systemPropertyHelper;
+
+ private AAIRestInterface testSubject;
+ private Response.Status status;
+
+ @Parameterized.Parameters
+ public static Collection<Object> data() {
+ return Arrays.asList(OK, NO_CONTENT);
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ mockSystemProperties();
+ testSubject = createTestSubject();
+ when(client.target(HTTP_LOCALHOST+PATH)).thenReturn(webTarget);
+ when(webTarget.request()).thenReturn(builder);
+ when(builder.accept(Mockito.anyString())).thenReturn(builder);
+ when(builder.header(Mockito.anyString(), Mockito.anyString())).thenReturn(builder);
+ when(servletRequestHelper.extractOrGenerateRequestId()).thenReturn(UUID.randomUUID().toString());
+ }
+
+ public ParametrizedAAIRestInterfaceTest(Response.Status status) {
+ this.status = status;
+ }
+
+ private AAIRestInterface createTestSubject() {
+ return new AAIRestInterface(Optional.of(client), httpsAuthClient, servletRequestHelper, systemPropertyHelper);
+ }
+
+ @Test
+ public void testRestDeleteWithValidResponse() throws Exception {
+ // given
+ String methodName = "Delete";
+
+ // when
+ when(builder.delete()).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(status);
+ boolean finalResponse = testSubject.Delete("", "", PATH);
+
+ // then
+ verify(builder).delete();
+ Assert.assertTrue(finalResponse);
+ }
+
+ private void mockSystemProperties() throws UnsupportedEncodingException, InvalidPropertyException {
+ when(systemPropertyHelper.getAAIServerUrl()).thenReturn(Optional.of(HTTP_LOCALHOST));
+ when(systemPropertyHelper.getAAIUseClientCert()).thenReturn(Optional.of("cert"));
+ when(systemPropertyHelper.getAAIVIDPasswd()).thenReturn(Optional.of("passwd"));
+ when(systemPropertyHelper.getAAIVIDUsername()).thenReturn(Optional.of("user"));
+ when(systemPropertyHelper.getEncodedCredentials()).thenReturn("someCredentials");
+ when(systemPropertyHelper.getFullServicePath(Mockito.anyString())).thenReturn("http://localhost/path");
+ }
+
+}
diff --git a/onap-enabler-be/src/test/java/org/onap/osam/aai/util/SingleAAIRestInterfaceTest.java b/onap-enabler-be/src/test/java/org/onap/osam/aai/util/SingleAAIRestInterfaceTest.java
new file mode 100644
index 0000000..5ec9b9e
--- /dev/null
+++ b/onap-enabler-be/src/test/java/org/onap/osam/aai/util/SingleAAIRestInterfaceTest.java
@@ -0,0 +1,310 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OSAM
+ * ================================================================================
+ * Copyright (C) 2018 AT&T
+ * ================================================================================
+ * 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=========================================================
+ */
+
+
+
+package org.onap.osam.aai.util;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.osam.aai.exceptions.InvalidPropertyException;
+import org.testng.Assert;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.UnsupportedEncodingException;
+import java.util.Optional;
+import java.util.UUID;
+
+import static javax.ws.rs.core.Response.Status.*;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SingleAAIRestInterfaceTest {
+
+ private static final String PATH = "path";
+ private static final String HTTP_LOCALHOST = "http://localhost/";
+ @Mock
+ private Client client;
+ @Mock
+ private WebTarget webTarget;
+ @Mock
+ private Invocation.Builder builder;
+ @Mock
+ private ServletRequestHelper servletRequestHelper;
+ @Mock
+ private HttpsAuthClient httpsAuthClient;
+ @Mock
+ private HttpServletRequest httpServletRequest;
+ @Mock
+ private Response response;
+ @Mock
+ private SystemPropertyHelper systemPropertyHelper;
+
+ private AAIRestInterface testSubject;
+
+ @Before
+ public void setUp() throws Exception {
+ mockSystemProperties();
+ testSubject = createTestSubject();
+ when(client.target(HTTP_LOCALHOST+PATH)).thenReturn(webTarget);
+ when(webTarget.request()).thenReturn(builder);
+ when(builder.accept(Mockito.anyString())).thenReturn(builder);
+ when(builder.header(Mockito.anyString(), Mockito.anyString())).thenReturn(builder);
+ when(servletRequestHelper.extractOrGenerateRequestId()).thenReturn(UUID.randomUUID().toString());
+ }
+
+ private AAIRestInterface createTestSubject() {
+ return new AAIRestInterface(Optional.of(client), httpsAuthClient, servletRequestHelper, systemPropertyHelper);
+ }
+
+ @Test
+ public void testEncodeURL() throws Exception {
+ String nodeKey = "some unusual uri";
+ Assert.assertEquals(testSubject.encodeURL(nodeKey), "some%20unusual%20uri");
+ }
+
+ @Test
+ public void testSetRestSrvrBaseURLWithNullValue() throws Exception {
+ testSubject.SetRestSrvrBaseURL(null);
+ }
+
+ @Test
+ public void testSetRestSrvrBaseURL() throws Exception {
+ String baseUrl = "anything";
+ testSubject.SetRestSrvrBaseURL(baseUrl);
+ Assert.assertEquals(testSubject.getRestSrvrBaseURL(), baseUrl);
+ }
+
+ @Test
+ public void testRestJsonPutWithResponse200() throws Exception {
+ // given
+ String methodName = "RestPut";
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
+
+ // when
+ when(builder.put(Mockito.any(Entity.class))).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(OK);
+ Response finalResponse = testSubject.RestPut("", PATH, payload, false);
+
+ // then
+ verify(builder).put(entity);
+ Assert.assertEquals(response, finalResponse);
+ }
+
+ @Test
+ public void testFailedRestJsonPut() throws Exception {
+ // given
+ String methodName = "RestPut";
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
+
+ // when
+ when(builder.put(Mockito.any(Entity.class))).thenThrow(new RuntimeException());
+ Response finalResponse = testSubject.RestPut("", PATH, payload, false);
+
+ // then
+ verify(builder).put(entity);
+ Assert.assertEquals(finalResponse, null);
+ }
+
+ @Test
+ public void testRestJsonPutWithResponse400() throws Exception {
+ // given
+ String methodName = "RestPut";
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
+
+ // when
+ when(builder.put(Mockito.any(Entity.class))).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
+ when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
+ Response finalResponse = testSubject.RestPut("", PATH, payload, false);
+
+ // then
+ verify(builder).put(entity);
+ Assert.assertEquals(response, finalResponse);
+ }
+
+ @Test
+ public void testRestPostWithResponse200() throws Exception {
+ // given
+ String methodName = "RestPost";
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
+
+ // when
+ when(builder.post(Mockito.any(Entity.class))).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(OK);
+ Response finalResponse = testSubject.RestPost("", PATH, payload, false);
+
+ // then
+ verify(builder).post(entity);
+ Assert.assertEquals(response, finalResponse);
+ }
+
+ @Test
+ public void testRestPostWithResponse400() throws Exception {
+ // given
+ String methodName = "RestPost";
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
+
+ // when
+ when(builder.post(Mockito.any(Entity.class))).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
+ when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
+ Response finalResponse = testSubject.RestPost("", PATH, payload, false);
+
+ // then
+ verify(builder).post(entity);
+ Assert.assertEquals(response, finalResponse);
+ }
+
+ @Test
+ public void testFailedRestPost() throws Exception {
+ // given
+ String methodName = "RestPost";
+ String payload = "{\"id\": 1}";
+ Entity<String> entity = Entity.entity(payload, MediaType.APPLICATION_JSON);
+
+ // when
+ when(builder.post(Mockito.any(Entity.class))).thenThrow(new RuntimeException());
+ Response finalResponse = testSubject.RestPost("", PATH, payload, false);
+
+ // then
+ verify(builder).post(entity);
+ Assert.assertEquals(finalResponse, null);
+ }
+
+ @Test
+ public void testRestDeleteWithResponse400() throws Exception {
+ // given
+ String methodName = "Delete";
+
+ // when
+ when(builder.delete()).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
+ String reason = "Any reason";
+ when(response.readEntity(String.class)).thenReturn(reason);
+ when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
+ boolean finalResponse = testSubject.Delete("", "", PATH);
+
+ // then
+ verify(builder).delete();
+ Assert.assertFalse(finalResponse);
+ }
+
+ @Test
+ public void testRestDeleteWithResponse404() throws Exception {
+ // given
+ String methodName = "Delete";
+
+ // when
+ when(builder.delete()).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(NOT_FOUND);
+ String reason = "Any reason";
+ when(response.readEntity(String.class)).thenReturn(reason);
+ when(response.getStatus()).thenReturn(NOT_FOUND.getStatusCode());
+ boolean finalResponse = testSubject.Delete("", "", PATH);
+
+ // then
+ verify(builder).delete();
+ Assert.assertFalse(finalResponse);
+ }
+
+ @Test
+ public void testFailedRestDelete() throws Exception {
+ // given
+ String methodName = "Delete";
+
+ // when
+ when(builder.delete()).thenThrow(new RuntimeException());
+ boolean finalResponse = testSubject.Delete("", "", PATH);
+
+ // then
+ verify(builder).delete();
+ Assert.assertFalse(finalResponse);
+ }
+
+ @Test
+ public void testRestJsonGetWithResponse200() throws Exception {
+ // given
+ String methodName = "RestGet";
+
+ // when
+ when(builder.get()).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(OK);
+ Response finalResponse = testSubject.RestGet("", "", PATH, false).getResponse();
+
+ // then
+ Assert.assertEquals(response, finalResponse);
+ }
+
+ @Test
+ public void testRestJsonGetWithResponse400() throws Exception {
+ // given
+ String methodName = "RestGet";
+
+ // when
+ when(builder.get()).thenReturn(response);
+ when(response.getStatusInfo()).thenReturn(BAD_REQUEST);
+ when(response.getStatus()).thenReturn(BAD_REQUEST.getStatusCode());
+ Response finalResponse = testSubject.RestGet("", "", PATH, false).getResponse();
+
+ // then
+ Assert.assertEquals(response, finalResponse);
+ }
+
+ @Test
+ public void testFailedRestGet() throws Exception {
+ // given
+ String methodName = "RestGet";
+
+ // when
+ when(builder.get()).thenThrow(new RuntimeException());
+ Response finalResponse = testSubject.RestGet("", "", PATH, false).getResponse();
+
+ // then
+ Assert.assertEquals(finalResponse, null);
+ }
+
+ private void mockSystemProperties() throws UnsupportedEncodingException, InvalidPropertyException {
+ when(systemPropertyHelper.getAAIServerUrl()).thenReturn(Optional.of(HTTP_LOCALHOST));
+ when(systemPropertyHelper.getAAIUseClientCert()).thenReturn(Optional.of("cert"));
+ when(systemPropertyHelper.getAAIVIDPasswd()).thenReturn(Optional.of("passwd"));
+ when(systemPropertyHelper.getAAIVIDUsername()).thenReturn(Optional.of("user"));
+ when(systemPropertyHelper.getEncodedCredentials()).thenReturn("someCredentials");
+ when(systemPropertyHelper.getFullServicePath(Mockito.anyString())).thenReturn("http://localhost/path");
+ when(systemPropertyHelper.getServiceBasePath(Mockito.anyString())).thenReturn("http://localhost/path");
+ }
+
+}