aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunction.java17
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java30
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunction.java2
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java1
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java7
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java10
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentinterfaceservice/IntentInterfaceService.java3
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentinterfaceservice/impl/IntentInterfaceServiceImpl.java13
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunctionTest.java150
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunctionTest.java167
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java99
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionServiceTest.java91
-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.java90
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessServiceTest.java111
16 files changed, 345 insertions, 632 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunction.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunction.java
index 1203508..5489070 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunction.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunction.java
@@ -25,6 +25,7 @@ import org.onap.usecaseui.intentanalysis.bean.models.Context;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentEventRecord;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.onap.usecaseui.intentanalysis.exception.CommonException;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.contextService.IntentContextService;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentEventRecord.IntentEventRecordService;
@@ -88,12 +89,7 @@ public class CLLBusinessIntentManagementFunction extends IntentManagementFunctio
LinkedHashMap<IntentGoalBean, IntentManagementFunction> linkedMap = investigation(originIntentGoalBean);
implementIntent(intentGoalBean.getIntent(), linkedMap);
if (intentGoalBean.getIntentGoalType() == IntentGoalType.DELETE) {
- List<Context> parentInfo = intentGoalBean.getIntent().getIntentContexts().stream().filter(a ->
- StringUtils.equalsIgnoreCase(a.getContextName(), "parentIntent info")).collect(Collectors.toList());
-
- String userInputId = parentInfo.get(0).getContextConditions().get(0).getConditionValue();
intentService.deleteIntent(intentGoalBean.getIntent().getIntentId());
- intentService.deleteIntent(userInputId);
}
}
@@ -118,8 +114,7 @@ public class CLLBusinessIntentManagementFunction extends IntentManagementFunctio
Intent originIntent = intentGoalBean.getIntent();
IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType();
if (intentGoalType == IntentGoalType.CREATE) {
- //return knowledgeModule.intentCognition(originIntent);
- return intentGoalBean;
+ return knowledgeModule.intentCognition(originIntent);
} else if (intentGoalType == IntentGoalType.UPDATE) {
return new IntentGoalBean(intentGoalBean.getIntent(), IntentGoalType.UPDATE);
} else {
@@ -160,9 +155,15 @@ public class CLLBusinessIntentManagementFunction extends IntentManagementFunctio
if (!isParallel) {
//Block and regularly query whether the event is published
boolean isPublish = false;
- while (isPublish) {
+ int count = 1;
+ while (!isPublish) {
Thread.sleep(1000);
IntentEventRecord record = intentEventRecordService.getIntentEventRecordByntentId(newIdIntent.getIntentId(), "create");
+ count++;
+ // it will take one hour to wait operation end
+ if (count==3600){
+ throw new CommonException("Operation took too long, failed",500);
+ }
if (null != record) {
isPublish = true;
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java
index 0272e3f..ba28e71 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java
@@ -49,8 +49,6 @@ public class IntentController {
private IntentService intentService;
@Autowired
- private IntentProcessService processService;
- @Autowired
FormatIntentInputManagementFunction formatIntentInputManagementFunction;
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
@@ -60,9 +58,9 @@ public class IntentController {
@GetMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ServiceResult getIntentById(
- @PathVariable(INTENT_ID) String intentId) {
+ @PathVariable(INTENT_ID) String intentId) {
return new ServiceResult(new ResultHeader(RSEPONSE_SUCCESS, "get Intent success"),
- intentService.getIntent(intentId));
+ intentService.getIntent(intentId));
}
@@ -72,14 +70,10 @@ public class IntentController {
Intent returnIntent = new Intent();
log.info("Execute create intent %s start",intent.getIntentName());
try {
- processService.setIntentRole(formatIntentInputManagementFunction, null);
- IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
- IntentGoalBean newIntentGoalBean = processService.intentProcess(intentGoalBean);
-
- newIntentGoalBean.getIntent().setIntentGenerateType(IntentGenerateType.USERINPUT);
- returnIntent = intentService.createIntent(newIntentGoalBean.getIntent());
+ formatIntentInputManagementFunction.receiveIntentAsOwner(new IntentGoalBean(intent,IntentGoalType.CREATE));
+ returnIntent = intentService.getIntent(intent.getIntentId());
resultHeader.setResult_code(RSEPONSE_SUCCESS);
- resultHeader.setResult_message("create intent success");
+ resultHeader.setResult_message("create intent finish,please waiting");
log.info("Execute create intent finished");
} catch (CommonException exception) {
log.error("Execute create intent Exception:", exception);
@@ -98,10 +92,8 @@ public class IntentController {
@RequestBody Intent intent) {
log.info("Execute update intent start");
try {
- processService.setIntentRole(formatIntentInputManagementFunction, null);
- IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.UPDATE);
- IntentGoalBean newIntentGoalBean = processService.intentProcess(intentGoalBean);
- Intent reIntent = intentService.updateIntent(newIntentGoalBean.getIntent());
+ formatIntentInputManagementFunction.receiveIntentAsOwner(new IntentGoalBean(intent,IntentGoalType.UPDATE));
+ Intent reIntent = intentService.getIntent(intentId);
log.info("Execute update intent finished");
return new ServiceResult(new ResultHeader(RSEPONSE_SUCCESS, "update intent success"), reIntent);
} catch (CommonException exception) {
@@ -117,10 +109,8 @@ public class IntentController {
public ServiceResult removeIntentById(@PathVariable(INTENT_ID) String intentId) {
log.info("Execute delete intent start");
try {
- processService.setIntentRole(formatIntentInputManagementFunction, null);
Intent intent = intentService.getIntent(intentId);
- IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE);
- processService.intentProcess(intentGoalBean);
+ formatIntentInputManagementFunction.receiveIntentAsOwner(new IntentGoalBean(intent,IntentGoalType.DELETE));
log.info("Execute delete intent finished");
return new ServiceResult(new ResultHeader(RSEPONSE_SUCCESS, "delete intent success"));
} catch (CommonException exception) {
@@ -140,4 +130,6 @@ public class IntentController {
}
}
-}
+
+
+} \ No newline at end of file
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunction.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunction.java
index 4d16d92..79578ec 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunction.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunction.java
@@ -131,6 +131,8 @@ public class FormatIntentInputManagementFunction extends IntentManagementFunctio
//update userInput intent
intentService.updateIntent(originIntent);
} else {
+ //deal with userInput intent
+ intentService.deleteIntent(originIntent.getIntentId());
// intent-Distribution-delete
boolean isAcceptDelete = intentInterfaceService.deleteInterface(originIntent, next.getKey(), next.getValue());
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java
index efd09a2..f9d0c74 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java
@@ -121,7 +121,6 @@ public class FormatIntentInputDecisionModule extends DecisionModule {
List<Intent> subIntentList = intentContextService.getSubIntentInfoFromContext(intentGoalBean.getIntent());
for (Intent intent : subIntentList) {
IntentManagementFunction intentHandlerInfo = intentContextService.getHandlerInfo(intent);
- // UpdateIntentInfo(intentGoalBean.getIntent(), intent);//new process move to defineProcess
IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.UPDATE);
intentMap.put(subIntentGoalBean, intentHandlerInfo);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java
index f41c5ee..796bb19 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java
@@ -64,13 +64,6 @@ public abstract class ActuationModule {
public boolean distrubuteIntentToHandler(Map.Entry<IntentGoalBean, IntentManagementFunction> entry) {
IntentGoalType intentGoalType = entry.getKey().getIntentGoalType();
- if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) {
- return intentInterfaceService.createInterface(entry.getKey(), entry.getValue());
- } else if (StringUtils.equalsIgnoreCase("update", intentGoalType.name())) {
- return intentInterfaceService.updateInterface(entry.getKey(), entry.getValue());
- } else if (StringUtils.equalsIgnoreCase("delete", intentGoalType.name())) {
- return intentInterfaceService.deleteInterface(entry.getKey(), entry.getValue());
- }
return false;
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java
index 57483fe..f225d60 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/KnowledgeModule.java
@@ -91,15 +91,17 @@ public abstract class KnowledgeModule {
}
// condition ownerName = foramtIntentInput
List<Context> ownerInfo = intent.getIntentContexts().stream().filter(x ->
- StringUtils.equalsIgnoreCase(x.getContextName(), "ownerInfo")).collect(Collectors.toList());
+ StringUtils.equalsIgnoreCase(x.getContextName(), "owner Info")).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(ownerInfo)) {
for (Context context : ownerInfo) {
List<Condition> contextConditions = context.getContextConditions();
boolean equals = false;
for (Condition condition : contextConditions) {
- String conditionstr = "ownerName equal to formatIntentInputManagementFunction";
- String concatStr = condition.getConditionName() + condition.getOperator().name() + condition.getConditionValue();
- if (StringUtils.equalsIgnoreCase(concatStr.trim(), conditionstr.replaceAll(" ", ""))) {
+ String conditionstr = "owner class name equal to formatIntentInputManagementFunction";
+ String conValue = condition.getConditionValue();
+ String conditionValue = conValue.substring(conValue.lastIndexOf(".")+1);
+ String concatStr = condition.getConditionName() + condition.getOperator().name() + conditionValue;
+ if (StringUtils.equalsIgnoreCase(concatStr.replaceAll(" ",""), conditionstr.replaceAll(" ", ""))) {
fiterList.add(intent);
equals = true;
break;
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentinterfaceservice/IntentInterfaceService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentinterfaceservice/IntentInterfaceService.java
index bbb09f4..bbeb12e 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentinterfaceservice/IntentInterfaceService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentinterfaceservice/IntentInterfaceService.java
@@ -20,13 +20,10 @@ import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
public interface IntentInterfaceService {
- public boolean createInterface(IntentGoalBean intentGoalBean, IntentManagementFunction imf);
public boolean createInterface(Intent originalIntent,IntentGoalBean intentGoalBean, IntentManagementFunction imf);
- public boolean updateInterface(IntentGoalBean intentGoalBean, IntentManagementFunction imf);
public boolean updateInterface(Intent originalIntent,IntentGoalBean intentGoalBean, IntentManagementFunction imf);
- public boolean deleteInterface(IntentGoalBean intentGoalBean, IntentManagementFunction imf);
public boolean deleteInterface(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction imf);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentinterfaceservice/impl/IntentInterfaceServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentinterfaceservice/impl/IntentInterfaceServiceImpl.java
index a9410c6..b142b5a 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentinterfaceservice/impl/IntentInterfaceServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentinterfaceservice/impl/IntentInterfaceServiceImpl.java
@@ -25,10 +25,6 @@ import java.time.LocalDateTime;
@Service
public class IntentInterfaceServiceImpl implements IntentInterfaceService {
- @Override
- public boolean createInterface(IntentGoalBean intentGoalBean, IntentManagementFunction imf) {
- return false;
- }
@Override
public boolean createInterface(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
@@ -42,10 +38,6 @@ public class IntentInterfaceServiceImpl implements IntentInterfaceService {
}
- @Override
- public boolean updateInterface(IntentGoalBean intentGoalBean, IntentManagementFunction imf) {
- return false;
- }
@Override
public boolean updateInterface(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
@@ -56,11 +48,6 @@ public class IntentInterfaceServiceImpl implements IntentInterfaceService {
return true;
}
- @Override
- public boolean deleteInterface(IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
- handler.getKnowledgeModule().recieveDeleteIntent();
- return true;
- }
@Override
public boolean deleteInterface(Intent originalIntent, IntentGoalBean intentGoalBean, IntentManagementFunction handler) {
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunctionTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunctionTest.java
new file mode 100644
index 0000000..2f91691
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/CLLBusinessIntentManagementFunctionTest.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2023 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.cllBusinessIntentMgt;
+
+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.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessActuationModule;
+import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessDecisionModule;
+import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule.CLLBusinessKnowledgeModule;
+import org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.CLLDeliveryIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule.FormatIntentInputActuationModule;
+import org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule.FormatIntentInputDecisionModule;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.contextService.IntentContextService;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentEventRecord.IntentEventRecordService;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentinterfaceservice.IntentInterfaceService;
+import org.onap.usecaseui.intentanalysis.service.ContextService;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.beans.factory.annotation.Autowired;
+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.LinkedHashMap;
+import java.util.List;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class CLLBusinessIntentManagementFunctionTest {
+ @InjectMocks
+ CLLBusinessIntentManagementFunction cllBusinessIntentManagementFunction;
+ KnowledgeModule knowledgeModule = mock(CLLBusinessKnowledgeModule.class);
+ DecisionModule decisionModule = mock(CLLBusinessDecisionModule.class);
+ ActuationModule actuationModule = mock(CLLBusinessActuationModule.class);
+ @Mock
+ CLLDeliveryIntentManagementFunction cllDeliveryIntentManagementFunction;
+ @Mock
+ public IntentContextService intentContextService;
+ @Mock
+ IntentInterfaceService intentInterfaceService;
+ @Mock
+ ApplicationContext applicationContext;
+ @Mock
+ ContextService contextService;
+ @Mock
+ IntentService intentService;
+ @Mock
+ IntentEventRecordService intentEventRecordService;
+
+ 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.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);
+ intentGoalBean.setIntent(intent);
+ intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
+ }
+
+ @Test
+ public void testDetection() {
+ cllBusinessIntentManagementFunction.detection(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+ @Test
+ public void testInvestigation() {
+ cllBusinessIntentManagementFunction.investigation(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+ @Test
+ public void testImplementIntentCreate() { // TODO: 2023/3/30
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>();
+ map.put(intentGoalBean, cllDeliveryIntentManagementFunction);
+ Mockito.when(decisionModule.intentObjectDefine(any(),any())).thenReturn(intent);
+ cllBusinessIntentManagementFunction.implementIntent(intent, map);
+ Assert.assertTrue(true);
+ }
+ @Test
+ public void testImplementIntentUpdate() {
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>();
+ intentGoalBean.setIntentGoalType(IntentGoalType.UPDATE);
+ map.put(intentGoalBean, cllDeliveryIntentManagementFunction);
+ cllBusinessIntentManagementFunction.implementIntent(intent, map);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testImplementIntentDelete() {
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>();
+ intentGoalBean.setIntentGoalType(IntentGoalType.DELETE);
+ map.put(intentGoalBean, cllDeliveryIntentManagementFunction);
+ cllBusinessIntentManagementFunction.implementIntent(intent, map);
+ Assert.assertTrue(true);
+ }
+
+} \ No newline at end of file
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunctionTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunctionTest.java
new file mode 100644
index 0000000..9aba940
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/FormatIntentInputManagementFunctionTest.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2023 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;
+
+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.formatintentinputMgt.formatintentinputModule.FormatIntentInputActuationModule;
+import org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule.FormatIntentInputDecisionModule;
+import org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule.FormatIntentInputKnowledgeModule;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.contextService.IntentContextService;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule;
+import org.onap.usecaseui.intentanalysis.intentBaseService.intentinterfaceservice.IntentInterfaceService;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+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.LinkedHashMap;
+import java.util.List;
+
+import static org.mockito.Mockito.mock;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class FormatIntentInputManagementFunctionTest {
+ @InjectMocks
+ FormatIntentInputManagementFunction formatIntentInputManagementFunction;
+ KnowledgeModule knowledgeModule = mock(FormatIntentInputKnowledgeModule.class);
+ DecisionModule decisionModule = mock(FormatIntentInputDecisionModule.class);
+ ActuationModule actuationModule = mock(FormatIntentInputActuationModule.class);
+ @Mock
+ CLLBusinessIntentManagementFunction cllBusinessIntentManagementFunction;
+ @Mock
+ IntentInterfaceService intentInterfaceService;
+ @Mock
+ ApplicationContext applicationContext;
+ @Mock
+ IntentService intentService;
+ @Mock
+ IntentContextService intentContextService;
+
+
+ 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.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);
+ intentGoalBean.setIntent(intent);
+ intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
+ }
+
+ @Test
+ public void testDetection() {
+ formatIntentInputManagementFunction.detection(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testInvestigation() {
+ formatIntentInputManagementFunction.investigation(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testImplementIntentCreate() {
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>();
+ map.put(intentGoalBean, cllBusinessIntentManagementFunction);
+ formatIntentInputManagementFunction.implementIntent(intent, map);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testImplementIntentUpdate() {
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>();
+ intentGoalBean.setIntentGoalType(IntentGoalType.UPDATE);
+ map.put(intentGoalBean, cllBusinessIntentManagementFunction);
+ formatIntentInputManagementFunction.implementIntent(intent, map);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testImplementIntentDelete() {
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>();
+ intentGoalBean.setIntentGoalType(IntentGoalType.DELETE);
+ map.put(intentGoalBean, cllBusinessIntentManagementFunction);
+ formatIntentInputManagementFunction.implementIntent(intent, map);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testUpdateIntentInfo() {
+ Intent originalIntent = new Intent();
+
+ originalIntent.setIntentName("cllIntent");
+ originalIntent.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);
+ originalIntent.setIntentExpectations(expectationList);
+
+ formatIntentInputManagementFunction.updateIntentInfo(originalIntent, intent);
+ Assert.assertTrue(true);
+ }
+} \ No newline at end of file
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
deleted file mode 100644
index cc5830a..0000000
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.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.intentBaseService.contextService.IntentContextService;
-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;
- @Mock
- IntentContextService intentContextService;
- 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);
- }
-
- @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(intent, 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
deleted file mode 100644
index 95e319e..0000000
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionServiceTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-
-/*
- * 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 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.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);
- }
-
- @Test
- public void testDetectionProcess() {
- intentDetectionService.setIntentRole(intentOwner, null);
- IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
- intentDetectionService.detectionProcess(intentGoalBean);
- 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
deleted file mode 100644
index 6453048..0000000
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionServiceTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.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);
- 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
deleted file mode 100644
index 774325e..0000000
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationServiceTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-
-/*
- * 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.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);
- 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
deleted file mode 100644
index 65e425c..0000000
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationServiceTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.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);
- intentGoalBean.setIntent(intent);
- intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
- }
- @Test
- public void testIntentOperation() {
- intentOperationService.setIntentRole(intentOwner, formatIntentInputManagementFunction);
- IntentGoalBean intentGoalBean = new IntentGoalBean(intent,IntentGoalType.CREATE);
- intentOperationService.operationProcess(intent, intentGoalBean);
- 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
deleted file mode 100644
index e961371..0000000
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessServiceTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.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.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);
- 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);
- IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
- intentProcessService.intentProcess(intentGoalBean);
- Assert.assertTrue(true);
- }
-} \ No newline at end of file