diff options
Diffstat (limited to 'appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org')
11 files changed, 745 insertions, 441 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestIdentityUrl.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestIdentityUrl.java index 1694529f4..d7dc2a8dc 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestIdentityUrl.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestIdentityUrl.java @@ -28,9 +28,7 @@ package org.openecomp.appc.adapter.iaas.impl; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; - import java.util.Properties; - import org.junit.BeforeClass; import org.junit.Test; import org.openecomp.appc.adapter.iaas.impl.IdentityURL; diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderAdapterImpl.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderAdapterImpl.java index 1e827b7e4..cbca170e0 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderAdapterImpl.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderAdapterImpl.java @@ -29,7 +29,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; - import java.io.IOException; import java.lang.reflect.Field; import java.util.HashMap; @@ -37,7 +36,6 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; - import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; @@ -61,7 +59,6 @@ import com.att.cdp.zones.model.Image; import com.att.cdp.zones.model.Server; import com.att.cdp.zones.model.Server.Status; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; - import com.woorea.openstack.keystone.model.Access.Service.Endpoint; /** @@ -100,15 +97,12 @@ public class TestProviderAdapterImpl { private ProviderAdapterImpl adapter; /** - * Use reflection to locate fields and methods so that they can be manipulated during the test to change the - * internal state accordingly. + * Use reflection to locate fields and methods so that they can be manipulated during the test + * to change the internal state accordingly. * - * @throws NoSuchFieldException - * if the field(s) dont exist - * @throws SecurityException - * if reflective access is not allowed - * @throws NoSuchMethodException - * If the method(s) dont exist + * @throws NoSuchFieldException if the field(s) dont exist + * @throws SecurityException if reflective access is not allowed + * @throws NoSuchMethodException If the method(s) dont exist */ @SuppressWarnings("nls") @BeforeClass @@ -135,16 +129,14 @@ public class TestProviderAdapterImpl { /** * Setup the test environment. * - * @throws IllegalAccessException - * if this Field object is enforcing Java language access control and the underlying field is either - * inaccessible or final. - * @throws IllegalArgumentException - * if the specified object is not an instance of the class or interface declaring the underlying field - * (or a subclass or implementor thereof), or if an unwrapping conversion fails. - * @throws NullPointerException - * if the specified object is null and the field is an instance field. - * @throws ExceptionInInitializerError - * if the initialization provoked by this method fails. + * @throws IllegalAccessException if this Field object is enforcing Java language access control + * and the underlying field is either inaccessible or final. + * @throws IllegalArgumentException if the specified object is not an instance of the class or + * interface declaring the underlying field (or a subclass or implementor thereof), or + * if an unwrapping conversion fails. + * @throws NullPointerException if the specified object is null and the field is an instance + * field. + * @throws ExceptionInInitializerError if the initialization provoked by this method fails. */ @Before public void setup() throws IllegalArgumentException, IllegalAccessException { @@ -154,19 +146,16 @@ public class TestProviderAdapterImpl { } /** - * This method inspects the provider adapter implementation to make sure that the cache of providers and tenants, as - * well as the service catalog, and all pools of contexts have been set up correctly. + * This method inspects the provider adapter implementation to make sure that the cache of + * providers and tenants, as well as the service catalog, and all pools of contexts have been + * set up correctly. * - * @throws IllegalAccessException - * if this Field object is enforcing Java language access control and the underlying field is - * inaccessible. - * @throws IllegalArgumentException - * if the specified object is not an instance of the class or interface declaring the underlying field - * (or a subclass or implementor thereof). + * @throws IllegalAccessException if this Field object is enforcing Java language access control + * and the underlying field is inaccessible. + * @throws IllegalArgumentException if the specified object is not an instance of the class or + * interface declaring the underlying field (or a subclass or implementor thereof). */ - @SuppressWarnings({ - "unchecked" - }) + @SuppressWarnings({"unchecked"}) @Ignore @Test public void validateCacheIsCreatedCorrectly() throws IllegalArgumentException, IllegalAccessException { @@ -199,18 +188,18 @@ public class TestProviderAdapterImpl { assertNotNull(serviceTypes); assertEquals(12, serviceTypes.size()); - assertEquals(TENANT_NAME, catalog.getTenantName()); - assertEquals(TENANT_ID, catalog.getTenantId()); + assertEquals(TENANT_NAME, catalog.getProjectName()); + assertEquals(TENANT_ID, catalog.getProjectId()); Set<String> regionNames = catalog.getRegions(); assertNotNull(regionNames); assertEquals(1, regionNames.size()); assertTrue(regionNames.contains(REGION_NAME)); - List<Endpoint> endpoints = catalog.getEndpoints(ServiceCatalog.IDENTITY_SERVICE); + List<?> endpoints = catalog.getEndpoints(ServiceCatalog.IDENTITY_SERVICE); assertNotNull(endpoints); assertEquals(1, endpoints.size()); - Endpoint endpoint = endpoints.get(0); + Endpoint endpoint = (Endpoint) endpoints.get(0); assertNotNull(endpoint); assertEquals(REGION_NAME, endpoint.getRegion()); assertEquals(IDENTITY_URL, endpoint.getPublicURL()); @@ -218,28 +207,28 @@ public class TestProviderAdapterImpl { endpoints = catalog.getEndpoints(ServiceCatalog.COMPUTE_SERVICE); assertNotNull(endpoints); assertEquals(1, endpoints.size()); - endpoint = endpoints.get(0); + endpoint = (Endpoint) endpoints.get(0); assertNotNull(endpoint); assertEquals(REGION_NAME, endpoint.getRegion()); endpoints = catalog.getEndpoints(ServiceCatalog.VOLUME_SERVICE); assertNotNull(endpoints); assertEquals(1, endpoints.size()); - endpoint = endpoints.get(0); + endpoint = (Endpoint) endpoints.get(0); assertNotNull(endpoint); assertEquals(REGION_NAME, endpoint.getRegion()); endpoints = catalog.getEndpoints(ServiceCatalog.IMAGE_SERVICE); assertNotNull(endpoints); assertEquals(1, endpoints.size()); - endpoint = endpoints.get(0); + endpoint = (Endpoint) endpoints.get(0); assertNotNull(endpoint); assertEquals(REGION_NAME, endpoint.getRegion()); endpoints = catalog.getEndpoints(ServiceCatalog.NETWORK_SERVICE); assertNotNull(endpoints); assertEquals(1, endpoints.size()); - endpoint = endpoints.get(0); + endpoint = (Endpoint) endpoints.get(0); assertNotNull(endpoint); assertEquals(REGION_NAME, endpoint.getRegion()); @@ -251,23 +240,21 @@ public class TestProviderAdapterImpl { } /** - * This test case is used to actually validate that a server has been restarted from an already running state + * This test case is used to actually validate that a server has been restarted from an already + * running state * - * @throws ZoneException - * If the login cannot be performed because the principal and/or credentials are invalid. - * @throws IllegalArgumentException - * If the principal and/or credential are null or empty, or if the expected argument(s) are not defined - * or are invalid - * @throws IllegalStateException - * If the identity service is not available or cannot be created - * @throws IOException - * if an I/O error occurs - * @throws APPCException + * @throws ZoneException If the login cannot be performed because the principal and/or + * credentials are invalid. + * @throws IllegalArgumentException If the principal and/or credential are null or empty, or if + * the expected argument(s) are not defined or are invalid + * @throws IllegalStateException If the identity service is not available or cannot be created + * @throws IOException if an I/O error occurs + * @throws APPCException */ // @Ignore @Test public void testRestartRunningServer() - throws IllegalStateException, IllegalArgumentException, ZoneException, IOException, APPCException { + throws IllegalStateException, IllegalArgumentException, ZoneException, IOException, APPCException { Properties properties = new Properties(); properties.setProperty(ContextFactory.PROPERTY_IDENTITY_URL, IDENTITY_URL); properties.setProperty(ContextFactory.PROPERTY_REGION, REGION_NAME); @@ -297,27 +284,24 @@ public class TestProviderAdapterImpl { } } - + /****************************************/ /** - * Tests that the vmStatuschecker method works and returns the correct status of the VM requested + * Tests that the vmStatuschecker method works and returns the correct status of the VM + * requested * - * @throws ZoneException - * If the login cannot be performed because the principal and/or credentials are invalid. - * @throws IllegalArgumentException - * If the principal and/or credential are null or empty, or if the expected argument(s) are not defined - * or are invalid - * @throws IllegalStateException - * If the identity service is not available or cannot be created - * @throws IOException - * if an I/O error occurs - * @throws UnknownProviderException - * If the provider cannot be found + * @throws ZoneException If the login cannot be performed because the principal and/or + * credentials are invalid. + * @throws IllegalArgumentException If the principal and/or credential are null or empty, or if + * the expected argument(s) are not defined or are invalid + * @throws IllegalStateException If the identity service is not available or cannot be created + * @throws IOException if an I/O error occurs + * @throws UnknownProviderException If the provider cannot be found */ // @Ignore @Test public void testVmStatuschecker() throws IllegalStateException, IllegalArgumentException, ZoneException, - UnknownProviderException, IOException { + UnknownProviderException, IOException { Properties properties = new Properties(); properties.setProperty(ContextFactory.PROPERTY_IDENTITY_URL, IDENTITY_URL); properties.setProperty(ContextFactory.PROPERTY_REGION, REGION_NAME); @@ -333,33 +317,32 @@ public class TestProviderAdapterImpl { Server server = computeService.getServer(vm.getServerId()); if (!server.getStatus().equals(Status.RUNNING)) { server.start(); - assertTrue(waitForStateChange(server, Status.RUNNING));} - //or instead of the if-block, can ensureRunning(server) be used? + assertTrue(waitForStateChange(server, Status.RUNNING)); + } + // or instead of the if-block, can ensureRunning(server) be used? ensureRunning(server); assertEquals(Server.Status.RUNNING, server.getStatus()); - } + } } + /****************************************/ - - + + /** * Tests that we can restart a server that is already stopped * - * @throws ZoneException - * If the login cannot be performed because the principal and/or credentials are invalid. - * @throws IllegalArgumentException - * If the principal and/or credential are null or empty, or if the expected argument(s) are not defined - * or are invalid. - * @throws IllegalStateException - * If the identity service is not available or cannot be created - * @throws IOException - * if an I/O error occurs - * @throws APPCException + * @throws ZoneException If the login cannot be performed because the principal and/or + * credentials are invalid. + * @throws IllegalArgumentException If the principal and/or credential are null or empty, or if + * the expected argument(s) are not defined or are invalid. + * @throws IllegalStateException If the identity service is not available or cannot be created + * @throws IOException if an I/O error occurs + * @throws APPCException */ // @Ignore @Test public void testRestartStoppedServer() - throws IllegalStateException, IllegalArgumentException, ZoneException, IOException, APPCException { + throws IllegalStateException, IllegalArgumentException, ZoneException, IOException, APPCException { Properties properties = new Properties(); properties.setProperty(ContextFactory.PROPERTY_IDENTITY_URL, IDENTITY_URL); properties.setProperty(ContextFactory.PROPERTY_REGION, REGION_NAME); @@ -392,24 +375,19 @@ public class TestProviderAdapterImpl { /** * Tests that we can rebuild a running server (not created from a bootable volume) * - * @throws ZoneException - * If the login cannot be performed because the principal and/or credentials are invalid. - * @throws IllegalArgumentException - * If the principal and/or credential are null or empty, or if the expected argument(s) are not defined - * or are invalid. - * @throws IllegalStateException - * If the identity service is not available or cannot be created - * @throws UnknownProviderException - * If the provider cannot be found - * @throws IOException - * if an I/O error occurs - * @throws APPCException - * If the server cannot be rebuilt for some reason + * @throws ZoneException If the login cannot be performed because the principal and/or + * credentials are invalid. + * @throws IllegalArgumentException If the principal and/or credential are null or empty, or if + * the expected argument(s) are not defined or are invalid. + * @throws IllegalStateException If the identity service is not available or cannot be created + * @throws UnknownProviderException If the provider cannot be found + * @throws IOException if an I/O error occurs + * @throws APPCException If the server cannot be rebuilt for some reason */ // @Ignore @Test public void testRebuildRunningServer() - throws IOException, IllegalStateException, IllegalArgumentException, ZoneException, APPCException { + throws IOException, IllegalStateException, IllegalArgumentException, ZoneException, APPCException { Properties properties = new Properties(); properties.setProperty(ContextFactory.PROPERTY_IDENTITY_URL, IDENTITY_URL); properties.setProperty(ContextFactory.PROPERTY_REGION, REGION_NAME); @@ -438,24 +416,19 @@ public class TestProviderAdapterImpl { /** * Tests that we can rebuild a paused server (not created from a bootable volume) * - * @throws ZoneException - * If the login cannot be performed because the principal and/or credentials are invalid. - * @throws IllegalArgumentException - * If the principal and/or credential are null or empty, or if the expected argument(s) are not defined - * or are invalid. - * @throws IllegalStateException - * If the identity service is not available or cannot be created - * @throws UnknownProviderException - * If the provider cannot be found - * @throws IOException - * if an I/O error occurs - * @throws APPCException - * If the server cannot be rebuilt for some reason + * @throws ZoneException If the login cannot be performed because the principal and/or + * credentials are invalid. + * @throws IllegalArgumentException If the principal and/or credential are null or empty, or if + * the expected argument(s) are not defined or are invalid. + * @throws IllegalStateException If the identity service is not available or cannot be created + * @throws UnknownProviderException If the provider cannot be found + * @throws IOException if an I/O error occurs + * @throws APPCException If the server cannot be rebuilt for some reason */ // @Ignore @Test public void testRebuildPausedServer() - throws IOException, IllegalStateException, IllegalArgumentException, ZoneException, APPCException { + throws IOException, IllegalStateException, IllegalArgumentException, ZoneException, APPCException { Properties properties = new Properties(); properties.setProperty(ContextFactory.PROPERTY_IDENTITY_URL, IDENTITY_URL); properties.setProperty(ContextFactory.PROPERTY_REGION, REGION_NAME); @@ -483,24 +456,19 @@ public class TestProviderAdapterImpl { /** * Tests that we can rebuild a paused server (not created from a bootable volume) * - * @throws ZoneException - * If the login cannot be performed because the principal and/or credentials are invalid. - * @throws IllegalArgumentException - * If the principal and/or credential are null or empty, or if the expected argument(s) are not defined - * or are invalid. - * @throws IllegalStateException - * If the identity service is not available or cannot be created - * @throws UnknownProviderException - * If the provider cannot be found - * @throws IOException - * if an I/O error occurs - * @throws APPCException - * If the server cannot be rebuilt for some reason + * @throws ZoneException If the login cannot be performed because the principal and/or + * credentials are invalid. + * @throws IllegalArgumentException If the principal and/or credential are null or empty, or if + * the expected argument(s) are not defined or are invalid. + * @throws IllegalStateException If the identity service is not available or cannot be created + * @throws UnknownProviderException If the provider cannot be found + * @throws IOException if an I/O error occurs + * @throws APPCException If the server cannot be rebuilt for some reason */ // @Ignore @Test public void testRebuildSuspendedServer() - throws IOException, IllegalStateException, IllegalArgumentException, ZoneException, APPCException { + throws IOException, IllegalStateException, IllegalArgumentException, ZoneException, APPCException { Properties properties = new Properties(); properties.setProperty(ContextFactory.PROPERTY_IDENTITY_URL, IDENTITY_URL); properties.setProperty(ContextFactory.PROPERTY_REGION, REGION_NAME); @@ -528,24 +496,19 @@ public class TestProviderAdapterImpl { /** * Tests that we can rebuild a paused server (not created from a bootable volume) * - * @throws ZoneException - * If the login cannot be performed because the principal and/or credentials are invalid. - * @throws IllegalArgumentException - * If the principal and/or credential are null or empty, or if the expected argument(s) are not defined - * or are invalid. - * @throws IllegalStateException - * If the identity service is not available or cannot be created - * @throws UnknownProviderException - * If the provider cannot be found - * @throws IOException - * if an I/O error occurs - * @throws APPCException - * If the server cannot be rebuilt for some reason + * @throws ZoneException If the login cannot be performed because the principal and/or + * credentials are invalid. + * @throws IllegalArgumentException If the principal and/or credential are null or empty, or if + * the expected argument(s) are not defined or are invalid. + * @throws IllegalStateException If the identity service is not available or cannot be created + * @throws UnknownProviderException If the provider cannot be found + * @throws IOException if an I/O error occurs + * @throws APPCException If the server cannot be rebuilt for some reason */ // @Ignore @Test public void testRebuildStoppedServer() - throws IOException, IllegalStateException, IllegalArgumentException, ZoneException, APPCException { + throws IOException, IllegalStateException, IllegalArgumentException, ZoneException, APPCException { Properties properties = new Properties(); properties.setProperty(ContextFactory.PROPERTY_IDENTITY_URL, IDENTITY_URL); properties.setProperty(ContextFactory.PROPERTY_REGION, REGION_NAME); @@ -571,98 +534,97 @@ public class TestProviderAdapterImpl { } /** - * Test subsequent action on second vm in different Tenant resulting in {"itemNotFound": {"message": "Instance could not be found", "code": 404}} + * Test subsequent action on second vm in different Tenant resulting in {"itemNotFound": + * {"message": "Instance could not be found", "code": 404}} * - * @throws ZoneException - * If the login cannot be performed because the principal and/or credentials are invalid. - * @throws IllegalArgumentException - * If the principal and/or credential are null or empty, or if the expected argument(s) are not defined - * or are invalid - * @throws IllegalStateException - * If the identity service is not available or cannot be created - * @throws IOException - * if an I/O error occurs - * @throws APPCException + * @throws ZoneException If the login cannot be performed because the principal and/or + * credentials are invalid. + * @throws IllegalArgumentException If the principal and/or credential are null or empty, or if + * the expected argument(s) are not defined or are invalid + * @throws IllegalStateException If the identity service is not available or cannot be created + * @throws IOException if an I/O error occurs + * @throws APPCException */ @Test - public void testTenantVerification() throws IllegalStateException, IllegalArgumentException, ZoneException, - IOException, APPCException { - + public void testTenantVerification() + throws IllegalStateException, IllegalArgumentException, ZoneException, IOException, APPCException { + Properties properties = new Properties(); properties.setProperty(ContextFactory.PROPERTY_IDENTITY_URL, "http://example.com:5000"); properties.setProperty(ContextFactory.PROPERTY_TENANT, "APP-C"); properties.setProperty(ContextFactory.PROPERTY_TRUSTED_HOSTS, "*"); String vmUrl = - "http://192.168.1.2:8774/v2/abcde12345fghijk6789lmnopq123rst/servers/abc12345-1234-5678-890a-abcdefg12345"; - - //try (Context context = ContextFactory.getContext(PROVIDER_TYPE, properties)) { - // context.login("AppC", "AppC"); - - // call lookupServer on vm in defined tenant "APP-C_TLV" - VMURL vm = VMURL.parseURL(vmUrl); - - Map<String, String> params = new HashMap<>(); - params.put(ProviderAdapter.PROPERTY_INSTANCE_URL, vmUrl); - params.put(ProviderAdapter.PROPERTY_IDENTITY_URL, "http://example.com:5000/v2.0"); - params.put(ProviderAdapter.PROPERTY_PROVIDER_NAME, "http://example.com:5000/v2.0"); - SvcLogicContext svcContext = new SvcLogicContext(); - - long start, end = 0; - - System.out.println("\n--------------------Begin lookupServer on tenant 1--------------------"); - start = System.currentTimeMillis(); - Server server = adapter.lookupServer(params, svcContext); - end = System.currentTimeMillis(); - - System.out.println(String.format("lookupServer on tenant 1 took %ds", (end - start) / 1000)); - System.out.println("----------------------------------------------------------------------\n"); - assertNotNull(server); - - //repeat to show that context is reused for second request - System.out.println("\n-----------------Begin repeat lookupServer on tenant 1----------------"); - start = System.currentTimeMillis(); - server = adapter.lookupServer(params, svcContext); - end = System.currentTimeMillis(); - - System.out.println(String.format("Repeat lookupServer on tenant 1 took %ds", (end - start) / 1000)); - System.out.println("----------------------------------------------------------------------\n"); - assertNotNull(server); - - // call lookupServer on vm in second tenant "Play" - // This is where we would fail due to using the previous - // tenants context - vmUrl = "http://192.168.1.2:8774/v2/abcde12345fghijk6789lmnopq123rst/servers/abc12345-1234-5678-890a-abcdefg12345"; - vm = VMURL.parseURL(vmUrl); - params.put(ProviderAdapter.PROPERTY_INSTANCE_URL, vmUrl); - - System.out.println("\n--------------------Begin lookupServer on tenant 2--------------------"); - start = System.currentTimeMillis(); - server = adapter.lookupServer(params, svcContext); - end = System.currentTimeMillis(); - System.out.println(String.format("\nlookupServer on tenant 2 took %ds", (end - start) / 1000)); - System.out.println("----------------------------------------------------------------------\n"); - assertNotNull(server); - - // call lookupServer on vm in non-existing tenant - vmUrl = "http://192.168.1.2:8774/v2/abcde12345fghijk6789lmnopq123rst/servers/abc12345-1234-5678-890a-abcdefg12345"; - vm = VMURL.parseURL(vmUrl); - params.put(ProviderAdapter.PROPERTY_INSTANCE_URL, vmUrl); - - System.out.println("\n--------------Begin lookupServer on non-existant tenant--------------"); - start = System.currentTimeMillis(); - server = adapter.lookupServer(params, svcContext); - end = System.currentTimeMillis(); - System.out.println(String.format("\nlookupServer on tenant 3 took %ds", (end - start) / 1000)); - System.out.println("----------------------------------------------------------------------\n"); - assertNull(server); - - //} + "http://192.168.1.2:8774/v2/abcde12345fghijk6789lmnopq123rst/servers/abc12345-1234-5678-890a-abcdefg12345"; + + // try (Context context = ContextFactory.getContext(PROVIDER_TYPE, properties)) { + // context.login("AppC", "AppC"); + + // call lookupServer on vm in defined tenant "APP-C_TLV" + VMURL vm = VMURL.parseURL(vmUrl); + + Map<String, String> params = new HashMap<>(); + params.put(ProviderAdapter.PROPERTY_INSTANCE_URL, vmUrl); + params.put(ProviderAdapter.PROPERTY_IDENTITY_URL, "http://example.com:5000/v2.0"); + params.put(ProviderAdapter.PROPERTY_PROVIDER_NAME, "http://example.com:5000/v2.0"); + SvcLogicContext svcContext = new SvcLogicContext(); + + long start, end = 0; + + System.out.println("\n--------------------Begin lookupServer on tenant 1--------------------"); + start = System.currentTimeMillis(); + Server server = adapter.lookupServer(params, svcContext); + end = System.currentTimeMillis(); + + System.out.println(String.format("lookupServer on tenant 1 took %ds", (end - start) / 1000)); + System.out.println("----------------------------------------------------------------------\n"); + assertNotNull(server); + + // repeat to show that context is reused for second request + System.out.println("\n-----------------Begin repeat lookupServer on tenant 1----------------"); + start = System.currentTimeMillis(); + server = adapter.lookupServer(params, svcContext); + end = System.currentTimeMillis(); + + System.out.println(String.format("Repeat lookupServer on tenant 1 took %ds", (end - start) / 1000)); + System.out.println("----------------------------------------------------------------------\n"); + assertNotNull(server); + + // call lookupServer on vm in second tenant "Play" + // This is where we would fail due to using the previous + // tenants context + vmUrl = "http://192.168.1.2:8774/v2/abcde12345fghijk6789lmnopq123rst/servers/abc12345-1234-5678-890a-abcdefg12345"; + vm = VMURL.parseURL(vmUrl); + params.put(ProviderAdapter.PROPERTY_INSTANCE_URL, vmUrl); + + System.out.println("\n--------------------Begin lookupServer on tenant 2--------------------"); + start = System.currentTimeMillis(); + server = adapter.lookupServer(params, svcContext); + end = System.currentTimeMillis(); + System.out.println(String.format("\nlookupServer on tenant 2 took %ds", (end - start) / 1000)); + System.out.println("----------------------------------------------------------------------\n"); + assertNotNull(server); + + // call lookupServer on vm in non-existing tenant + vmUrl = "http://192.168.1.2:8774/v2/abcde12345fghijk6789lmnopq123rst/servers/abc12345-1234-5678-890a-abcdefg12345"; + vm = VMURL.parseURL(vmUrl); + params.put(ProviderAdapter.PROPERTY_INSTANCE_URL, vmUrl); + + System.out.println("\n--------------Begin lookupServer on non-existant tenant--------------"); + start = System.currentTimeMillis(); + server = adapter.lookupServer(params, svcContext); + end = System.currentTimeMillis(); + System.out.println(String.format("\nlookupServer on tenant 3 took %ds", (end - start) / 1000)); + System.out.println("----------------------------------------------------------------------\n"); + assertNull(server); + + // } } + /****************************************/ - + @Test public void testSnapshotServer() throws Exception { Properties properties = new Properties(); @@ -672,7 +634,7 @@ public class TestProviderAdapterImpl { properties.setProperty(ContextFactory.PROPERTY_TRUSTED_HOSTS, "*"); String vmUrl = - "http://192.168.1.2:8774/v2/abcde12345fghijk6789lmnopq123rst/servers/abc12345-1234-5678-890a-abcdefg12345"; + "http://192.168.1.2:8774/v2/abcde12345fghijk6789lmnopq123rst/servers/abc12345-1234-5678-890a-abcdefg12345"; try (Context context = ContextFactory.getContext(PROVIDER_TYPE, properties)) { context.login("AppC", "AppC"); @@ -704,10 +666,8 @@ public class TestProviderAdapterImpl { /** * Ensures that the server is in stopped (shutdown) state prior to test * - * @param server - * The server to ensure is stopped - * @throws ZoneException - * If the server can't be operated upon for some reason + * @param server The server to ensure is stopped + * @throws ZoneException If the server can't be operated upon for some reason */ @SuppressWarnings("nls") private static void ensureStopped(Server server) throws ZoneException { @@ -717,7 +677,7 @@ public class TestProviderAdapterImpl { case PENDING: waitForStateChange(server, Server.Status.READY, Server.Status.RUNNING, Server.Status.PAUSED, - Server.Status.SUSPENDED, Server.Status.ERROR); + Server.Status.SUSPENDED, Server.Status.ERROR); ensureSuspended(server); break; @@ -750,10 +710,8 @@ public class TestProviderAdapterImpl { /** * Ensures that the server is in suspended state prior to test * - * @param server - * The server to ensure is suspended - * @throws ZoneException - * If the server can't be operated upon for some reason + * @param server The server to ensure is suspended + * @throws ZoneException If the server can't be operated upon for some reason */ @SuppressWarnings("nls") private static void ensureSuspended(Server server) throws ZoneException { @@ -763,7 +721,7 @@ public class TestProviderAdapterImpl { case PENDING: waitForStateChange(server, Server.Status.READY, Server.Status.RUNNING, Server.Status.PAUSED, - Server.Status.SUSPENDED, Server.Status.ERROR); + Server.Status.SUSPENDED, Server.Status.ERROR); ensureSuspended(server); break; @@ -796,10 +754,8 @@ public class TestProviderAdapterImpl { /** * This method makes sure that the indicated server is running before performing a test * - * @param server - * The server to ensure is running - * @throws ZoneException - * If the server can't be operated upon + * @param server The server to ensure is running + * @throws ZoneException If the server can't be operated upon */ @SuppressWarnings("nls") private static void ensureRunning(Server server) throws ZoneException { @@ -809,7 +765,7 @@ public class TestProviderAdapterImpl { case PENDING: waitForStateChange(server, Server.Status.READY, Server.Status.RUNNING, Server.Status.PAUSED, - Server.Status.SUSPENDED, Server.Status.ERROR); + Server.Status.SUSPENDED, Server.Status.ERROR); ensureRunning(server); break; @@ -838,10 +794,8 @@ public class TestProviderAdapterImpl { /** * This method will make sure that the server we are testing is paused * - * @param server - * The server to make sure is paused for the test - * @throws ZoneException - * If anything fails + * @param server The server to make sure is paused for the test + * @throws ZoneException If anything fails */ @SuppressWarnings("nls") private static void ensurePaused(Server server) throws ZoneException { @@ -851,7 +805,7 @@ public class TestProviderAdapterImpl { case PENDING: waitForStateChange(server, Server.Status.READY, Server.Status.RUNNING, Server.Status.PAUSED, - Server.Status.SUSPENDED, Server.Status.ERROR); + Server.Status.SUSPENDED, Server.Status.ERROR); ensurePaused(server); break; @@ -882,23 +836,24 @@ public class TestProviderAdapterImpl { } /** - * Enter a pool-wait loop checking the server state to see if it has entered one of the desired states or not. + * Enter a pool-wait loop checking the server state to see if it has entered one of the desired + * states or not. * <p> - * This method checks the state of the server periodically for one of the desired states. When the server enters one - * of the desired states, the method returns a successful indication (true). If the server never enters one of the - * desired states within the alloted timeout period, then the method returns a failed response (false). No - * exceptions are thrown from this method. + * This method checks the state of the server periodically for one of the desired states. When + * the server enters one of the desired states, the method returns a successful indication + * (true). If the server never enters one of the desired states within the alloted timeout + * period, then the method returns a failed response (false). No exceptions are thrown from this + * method. * </p> * - * @param server - * The server to wait on - * @param desiredStates - * A variable list of desired states, any one of which is allowed. - * @return True if the server entered one of the desired states, and false if not and the wait loop timed out. + * @param server The server to wait on + * @param desiredStates A variable list of desired states, any one of which is allowed. + * @return True if the server entered one of the desired states, and false if not and the wait + * loop timed out. */ private static boolean waitForStateChange(Server server, Server.Status... desiredStates) { - int timeout = - ConfigurationFactory.getConfiguration().getIntegerProperty(Constants.PROPERTY_SERVER_STATE_CHANGE_TIMEOUT); + int timeout = ConfigurationFactory.getConfiguration() + .getIntegerProperty(Constants.PROPERTY_SERVER_STATE_CHANGE_TIMEOUT); long limit = System.currentTimeMillis() + (timeout * 1000); Server vm = server; @@ -925,20 +880,22 @@ public class TestProviderAdapterImpl { } /* - * @Test public void testTerminateStack() throws IllegalStateException, IllegalArgumentException, ZoneException, - * UnknownProviderException, IOException { Properties properties = new Properties(); - * properties.setProperty(ContextFactory.PROPERTY_IDENTITY_URL, IDENTITY_URL); - * properties.setProperty(ContextFactory.PROPERTY_REGION, REGION_NAME); + * @Test public void testTerminateStack() throws IllegalStateException, + * IllegalArgumentException, ZoneException, UnknownProviderException, IOException { Properties + * properties = new Properties(); properties.setProperty(ContextFactory.PROPERTY_IDENTITY_URL, + * IDENTITY_URL); properties.setProperty(ContextFactory.PROPERTY_REGION, REGION_NAME); * properties.setProperty(ContextFactory.PROPERTY_TENANT, TENANT_NAME); * properties.setProperty(ContextFactory.PROPERTY_TRUSTED_HOSTS, "*"); * properties.setProperty(ContextFactory.PROPERTY_DISABLE_PROXY, "true"); try (Context context = - * ContextFactory.getContext(PROVIDER_TYPE, properties)) { context.login(PRINCIPAL, CREDENTIAL); VMURL vm = - * VMURL.parseURL(SERVER_URL); ComputeService computeService = context.getComputeService(); Server server = - * computeService.getServer(vm.getServerId()); if (!server.getStatus().equals(Status.RUNNING)) { server.start(); - * assertTrue(waitForStateChange(server, Status.RUNNING)); } Map<String, String> params = new HashMap<>(); - * params.put(ProviderAdapter.PROPERTY_INSTANCE_URL, SERVER_URL); params.put(ProviderAdapter.PROPERTY_PROVIDER_NAME, - * PROVIDER_NAME); SvcLogicContext svcContext = new SvcLogicContext(); Stack stack = adapter.terminateStack(params, - * svcContext); assertNotNull(stack); } } + * ContextFactory.getContext(PROVIDER_TYPE, properties)) { context.login(PRINCIPAL, CREDENTIAL); + * VMURL vm = VMURL.parseURL(SERVER_URL); ComputeService computeService = + * context.getComputeService(); Server server = computeService.getServer(vm.getServerId()); if + * (!server.getStatus().equals(Status.RUNNING)) { server.start(); + * assertTrue(waitForStateChange(server, Status.RUNNING)); } Map<String, String> params = new + * HashMap<>(); params.put(ProviderAdapter.PROPERTY_INSTANCE_URL, SERVER_URL); + * params.put(ProviderAdapter.PROPERTY_PROVIDER_NAME, PROVIDER_NAME); SvcLogicContext svcContext + * = new SvcLogicContext(); Stack stack = adapter.terminateStack(params, svcContext); + * assertNotNull(stack); } } */ } diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderOperation.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderOperation.java index a954a70a6..56c67ddd9 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderOperation.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderOperation.java @@ -26,7 +26,6 @@ package org.openecomp.appc.adapter.iaas.impl; import java.lang.reflect.Field; import java.util.Map; - import org.openecomp.appc.adapter.iaas.provider.operation.impl.base.ProviderOperation; import org.openecomp.appc.exceptions.APPCException; import com.att.cdp.zones.model.ModelObject; @@ -34,21 +33,19 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.MDC; - import org.openecomp.appc.configuration.ConfigurationFactory; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; - import static org.openecomp.appc.adapter.iaas.provider.operation.common.constants.Constants.MDC_SERVICE; /** - * This class is used to test methods and functions of the adapter implementation that do not require and do not set up - * connections to any providers. + * This class is used to test methods and functions of the adapter implementation that do not + * require and do not set up connections to any providers. * * @since Jan 20, 2016 * @version $Id$ */ -public class TestProviderOperation extends ProviderOperation{ +public class TestProviderOperation extends ProviderOperation { private static Class<?> providerAdapterImplClass; private static Class<?> configurationFactoryClass; @@ -56,15 +53,12 @@ public class TestProviderOperation extends ProviderOperation{ private static Field configField; /** - * Use reflection to locate fields and methods so that they can be manipulated during the test to change the - * internal state accordingly. + * Use reflection to locate fields and methods so that they can be manipulated during the test + * to change the internal state accordingly. * - * @throws NoSuchFieldException - * if the field(s) dont exist - * @throws SecurityException - * if reflective access is not allowed - * @throws NoSuchMethodException - * If the method(s) dont exist + * @throws NoSuchFieldException if the field(s) dont exist + * @throws SecurityException if reflective access is not allowed + * @throws NoSuchMethodException If the method(s) dont exist */ @SuppressWarnings("nls") @BeforeClass @@ -82,8 +76,7 @@ public class TestProviderOperation extends ProviderOperation{ /** * This test expects a failure because the value to be validated is a null URL * - * @throws RequestFailedException - * Expected + * @throws RequestFailedException Expected */ @SuppressWarnings("nls") @Test(expected = RequestFailedException.class) @@ -99,8 +92,7 @@ public class TestProviderOperation extends ProviderOperation{ /** * This test expects a failure because the value to be validated is an empty URL * - * @throws RequestFailedException - * Expected + * @throws RequestFailedException Expected */ @SuppressWarnings("nls") @Test(expected = RequestFailedException.class) @@ -116,8 +108,7 @@ public class TestProviderOperation extends ProviderOperation{ /** * This test expects a failure because the value to be validated is a blank URL * - * @throws RequestFailedException - * Expected + * @throws RequestFailedException Expected */ @SuppressWarnings("nls") @Test(expected = RequestFailedException.class) @@ -133,8 +124,7 @@ public class TestProviderOperation extends ProviderOperation{ /** * This test expects a failure because the value to be validated is a bad URL * - * @throws RequestFailedException - * Expected + * @throws RequestFailedException Expected */ @SuppressWarnings("nls") @Test(expected = RequestFailedException.class) @@ -150,8 +140,7 @@ public class TestProviderOperation extends ProviderOperation{ /** * This test expects to pass * - * @throws RequestFailedException - * Un-Expected + * @throws RequestFailedException Un-Expected */ @SuppressWarnings("nls") @Test @@ -160,13 +149,14 @@ public class TestProviderOperation extends ProviderOperation{ SvcLogicContext svcContext = new SvcLogicContext(); RequestContext rc = new RequestContext(svcContext); String link = - "http://some.host:1234/v2/01d82c08594a4b23a0f9260c94be0c4d/servers/f888f89f-096b-421e-ba36-34f714071551"; + "http://some.host:1234/v2/01d82c08594a4b23a0f9260c94be0c4d/servers/f888f89f-096b-421e-ba36-34f714071551"; validateVMURL(VMURL.parseURL(link)); } @Override - protected ModelObject executeProviderOperation(Map<String, String> params, SvcLogicContext context) throws APPCException { + protected ModelObject executeProviderOperation(Map<String, String> params, SvcLogicContext context) + throws APPCException { return null; } } diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestRequestContext.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestRequestContext.java index 1c67e2d63..efb40dfac 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestRequestContext.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestRequestContext.java @@ -26,7 +26,6 @@ package org.openecomp.appc.adapter.iaas.impl; import static org.junit.Assert.*; - import org.junit.Before; import org.junit.Test; import org.openecomp.appc.Constants; @@ -37,7 +36,8 @@ import org.openecomp.appc.configuration.ConfigurationFactory; /** * Test the RequestContext object * <p> - * The request context is used to track retries, recovery attempts, and time to live of the processing of a request. + * The request context is used to track retries, recovery attempts, and time to live of the + * processing of a request. * </p> */ @@ -47,8 +47,8 @@ public class TestRequestContext { private Configuration config = ConfigurationFactory.getConfiguration(); /** - * Set up the test environment by forcing the retry delay and limit to small values for the test and setting up the - * request context object. + * Set up the test environment by forcing the retry delay and limit to small values for the test + * and setting up the request context object. */ @Before public void setup() { @@ -95,8 +95,8 @@ public class TestRequestContext { } /** - * The RequestContext tracks the number of retry attempts against the limit. This test verifies that tracking logic - * works correctly. + * The RequestContext tracks the number of retry attempts against the limit. This test verifies + * that tracking logic works correctly. */ @Test public void testCanRetry() { @@ -116,10 +116,10 @@ public class TestRequestContext { } /** - * The same RequestContext is used throughout the processing, and retries need to be reset once successfully - * connected so that any earlier (successful) recoveries are not considered when performing any new future - * recoveries. This test ensures that a reset clears the retry counter and that we can attempt retries again up to - * the limit. + * The same RequestContext is used throughout the processing, and retries need to be reset once + * successfully connected so that any earlier (successful) recoveries are not considered when + * performing any new future recoveries. This test ensures that a reset clears the retry counter + * and that we can attempt retries again up to the limit. */ @Test public void testResetAndCanRetry() { @@ -137,10 +137,10 @@ public class TestRequestContext { } /** - * This test is used to test tracking of time to live for the request context. Because time is inexact, the - * assertions can only be ranges of values, such as at least some value or greater. The total duration tracking in - * the request context is only updated on each call to {@link RequestContext#isAlive()}. Also, durations are NOT - * affected by calls to reset. + * This test is used to test tracking of time to live for the request context. Because time is + * inexact, the assertions can only be ranges of values, such as at least some value or greater. + * The total duration tracking in the request context is only updated on each call to + * {@link RequestContext#isAlive()}. Also, durations are NOT affected by calls to reset. */ @Test public void testTimeToLive() { diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalog.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalog.java index 7dbe3749e..be769a066 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalog.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalog.java @@ -30,28 +30,27 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; - +import java.util.HashSet; import java.util.List; import java.util.Properties; - +import java.util.Set; +import java.util.concurrent.locks.ReentrantReadWriteLock; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; -import org.openecomp.appc.adapter.iaas.impl.ServiceCatalog; +import org.mockito.Mockito; import org.openecomp.appc.configuration.ConfigurationFactory; import com.att.cdp.exceptions.ZoneException; - import com.woorea.openstack.keystone.model.Access.Service; /** * This class tests the service catalog against a known provider. */ -@Ignore public class TestServiceCatalog { // Number - private static int EXPECTED_REGIONS = 1; + private static int EXPECTED_REGIONS = 2; private static int EXPECTED_ENDPOINTS = 1; private static String PRINCIPAL; @@ -72,12 +71,11 @@ public class TestServiceCatalog { PRINCIPAL = props.getProperty("provider1.tenant1.userid", "appc"); CREDENTIAL = props.getProperty("provider1.tenant1.password", "appc"); TENANT_NAME = props.getProperty("provider1.tenant1.name", "appc"); - TENANT_ID = - props.getProperty("provider1.tenant1.id", + TENANT_ID = props.getProperty("provider1.tenant1.id", props.getProperty("test.tenantid", "abcde12345fghijk6789lmnopq123rst")); REGION_NAME = props.getProperty("provider1.tenant1.region", "RegionOne"); - EXPECTED_REGIONS = Integer.valueOf(props.getProperty("test.expected-regions", "0")); + EXPECTED_REGIONS = Integer.valueOf(props.getProperty("test.expected-regions", "2")); EXPECTED_ENDPOINTS = Integer.valueOf(props.getProperty("test.expected-endpoints", "0")); } @@ -89,16 +87,12 @@ public class TestServiceCatalog { @Before public void setup() throws ZoneException { properties = new Properties(); - catalog = new ServiceCatalog(IDENTITY_URL, TENANT_NAME, PRINCIPAL, CREDENTIAL, properties); - } + catalog = Mockito.mock(ServiceCatalog.class, Mockito.CALLS_REAL_METHODS); + catalog.rwLock = new ReentrantReadWriteLock(); - /** - * Test that the tenant name and ID are returned correctly - */ - @Test - public void testKnownTenant() { - assertEquals(TENANT_NAME, catalog.getTenantName()); - assertEquals(TENANT_ID, catalog.getTenantId()); + Set<String> testdata = new HashSet<>(); + testdata.add("RegionOne"); + catalog.regions = testdata; } /** @@ -107,44 +101,5 @@ public class TestServiceCatalog { @Test public void testKnownRegions() { assertEquals(EXPECTED_REGIONS, catalog.getRegions().size()); - // assertEquals(REGION_NAME, catalog.getRegions().toArray()[0]); - } - - /** - * Test that we can check for published services correctly - */ - @Test - public void testServiceTypesPublished() { - assertTrue(catalog.isServicePublished("compute")); - assertFalse(catalog.isServicePublished("bogus")); - } - - /** - * Check that we can get the list of published services - */ - @Test - public void testPublishedServicesList() { - List<String> services = catalog.getServiceTypes(); - - assertTrue(services.contains(ServiceCatalog.COMPUTE_SERVICE)); - assertTrue(services.contains(ServiceCatalog.IDENTITY_SERVICE)); - assertTrue(services.contains(ServiceCatalog.IMAGE_SERVICE)); - assertTrue(services.contains(ServiceCatalog.NETWORK_SERVICE)); - assertTrue(services.contains(ServiceCatalog.VOLUME_SERVICE)); - } - - /** - * Test that we can get the endpoint(s) for a service - */ - @Test - public void testEndpointList() { - List<Service.Endpoint> endpoints = catalog.getEndpoints(ServiceCatalog.COMPUTE_SERVICE); - - assertNotNull(endpoints); - assertFalse(endpoints.isEmpty()); - assertEquals(EXPECTED_ENDPOINTS, endpoints.size()); - - Service.Endpoint endpoint = endpoints.get(0); - // assertEquals(REGION_NAME, endpoint.getRegion()); } } diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalogFactory.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalogFactory.java new file mode 100644 index 000000000..e97e64d10 --- /dev/null +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalogFactory.java @@ -0,0 +1,89 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.adapter.iaas.impl;
+
+import java.util.Properties;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestServiceCatalogFactory {
+
+ @Test
+ public void testGetServiceCatalogV2() {
+ String tenantIdentifier = null;
+ String principal = null;
+ String credential = null;
+ String domain = null;
+ Properties properties = null;
+
+ String url = "http://192.168.1.1:5000/v2.0/";
+ ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,
+ domain, properties);
+ Assert.assertNotNull(catalog);
+ Assert.assertEquals(catalog.getClass(), ServiceCatalogV2.class);
+
+ url = "http://192.168.1.1:5000/v2/";
+ catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential, domain,
+ properties);
+ Assert.assertNotNull(catalog);
+ Assert.assertEquals(catalog.getClass(), ServiceCatalogV2.class);
+
+ url = "http://192.168.1.1:5000/v2.1/";
+ catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential, domain,
+ properties);
+ Assert.assertNotNull(catalog);
+ Assert.assertEquals(catalog.getClass(), ServiceCatalogV2.class);
+
+ }
+
+ @Test
+ public void testGetServiceCatalogV3() {
+ String url = "http://192.168.1.1:5000/v3.0/";
+ String tenantIdentifier = null;
+ String principal = null;
+ String credential = null;
+ String domain = null;
+ Properties properties = null;
+ ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,
+ domain, properties);
+
+ Assert.assertNotNull(catalog);
+ Assert.assertEquals(catalog.getClass(), ServiceCatalogV3.class);
+ }
+
+ @Test
+ public void testGetServiceCatalogOther() {
+ String url = "http://192.168.1.1:5000/v4.0/";
+ String tenantIdentifier = null;
+ String principal = null;
+ String credential = null;
+ String domain = null;
+ Properties properties = null;
+ ServiceCatalog catalog = ServiceCatalogFactory.getServiceCatalog(url, tenantIdentifier, principal, credential,
+ domain, properties);
+
+ Assert.assertNull(catalog);
+ }
+}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalogV2.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalogV2.java new file mode 100644 index 000000000..c26b3bee1 --- /dev/null +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalogV2.java @@ -0,0 +1,174 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.appc.adapter.iaas.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import com.att.cdp.exceptions.ZoneException;
+import com.woorea.openstack.keystone.model.Access.Service;
+import java.util.List;
+import java.util.Properties;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openecomp.appc.configuration.ConfigurationFactory;
+
+/**
+ * This class tests the service catalog against a known provider.
+ */
+@Ignore
+public class TestServiceCatalogV2 {
+
+ // Number
+ private static int EXPECTED_REGIONS = 1;
+ private static int EXPECTED_ENDPOINTS = 1;
+
+ private static String PRINCIPAL;
+ private static String CREDENTIAL;
+ private static String TENANT_NAME;
+ private static String TENANT_ID;
+ private static String IDENTITY_URL;
+ private static String REGION_NAME;
+
+ private ServiceCatalogV2 catalog;
+
+ private Properties properties;
+
+ @BeforeClass
+ public static void before() {
+ Properties props = ConfigurationFactory.getConfiguration().getProperties();
+ IDENTITY_URL = props.getProperty("provider1.identity", "appc");
+ PRINCIPAL = props.getProperty("provider1.tenant1.userid", "appc");
+ CREDENTIAL = props.getProperty("provider1.tenant1.password", "appc");
+ TENANT_NAME = props.getProperty("provider1.tenant1.name", "appc");
+ TENANT_ID = props.getProperty("provider1.tenant1.id",
+ props.getProperty("test.tenantid", "abcde12345fghijk6789lmnopq123rst"));
+ REGION_NAME = props.getProperty("provider1.tenant1.region", "RegionOne");
+
+ EXPECTED_REGIONS = Integer.valueOf(props.getProperty("test.expected-regions", "0"));
+ EXPECTED_ENDPOINTS = Integer.valueOf(props.getProperty("test.expected-endpoints", "0"));
+ }
+
+ /**
+ * Setup the test environment by loading a new service catalog for each test
+ *
+ * @throws ZoneException
+ */
+ @Before
+ public void setup() throws ZoneException {
+ properties = new Properties();
+ catalog = new ServiceCatalogV2(IDENTITY_URL, TENANT_NAME, PRINCIPAL, CREDENTIAL, properties);
+ catalog.init();
+ }
+
+ /**
+ * Test that the tenant name and ID are returned correctly
+ */
+ @Test
+ public void testKnownTenant() {
+ assertEquals(TENANT_NAME, catalog.getProjectName());
+ assertEquals(TENANT_ID, catalog.getProjectId());
+ }
+
+ /**
+ * Test that we find all of the expected region(s)
+ */
+ @Test
+ public void testKnownRegions() {
+ assertEquals(EXPECTED_REGIONS, catalog.getRegions().size());
+ // assertEquals(REGION_NAME, catalog.getRegions().toArray()[0]);
+ }
+
+ /**
+ * Test that we can check for published services correctly
+ */
+ @Test
+ public void testServiceTypesPublished() {
+ assertTrue(catalog.isServicePublished("compute"));
+ assertFalse(catalog.isServicePublished("bogus"));
+ }
+
+ /**
+ * Check that we can get the list of published services
+ */
+ @Test
+ public void testPublishedServicesList() {
+ // List<String> services = catalog.getServiceTypes();
+
+ // assertTrue(services.contains(ServiceCatalog.COMPUTE_SERVICE));
+ // assertTrue(services.contains(ServiceCatalog.IDENTITY_SERVICE));
+ // assertTrue(services.contains(ServiceCatalog.IMAGE_SERVICE));
+ // assertTrue(services.contains(ServiceCatalog.NETWORK_SERVICE));
+ // assertTrue(services.contains(ServiceCatalog.VOLUME_SERVICE));
+ }
+
+ /**
+ * Test that we can get the endpoint(s) for a service
+ */
+ @Test
+ public void testEndpointList() {
+ List<Service.Endpoint> endpoints = catalog.getEndpoints(ServiceCatalog.COMPUTE_SERVICE);
+
+ assertNotNull(endpoints);
+ assertFalse(endpoints.isEmpty());
+ assertEquals(EXPECTED_ENDPOINTS, endpoints.size());
+
+ Service.Endpoint endpoint = endpoints.get(0);
+ // assertEquals(REGION_NAME, endpoint.getRegion());
+ }
+
+ @Test
+ public void testToString() {
+ String testString = catalog.toString();
+ assertNotNull(testString);
+ }
+
+ @Ignore
+ @Test
+ public void liveConnectionTest() {
+ // this test should only be used by developers when testing against a live Openstack
+ // instance, otherwise it should be ignored
+ properties = new Properties();
+ String identity = "http://192.168.0.1:5000/v2.0";
+ String tenantName = "Tenant";
+ String user = "user";
+ String pass = "pass";
+
+ ServiceCatalogV2 catalog = new ServiceCatalogV2(identity, tenantName, user, pass, properties);
+
+ try {
+ catalog.init();
+ } catch (ZoneException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String out = catalog.toString();
+ System.out.println(out);
+ }
+}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalogV3.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalogV3.java new file mode 100644 index 000000000..14f44d10c --- /dev/null +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestServiceCatalogV3.java @@ -0,0 +1,167 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+
+
+package org.openecomp.appc.adapter.iaas.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import com.att.cdp.exceptions.ZoneException;
+import com.woorea.openstack.keystone.v3.model.Token.Service.Endpoint;
+import java.util.List;
+import java.util.Properties;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openecomp.appc.configuration.ConfigurationFactory;
+
+/**
+ * This class tests the service catalog against a known provider.
+ */
+@Ignore
+public class TestServiceCatalogV3 {
+
+ // Number
+ private static int EXPECTED_REGIONS = 1;
+ private static int EXPECTED_ENDPOINTS = 1;
+
+ private static String PRINCIPAL;
+ private static String CREDENTIAL;
+ private static String DOMAIN;
+ private static String TENANT_NAME;
+ private static String TENANT_ID;
+ private static String IDENTITY_URL;
+ private static String REGION_NAME;
+
+ private ServiceCatalogV3 catalog;
+
+ private Properties properties;
+
+ @BeforeClass
+ public static void before() {
+ Properties props = ConfigurationFactory.getConfiguration().getProperties();
+ IDENTITY_URL = props.getProperty("provider1.identity");
+ PRINCIPAL = props.getProperty("provider1.tenant1.userid", "appc");
+ CREDENTIAL = props.getProperty("provider1.tenant1.password", "appc");
+ DOMAIN = props.getProperty("provider1.tenant1.domain", "Default");
+ TENANT_NAME = props.getProperty("provider1.tenant1.name", "appc");
+ TENANT_ID = props.getProperty("provider1.tenant1.id",
+ props.getProperty("test.tenantid", "abcde12345fghijk6789lmnopq123rst"));
+ REGION_NAME = props.getProperty("provider1.tenant1.region", "RegionOne");
+
+ EXPECTED_REGIONS = Integer.valueOf(props.getProperty("test.expected-regions", "0"));
+ EXPECTED_ENDPOINTS = Integer.valueOf(props.getProperty("test.expected-endpoints", "0"));
+ }
+
+ /**
+ * Setup the test environment by loading a new service catalog for each test
+ *
+ * @throws ZoneException
+ */
+ @Before
+ public void setup() throws ZoneException {
+ properties = new Properties();
+ catalog = new ServiceCatalogV3(IDENTITY_URL, TENANT_NAME, PRINCIPAL, CREDENTIAL, DOMAIN, properties);
+ }
+
+ /**
+ * Test that the tenant name and ID are returned correctly
+ */
+ @Test
+ public void testKnownTenant() {
+ assertEquals(TENANT_NAME, catalog.getProjectName());
+ assertEquals(TENANT_ID, catalog.getProjectId());
+ }
+
+ /**
+ * Test that we find all of the expected region(s)
+ */
+ @Test
+ public void testKnownRegions() {
+ assertEquals(EXPECTED_REGIONS, catalog.getRegions().size());
+ // assertEquals(REGION_NAME, catalog.getRegions().toArray()[0]);
+ }
+
+ /**
+ * Test that we can check for published services correctly
+ */
+ @Test
+ public void testServiceTypesPublished() {
+ assertTrue(catalog.isServicePublished("compute"));
+ assertFalse(catalog.isServicePublished("bogus"));
+ }
+
+ /**
+ * Check that we can get the list of published services
+ */
+ @Test
+ public void testPublishedServicesList() {
+ List<String> services = catalog.getServiceTypes();
+
+ assertTrue(services.contains(ServiceCatalog.COMPUTE_SERVICE));
+ assertTrue(services.contains(ServiceCatalog.IDENTITY_SERVICE));
+ assertTrue(services.contains(ServiceCatalog.IMAGE_SERVICE));
+ assertTrue(services.contains(ServiceCatalog.NETWORK_SERVICE));
+ assertTrue(services.contains(ServiceCatalog.VOLUME_SERVICE));
+ }
+
+ /**
+ * Test that we can get the endpoint(s) for a service
+ */
+ @Test
+ public void testEndpointList() {
+ List<Endpoint> endpoints = catalog.getEndpoints(ServiceCatalog.COMPUTE_SERVICE);
+
+ assertNotNull(endpoints);
+ assertFalse(endpoints.isEmpty());
+ assertEquals(EXPECTED_ENDPOINTS, endpoints.size());
+
+ Endpoint endpoint = endpoints.get(0);
+ // assertEquals(REGION_NAME, endpoint.getRegion());
+ }
+
+ @Test
+ public void testToString() {
+ String testString = catalog.toString();
+ assertNotNull(testString);
+ }
+
+ @Ignore
+ @Test
+ public void liveConnectionTest() {
+ // this test should only be used by developers when testing against a live Openstack
+ // instance, otherwise it should be ignored
+ properties = new Properties();
+ String identity = "";
+ String tenantName = "";
+ String user = "";
+ String pass = "";
+
+ catalog = new ServiceCatalogV3(IDENTITY_URL, TENANT_NAME, PRINCIPAL, CREDENTIAL, DOMAIN, properties);
+ }
+}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestVMURL.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestVMURL.java index 46dd5eea9..5986fdd64 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestVMURL.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestVMURL.java @@ -29,9 +29,7 @@ package org.openecomp.appc.adapter.iaas.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; - import java.util.Properties; - import org.junit.BeforeClass; import org.junit.Test; import org.openecomp.appc.adapter.iaas.impl.VMURL; @@ -94,22 +92,6 @@ public class TestVMURL { assertEquals("/api/multicloud/v0/cloudowner_region", url.getPath()); assertEquals(TENANTID, url.getTenantId()); assertEquals(VMID, url.getServerId()); - assertEquals("v2",url.getVersion()); - assertEquals(url.toString(), URL); - } - - @Test - public void testValidURL4() { - URL = "http://msb.onap.org:80/api/multicloud/v0/cloudowner_region/v2.1/abcde12345fghijk6789lmnopq123rst/servers/abc12345-1234-5678-890a-abcdefg12345"; - VMURL url = VMURL.parseURL(URL); - assertNotNull(url); - assertEquals("http", url.getScheme()); - assertEquals("msb.onap.org", url.getHost()); - assertEquals("80", url.getPort()); - assertEquals("/api/multicloud/v0/cloudowner_region", url.getPath()); - assertEquals(TENANTID, url.getTenantId()); - assertEquals(VMID, url.getServerId()); - assertEquals("v2.1",url.getVersion()); assertEquals(url.toString(), URL); } diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/test/ExecutorHarness.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/test/ExecutorHarness.java index 9dc3938e6..a05474a34 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/test/ExecutorHarness.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/test/ExecutorHarness.java @@ -32,9 +32,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import org.openecomp.appc.test.InterceptLogger; - import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; @@ -55,38 +53,39 @@ public class ExecutorHarness { private Map<String, Method> methods; /** - * The field of the class being tested that contains the reference to the logger to be used. This is modified to - * point to our interception logger for the test. + * The field of the class being tested that contains the reference to the logger to be used. + * This is modified to point to our interception logger for the test. */ private Field contextLogger; /** - * The interception logger that buffers all messages logged and allows us to look at them as part of the test case. + * The interception logger that buffers all messages logged and allows us to look at them as + * part of the test case. */ private InterceptLogger logger; /** * Create the harness and initialize it * - * @throws SecurityException - * If a security manager, s, is present and any of the following conditions is met: - * <ul> - * <li>invocation of s.checkMemberAccess(this, Member.DECLARED) denies access to the declared field</li> - * <li>the caller's class loader is not the same as or an ancestor of the class loader for the current - * class and invocation of s.checkPackageAccess() denies access to the package of this class</li> - * </ul> - * @throws NoSuchFieldException - * if a field with the specified name is not found. - * @throws IllegalAccessException - * if this Field object is enforcing Java language access control and the underlying field is either - * inaccessible or final. - * @throws IllegalArgumentException - * if the specified object is not an instance of the class or interface declaring the underlying field - * (or a subclass or implementor thereof), or if an unwrapping conversion fails. + * @throws SecurityException If a security manager, s, is present and any of the following + * conditions is met: + * <ul> + * <li>invocation of s.checkMemberAccess(this, Member.DECLARED) denies access to the + * declared field</li> + * <li>the caller's class loader is not the same as or an ancestor of the class loader + * for the current class and invocation of s.checkPackageAccess() denies access to the + * package of this class</li> + * </ul> + * @throws NoSuchFieldException if a field with the specified name is not found. + * @throws IllegalAccessException if this Field object is enforcing Java language access control + * and the underlying field is either inaccessible or final. + * @throws IllegalArgumentException if the specified object is not an instance of the class or + * interface declaring the underlying field (or a subclass or implementor thereof), or + * if an unwrapping conversion fails. */ @SuppressWarnings("nls") - public ExecutorHarness() throws NoSuchFieldException, SecurityException, IllegalArgumentException, - IllegalAccessException { + public ExecutorHarness() + throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { methods = new HashMap<>(); new SvcLogicContext(); @@ -100,33 +99,31 @@ public class ExecutorHarness { /** * Convenience constructor * - * @param executor - * The executor to be tested by the harness - * @throws SecurityException - * If a security manager, s, is present and any of the following conditions is met: - * <ul> - * <li>invocation of s.checkMemberAccess(this, Member.DECLARED) denies access to the declared field</li> - * <li>the caller's class loader is not the same as or an ancestor of the class loader for the current - * class and invocation of s.checkPackageAccess() denies access to the package of this class</li> - * </ul> - * @throws NoSuchFieldException - * if a field with the specified name is not found. - * @throws IllegalAccessException - * if this Field object is enforcing Java language access control and the underlying field is either - * inaccessible or final. - * @throws IllegalArgumentException - * if the specified object is not an instance of the class or interface declaring the underlying field - * (or a subclass or implementor thereof), or if an unwrapping conversion fails. + * @param executor The executor to be tested by the harness + * @throws SecurityException If a security manager, s, is present and any of the following + * conditions is met: + * <ul> + * <li>invocation of s.checkMemberAccess(this, Member.DECLARED) denies access to the + * declared field</li> + * <li>the caller's class loader is not the same as or an ancestor of the class loader + * for the current class and invocation of s.checkPackageAccess() denies access to the + * package of this class</li> + * </ul> + * @throws NoSuchFieldException if a field with the specified name is not found. + * @throws IllegalAccessException if this Field object is enforcing Java language access control + * and the underlying field is either inaccessible or final. + * @throws IllegalArgumentException if the specified object is not an instance of the class or + * interface declaring the underlying field (or a subclass or implementor thereof), or + * if an unwrapping conversion fails. */ - public ExecutorHarness(SvcLogicJavaPlugin executor) throws NoSuchFieldException, SecurityException, - IllegalArgumentException, IllegalAccessException { + public ExecutorHarness(SvcLogicJavaPlugin executor) + throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { this(); setExecutor(executor); } /** - * @param executor - * The java plugin class to be executed + * @param executor The java plugin class to be executed */ public void setExecutor(SvcLogicJavaPlugin executor) { this.executor = executor; @@ -150,20 +147,20 @@ public class ExecutorHarness { } /** - * Returns an indication if the named method is a valid executor method that could be called from a DG execute node + * Returns an indication if the named method is a valid executor method that could be called + * from a DG execute node * - * @param methodName - * The method name to be validated - * @return True if the method name meets the signature requirements, false if the method either does not exist or - * does not meet the requirements. + * @param methodName The method name to be validated + * @return True if the method name meets the signature requirements, false if the method either + * does not exist or does not meet the requirements. */ public boolean isExecMethod(String methodName) { return methods.containsKey(methodName); } /** - * This method scans the executor class hierarchy to locate all methods that match the required signature of the - * executor and records these methods in a map. + * This method scans the executor class hierarchy to locate all methods that match the required + * signature of the executor and records these methods in a map. */ private void scanExecutor() { methods.clear(); @@ -174,7 +171,7 @@ public class ExecutorHarness { Class<?>[] paramTypes = method.getParameterTypes(); if (paramTypes.length == 2) { if (Map.class.isAssignableFrom(paramTypes[0]) - && SvcLogicContext.class.isAssignableFrom(paramTypes[1])) { + && SvcLogicContext.class.isAssignableFrom(paramTypes[1])) { methods.put(method.getName(), method); } } diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/test/InterceptLogger.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/test/InterceptLogger.java index b0a8e824e..efc84a1e4 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/test/InterceptLogger.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/test/InterceptLogger.java @@ -28,14 +28,13 @@ package org.openecomp.appc.test; import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; - import org.slf4j.Marker; - import ch.qos.logback.classic.Level; /** - * This class is used as an intercept logger that can be used in testing to intercept and record all messages that are - * logged, thus allowing a junit test case to examine the log output and make assertions. + * This class is used as an intercept logger that can be used in testing to intercept and record all + * messages that are logged, thus allowing a junit test case to examine the log output and make + * assertions. */ public class InterceptLogger implements org.slf4j.Logger { @@ -81,24 +80,21 @@ public class InterceptLogger implements org.slf4j.Logger { } /** - * @param level - * the value for level + * @param level the value for level */ public void setLevel(Level level) { this.level = level; } /** - * @param message - * the value for message + * @param message the value for message */ public void setMessage(String message) { this.message = message; } /** - * @param timestamp - * the value for timestamp + * @param timestamp the value for timestamp */ public void setTimestamp(long timestamp) { this.timestamp = timestamp; @@ -112,8 +108,7 @@ public class InterceptLogger implements org.slf4j.Logger { } /** - * @param t - * the value for t + * @param t the value for t */ public void setThrowable(Throwable t) { this.t = t; |