summaryrefslogtreecommitdiffstats
path: root/adapters/mso-tenant-adapter
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-05-02 16:46:14 -0400
committerRob Daugherty <rd472p@att.com>2018-05-04 15:28:51 +0000
commit3ee4ec41ac18e51a16eafa767e090502b1a33fb5 (patch)
tree11a4d7b6c3bc5b88ce8dd67f12c7726c9f7dd80f /adapters/mso-tenant-adapter
parent13999df2b5cbcfd29d479e20970b39ba876725f3 (diff)
Fix CloudConfig junits
...for some definition of the word "fix". There is still a lot that's less than ideal about how CloudConfig is handled, and with how the unit tests are written. Change-Id: Ic8c66c64d336f22c141687cf41a4828810bf1aec Issue-ID: SO-584 Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'adapters/mso-tenant-adapter')
-rw-r--r--adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java5
-rw-r--r--adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImplTest.java22
2 files changed, 25 insertions, 2 deletions
diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java
index 58169f6f92..85d50aee47 100644
--- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java
+++ b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java
@@ -58,6 +58,11 @@ public class MsoTenantAdapterImpl implements MsoTenantAdapter {
WebServiceContext wsContext;
private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+
+ protected MsoTenantUtilsFactory getTenantUtilsFactory() {
+ return tFactory;
+ }
+
/**
* Health Check web method. Does nothing but return to show the adapter is deployed.
*/
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
index e60a143b11..821c114351 100644
--- 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
@@ -19,8 +19,13 @@
*/
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;
@@ -28,11 +33,24 @@ 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.
-
- MsoTenantAdapterImpl msoTenantAdapter = new MsoTenantAdapterImpl();
+
+ @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 {