summaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/test
diff options
context:
space:
mode:
authorhekeguang <hekeguang@chinamobile.com>2022-09-29 11:11:13 +0800
committerhekeguang <hekeguang@chinamobile.com>2022-09-29 11:12:09 +0800
commit4ba5d5c124ee84adac7dd0b97f6e42f5954bd7dc (patch)
tree08efac2451ccb8620bea177d863345e27f6c17ed /intentanalysis/src/test
parent4f006378f24d0a890214e6567b78c5e0d9881738 (diff)
Add test code.
Issue-ID: USECASEUI-696 Change-Id: I39f1dd498ef2a8d4f2d4373575401eb1feb03dd3 Signed-off-by: hekeguang <hekeguang@chinamobile.com>
Diffstat (limited to 'intentanalysis/src/test')
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java3
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java116
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java2
-rw-r--r--intentanalysis/src/test/resources/intentdb-test-data.sql6
4 files changed, 119 insertions, 8 deletions
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java
index 3cc406d..d01ebc7 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java
@@ -19,9 +19,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onap.usecaseui.intentanalysis.bean.enums.IntentFunctionType;
-import org.onap.usecaseui.intentanalysis.bean.enums.SupportArea;
-
-import java.util.ArrayList;
public class IntentManagementFunctionRegInfoTest {
@Before
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java
new file mode 100644
index 0000000..0a3cf04
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java
@@ -0,0 +1,116 @@
+package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.usecaseui.intentanalysis.IntentAnalysisApplicationTests;
+import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
+import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
+import org.onap.usecaseui.intentanalysis.bean.models.*;
+import org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.CLLAssuranceIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.CLLDeliveryIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.service.ImfRegInfoService;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class CLLBusinessDecisionModuleTest {
+ @InjectMocks
+ CLLBusinessDecisionModule cllBusinessDecisionModule;
+
+ @Mock
+ private ImfRegInfoService imfRegInfoService;
+ @Mock
+ private ApplicationContext applicationContext;
+
+ IntentGoalBean intentGoalBean = new IntentGoalBean();
+ Intent intent = new Intent();
+ @Before
+ public void before() throws Exception {
+ intent.setIntentName("cllIntent");
+ intent.setIntentId("12345");
+ List<Expectation> expectationList = new ArrayList<>();
+
+ Expectation delivery = new Expectation();
+ delivery.setExpectationId("12345-delivery");
+ delivery.setExpectationName("deliveryExpectation");
+ delivery.setExpectationType(ExpectationType.DELIVERY);
+ ExpectationObject expectationObject = new ExpectationObject();
+ expectationObject.setObjectType(ObjectType.SLICING);
+ //expetationTarget Context FulfilmentInfo is empty
+ delivery.setExpectationObject(expectationObject);
+ expectationList.add(delivery);
+
+ Expectation assurance = new Expectation();
+ assurance.setExpectationId("12345-assurance");
+ assurance.setExpectationName("assuranceExpectation");
+ assurance.setExpectationType(ExpectationType.ASSURANCE);
+ ExpectationObject expectationObject1 = new ExpectationObject();
+ expectationObject1.setObjectType(ObjectType.CCVPN);
+ //expetationTarget Context FulfilmentInfo is empty
+ assurance.setExpectationObject(expectationObject1);
+ expectationList.add(assurance);
+
+ intent.setIntentExpectations(expectationList);
+ intent.setIntentExpectations(expectationList);
+ intent.setIntentExpectations(expectationList);
+ intentGoalBean.setIntent(intent);
+ intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
+ }
+ @Test
+ public void testNeedDecompostion(){
+// IntentManagementFunctionRegInfo imfRegInfo = new IntentManagementFunctionRegInfo();
+//
+// imfRegInfo.setSupportArea("cll");
+// imfRegInfo.setSupportInterfaces("CREATE");
+// imfRegInfo.setHandleName("aaa");
+// // Mockito.when(imfRegInfoService.getImfRegInfo(intentGoalBean)).thenReturn(imfRegInfo).thenReturn(imfRegInfo);
+// Mockito.when(cllBusinessDecisionModule.exploreIntentHandlers(intentGoalBean)).thenReturn(new IntentManagementFunction());
+// Mockito.when(applicationContext.getBean("CLLDeliveryIntentManagementFunction")).thenReturn(new CLLDeliveryIntentManagementFunction());
+// cllBusinessDecisionModule.findHandler(intentGoalBean);
+ cllBusinessDecisionModule.needDecompostion(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+ @Test
+ public void testIntentDecomposition(){
+ cllBusinessDecisionModule.intentDecomposition(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testIntentOrchestration(){
+ List<IntentGoalBean> intentGoalBeanList=new ArrayList<>();
+ IntentGoalBean delivery=new IntentGoalBean();
+
+ Intent deliveryIntent= new Intent();
+ deliveryIntent.setIntentName("delivery");
+
+ delivery.setIntentGoalType(IntentGoalType.CREATE);
+ delivery.setIntent(deliveryIntent);
+ intentGoalBeanList.add(delivery);
+
+ IntentGoalBean assurance=new IntentGoalBean();
+
+ Intent assuranceIntent= new Intent();
+ deliveryIntent.setIntentName("assurance");
+
+ assurance.setIntentGoalType(IntentGoalType.CREATE);
+ assurance.setIntent(assuranceIntent);
+ intentGoalBeanList.add(assurance);
+
+ cllBusinessDecisionModule.intentOrchestration(intentGoalBeanList);
+ Assert.assertTrue(true);
+ }
+} \ No newline at end of file
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java
index 4067b4f..164df70 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java
@@ -23,8 +23,6 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
-import org.onap.usecaseui.intentanalysis.bean.enums.SupportArea;
-import org.onap.usecaseui.intentanalysis.bean.enums.SupportInterface;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo;
diff --git a/intentanalysis/src/test/resources/intentdb-test-data.sql b/intentanalysis/src/test/resources/intentdb-test-data.sql
index a20f814..78f4d1e 100644
--- a/intentanalysis/src/test/resources/intentdb-test-data.sql
+++ b/intentanalysis/src/test/resources/intentdb-test-data.sql
@@ -45,11 +45,11 @@ values ('expectation without affiliate 2', 'CLL Assurance Expectation', 'ASSURAN
-- Records of expectation_object
-- ----------------------------
MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
-values ('b1bc45a6-f396-4b65-857d-6d2312bfb352', 'OBJECT1', '', 'expectationId1');
+values ('b1bc45a6-f396-4b65-857d-6d2312bfb352', 'SLICING', '', 'expectationId1');
MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
-values ('931a8690-fa61-4c2b-a387-9e0fa6152136', 'OBJECT2', '', 'expectationId2');
+values ('931a8690-fa61-4c2b-a387-9e0fa6152136', 'CCVPN', '', 'expectationId2');
MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
-values ('3f36bf22-3416-4150-8005-cdc406a43310', 'OBJECT2', '', 'expectationId3');
+values ('3f36bf22-3416-4150-8005-cdc406a43310', 'CCVPN', '', 'expectationId3');
-- ----------------------------
-- Records of expectation_target