diff options
Diffstat (limited to 'intentanalysis')
31 files changed, 1095 insertions, 124 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java index dfb0efe..11bc504 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java @@ -17,7 +17,6 @@ package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule 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.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService; @@ -26,11 +25,6 @@ import org.onap.usecaseui.intentanalysis.service.IntentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - @Component public class CLLBusinessActuationModule extends ActuationModule { @Autowired @@ -42,13 +36,13 @@ public class CLLBusinessActuationModule extends ActuationModule { @Override - public void sendToIntentHandler(Intent intent,IntentManagementFunction IntentHandler) { + public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) { processService.setIntentRole(IntentHandler, null); processService.intentProcess(intent); } @Override - public void sendToNonIntentHandler() { + public void directOperation() { } @@ -56,4 +50,9 @@ public class CLLBusinessActuationModule extends ActuationModule { public void interactWithIntentHandle() { } + + @Override + public void fulfillIntent(Intent intent, IntentManagementFunction intentHandler) { + toNextIntentHandler(intent,intentHandler); + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java index 6428742..83a8931 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java @@ -32,10 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; @Log4j2 @@ -131,9 +128,9 @@ public class CLLBusinessDecisionModule extends DecisionModule { } @Override - public List<Map<IntentGoalBean, IntentManagementFunction>> findHandler(IntentGoalBean intentGoalBean) { + public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) { boolean needDecompostion = needDecompostion(intentGoalBean); - List<Map<IntentGoalBean, IntentManagementFunction>> intentMapList = new ArrayList<>(); + LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>(); if (needDecompostion) { List<IntentGoalBean> subIntentGoalList = intentDecomposition(intentGoalBean); List<IntentGoalBean> sortList = intentOrchestration(subIntentGoalList); @@ -141,14 +138,11 @@ public class CLLBusinessDecisionModule extends DecisionModule { Map<IntentGoalBean, IntentManagementFunction> map = new HashMap<>(); IntentManagementFunction imf = exploreIntentHandlers(subIntentGoal); map.put(subIntentGoal, imf); - intentMapList.add(map); } } else { - Map<IntentGoalBean, IntentManagementFunction> map = new HashMap<>(); - map.put(intentGoalBean, exploreIntentHandlers(intentGoalBean)); - intentMapList.add(map); + intentMap.put(intentGoalBean, exploreIntentHandlers(intentGoalBean)); } - return intentMapList; + return intentMap; } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/CLLAssuranceIntentManagementFunction.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/CLLAssuranceIntentManagementFunction.java index 3e489ae..7947edb 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/CLLAssuranceIntentManagementFunction.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/CLLAssuranceIntentManagementFunction.java @@ -15,7 +15,29 @@ */ package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt; +import lombok.Data; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; +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.springframework.stereotype.Component; +import javax.annotation.Resource; +@Data +@Component("CLLAssuranceIntentManagementFunction") public class CLLAssuranceIntentManagementFunction extends IntentManagementFunction { + @Resource(name = "CLLAssuranceActuationModule") + public void setActuationModule(ActuationModule actuationModule) { + this.actuationModule = actuationModule; + } + + @Resource(name = "CLLAssuranceKnowledgeModule") + public void setKnowledgeModule(KnowledgeModule knowledgeModule) { + this.knowledgeModule = knowledgeModule; + } + + @Resource(name = "CLLAssuranceDecisionModule") + public void setDecisionModule(DecisionModule decisionModule) { + this.decisionModule = decisionModule; + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java index c061d76..325e980 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java @@ -15,5 +15,30 @@ */ package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule; -public class CLLAssuranceActuationModule { +import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; +import org.springframework.stereotype.Component; + +@Component +public class CLLAssuranceActuationModule extends ActuationModule { + @Override + public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) { + + } + + @Override + public void directOperation() { + + } + + @Override + public void interactWithIntentHandle() { + + } + + @Override + public void fulfillIntent(Intent intent, IntentManagementFunction intentHandler) { + directOperation(); + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceDecisionModule.java index 8a65b55..2054484 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceDecisionModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceDecisionModule.java @@ -15,5 +15,41 @@ */ package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule; -public class CLLAssuranceDecisionModule { +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; +import org.springframework.stereotype.Component; + +import java.util.LinkedHashMap; +@Component +public class CLLAssuranceDecisionModule extends DecisionModule { + @Override + public void determineUltimateGoal() { + + } + + @Override + public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) { + return null; + } + + @Override + public void intentDefinition() { + + } + + @Override + public void decideSuitableAction() { + + } + + @Override + public void interactWithTemplateDb() { + + } + + @Override + public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) { + return null; + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceKnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceKnowledgeModule.java index 75bffbd..c1300f0 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceKnowledgeModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceKnowledgeModule.java @@ -15,5 +15,30 @@ */ package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule; -public class CLLAssuranceKnowledgeModule { +import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule; +import org.springframework.stereotype.Component; + +@Component +public class CLLAssuranceKnowledgeModule extends KnowledgeModule { + @Override + public IntentGoalBean intentCognition(Intent intent) { + return null; + } + + @Override + public boolean recieveCreateIntent() { + return false; + } + + @Override + public boolean recieveUpdateIntent() { + return false; + } + + @Override + public boolean recieveDeleteIntent() { + return false; + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/CLLDeliveryIntentManagementFunction.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/CLLDeliveryIntentManagementFunction.java new file mode 100644 index 0000000..fe37f95 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/CLLDeliveryIntentManagementFunction.java @@ -0,0 +1,43 @@ +/* + * 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.clldeliveryIntentmgt; + +import lombok.Data; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; +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.springframework.stereotype.Component; + +import javax.annotation.Resource; +@Data +@Component("CLLDeliveryIntentManagementFunction") +public class CLLDeliveryIntentManagementFunction extends IntentManagementFunction { + @Resource(name = "CLLDeliveryActuationModule") + public void setActuationModule(ActuationModule actuationModule) { + this.actuationModule = actuationModule; + } + + @Resource(name = "CLLDeliveryKnowledgeModule") + public void setKnowledgeModule(KnowledgeModule knowledgeModule) { + this.knowledgeModule = knowledgeModule; + } + + @Resource(name = "CLLDeliveryDecisionModule") + public void setDecisionModule(DecisionModule decisionModule) { + this.decisionModule = decisionModule; + } +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/CLLDeliveryManagementFunction.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/CLLDeliveryManagementFunction.java deleted file mode 100644 index 76b0cf5..0000000 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/CLLDeliveryManagementFunction.java +++ /dev/null @@ -1,21 +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.clldeliveryIntentmgt; - -import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; - -public class CLLDeliveryManagementFunction extends IntentManagementFunction { -} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java index 65a2ca8..b111a9f 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java @@ -15,5 +15,30 @@ */ package org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.clldeliverymodule; -public class CLLDeliveryActuationModule { +import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; +import org.springframework.stereotype.Component; + +@Component +public class CLLDeliveryActuationModule extends ActuationModule { + @Override + public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) { + + } + + @Override + public void directOperation() { + + } + + @Override + public void interactWithIntentHandle() { + + } + + @Override + public void fulfillIntent(Intent intent, IntentManagementFunction intentHandler) { + this.directOperation(); + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryDecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryDecisionModule.java index 42dea4f..e73aab4 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryDecisionModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryDecisionModule.java @@ -15,5 +15,41 @@ */ package org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.clldeliverymodule; -public class CLLDeliveryDecisionModule { +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; +import org.springframework.stereotype.Component; + +import java.util.LinkedHashMap; +@Component +public class CLLDeliveryDecisionModule extends DecisionModule { + @Override + public void determineUltimateGoal() { + + } + + @Override + public IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean) { + return null; + } + + @Override + public void intentDefinition() { + + } + + @Override + public void decideSuitableAction() { + + } + + @Override + public void interactWithTemplateDb() { + + } + + @Override + public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) { + return null; + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryKnowledgeModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryKnowledgeModule.java index c2f5278..1222d4d 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryKnowledgeModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryKnowledgeModule.java @@ -15,5 +15,30 @@ */ package org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.clldeliverymodule; -public class CLLDeliveryKnowledgeModule { +import org.onap.usecaseui.intentanalysis.bean.models.Intent; +import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; +import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule; +import org.springframework.stereotype.Component; + +@Component +public class CLLDeliveryKnowledgeModule extends KnowledgeModule { + @Override + public IntentGoalBean intentCognition(Intent intent) { + return null; + } + + @Override + public boolean recieveCreateIntent() { + return false; + } + + @Override + public boolean recieveUpdateIntent() { + return false; + } + + @Override + public boolean recieveDeleteIntent() { + return false; + } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java index 8042d7f..1d397fd 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java @@ -15,27 +15,32 @@ */ package org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule; +import lombok.extern.log4j.Log4j2; import org.onap.usecaseui.intentanalysis.bean.models.Intent; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule; import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +@Log4j2 @Component public class FormatIntentInputActuationModule extends ActuationModule { @Autowired IntentProcessService processService; @Override - public void sendToIntentHandler(Intent intent, IntentManagementFunction IntentHandler) { - processService.setIntentRole(IntentHandler, null); - processService.intentProcess(intent); + public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) { + log.info("do nothing"); } @Override - public void sendToNonIntentHandler() { + public void directOperation() { } @Override public void interactWithIntentHandle() { } + + @Override + public void fulfillIntent(Intent intent, IntentManagementFunction intentHandler) { + } } 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 4faa719..edb3814 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 @@ -58,17 +58,15 @@ public class FormatIntentInputDecisionModule extends DecisionModule { } @Override - public List<Map<IntentGoalBean, IntentManagementFunction>> findHandler(IntentGoalBean intentGoalBean) { - List<Map<IntentGoalBean, IntentManagementFunction>> intentMapList = new ArrayList<>(); + public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) { + LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>(); boolean needDecompostion = needDecompostion(intentGoalBean); if (needDecompostion) { intentDecomposition(intentGoalBean); }else{ - Map<IntentGoalBean, IntentManagementFunction> map = new HashMap<>(); - map.put(intentGoalBean, exploreIntentHandlers(intentGoalBean)); - intentMapList.add(map); + intentMap.put(intentGoalBean, exploreIntentHandlers(intentGoalBean)); } - return intentMapList; + return intentMap; } public boolean needDecompostion(IntentGoalBean intentGoalBean) { diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java index cb21982..6d40996 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java @@ -61,7 +61,7 @@ public class IMFRegInfoServiceImpl implements IMFRegInfoService { (IntentManagementFunction)applicationContext.getBean(managetFunctionRegName); ActuationModule actuationModule = function.getActuationModule(); - actuationModule.sendToNonIntentHandler(); + actuationModule.directOperation(); IntentManagementFunction intentManagementFunction = (IntentManagementFunction) Class.forName(managetFunctionRegName) .getDeclaredConstructor().newInstance(); 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 6c7b4f7..ec60df2 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 @@ -24,9 +24,7 @@ import org.onap.usecaseui.intentanalysis.intentBaseService.intentinterfaceservic import org.onap.usecaseui.intentanalysis.service.IntentService; import org.springframework.beans.factory.annotation.Autowired; -import java.util.List; import java.util.Map; -import java.util.stream.Collectors; public abstract class ActuationModule { @Autowired @@ -34,33 +32,31 @@ public abstract class ActuationModule { @Autowired IntentService intentService; - //actuationModel & knownledgeModel interact - public abstract void sendToIntentHandler(Intent intent, IntentManagementFunction IntentHandler); + //send to the next level intent handler + public abstract void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler); - public abstract void sendToNonIntentHandler();//直接操作 + //Direct operation + public abstract void directOperation(); public abstract void interactWithIntentHandle(); //Save intent information to the intent instance database - public void saveIntentToDb(Map<IntentGoalBean, IntentManagementFunction> intentMap) { - List<Intent> subIntentList = intentMap.keySet().stream().map(IntentGoalBean::getIntent) - .collect(Collectors.toList()); - for (Intent subIntent : subIntentList) { - intentService.createIntent(subIntent); - } + public void saveIntentToDb(Intent intent) { + intentService.createIntent(intent); } - public boolean distrubuteIntentToHandler(Map<IntentGoalBean, IntentManagementFunction> intentMap) { - for (Map.Entry<IntentGoalBean, IntentManagementFunction> entry : intentMap.entrySet()) { - IntentGoalType intentGoalType = entry.getKey().getIntentGoalType(); - if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) { - return intentInterfaceService.createInterface(entry.getKey().getIntent(), entry.getValue()); - } else if (StringUtils.equalsIgnoreCase("update", intentGoalType.name())) { - return intentInterfaceService.updateInterface(entry.getKey().getIntent(), entry.getValue()); - } else if (StringUtils.equalsIgnoreCase("delete", intentGoalType.name())) { - return intentInterfaceService.deleteInterface(entry.getKey().getIntent(), entry.getValue()); - } + public boolean distrubuteIntentToHandler(Map.Entry<IntentGoalBean, IntentManagementFunction> entry) { + IntentGoalType intentGoalType = entry.getKey().getIntentGoalType(); + if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) { + return intentInterfaceService.createInterface(entry.getKey().getIntent(), entry.getValue()); + } else if (StringUtils.equalsIgnoreCase("update", intentGoalType.name())) { + return intentInterfaceService.updateInterface(entry.getKey().getIntent(), entry.getValue()); + } else if (StringUtils.equalsIgnoreCase("delete", intentGoalType.name())) { + return intentInterfaceService.deleteInterface(entry.getKey().getIntent(), entry.getValue()); } return false; } + + //determine if the intent is to be processed directly or sent to the next-level processor + public abstract void fulfillIntent(Intent intent, IntentManagementFunction intentHandler); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java index a89656b..52dab8e 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java @@ -19,8 +19,7 @@ package org.onap.usecaseui.intentanalysis.intentBaseService.intentModule; import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; -import java.util.List; -import java.util.Map; +import java.util.LinkedHashMap; public abstract class DecisionModule { public abstract void determineUltimateGoal(); @@ -34,6 +33,6 @@ public abstract class DecisionModule { public abstract void interactWithTemplateDb(); - public abstract List<Map<IntentGoalBean, IntentManagementFunction>> findHandler(IntentGoalBean intentGoalBean); + public abstract LinkedHashMap<IntentGoalBean,IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean); } 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 02d467a..bce9c95 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 @@ -19,10 +19,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.onap.usecaseui.intentanalysis.bean.models.*; import org.onap.usecaseui.intentanalysis.service.IntentService; -import org.onap.usecaseui.intentanalysis.service.impl.IntentServiceImpl; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionService.java index 01581c4..31119e1 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionService.java @@ -41,10 +41,10 @@ public class IntentDefinitionService { } } - public void definitionPorcess(Map<IntentGoalBean,IntentManagementFunction> intentMap) { + public void definitionPorcess(Map.Entry<IntentGoalBean, IntentManagementFunction> entry) { DecisionModule intentDecisionModule = intentOwner.getDecisionModule(); ActuationModule intentActuationModule = intentOwner.getActuationModule(); intentDecisionModule.intentDefinition(); - intentActuationModule.saveIntentToDb(intentMap);//id type + intentActuationModule.saveIntentToDb(entry.getKey().getIntent());//id type } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java index 3a4e48e..83f9b00 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDistributionService.java @@ -41,9 +41,9 @@ public class IntentDistributionService { } } - public boolean distributionProcess(Map<IntentGoalBean, IntentManagementFunction> intentMap) { + public boolean distributionProcess(Map.Entry<IntentGoalBean, IntentManagementFunction> entry) { - return intentOwner.getActuationModule().distrubuteIntentToHandler(intentMap); + return intentOwner.getActuationModule().distrubuteIntentToHandler(entry); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationService.java index 36476b1..ac4612f 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationService.java @@ -21,10 +21,7 @@ import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunct import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Service public class IntentInvestigationService { @@ -40,7 +37,7 @@ public class IntentInvestigationService { } } - public List<Map<IntentGoalBean,IntentManagementFunction>> investigationProcess(IntentGoalBean intentGoalBean) { + public LinkedHashMap<IntentGoalBean,IntentManagementFunction> investigationProcess(IntentGoalBean intentGoalBean) { DecisionModule intentDecisionModule = intentOwner.getDecisionModule(); return intentDecisionModule.findHandler(intentGoalBean); } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationService.java index f26be6c..d2eb313 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationService.java @@ -28,24 +28,22 @@ public class IntentOperationService { private IntentManagementFunction intentHandler; private IntentManagementFunction intentOwner; - public void setIntentRole(IntentManagementFunction intentOwner, IntentManagementFunction intentHandler){ - if (intentOwner!= null){ + public void setIntentRole(IntentManagementFunction intentOwner, IntentManagementFunction intentHandler) { + if (intentOwner != null) { this.intentOwner = intentOwner; } - if (intentHandler!= null){ - this.intentHandler= intentHandler; + if (intentHandler != null) { + this.intentHandler = intentHandler; } } public void operationProcess(Intent intent) { DecisionModule intentDecisionModule = intentOwner.getDecisionModule(); - ActuationModule intentActuationModule = intentOwner.getActuationModule(); + ActuationModule intentActuationModule = intentHandler.getActuationModule(); //intentDecisionModule.interactWithTemplateDb(); intentActuationModule.interactWithIntentHandle(); - - intentActuationModule.sendToIntentHandler(intent,intentHandler); - - intentActuationModule.sendToNonIntentHandler(); + //determine whether to operate directly or send to next intent handler + intentActuationModule.fulfillIntent(intent, intentHandler); } } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java index df1c437..fc18bf7 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java @@ -22,7 +22,8 @@ import org.onap.usecaseui.intentanalysis.service.IntentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.List; +import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.Map; @Service @@ -37,47 +38,44 @@ public class IntentProcessService { IntentDistributionService intentDistributionService; @Autowired IntentOperationService intentOperationService; -@Autowired + @Autowired IntentService intentService; private IntentManagementFunction intentOwner; private IntentManagementFunction intentHandler; - public void setIntentRole(IntentManagementFunction intentOwner, IntentManagementFunction intentHandler){ - if (intentOwner!= null){ + public void setIntentRole(IntentManagementFunction intentOwner, IntentManagementFunction intentHandler) { + if (intentOwner != null) { this.intentOwner = intentOwner; } - if (intentHandler!= null){ - this.intentHandler= intentHandler; + if (intentHandler != null) { + this.intentHandler = intentHandler; } } + public void intentProcess(Intent intent) { - intentDetectionService.setIntentRole(intentOwner,intentHandler); + intentDetectionService.setIntentRole(intentOwner, intentHandler); IntentGoalBean intentGoalBean = intentDetectionService.detectionProcess(intent); //investigation process - intentInvestigationService.setIntentRole(intentOwner,intentHandler); - List<Map<IntentGoalBean,IntentManagementFunction>> intentListMap = + intentInvestigationService.setIntentRole(intentOwner, intentHandler); + LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = intentInvestigationService.investigationProcess(intentGoalBean); - - for (Map<IntentGoalBean,IntentManagementFunction> map : intentListMap) { + Iterator<Map.Entry<IntentGoalBean, IntentManagementFunction>> iterator = intentMap.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry<IntentGoalBean, IntentManagementFunction> next = iterator.next(); //definition process save subintent - intentDefinitionService.setIntentRole(intentOwner,intentHandler); - intentDefinitionService.definitionPorcess(map); + intentDefinitionService.setIntentRole(intentOwner, intentHandler); + intentDefinitionService.definitionPorcess(next); //distribution process - intentDistributionService.setIntentRole(intentOwner,intentHandler); - intentDistributionService.distributionProcess(map); - - //operation process enery entry only have one key-value - for (Map.Entry<IntentGoalBean, IntentManagementFunction> entry : map.entrySet()) { - intentOperationService.setIntentRole(intentOwner,entry.getValue()); - intentOperationService.operationProcess(entry.getKey().getIntent()); - } + intentDistributionService.setIntentRole(intentOwner, intentHandler); + intentDistributionService.distributionProcess(next); + intentOperationService.setIntentRole(intentOwner, next.getValue()); + intentOperationService.operationProcess(next.getKey().getIntent()); } } - } 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 diff --git a/intentanalysis/src/test/resources/intentdb-test-init.sql b/intentanalysis/src/test/resources/intentdb-test-init.sql index 211e1cb..3a60df7 100644 --- a/intentanalysis/src/test/resources/intentdb-test-init.sql +++ b/intentanalysis/src/test/resources/intentdb-test-init.sql @@ -78,3 +78,11 @@ create table if not exists condition parent_id varchar(255) ); +create table if not exists intent_management_function_reg_info( + imfr_info_id varchar(255) primary key, + imfr_info_description varchar(255), + support_model varchar(255), + handle_name varchar(255), + intent_function_type varchar(255) + ); + |