summaryrefslogtreecommitdiffstats
path: root/ueb-listener/src/test
diff options
context:
space:
mode:
authorlalena.aria <lalena.aria@att.com>2018-07-18 16:16:58 -0400
committerlalena.aria <lalena.aria@att.com>2018-07-19 13:06:54 -0400
commit18cc5f6913e7a71df1945e5e29f394b285867cb3 (patch)
tree37546fd7ac7ca88d17474f1980eaa1b71a0b22c1 /ueb-listener/src/test
parent16ecee44bc14dcb0a128cfdabf0ae8b17f1db057 (diff)
Refactor for CCSDK UEB Listener
Changes made: Moved DB insertions into model classes. Added SdncGroupModel object. Added policy ingestion in SdncBaseModel. Cleanup in SdncUebCallback. Changed sdc.tosca.version to 1.3.5 in pom.xml. Issue-ID: CCSDK-360 Change-Id: If965c38275a1dc7fc63847d3aa944aed1a6bd1f9 Signed-off-by: lalena.aria <lalena.aria@att.com>
Diffstat (limited to 'ueb-listener/src/test')
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java4
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java4
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java4
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModelTest.java4
-rw-r--r--ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java39
5 files changed, 41 insertions, 14 deletions
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java
index e8c7b1afd..360c36c9f 100644
--- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java
@@ -6,6 +6,7 @@ package org.onap.ccsdk.sli.northbound.uebclient;
import org.junit.Test;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.toscaparser.api.NodeTemplate;
+ import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
public class SdncARModelTest {
@@ -13,7 +14,8 @@ package org.onap.ccsdk.sli.northbound.uebclient;
public void testSdncARModelConstructor() {
ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class);
NodeTemplate nodeTemplate = mock(NodeTemplate.class);
- SdncARModel testSdncARModel = new SdncARModel(mockCsarHelper,nodeTemplate);
+ DBResourceManager mockDBResourceManager = mock(DBResourceManager.class);
+ SdncARModel testSdncARModel = new SdncARModel(mockCsarHelper,nodeTemplate,mockDBResourceManager);
assertNotNull(testSdncARModel);
}
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java
index 9df89fb24..d50c47a40 100644
--- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java
@@ -8,6 +8,7 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
public class SdncNodeModelTest {
@@ -17,7 +18,8 @@ public class SdncNodeModelTest {
public void setUp() throws Exception {
ISdcCsarHelper isdcCsarHelper = mock(ISdcCsarHelper.class);
NodeTemplate nodeTemplate = mock(NodeTemplate.class);
- sdncNodeModel = new SdncNodeModel(isdcCsarHelper, nodeTemplate);
+ DBResourceManager mockDBResourceManager = mock(DBResourceManager.class);
+ sdncNodeModel = new SdncNodeModel(isdcCsarHelper, nodeTemplate, mockDBResourceManager);
sdncNodeModel.setServiceUUID("0e8d757f-1c80-40af-85de-31d64f1f5af8");
sdncNodeModel.setEcompGeneratedNaming("hello-world");
}
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java
index f03a09fcf..a09c5a2ba 100644
--- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java
@@ -8,6 +8,7 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
public class SdncVFCModelTest {
@@ -17,7 +18,8 @@ public class SdncVFCModelTest {
public void setup() {
ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class);
NodeTemplate mockNodeTemplate = mock(NodeTemplate.class);
- testSdncVFCModel = new SdncVFCModel(mockCsarHelper, mockNodeTemplate);
+ DBResourceManager mockDBResourceManager = mock(DBResourceManager.class);
+ testSdncVFCModel = new SdncVFCModel(mockCsarHelper, mockNodeTemplate, mockDBResourceManager);
testSdncVFCModel.setVmType("Test-type");
testSdncVFCModel.setVmCount("5");
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModelTest.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModelTest.java
index 881018ef6..1fd10104c 100644
--- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModelTest.java
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModelTest.java
@@ -6,6 +6,7 @@ import static org.mockito.Mockito.mock;
import org.junit.Test;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.toscaparser.api.Group;
+import org.onap.ccsdk.sli.northbound.uebclient.SdncVFModel;
public class SdncVFModuleModelTest {
@@ -13,7 +14,8 @@ public class SdncVFModuleModelTest {
public void testSdncVFModuleModelConstructor() {
Group mockGroup = mock(Group.class);
ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class);
- SdncVFModuleModel testSdncVFModel = new SdncVFModuleModel(mockCsarHelper, mockGroup);
+ SdncVFModel mockSdncVFModel = mock(SdncVFModel.class);
+ SdncVFModuleModel testSdncVFModel = new SdncVFModuleModel(mockCsarHelper, mockGroup, mockSdncVFModel);
assertNotNull(testSdncVFModel);
}
diff --git a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java
index b53bdb392..d0a94d4bd 100644
--- a/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java
+++ b/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java
@@ -214,18 +214,18 @@ public class TestSdncUebCallback {
when(mockProcessArtifact1.getArtifactTimeout()).thenReturn(110);
mockProcessArtifact2 = mock(IArtifactInfo.class);
- when(mockProcessArtifact1.getArtifactName()).thenReturn("mockProcessArtifact2");
- when(mockProcessArtifact1.getArtifactType()).thenReturn("DG_XML");
- when(mockProcessArtifact1.getArtifactURL()).thenReturn("https://asdc.sdc.com/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
- when(mockProcessArtifact1.getArtifactChecksum()).thenReturn("456jhgt 1234ftg");
- when(mockProcessArtifact1.getArtifactTimeout()).thenReturn(110);
+ when(mockProcessArtifact2.getArtifactName()).thenReturn("mockProcessArtifact2");
+ when(mockProcessArtifact2.getArtifactType()).thenReturn("DG_XML");
+ when(mockProcessArtifact2.getArtifactURL()).thenReturn("https://asdc.sdc.com/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
+ when(mockProcessArtifact2.getArtifactChecksum()).thenReturn("456jhgt 1234ftg");
+ when(mockProcessArtifact2.getArtifactTimeout()).thenReturn(110);
mockProcessArtifact3 = mock(IArtifactInfo.class);
- when(mockProcessArtifact1.getArtifactName()).thenReturn("mockProcessArtifact3");
- when(mockProcessArtifact1.getArtifactType()).thenReturn("HEAT");
- when(mockProcessArtifact1.getArtifactURL()).thenReturn("https://asdc.sdc.com/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
- when(mockProcessArtifact1.getArtifactChecksum()).thenReturn("123tfg123 543gtd");
- when(mockProcessArtifact1.getArtifactTimeout()).thenReturn(110);
+ when(mockProcessArtifact3.getArtifactName()).thenReturn("mockProcessArtifact3");
+ when(mockProcessArtifact3.getArtifactType()).thenReturn("HEAT");
+ when(mockProcessArtifact3.getArtifactURL()).thenReturn("https://asdc.sdc.com/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml");
+ when(mockProcessArtifact3.getArtifactChecksum()).thenReturn("123tfg123 543gtd");
+ when(mockProcessArtifact3.getArtifactTimeout()).thenReturn(110);
mockServiceArtifact1 = mock(IArtifactInfo.class);
@@ -267,7 +267,16 @@ public class TestSdncUebCallback {
cb.setJdbcDataSource(dblibSvc);
INotificationData iData = mock(INotificationData.class);
+ /*IArtifactInfo iArtifactInfo = mock(IArtifactInfo.class);
+ when(iArtifactInfo.getArtifactName()).thenReturn("testArtifact1");
+ when(iArtifactInfo.getArtifactType()).thenReturn("TOSCA_CSAR");
+ List artifactInfoList = new ArrayList();
+ artifactInfoList.add(iArtifactInfo);*/
+
+ when(iData.getServiceName()).thenReturn("testServiceName");
+ //when(iData.getServiceArtifacts()).thenReturn(artifactInfoList);
cb.activateCallback(iData);
+
}
@@ -292,6 +301,16 @@ public class TestSdncUebCallback {
when(mockData.getServiceName()).thenReturn("Test_service_name");
when(mockData.getServiceArtifacts()).thenReturn(processLevelArtifactList);
+ /*IArtifactInfo iArtifactInfo = mock(IArtifactInfo.class);
+ when(iArtifactInfo.getArtifactName()).thenReturn("testArtifact1");
+ when(iArtifactInfo.getArtifactType()).thenReturn("TOSCA_CSAR");
+ List artifactInfoList = new ArrayList();
+ artifactInfoList.add(iArtifactInfo);
+
+ //when(mockData.getServiceName()).thenReturn("testServiceName");
+ when(mockData.getServiceArtifacts()).thenReturn(artifactInfoList);*/
+
+
SdncUebCallback cb1 = new SdncUebCallback(iDistClient1, config);
cb1.activateCallback(mockData);
assertTrue(true);