aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/test/java
diff options
context:
space:
mode:
authorhekeguang <hekeguang@chinamobile.com>2022-09-08 11:22:29 +0800
committerhekeguang <hekeguang@chinamobile.com>2022-09-08 11:22:45 +0800
commitd0b3048fe93a50fdaa2ad34a166794abdc902580 (patch)
tree48b18f22d3eae533dd9b4414b47599edba977c08 /intentanalysis/src/test/java
parent8969f7b2a92316e0e87ec1a56cb0801c9f871a5f (diff)
Add intent base operation process code .
Issue-ID: USECASEUI-696 Change-Id: Iff7e561c6bbc1437ba3b002875c3e120504e95dd Signed-off-by: hekeguang <hekeguang@chinamobile.com>
Diffstat (limited to 'intentanalysis/src/test/java')
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModuleTest.java92
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModuleTest.java121
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java95
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionServiceTest.java88
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionServiceTest.java93
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationServiceTest.java93
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationServiceTest.java89
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessServiceTest.java95
8 files changed, 766 insertions, 0 deletions
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModuleTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModuleTest.java
new file mode 100644
index 0000000..ea1717f
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModuleTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2022 CMCC, Inc. and others. 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.
+ *
+ */
+
+package org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule;
+
+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.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.Expectation;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+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;
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class FormatIntentInputDecisionModuleTest {
+ @InjectMocks
+ FormatIntentInputDecisionModule formatIntentInputDecisionModule;
+ @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.OBJECT1);
+ //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.OBJECT2);
+ //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 testExploreIntentHandlers(){
+ IntentManagementFunction intentManagementFunction = formatIntentInputDecisionModule.exploreIntentHandlers(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+ @Test
+ public void testFindHandler(){
+ formatIntentInputDecisionModule.findHandler(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+} \ No newline at end of file
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModuleTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModuleTest.java
new file mode 100644
index 0000000..eae144e
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputKnowledgeModuleTest.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2022 CMCC, Inc. and others. 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.
+ *
+ */
+
+package org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule;
+
+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.enums.OperatorType;
+import org.onap.usecaseui.intentanalysis.bean.models.*;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.mockito.ArgumentMatchers.anyString;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class FormatIntentInputKnowledgeModuleTest {
+ @InjectMocks
+ FormatIntentInputKnowledgeModule formatIntentInputKnowledgeModule;
+
+ @Mock
+ IntentService intentService;
+ 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.OBJECT1);
+ //expetationTarget Context FulfilmentInfo is empty
+ delivery.setExpectationObject(expectationObject);
+ List<ExpectationTarget> expectationTargets = new ArrayList<>();
+ ExpectationTarget expectationTarget = new ExpectationTarget();
+ expectationTarget.setTargetName("aaaa");
+ expectationTargets.add(expectationTarget);
+ delivery.setExpectationTargets(expectationTargets);
+ 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.OBJECT2);
+ //expetationTarget Context FulfilmentInfo is empty
+ assurance.setExpectationObject(expectationObject1);
+
+ List<ExpectationTarget> expectationTarget2 = new ArrayList<>();
+ ExpectationTarget expectationTargetAssu = new ExpectationTarget();
+ expectationTargetAssu.setTargetName("aaaa");
+ expectationTarget2.add(expectationTargetAssu);
+ assurance.setExpectationTargets(expectationTarget2);
+
+ expectationList.add(assurance);
+
+ intent.setIntentExpectations(expectationList);
+ intent.setIntentExpectations(expectationList);
+ intent.setIntentExpectations(expectationList);
+
+ List<Context> intentContexts = new ArrayList<>();
+ Context context = new Context();
+ context.setContextName("owninfo");
+
+ List<Condition> conditionList = new ArrayList<>();//ownerName = formatIntentInputManagementFunction"
+ Condition condition = new Condition();
+ condition.setConditionName("ownerName");
+ condition.setOperator(OperatorType.EQUALTO);
+ condition.setConditionValue("formatIntentInputManagementFunction");
+ conditionList.add(condition);
+ context.setContextConditions(conditionList);
+ intentContexts.add(context);
+ intent.setIntentContexts(intentContexts);
+
+ intentGoalBean.setIntent(intent);
+ intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
+ }
+
+ @Test
+ public void testFormatIntentInputKnowledgeModule() {
+ List<Intent> list = new ArrayList<>();
+ list.add(intent);
+ Mockito.when(intentService.getIntentByName(anyString())).thenReturn(list);
+ formatIntentInputKnowledgeModule.intentCognition(intent);
+ Assert.assertTrue(true);
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java
new file mode 100644
index 0000000..1394f50
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2022 CMCC, Inc. and others. 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.
+ *
+ */
+
+package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+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.Expectation;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.CLLBusinessIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class IntentDefinitionServiceTest {
+
+ @InjectMocks
+ IntentDefinitionService intentDefinitionService;
+
+ @Resource(name = "formatIntentInputManagementFunction")
+ private IntentManagementFunction intentOwner;
+ @Resource(name = "CLLBusinessIntentManagementFunction")
+ private CLLBusinessIntentManagementFunction cllBusinessIntentManagementFunction;
+ 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.OBJECT1);
+ //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.OBJECT2);
+ //expetationTarget Context FulfilmentInfo is empty
+ assurance.setExpectationObject(expectationObject1);
+ expectationList.add(assurance);
+
+ intent.setIntentExpectations(expectationList);
+ }
+
+ @Test
+ public void testDefinitionPorcess() {
+ intentDefinitionService.setIntentRole(intentOwner, cllBusinessIntentManagementFunction);
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>();
+ IntentGoalBean gb = new IntentGoalBean(intent, IntentGoalType.CREATE);
+ map.put(gb, new IntentManagementFunction());
+ intentDefinitionService.definitionPorcess(map.entrySet().iterator().next());
+ Assert.assertTrue(true);
+ }
+} \ No newline at end of file
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionServiceTest.java
new file mode 100644
index 0000000..fa67cf2
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionServiceTest.java
@@ -0,0 +1,88 @@
+
+/*
+ * Copyright (C) 2022 CMCC, Inc. and others. 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.
+ *
+ */
+
+package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.onap.usecaseui.intentanalysis.IntentAnalysisApplicationTests;
+import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType;
+import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
+import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.CLLBusinessIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class IntentDetectionServiceTest {
+ @InjectMocks
+ IntentDetectionService intentDetectionService;
+ @Resource(name = "formatIntentInputManagementFunction")
+ private IntentManagementFunction intentOwner;
+ @Resource(name = "CLLBusinessIntentManagementFunction")
+ private CLLBusinessIntentManagementFunction cllBusinessIntentManagementFunction;
+ 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.OBJECT1);
+ //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.OBJECT2);
+ //expetationTarget Context FulfilmentInfo is empty
+ assurance.setExpectationObject(expectationObject1);
+ expectationList.add(assurance);
+
+ intent.setIntentExpectations(expectationList);
+ }
+
+ @Test
+ public void testDetectionProcess() {
+ intentDetectionService.setIntentRole(intentOwner, null);
+ intentDetectionService.detectionProcess(intent);
+ Assert.assertTrue(true);
+
+ }
+} \ No newline at end of file
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionServiceTest.java
new file mode 100644
index 0000000..882770c
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionServiceTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2022 CMCC, Inc. and others. 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.
+ *
+ */
+
+package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+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.Expectation;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.CLLBusinessIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class IntentDistributionServiceTest {
+ @InjectMocks
+ IntentDistributionService IntentDistributionService;
+ @Resource(name = "formatIntentInputManagementFunction")
+ private IntentManagementFunction intentOwner;
+ @Resource(name = "CLLBusinessIntentManagementFunction")
+ private CLLBusinessIntentManagementFunction cllBusinessIntentManagementFunction;
+ Intent intent = new Intent();
+ IntentGoalBean intentGoalBean = new IntentGoalBean();
+
+ @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.OBJECT1);
+ //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.OBJECT2);
+ //expetationTarget Context FulfilmentInfo is empty
+ assurance.setExpectationObject(expectationObject1);
+ expectationList.add(assurance);
+
+ intent.setIntentExpectations(expectationList);
+ intentGoalBean.setIntent(intent);
+ intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
+ }
+ @Test
+ public void testIntentDistribution() {
+ IntentDistributionService.setIntentRole(intentOwner, cllBusinessIntentManagementFunction);
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>();
+ map.put(intentGoalBean,cllBusinessIntentManagementFunction);
+ IntentDistributionService.distributionProcess(map.entrySet().iterator().next());
+ Assert.assertTrue(true);
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationServiceTest.java
new file mode 100644
index 0000000..ea0bf7a
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationServiceTest.java
@@ -0,0 +1,93 @@
+
+/*
+ * Copyright (C) 2022 CMCC, Inc. and others. 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.
+ *
+ */
+
+package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+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.Expectation;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.CLLBusinessIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class IntentInvestigationServiceTest {
+ @InjectMocks
+ IntentInvestigationService intentInvestigationService;
+
+ @Resource(name = "formatIntentInputManagementFunction")
+ private IntentManagementFunction intentOwner;
+ @Resource(name = "CLLBusinessIntentManagementFunction")
+ private CLLBusinessIntentManagementFunction cllBusinessIntentManagementFunction;
+ Intent intent = new Intent();
+ IntentGoalBean intentGoalBean = new IntentGoalBean();
+
+ @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.OBJECT1);
+ //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.OBJECT2);
+ //expetationTarget Context FulfilmentInfo is empty
+ assurance.setExpectationObject(expectationObject1);
+ expectationList.add(assurance);
+
+ intent.setIntentExpectations(expectationList);
+ intent.setIntentExpectations(expectationList);
+ intentGoalBean.setIntent(intent);
+ intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
+ }
+ @Test
+ public void testDetectionProcess() {
+ intentInvestigationService.setIntentRole(intentOwner, null);
+ intentInvestigationService.investigationProcess(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationServiceTest.java
new file mode 100644
index 0000000..f2167e6
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationServiceTest.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2022 CMCC, Inc. and others. 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.
+ *
+ */
+
+package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+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.Expectation;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.onap.usecaseui.intentanalysis.formatintentinputMgt.FormatIntentInputManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class IntentOperationServiceTest {
+ @InjectMocks
+ IntentOperationService intentOperationService;
+
+ @Resource(name = "formatIntentInputManagementFunction")
+ private IntentManagementFunction intentOwner;
+ @Resource(name = "formatIntentInputManagementFunction")
+ private FormatIntentInputManagementFunction formatIntentInputManagementFunction;
+ 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.OBJECT1);
+ //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.OBJECT2);
+ //expetationTarget Context FulfilmentInfo is empty
+ assurance.setExpectationObject(expectationObject1);
+ expectationList.add(assurance);
+
+ intent.setIntentExpectations(expectationList);
+ intentGoalBean.setIntent(intent);
+ intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
+ }
+ @Test
+ public void testIntentOperation() {
+ intentOperationService.setIntentRole(intentOwner, formatIntentInputManagementFunction);
+ intentOperationService.operationProcess(intent);
+ Assert.assertTrue(true);
+ }
+} \ No newline at end of file
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessServiceTest.java
new file mode 100644
index 0000000..7836793
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessServiceTest.java
@@ -0,0 +1,95 @@
+package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+
+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.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.Expectation;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.CLLBusinessIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class IntentProcessServiceTest {
+ @InjectMocks
+ IntentProcessService intentProcessService;
+ @Resource(name = "formatIntentInputManagementFunction")
+ private IntentManagementFunction intentOwner;
+ @Resource(name = "CLLBusinessIntentManagementFunction")
+ private CLLBusinessIntentManagementFunction cllBusinessIntentManagementFunction;
+ Intent intent = new Intent();
+ IntentGoalBean intentGoalBean = new IntentGoalBean();
+ @Mock
+ IntentDetectionService intentDetectionService;
+ @Mock
+ IntentInvestigationService intentInvestigationService;
+ @Mock
+ IntentDefinitionService intentDefinitionService;
+ @Mock
+ IntentDistributionService intentDistributionService;
+ @Mock
+ IntentOperationService intentOperationService;
+ @Mock
+ IntentService intentService;
+
+
+ @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.OBJECT1);
+ //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.OBJECT2);
+ //expetationTarget Context FulfilmentInfo is empty
+ assurance.setExpectationObject(expectationObject1);
+ expectationList.add(assurance);
+
+ intent.setIntentExpectations(expectationList);
+ intentGoalBean.setIntent(intent);
+ intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
+ }
+ @Test
+ public void testIntentProcess() {
+ intentProcessService.setIntentRole(intentOwner,cllBusinessIntentManagementFunction);
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
+ intentMap.put(intentGoalBean,cllBusinessIntentManagementFunction);
+ when(intentInvestigationService.investigationProcess(any())).thenReturn(intentMap);
+ intentProcessService.intentProcess(intent);
+ Assert.assertTrue(true);
+ }
+} \ No newline at end of file