diff options
author | Patrick Brady <pb071s@att.com> | 2017-06-01 10:45:37 -0700 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-06-02 13:05:15 -0700 |
commit | c7d0075d223eab9f89fd28853c4b138792059be9 (patch) | |
tree | 40aa3e41e598ea7a59bcf6899a2004c1abab11c2 /appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java | |
parent | 8aac2df744820304ee29354333661699e9695939 (diff) |
Merge of new rebased code
Change-Id: I9b8d1f69eb3e0af1935ed8304fea4bf54c1aac47
Signed-off-by: Patrick Brady <pb071s@att.com>
Diffstat (limited to 'appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java')
-rw-r--r-- | appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderAdapterImpl.java | 10 | ||||
-rw-r--r-- | appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderOperation.java (renamed from appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderAdapterImplNoConnection.java) | 67 | ||||
-rw-r--r-- | appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestVMURL.java | 9 |
3 files changed, 41 insertions, 45 deletions
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 d83c18b04..abf35db39 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 @@ -259,13 +259,12 @@ public class TestProviderAdapterImpl { * 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 APPCException */ // @Ignore @Test public void testRestartRunningServer() - throws IllegalStateException, IllegalArgumentException, ZoneException, UnknownProviderException, IOException { + 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); @@ -350,15 +349,14 @@ public class TestProviderAdapterImpl { * 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 */ // @Ignore @Test public void testRestartStoppedServer() - throws IllegalStateException, IllegalArgumentException, ZoneException, UnknownProviderException, IOException { + 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); diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderAdapterImplNoConnection.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderOperation.java index d4683aa80..f9b571320 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderAdapterImplNoConnection.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestProviderOperation.java @@ -19,41 +19,43 @@ * ============LICENSE_END========================================================= */ - - 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; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import org.openecomp.appc.adapter.iaas.impl.ProviderAdapterImpl; -import org.openecomp.appc.adapter.iaas.impl.RequestContext; -import org.openecomp.appc.adapter.iaas.impl.RequestFailedException; -import org.openecomp.appc.adapter.iaas.impl.VMURL; +import org.slf4j.MDC; + import org.openecomp.appc.configuration.ConfigurationFactory; import org.openecomp.sdnc.sli.SvcLogicContext; -import org.slf4j.MDC; + +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. + * + * @since Jan 20, 2016 + * @version $Id$ */ -public class TestProviderAdapterImplNoConnection { +public class TestProviderOperation extends ProviderOperation{ private static Class<?> providerAdapterImplClass; private static Class<?> configurationFactoryClass; private static Field providerCacheField; private static Field configField; - 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. - * + * * @throws NoSuchFieldException * if the field(s) dont exist * @throws SecurityException @@ -75,96 +77,93 @@ public class TestProviderAdapterImplNoConnection { } /** - * initialize the test cases - */ - @Before - public void setup() { - adapter = new ProviderAdapterImpl(false); - } - - /** * This test expects a failure because the value to be validated is a null URL - * + * * @throws RequestFailedException * Expected */ @SuppressWarnings("nls") @Test(expected = RequestFailedException.class) public void testValidateParameterPatternExpectFailNullValue() throws RequestFailedException { - MDC.put(ProviderAdapterImpl.MDC_SERVICE, "junit"); + MDC.put(MDC_SERVICE, "junit"); SvcLogicContext svcContext = new SvcLogicContext(); RequestContext rc = new RequestContext(svcContext); String link = null; - adapter.validateVMURL(VMURL.parseURL(link)); + validateVMURL(VMURL.parseURL(link)); } /** * This test expects a failure because the value to be validated is an empty URL - * + * * @throws RequestFailedException * Expected */ @SuppressWarnings("nls") @Test(expected = RequestFailedException.class) public void testValidateParameterPatternExpectFailEmptyValue() throws RequestFailedException { - MDC.put(ProviderAdapterImpl.MDC_SERVICE, "junit"); + MDC.put(MDC_SERVICE, "junit"); SvcLogicContext svcContext = new SvcLogicContext(); RequestContext rc = new RequestContext(svcContext); String link = ""; - adapter.validateVMURL(VMURL.parseURL(link)); + validateVMURL(VMURL.parseURL(link)); } /** * This test expects a failure because the value to be validated is a blank URL - * + * * @throws RequestFailedException * Expected */ @SuppressWarnings("nls") @Test(expected = RequestFailedException.class) public void testValidateParameterPatternExpectFailBlankValue() throws RequestFailedException { - MDC.put(ProviderAdapterImpl.MDC_SERVICE, "junit"); + MDC.put(MDC_SERVICE, "junit"); SvcLogicContext svcContext = new SvcLogicContext(); RequestContext rc = new RequestContext(svcContext); String link = " "; - adapter.validateVMURL(VMURL.parseURL(link)); + validateVMURL(VMURL.parseURL(link)); } /** * This test expects a failure because the value to be validated is a bad URL - * + * * @throws RequestFailedException * Expected */ @SuppressWarnings("nls") @Test(expected = RequestFailedException.class) public void testValidateParameterPatternExpectFailBadURL() throws RequestFailedException { - MDC.put(ProviderAdapterImpl.MDC_SERVICE, "junit"); + MDC.put(MDC_SERVICE, "junit"); SvcLogicContext svcContext = new SvcLogicContext(); RequestContext rc = new RequestContext(svcContext); String link = "http://some.host:1234/01d82c08594a4b23a0f9260c94be0c4d/"; - adapter.validateVMURL(VMURL.parseURL(link)); + validateVMURL(VMURL.parseURL(link)); } /** * This test expects to pass - * + * * @throws RequestFailedException * Un-Expected */ @SuppressWarnings("nls") @Test public void testValidateParameterPatternValidURL() throws RequestFailedException { - MDC.put(ProviderAdapterImpl.MDC_SERVICE, "junit"); + MDC.put(MDC_SERVICE, "junit"); SvcLogicContext svcContext = new SvcLogicContext(); RequestContext rc = new RequestContext(svcContext); String link = "http://some.host:1234/v2/01d82c08594a4b23a0f9260c94be0c4d/servers/f888f89f-096b-421e-ba36-34f714071551"; - adapter.validateVMURL(VMURL.parseURL(link)); + validateVMURL(VMURL.parseURL(link)); + } + + @Override + 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/TestVMURL.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/test/java/org/openecomp/appc/adapter/iaas/impl/TestVMURL.java index 852bb4137..d99f89b29 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 @@ -43,11 +43,10 @@ public class TestVMURL { @BeforeClass public static void before() { - Properties props = ConfigurationFactory.getConfiguration().getProperties(); - IP = props.getProperty("test.ip"); - PORT = props.getProperty("test.port"); - TENANTID = props.getProperty("test.tenantid"); - VMID = props.getProperty("test.vmid"); + IP = "192.168.1.2"; + PORT = "5000"; + TENANTID = "abcde12345fghijk6789lmnopq123rst"; + VMID = "abc12345-1234-5678-890a-abcdefg12345"; URL = String.format("http://%s:%s/v2/%s/servers/%s", IP, PORT, TENANTID, VMID); } |