diff options
Diffstat (limited to 'common/src/test/java/org/openecomp/mso/client/aai')
20 files changed, 0 insertions, 1321 deletions
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java deleted file mode 100644 index da63b27efb..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/AAIConfigurationTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.junit.Assert.assertEquals; - -import java.util.UUID; - -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.openecomp.mso.client.aai.entities.uri.AAIUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; -import org.openecomp.mso.serviceinstancebeans.ModelInfo; -import org.openecomp.mso.serviceinstancebeans.RequestDetails; - -import com.github.tomakehurst.wiremock.junit.WireMockRule; - -public class AAIConfigurationTest { - - @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443)); - - @Ignore - @Test - public void verifyCreate() { - AAIConfigurationClient aaiConfiguration = new AAIConfigurationClient(); - ModelInfo modelInfo = new ModelInfo(); - modelInfo.setModelInvariantId("testInvariantID"); - modelInfo.setModelVersionId("testVersionID"); - modelInfo.setModelCustomizationId("testCustomizationID"); - RequestDetails requestDetails = new RequestDetails(); - requestDetails.setModelInfo(modelInfo); - String configurationType = "test"; - String configurationSubType = "test"; - aaiConfiguration.createConfiguration(requestDetails, UUID.randomUUID().toString(), configurationType, configurationSubType); - } - - @Test - public void verifyNotExists() { - AAIUri path = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "test2"); - wireMockRule.stubFor(get( - urlPathEqualTo("/aai/v11" + path.build())) - .willReturn( - aResponse() - .withHeader("Content-Type", "text/plain") - .withBody("hello") - .withStatus(404))); - AAIConfigurationClient aaiConfiguration = new AAIConfigurationClient(); - boolean result = aaiConfiguration.configurationExists("test2"); - assertEquals("path not found", false, result); - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIExceptionMapperTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIExceptionMapperTest.java deleted file mode 100644 index 625e281792..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/AAIExceptionMapperTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai; - -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.openecomp.mso.client.aai.entities.AAIError; - -public class AAIExceptionMapperTest { - - @Mock private AAIError errorObj; - - @Before - public void init() { - MockitoAnnotations.initMocks(this); - } - @Test - public void nestedReplace() { - String error = "Error %1 on %2"; - List<String> list = Arrays.asList("PUT", "hello %1"); - AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); - String result = formatter.fillInTemplate(error, list); - assertEquals("equal", "Error PUT on hello PUT", result); - - } - - @Test - public void noReplace() { - String error = "Error"; - List<String> list = new ArrayList<>(); - AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj); - String result = formatter.fillInTemplate(error, list); - assertEquals("equal", "Error", result); - - } - -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIObjectTypeTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIObjectTypeTest.java deleted file mode 100644 index c8f6299d81..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/AAIObjectTypeTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class AAIObjectTypeTest { - - @Test - public void verifyDefaultCase() { - assertEquals("default removed for tenant", "tenant", AAIObjectType.DEFAULT_TENANT.typeName()); - assertEquals("default removed for cloud-region", "cloud-region", AAIObjectType.DEFAULT_CLOUD_REGION.typeName()); - } - - @Test - public void verifyRegularCase() { - assertEquals("default removed for tenant", "allotted-resource", AAIObjectType.ALLOTTED_RESOURCE.typeName()); - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java deleted file mode 100644 index b6b01b384a..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai; - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.security.NoSuchAlgorithmException; -import java.util.List; -import java.util.UUID; - -import org.junit.Ignore; -import org.junit.Test; -import org.onap.aai.domain.yang.Pserver; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -public class AAIPServerTest { - - @Test - public void pserverTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException { - AAIRestClientImpl client = new AAIRestClientImpl(); - String json = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/aai/pserver.json"))); - List<Pserver> list = client.getListOfPservers(json); - - assertEquals("", list.get(0).getHostname(), "test"); - } - - @Test - @Ignore // IGNORED FOR 1710 MERGE TO ONAP - public void pserverActualTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException { - AAIRestClientImpl client = new AAIRestClientImpl(); - List<Pserver> list = client.getPhysicalServerByVnfId("d946afed-8ebe-4c5d-9665-54fcc043b8e7", UUID.randomUUID().toString()); - assertEquals("", list.size(), 0); - } - -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java deleted file mode 100644 index c7cc549130..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.junit.Assert.assertEquals; - -import org.junit.Rule; -import org.junit.Test; -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - -import com.github.tomakehurst.wiremock.junit.WireMockRule; -public class AAIResourcesClientTest { - - - - @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443)); - - @Test - public void verifyNotExists() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test"); - wireMockRule.stubFor(get( - urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString())) - .willReturn( - aResponse() - .withHeader("Content-Type", "text/plain") - .withBody("hello") - .withStatus(404))); - AAIResourcesClient client = new AAIResourcesClient(); - boolean result = client.exists(path); - assertEquals("path not found", false, result); - } - - @Test - public void verifyDelete() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); - wireMockRule.stubFor(get( - urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString())) - .willReturn( - aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("aai/resources/mockObject.json") - .withStatus(200))); - wireMockRule.stubFor(delete( - urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString())) - .withQueryParam("resource-version", equalTo("1234")) - .willReturn( - aResponse() - .withStatus(204))); - AAIResourcesClient client = new AAIResourcesClient(); - client.delete(path); - } - - @Test - public void verifyBasicAuth() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); - wireMockRule.stubFor(get( - urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString())) - .withHeader("Authorization", equalTo("Basic TVNPOk1TTw==")) - .willReturn( - aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("aai/resources/mockObject.json") - .withStatus(200))); - AAIResourcesClient client = new AAIResourcesClient(); - client.get(path); - } - - @Test - public void verifyConnect() { - AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2"); - AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); - wireMockRule.stubFor(put( - urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString() + "/relationship-list/relationship")) - .willReturn( - aResponse() - .withHeader("Content-Type", "application/json") - .withStatus(200))); - - AAIResourceUri pathClone = path.clone(); - AAIResourcesClient client = new AAIResourcesClient(); - client.connect(path, path2); - assertEquals("uri not modified", pathClone.build().toString(), path.build().toString()); - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.java deleted file mode 100644 index 1abb940f6e..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/AAITransactionalClientTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai; - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Map; -import java.util.Optional; - -import org.junit.Test; -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -public class AAITransactionalClientTest { - - - private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/bulkprocess/"; - - @Test - public void run() throws IOException { - - - AAIResourcesClient client = new AAIResourcesClient(); - AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); - AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test2"); - AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3"); - AAIResourceUri uriD = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test4"); - AAIResourceUri uriE = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test5"); - AAIResourceUri uriF = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test6"); - - AAIResourceUri uriAClone = uriA.clone(); - AAITransactionalClient transactions = client - .beginTransaction().connect(uriA, uriB).connect(uriC, uriD) - .beginNewTransaction().connect(uriE, uriF); - ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper(); - mapper.enable(SerializationFeature.INDENT_OUTPUT); - String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions()); - Map<String, Object> map1 = mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>(){}); - Map<String, Object> map2 = mapper.readValue(getJson("test-request.json"), new TypeReference<Map<String, Object>>(){}); - assertEquals("payloads are equal", map2, map1); - assertEquals("uri not manipulated", uriAClone.build().toString(), uriA.build().toString()); - } - - @Test - public void verifyResponse() throws IOException { - AAIResourcesClient client = new AAIResourcesClient(); - AAITransactionalClient transactions = client - .beginTransaction(); - assertEquals("success status", Optional.empty(), transactions.locateErrorMessages(getJson("response-success.json"))); - assertEquals(transactions.locateErrorMessages(getJson("response-failure.json")).get(), "another error message\nmy great error"); - - - } - - private String getJson(String filename) throws IOException { - return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename))); - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIURITest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIURITest.java deleted file mode 100644 index 366c587b11..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/AAIURITest.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai; - -import static org.junit.Assert.assertEquals; - -import javax.ws.rs.core.UriBuilder; - -import org.junit.Test; -import org.openecomp.mso.client.aai.entities.uri.AAIUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - -public class AAIURITest { - - - - - @Test - public void verifyTemplateReplacement() { - final String id = "test1"; - AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, id); - String manualReplace = AAIObjectType.CONFIGURATION.toString().replaceAll("\\{configuration-id\\}", id); - assertEquals("uri template replaced", aaiUri.build(), UriBuilder.fromPath(manualReplace).build()); - - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIUpdatorImplTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIUpdatorImplTest.java deleted file mode 100644 index 86adb5f458..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/AAIUpdatorImplTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai; - -import org.junit.Test; - -public class AAIUpdatorImplTest { - - AAIUpdatorImpl test = new AAIUpdatorImpl(); - - protected AAIRestClientI client; - - @Test - public void getClientTest() throws Exception { - test.getClient(); - } - - @Test - public void setClientTest() throws Exception { - test.setClient(client); - } - - - @Test(expected = NullPointerException.class) - public void updateVnfToLockedTest() throws Exception { - test.updateVnfToLocked("vnfId","uuId"); - } - - - @Test(expected = NullPointerException.class) - public void updateVnfToUnLockedTest() throws Exception { - test.updateVnfToUnLocked("vnfId","uuId"); - } - -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java deleted file mode 100644 index 12034e0eea..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.Pserver; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; - -@RunWith(MockitoJUnitRunner.class) -public class AAIValidatorTest { - - @Mock - protected AAIRestClientI client; - String vnfName = "testVnf"; - String uuid = "UUID"; - AAIValidatorImpl validator; - - @Before - public void init(){ - validator = new AAIValidatorImpl(); - validator.setClient(client); - } - - public List<Pserver> getPservers(boolean locked){ - Pserver pserver = new Pserver(); - pserver.setInMaint(locked); - List<Pserver> pservers = new ArrayList<Pserver>(); - pservers.add(pserver); - return pservers; - } - - public GenericVnf createGenericVnfs(boolean locked){ - GenericVnf genericVnf = new GenericVnf(); - genericVnf.setInMaint(locked); - return genericVnf; - } - - @Test - public void test_IsPhysicalServerLocked_True() throws IOException{ - when(client.getPhysicalServerByVnfId(vnfName,uuid)).thenReturn(getPservers(true)); - boolean locked = validator.isPhysicalServerLocked(vnfName, uuid); - assertEquals(true, locked); - } - - @Test - public void test_IsPhysicalServerLocked_False() throws JsonParseException, JsonMappingException, UnsupportedEncodingException, IOException { - when(client.getPhysicalServerByVnfId(vnfName,uuid)).thenReturn(getPservers(false)); - boolean locked = validator.isPhysicalServerLocked(vnfName, uuid); - assertEquals(false, locked); - } - - @Test - public void test_IsVNFLocked_False() throws Exception{ - when(client.getVnfByName(vnfName,uuid)).thenReturn(createGenericVnfs(false)); - boolean locked = validator.isVNFLocked(vnfName, uuid); - assertEquals(false, locked); - } - - @Test - public void test_IsVNFLocked_True() throws Exception{ - when(client.getVnfByName(vnfName,uuid)).thenReturn(createGenericVnfs(true)); - boolean locked = validator.isVNFLocked(vnfName, uuid); - assertEquals(true,locked ); - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/RelationshipsTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/RelationshipsTest.java deleted file mode 100644 index b2c1f9ed64..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/entities/RelationshipsTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai.entities; - -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; - -import org.junit.Test; -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - -public class RelationshipsTest { - - private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/"; - - @Test - public void run() throws IOException { - final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "e2e-complex.json"))); - - AAIResultWrapper wrapper = new AAIResultWrapper(content); - Relationships relationships = wrapper.getRelationships().get(); - - List<AAIResourceUri> test = relationships.getRelatedAAIUris(AAIObjectType.VCE); - - System.out.println(test.get(0).build()); - List<AAIResourceUri> uris = Arrays.asList( - AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"), - AAIUriFactory.createResourceUri(AAIObjectType.VCE, "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"), - AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a2935fa9-b743-49f4-9813-a127f13c4e93"), - AAIUriFactory.createResourceUri(AAIObjectType.VCE, "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4")); - - - assertTrue(uris.containsAll(test) && test.containsAll(uris)); - - } - -}
\ No newline at end of file diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactoryTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactoryTest.java deleted file mode 100644 index a62d4b89c6..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/AAIUriFactoryTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai.entities.uri; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.openecomp.mso.client.aai.AAIObjectType; - -public class AAIUriFactoryTest { - - - - @Test - public void automaticallyEncodeUriTemplateValue() { - - AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)"); - - String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29"; - assertEquals(expected, uri.build().toString()); - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUriTest.java deleted file mode 100644 index 12ca0a2709..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/ServiceInstanceUriTest.java +++ /dev/null @@ -1,194 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai.entities.uri; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.collection.IsIterableContainingInOrder.contains; -import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; - - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Optional; - -import javax.ws.rs.BadRequestException; -import javax.ws.rs.core.UriBuilder; - -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.mockito.Matchers; -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.AAIQueryClient; -import org.openecomp.mso.client.aai.Format; -import org.openecomp.mso.client.aai.entities.CustomQuery; -import org.openecomp.mso.client.aai.exceptions.AAIPayloadException; -import org.openecomp.mso.client.aai.exceptions.AAIUriComputationException; -import org.openecomp.mso.client.aai.exceptions.AAIUriNotFoundException; - -import com.github.tomakehurst.wiremock.junit.WireMockRule; - -public class ServiceInstanceUriTest { - - private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/"; - - @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443)); - - @Rule - public final ExpectedException exception = ExpectedException.none(); - - @Test - public void found() throws IOException { - final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json"))); - - ServiceInstanceUri instance = new ServiceInstanceUri("key3"); - final Optional<String> result = instance.extractRelatedLink(content); - final String expected = "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"; - assertEquals("result is equal", expected, result.get()); - - } - - @Test - public void oneKey() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException { - - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getSerivceInstance(any(Object.class)); - - final URI result = spy.build(); - final URI expected = UriBuilder.fromPath("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").build(); - assertEquals("result is equal", expected, result); - - } - - @Test - public void oneKeyQueryParams() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException { - - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getSerivceInstance(any(Object.class)); - - final URI result = spy.resourceVersion("1234").build(); - final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234").build(); - assertEquals("result is equal", expected, result); - - } - - @Test - public void oneKeyEncoded() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException { - - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space").when(spy).getSerivceInstance(any(Object.class)); - - final URI result = spy.build(); - final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space").build(); - assertEquals("result is equal", expected, result); - - } - - @Test - public void oneKeyGetKeys() throws IOException, URISyntaxException, AAIUriNotFoundException, AAIPayloadException { - - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%28space").when(spy).getSerivceInstance(any(Object.class)); - - assertThat(spy.getURIKeys().values(), contains("key1", "key2", "key3(space")); - - } - @Test - public void oneKeyClone() throws AAIUriNotFoundException, AAIPayloadException { - ServiceInstanceUri instance = new ServiceInstanceUri("key1"); - ServiceInstanceUri spy = spy(instance); - String uri = "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"; - doReturn(uri).when(spy).getSerivceInstance(any(Object.class)); - doReturn(Optional.of(uri)).when(spy).getCachedValue(); - final URI result = spy.resourceVersion("1234").clone().build(); - final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234").build(); - assertEquals("result is equal", expected, result); - } - - @Test - public void threeKey() throws IOException { - - ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3"); - final URI result = instance.build(); - final URI expected = UriBuilder.fromPath("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").build(); - assertEquals("result is equal", expected, result); - - } - - @Test - public void notfound() throws IOException, AAIUriNotFoundException, AAIPayloadException { - final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "empty-query-result.json"))); - - ServiceInstanceUri instance = new ServiceInstanceUri("key3"); - ServiceInstanceUri spy = spy(instance); - AAIQueryClient mockQueryClient = mock(AAIQueryClient.class); - when(mockQueryClient.query(any(Format.class), any(CustomQuery.class))).thenReturn(content); - when(spy.getQueryClient()).thenReturn(mockQueryClient); - exception.expect(AAIUriComputationException.class); - spy.build(); - - } - - @Test - public void cloneTest() { - ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3"); - final URI result = instance.build(); - final URI result2 = instance.clone().queryParam("something", "new").build(); - assertEquals("uris are not equal", false, result.toString().equals(result2.toString())); - - } - - @Test - public void noVertexFound() throws AAIUriNotFoundException, AAIPayloadException { - ServiceInstanceUri instance = new ServiceInstanceUri("key3"); - ServiceInstanceUri spy = spy(instance); - stubFor(put(urlMatching("/aai/v[0-9]+/query.*")) - .withRequestBody(containing("key3")) - .willReturn(aResponse() - .withStatus(400) - .withHeader("Content-Type", "application/json") - .withBodyFile(""))); - exception.expect(AAIUriComputationException.class); - exception.expectMessage(containsString("NotFoundException")); - spy.build(); - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriFromUriTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriFromUriTest.java deleted file mode 100644 index 6e3ab64108..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriFromUriTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai.entities.uri; - -import static org.junit.Assert.assertEquals; - -import javax.ws.rs.core.UriBuilder; - -import org.junit.Test; -import org.openecomp.mso.client.aai.AAIObjectType; - -public class SimpleUriFromUriTest { - - - - @Test - public void removeHost() { - - AAIUri uri = new SimpleUri(AAIObjectType.UNKNOWN, UriBuilder.fromUri("https://aai-conexus-e2e.test.att.com:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build()); - - assertEquals("root and version removed", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString()); - - } - @Test - public void noChange() { - - AAIUri uri = new SimpleUri(AAIObjectType.UNKNOWN, UriBuilder.fromUri("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build()); - - assertEquals("no change", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString()); - - } - - @Test - public void encodingPreserved() { - - AAIUri uri = new SimpleUri(AAIObjectType.UNKNOWN, UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build()); - - assertEquals("encoding preserved", "/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString()); - - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriTest.java deleted file mode 100644 index f4fe216cd2..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/SimpleUriTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai.entities.uri; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.collection.IsIterableContainingInOrder.contains; -import static org.junit.Assert.assertEquals; - -import java.util.Map; - -import org.junit.Test; -import org.openecomp.mso.client.aai.AAIObjectPlurals; -import org.openecomp.mso.client.aai.AAIObjectType; - -public class SimpleUriTest { - - - - @Test - public void relatedToTestPlural() { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); - uri.relatedTo(AAIObjectPlurals.PSERVER); - String uriOutput = uri.build().toString(); - assertEquals(true, uriOutput.contains("related-to")); - } - - @Test - public void relatedToTestSingular() { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); - uri.relatedTo(AAIObjectType.PSERVER, "test2"); - String uriOutput = uri.build().toString(); - assertEquals(true, uriOutput.contains("related-to")); - } - - @Test - public void cloneTest() { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1"); - AAIResourceUri cloned = uri.clone(); - Map<String,String> keys = cloned.getURIKeys(); - assertThat(keys.values(), contains("test1")); - } - - @Test - public void getKeysTest() { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "cloud1", "cloud2", "tenant1", "vserver1"); - Map<String,String> keys = uri.getURIKeys(); - System.out.println(keys); - System.out.println(uri.build()); - assertEquals("vserver1", keys.get("vserver-id")); - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImplTest.java b/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImplTest.java deleted file mode 100644 index e8d98718a4..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/entities/uri/parsers/UriParserSpringImplTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai.entities.uri.parsers; - -import static org.junit.Assert.assertEquals; - -import java.util.Map; - -import org.junit.Test; -import org.openecomp.mso.client.aai.AAIObjectType; - -public class UriParserSpringImplTest { - - - - - @Test - public void reverseTemplate() { - final UriParser parser = new UriParserSpringImpl(AAIObjectType.SERVICE_INSTANCE.toString()); - final String uri = "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"; - - Map<String, String> result = parser.parse(uri); - - assertEquals("found customer-id", "key1", result.get("global-customer-id")); - assertEquals("found service-type", "key2", result.get("service-type")); - assertEquals("found service-instance-id", "key3", result.get("service-instance-id")); - - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadExceptionTest.java b/common/src/test/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadExceptionTest.java deleted file mode 100644 index 3895230ed4..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/exceptions/AAIPayloadExceptionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. - * ================================================================================ - * 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.openecomp.mso.client.aai.exceptions; - -import org.junit.Test; - -public class AAIPayloadExceptionTest { - - Throwable t = new Throwable(); - - @Test - public void callConstructorTest() throws Exception { - - AAIPayloadException test1 = new AAIPayloadException("testing"); - - AAIPayloadException test2 = new AAIPayloadException("testing", t); - - AAIPayloadException test3 = new AAIPayloadException(t); - } - -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironmentTest.java b/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironmentTest.java deleted file mode 100644 index f512de848c..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOperationalEnvironmentTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* 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.openecomp.mso.client.aai.objects; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class AAIOperationalEnvironmentTest { - - AAIOperationalEnvironment aaiOE =new AAIOperationalEnvironment(); - - @Test - public void test() { - aaiOE.setOperationalEnvironmentId("operationalEnvironmentId"); - aaiOE.setOperationalEnvironmentName("operationalEnvironmentName"); - aaiOE.setOperationalEnvironmentStatus("operationalEnvironmentStatus"); - aaiOE.setOperationalEnvironmentType("operationalEnvironmentType"); - aaiOE.setResourceVersion("resourceVersion"); - aaiOE.setTenantContext("tenantContext"); - aaiOE.setWorkloadContext("workloadContext"); - assertEquals(aaiOE.getOperationalEnvironmentId(),"operationalEnvironmentId"); - assertEquals(aaiOE.getOperationalEnvironmentName(),"operationalEnvironmentName"); - assertEquals(aaiOE.getOperationalEnvironmentStatus(),"operationalEnvironmentStatus"); - assertEquals(aaiOE.getOperationalEnvironmentType(),"operationalEnvironmentType"); - assertEquals(aaiOE.getResourceVersion(),"resourceVersion"); - assertEquals(aaiOE.getTenantContext(),"tenantContext"); - assertEquals(aaiOE.getWorkloadContext(),"workloadContext"); - aaiOE.withOperationalEnvironmentId("operationalEnvironmentId"); - aaiOE.withOperationalEnvironmentName("operationalEnvironmentName"); - aaiOE.withOperationalEnvironmentStatus("operationalEnvironmentStatus"); - aaiOE.withOperationalEnvironmentType("operationalEnvironmentType"); - aaiOE.withResourceVersion("resourceVersion"); - aaiOE.withTenantContext("tenantContext"); - aaiOE.withWorkloadContext("workloadContext"); - } - -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOwningEntityTest.java b/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOwningEntityTest.java deleted file mode 100644 index bc2ae41dd6..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIOwningEntityTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* 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.openecomp.mso.client.aai.objects; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - -public class AAIOwningEntityTest { - AAIOwningEntity aaiOE= new AAIOwningEntity(); - @Test - public void test() { - aaiOE.setOwningEntityId("OwningEntityId"); - aaiOE.setOwningEntityName("OwningEntityName"); - assertEquals(aaiOE.getOwningEntityId(), "OwningEntityId"); - assertEquals(aaiOE.getOwningEntityName(), "OwningEntityName"); - aaiOE.withOwningEntity("OwningEntityId1", "OwningEntityName1"); - assert(aaiOE.getUri()!=null); - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIProjectTest.java b/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIProjectTest.java deleted file mode 100644 index 872b17a759..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIProjectTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* 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.openecomp.mso.client.aai.objects; - -import static org.junit.Assert.*; - -import org.junit.Test; -import org.openecomp.mso.client.aai.AAIObjectType; -import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; -import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; - -public class AAIProjectTest { - - - @Test - public void test() { - AAIProject aaiP =new AAIProject(); - aaiP.setProjectName("projectName"); - assertEquals(aaiP.getProjectName(),"projectName"); - aaiP.withProjectName("projectName"); - assert(aaiP.getUri()!=null); - - } -} diff --git a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIServiceInstanceTest.java b/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIServiceInstanceTest.java deleted file mode 100644 index 692e3bba0b..0000000000 --- a/common/src/test/java/org/openecomp/mso/client/aai/objects/AAIServiceInstanceTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* 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.openecomp.mso.client.aai.objects; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class AAIServiceInstanceTest { - - @Test - public void test() { - AAIServiceInstance aaiSI= new AAIServiceInstance(); - aaiSI.setEnvironmentContext("environmentContext"); - aaiSI.setModelInvariantUuid("modelInvariantUuid"); - aaiSI.setModelUuid("modelUuid"); - aaiSI.setoStatus("oStatus"); - aaiSI.setServiceInstanceId("serviceInstanceId"); - aaiSI.setServiceInstanceName("serviceInstanceName"); - aaiSI.setServiceRole("serviceRole"); - aaiSI.setServiceType("serviceType"); - aaiSI.setWorkloadContext("workloadContext"); - assertEquals(aaiSI.getEnvironmentContext(), "environmentContext"); - assertEquals(aaiSI.getModelInvariantUuid(), "modelInvariantUuid"); - assertEquals(aaiSI.getModelUuid(), "modelUuid"); - assertEquals(aaiSI.getoStatus(), "oStatus"); - assertEquals(aaiSI.getServiceInstanceId(), "serviceInstanceId"); - assertEquals(aaiSI.getServiceInstanceName(), "serviceInstanceName"); - assertEquals(aaiSI.getServiceRole(), "serviceRole"); - assertEquals(aaiSI.getServiceType(), "serviceType"); - assertEquals(aaiSI.getWorkloadContext(), "workloadContext"); - aaiSI.withServiceInstance("serviceInstanceId"); - assert(aaiSI.getUri()!=null); - } - -} |