aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-tenant-adapter/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-tenant-adapter/src/test')
-rw-r--r--adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImplTest.java82
-rw-r--r--adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/TenantAdapterRestTest.java60
-rw-r--r--adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExistsTest.java32
-rw-r--r--adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionBeanTest.java47
-rw-r--r--adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionTest.java49
-rw-r--r--adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/test/TenantTest.java132
-rw-r--r--adapters/mso-tenant-adapter/src/test/resources/logback-test.xml47
7 files changed, 0 insertions, 449 deletions
diff --git a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImplTest.java b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImplTest.java
deleted file mode 100644
index 821c114351..0000000000
--- a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImplTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.adapters.tenant;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.openecomp.mso.adapters.tenantrest.TenantRollback;
-import org.openecomp.mso.cloud.CloudConfig;
-import org.openecomp.mso.cloud.CloudConfigFactory;
-import org.openecomp.mso.entity.MsoRequest;
-
-import javax.validation.constraints.Null;
-import javax.xml.ws.Holder;
-import java.util.HashMap;
-
-public class MsoTenantAdapterImplTest {
-
- @Mock
- private static MsoTenantAdapterImpl msoTenantAdapter;
-
- @Mock
- private static CloudConfigFactory cloudConfigFactory;
-
- // TODO: following test case is done for coverage
- // later it should be modified for proper test.
-
- @BeforeClass
- public static final void prepare () {
- msoTenantAdapter = Mockito.spy (new MsoTenantAdapterImpl());
- cloudConfigFactory = Mockito.mock(CloudConfigFactory.class);
- CloudConfig cloudConfig = Mockito.mock(CloudConfig.class);
- Mockito.when(cloudConfigFactory.getCloudConfig()).thenReturn(cloudConfig);
- msoTenantAdapter.getTenantUtilsFactory().setCloudConfigFactory(cloudConfigFactory);
- }
-
- @Test
- public void healthCheck() throws Exception {
- msoTenantAdapter.healthCheck();
- }
-
- @Test(expected = NullPointerException.class)
- public void createTenant() throws Exception {
- msoTenantAdapter.createTenant("site", "tenant", new HashMap<>(),
- true, true, new MsoRequest(), new Holder(), new Holder());
- }
-
- @Test(expected = NullPointerException.class)
- public void queryTenant() throws Exception {
- msoTenantAdapter.queryTenant("site", "tenant", new MsoRequest(),
- new Holder<>(), new Holder<>(), new Holder<>());
- }
-
- @Test(expected = NullPointerException.class)
- public void deleteTenant() throws Exception {
- msoTenantAdapter.deleteTenant("cloud", "tenant", new MsoRequest(), new Holder());
- }
-
- @Test
- public void rollbackTenant() throws Exception {
- msoTenantAdapter.rollbackTenant(new TenantRollback());
- }
-
-} \ No newline at end of file
diff --git a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/TenantAdapterRestTest.java
deleted file mode 100644
index d710e67752..0000000000
--- a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/TenantAdapterRestTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.adapters.tenant;
-
-import org.junit.Test;
-import org.openecomp.mso.adapters.tenantrest.CreateTenantRequest;
-import org.openecomp.mso.adapters.tenantrest.DeleteTenantRequest;
-import org.openecomp.mso.adapters.tenantrest.RollbackTenantRequest;
-
-public class TenantAdapterRestTest {
-
- // TODO: following test case is done for coverage
- // later it should be modified for proper test.
-
- TenantAdapterRest tenantAdapterRest = new TenantAdapterRest();
-/*
-will need to rewrite these.. commenting for now...
- @Test(expected = ClassFormatError.class)
- public void healthcheck() throws Exception {
- tenantAdapterRest.healthcheck();
- }
-
- @Test(expected = ClassFormatError.class)
- public void createTenant() throws Exception {
- tenantAdapterRest.createTenant(new CreateTenantRequest());
- }
-
- @Test(expected = ClassFormatError.class)
- public void deleteTenant() throws Exception {
- tenantAdapterRest.deleteTenant("test", new DeleteTenantRequest());
- }
-
- @Test(expected = ClassFormatError.class)
- public void queryTenant() throws Exception {
- tenantAdapterRest.queryTenant("test", "test", "requestid", "serviceInstanceId");
- }
-
- @Test(expected = ClassFormatError.class)
- public void rollbackTenant() throws Exception {
- tenantAdapterRest.rollbackTenant("action", new RollbackTenantRequest());
- }
-*/
-} \ No newline at end of file
diff --git a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExistsTest.java b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExistsTest.java
deleted file mode 100644
index 7f30b70742..0000000000
--- a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExistsTest.java
+++ /dev/null
@@ -1,32 +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.adapters.tenant.exceptions;
-
-import org.junit.Test;
-
-public class TenantAlreadyExistsTest {
-
- @Test
- public void test() {
- TenantAlreadyExists tar= new TenantAlreadyExists("name", "cloudId", "tenantId");
- assert(tar!=null);
- }
-} \ No newline at end of file
diff --git a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionBeanTest.java b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionBeanTest.java
deleted file mode 100644
index c2f1d4e7aa..0000000000
--- a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionBeanTest.java
+++ /dev/null
@@ -1,47 +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.adapters.tenant.exceptions;
-
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
-
-public class TenantExceptionBeanTest {
-
-@Mock
-private MsoExceptionCategory mec;
-
-@InjectMocks
-private TenantExceptionBean teb;
-
-@Test
- public void test() {
- teb =new TenantExceptionBean("message",mec);
- teb.setMessage("message");
- teb.setCategory(MsoExceptionCategory.INTERNAL);
- teb.setCategory(MsoExceptionCategory.IO);
- teb.setCategory(MsoExceptionCategory.OPENSTACK);
- teb.setCategory(MsoExceptionCategory.USERDATA);
- assert(teb.getMessage().equals("message"));
- assert(teb.getCategory()!=null);
- }
-}
diff --git a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionTest.java b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionTest.java
deleted file mode 100644
index 32e1fd198d..0000000000
--- a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionTest.java
+++ /dev/null
@@ -1,49 +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.adapters.tenant.exceptions;
-
-import org.junit.Test;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
-
-public class TenantExceptionTest {
-
- @Mock
- private TenantExceptionBean teb;
-
- @Mock
- private MsoExceptionCategory mec;
-
- @InjectMocks
- private TenantException te;
-
- @Test
- public void test() {
- teb=new TenantExceptionBean("message");
- teb.setMessage("message");
- teb.setCategory(MsoExceptionCategory.INTERNAL);
- te = new TenantException("message", mec);
- te.setFaultInfo(teb);
- assert(te.getFaultInfo()!=null);
- assert(te.getFaultInfo().equals(teb));
- }
-}
diff --git a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/test/TenantTest.java b/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/test/TenantTest.java
deleted file mode 100644
index 2a33ebc50c..0000000000
--- a/adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/test/TenantTest.java
+++ /dev/null
@@ -1,132 +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.adapters.tenant.test;
-
-
-
-import java.util.Map;
-
-import javax.xml.ws.Holder;
-
-import org.openecomp.mso.adapters.tenant.MsoTenantAdapter;
-import org.openecomp.mso.adapters.tenant.MsoTenantAdapterImpl;
-import org.openecomp.mso.adapters.tenant.exceptions.TenantException;
-import org.openecomp.mso.adapters.tenantrest.TenantRollback;
-
-public class TenantTest {
- public static final void main (String args[])
- {
- String cloudId = "MT";
- cloudId = "AIC_GAMMALAB";
-
- MsoTenantAdapter tenantAdapter = new MsoTenantAdapterImpl();
-
- Holder<String> tenantId = new Holder<>();
- Holder<String> tenantName = new Holder<>();
- Holder<Map<String,String>> tenantMetadata = new Holder<>();
- Holder<Boolean> tenantDeleted = new Holder<>();
- Holder<TenantRollback> rollback = new Holder<>();
-
- try {
- tenantAdapter.queryTenant (cloudId, "934a4ac9c4bd4b8d9d8ab3ef900281b0", null, tenantId, tenantName, tenantMetadata);
- System.out.println ("Got Tenant ID=" + tenantId.value + ", name=" + tenantName.value + ", metadata = " + tenantMetadata.value);
- }
- catch (TenantException e) {
- System.out.println ("Got Tenant Exception: " + e);
- System.exit(1);
- }
-/*
- Map<String,String> metadata = new HashMap<String,String>();
- metadata.put("sdn-global-id", "abc");
- metadata.put("service-type", "gamma");
-
- // Create a new tenant
- try {
- tenantAdapter.createTenant(cloudId, "TEST_META6", metadata, true, tenantId, rollback);
- System.out.println ("Created Tenant ID " + tenantId.value);
- }
- catch (TenantAlreadyExists e) {
- System.out.println ("Create: Tenant already exists: " + "TEST_META6");
- }
- catch (TenantException e) {
- System.out.println ("Got Tenant Exception on Create: " + e);
- System.exit(1);
- }
-
- // Query the new tenant
- try {
- tenantAdapter.queryTenant (cloudId, "TEST_META6", tenantId, tenantName, tenantMetadata);
- System.out.println ("Queried Tenant ID=" + tenantId.value + ", name=" + tenantName.value + ", metadata = " + tenantMetadata.value);
- }
- catch (TenantException e) {
- System.out.println ("Got Tenant Exception on Query: " + e);
- System.exit(1);
- }
-
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e1) {}
-
- // Delete the new tenant
- try {
- tenantAdapter.deleteTenant (cloudId, tenantId.value, tenantDeleted);
- if (tenantDeleted.value)
- System.out.println ("Deleted Tenant " + tenantId.value);
- else
- System.out.println ("Delete: Tenant " + tenantId.value + " does not exist");
- }
- catch (TenantException e) {
- System.out.println ("Got Tenant Exception on Delete: " + e);
- }
-/*
- // Create another new tenant
- try {
- tenantAdapter.createTenant(cloudId, "TEST_MSO2", null, false, tenantId, rollback);
- System.out.println ("Created Tenant ID " + tenantId.value);
- }
- catch (TenantException e) {
- System.out.println ("Got Tenant Exception on Create: " + e);
- }
-
- // Query the new tenant
- try {
- tenantAdapter.queryTenant (cloudId, "TEST_MSO2", tenantId, tenantName);
- System.out.println ("Queried Tenant ID=" + tenantId.value + ", name=" + tenantName.value);
- }
- catch (TenantException e) {
- System.out.println ("Got Tenant Exception on Query: " + e);
- }
-
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e1) {}
-
- // Rollback the new tenant
- try {
- tenantAdapter.rollbackTenant(rollback.value);
- System.out.println ("Rolled Back Tenant ID " + tenantId.value);
- }
- catch (TenantException e) {
- System.out.println ("Got Tenant Exception on Rollback: " + e);
- }
-*/
- }
-}
diff --git a/adapters/mso-tenant-adapter/src/test/resources/logback-test.xml b/adapters/mso-tenant-adapter/src/test/resources/logback-test.xml
deleted file mode 100644
index a23395fe1b..0000000000
--- a/adapters/mso-tenant-adapter/src/test/resources/logback-test.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- 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=========================================================
- -->
-
-<configuration >
-
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
- </encoder>
- </appender>
-
-
- <logger name="com.att.eelf.audit" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.metrics" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="com.att.eelf.error" level="trace" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <root level="info">
- <appender-ref ref="STDOUT" />
- </root>
-
-
-</configuration>