summaryrefslogtreecommitdiffstats
path: root/intentanalysis
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyService.java2
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/apicall/PolicyAPICall.java4
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/impl/PolicyServiceImpl.java87
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/SOService.java3
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAPICall.java7
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/impl/SOServiceImpl.java24
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessActuationModule.java15
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java52
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModule.java72
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceDecisionModule.java15
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryActuationModule.java91
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/clldeliveryIntentmgt/clldeliverymodule/CLLDeliveryDecisionModule.java13
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentController.java31
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputActuationModule.java43
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModule.java70
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/contextService/IntentContextService.java187
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/ActuationModule.java16
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentModule/DecisionModule.java50
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionService.java31
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java14
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentInvestigationService.java23
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationService.java6
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessService.java19
-rw-r--r--intentanalysis/src/main/resources/application.yaml1
-rw-r--r--intentanalysis/src/main/resources/intent-analysis-data.sql8
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyServiceTest.java10
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/so/SOServiceTest.java18
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java18
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/formatintentinputMgt/formatintentinputModule/FormatIntentInputDecisionModuleTest.java2
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDefinitionServiceTest.java2
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionServiceTest.java5
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentOperationServiceTest.java2
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentProcessServiceTest.java3
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ContextServiceTest.java18
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationObjectServiceTest.java18
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationServiceTest.java18
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationTargetServiceTest.java18
-rw-r--r--intentanalysis/src/test/resources/intentdb-test-data.sql4
38 files changed, 874 insertions, 146 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyService.java
index 4511ed0..e5bc0bd 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyService.java
@@ -37,6 +37,6 @@ public interface PolicyService {
* @param closedLoopStatus True: start monitor, False: stop monitor
* @return
*/
- boolean updateIntentConfigPolicy(String cllId, String originalBW, boolean closedLoopStatus);
+ boolean updateIntentConfigPolicy(String cllId, String originalBW, String closedLoopStatus);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/apicall/PolicyAPICall.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/apicall/PolicyAPICall.java
index 8240661..4b38ebf 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/apicall/PolicyAPICall.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/apicall/PolicyAPICall.java
@@ -39,9 +39,9 @@ public interface PolicyAPICall {
"Accept: application/json",
"Content-Type: application/json"
})
- @POST("/policy/api/v1/policytypes/{policyType}/versions/{policyTypeVersion}/policies")
+ @POST("/policy/api/v1/policytypes/{policyType}/versions/{policyVersion}/policies")
Call<ResponseBody> createPolicy(@Path("policyType") String policyType,
- @Path("policyTypeVersion") String policyTypeVersion, @Body RequestBody body);
+ @Path("policyVersion") String policyVersion, @Body RequestBody body);
@Headers({
"Accept: application/json",
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/impl/PolicyServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/impl/PolicyServiceImpl.java
index d51d338..97fb1ef 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/impl/PolicyServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/policy/impl/PolicyServiceImpl.java
@@ -19,6 +19,10 @@ package org.onap.usecaseui.intentanalysis.adapters.policy.impl;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
+import java.util.LinkedHashMap;
+
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
@@ -41,13 +45,15 @@ public class PolicyServiceImpl implements PolicyService {
private PolicyAPICall policyAPICall;
+ private static StringBuilder policyVersion = new StringBuilder("0.0.0") ;
+
@Autowired
PolicyAuthConfig policyAuthConfig;
public PolicyAPICall getPolicyAPICall() {
if (null == policyAPICall) {
this.policyAPICall = RestfulServices.create(PolicyAPICall.class, policyAuthConfig.getUserName(),
- policyAuthConfig.getPassword());
+ policyAuthConfig.getPassword());
}
return this.policyAPICall;
}
@@ -65,9 +71,9 @@ public class PolicyServiceImpl implements PolicyService {
logger.info(String.format("Create policy, request body: %s", policyBody));
RequestBody policyReq = RequestBody.create(MediaType.parse("application/json"), policyBody.toString());
Response<ResponseBody> policyResponse = getPolicyAPICall().createPolicy(ModifyCLLPolicyConstants.policyType,
- ModifyCLLPolicyConstants.policyTypeVersion, policyReq).execute();
+ ModifyCLLPolicyConstants.policyTypeVersion, policyReq).execute();
logger.info(String.format("Create policy result, code: %d body: %s", policyResponse.code(),
- getResponseBodyStr(policyResponse)));
+ getResponseBodyStr(policyResponse)));
if (!policyResponse.isSuccessful()) {
logger.error("Create modify cll policy failed.");
return false;
@@ -78,10 +84,10 @@ public class PolicyServiceImpl implements PolicyService {
String deployPolicyBody = FileUtils.readFileToString(deployPolicyFile, StandardCharsets.UTF_8);
logger.info(String.format("Deploy policy, request body: %s", deployPolicyBody));
RequestBody deployPolicyReq = RequestBody.create(MediaType.parse("application/json"),
- deployPolicyBody.toString());
+ deployPolicyBody.toString());
Response<ResponseBody> deployPolicyResponse = getPolicyAPICall().deployPolicy(deployPolicyReq).execute();
logger.info(String.format("Deploy policy result, code: %d body: %s", deployPolicyResponse.code(),
- getResponseBodyStr(deployPolicyResponse)));
+ getResponseBodyStr(deployPolicyResponse)));
if (!deployPolicyResponse.isSuccessful()) {
logger.error("Deploy modify cll policy failed.");
return false;
@@ -97,20 +103,20 @@ public class PolicyServiceImpl implements PolicyService {
@Override
public boolean undeployAndRemoveModifyCLLPolicy() {
return undeployAndRemovePolicyIfExist(ModifyCLLPolicyConstants.policyType,
- ModifyCLLPolicyConstants.policyTypeVersion, ModifyCLLPolicyConstants.policyName,
- ModifyCLLPolicyConstants.policyVersion);
+ ModifyCLLPolicyConstants.policyTypeVersion, ModifyCLLPolicyConstants.policyName,
+ ModifyCLLPolicyConstants.policyVersion);
}
@Override
- public boolean updateIntentConfigPolicy(String cllId, String originalBW, boolean closedLoopStatus) {
+ public boolean updateIntentConfigPolicy(String cllId, String originalBW, String closedLoopStatus) {
//the policy engine does not support update now. so we need to remove and recreate the policy now.
logger.info(String.format(
- "Start to update the intent configuration policy, cllId: %s, originalBW: %s, closedLooopStatus:%b", cllId,
- originalBW, closedLoopStatus));
+ "Start to update the intent configuration policy, cllId: %s, originalBW: %s, closedLooopStatus:%b", cllId,
+ originalBW, closedLoopStatus));
//remove the configuration policy first
boolean res = undeployAndRemovePolicyIfExist(IntentConfigPolicyConstants.policyType,
- IntentConfigPolicyConstants.policyTypeVersion, IntentConfigPolicyConstants.policyName,
- IntentConfigPolicyConstants.policyVersion);
+ IntentConfigPolicyConstants.policyTypeVersion, IntentConfigPolicyConstants.policyName,
+ IntentConfigPolicyConstants.policyVersion);
if (!res) {
logger.warn("Undeploy and remove the intent configuration policy failed.");
}
@@ -130,17 +136,17 @@ public class PolicyServiceImpl implements PolicyService {
* @param closedLoopStatus
* @return
*/
- public boolean createAndDeployIntentConfigPolicy(String cllId, String originalBW, boolean closedLoopStatus) {
+ public boolean createAndDeployIntentConfigPolicy(String cllId, String originalBW, String closedLoopStatus) {
try {
//Create policy type
File policyTypeFile = Resources.getResourceAsFile("intentPolicy/intent_configs_policy_type.json");
String policyTypeBody = FileUtils.readFileToString(policyTypeFile, StandardCharsets.UTF_8);
logger.info(String.format("Create policy type, request body: %s", policyTypeBody));
RequestBody policyTypeReq = RequestBody.create(MediaType.parse("application/json"),
- policyTypeBody.toString());
+ policyTypeBody.toString());
Response<ResponseBody> response = getPolicyAPICall().createPolicyType(policyTypeReq).execute();
logger.info(String.format("Create policy type result, code: %d body: %s", response.code(),
- getResponseBodyStr(response)));
+ getResponseBodyStr(response)));
if (!response.isSuccessful()) {
logger.error("Create intent configuration policy type failed.");
return false;
@@ -149,15 +155,16 @@ public class PolicyServiceImpl implements PolicyService {
File policyFile = Resources.getResourceAsFile("intentPolicy/intent_configs_policy.json");
String policyBodyTemplate = FileUtils.readFileToString(policyFile, StandardCharsets.UTF_8);
String policyBody = policyBodyTemplate.replace("${CLL_ID}", cllId)
- .replace("${CLOSED_LOOP_STATUS}", String.valueOf(closedLoopStatus))
- .replace("${ORIGINAL_BW}", originalBW);
- logger.info(String.format("Create policy, request body: %s", policyBody));
- RequestBody policyReq = RequestBody.create(MediaType.parse("application/json"), policyBody.toString());
+ .replace("${CLOSED_LOOP_STATUS}", closedLoopStatus)
+ .replace("${ORIGINAL_BW}", originalBW);
+ String policyJsonBody = updatePolicyVersion(policyBody);
+ logger.info(String.format("Create policy, request body: %s", policyJsonBody));
+ RequestBody policyReq = RequestBody.create(MediaType.parse("application/json"), policyJsonBody);
Response<ResponseBody> policyResponse = getPolicyAPICall().createPolicy(
- IntentConfigPolicyConstants.policyType, IntentConfigPolicyConstants.policyTypeVersion, policyReq)
- .execute();
+ IntentConfigPolicyConstants.policyType, policyVersion.toString(), policyReq)
+ .execute();
logger.info(String.format("Create policy result, code: %d body: %s", policyResponse.code(),
- getResponseBodyStr(policyResponse)));
+ getResponseBodyStr(policyResponse)));
if (!policyResponse.isSuccessful()) {
logger.error("Create intent configuration policy failed.");
return false;
@@ -168,10 +175,10 @@ public class PolicyServiceImpl implements PolicyService {
String deployPolicyBody = FileUtils.readFileToString(deployPolicyFile, StandardCharsets.UTF_8);
logger.info(String.format("Deploy policy, request body: %s", deployPolicyBody));
RequestBody deployPolicyReq = RequestBody.create(MediaType.parse("application/json"),
- deployPolicyBody.toString());
+ deployPolicyBody.toString());
Response<ResponseBody> deployPolicyResponse = getPolicyAPICall().deployPolicy(deployPolicyReq).execute();
logger.info(String.format("Deploy policy result, code: %d body: %s", deployPolicyResponse.code(),
- getResponseBodyStr(deployPolicyResponse)));
+ getResponseBodyStr(deployPolicyResponse)));
if (!deployPolicyResponse.isSuccessful()) {
logger.error("Deploy intent configuration policy failed.");
return false;
@@ -190,24 +197,24 @@ public class PolicyServiceImpl implements PolicyService {
* @return
*/
private boolean undeployAndRemovePolicyIfExist(String policyType, String policyTypeVersion, String policyName,
- String policyVersion) {
+ String policyVersion) {
try {
//check if the policy exists
Response<ResponseBody> response = getPolicyAPICall().getPolicy(policyType, policyTypeVersion, policyName,
- policyVersion).execute();
+ policyVersion).execute();
logger.info(String.format("The policy query result, code: %d body: %s", response.code(),
- getResponseBodyStr(response)));
+ getResponseBodyStr(response)));
// remove the policy if exists.
if (response.isSuccessful()) {
logger.info("The policy exists, start to undeploy.");
Response<ResponseBody> undeployResponse = getPolicyAPICall().undeployPolicy(policyName).execute();
logger.info(String.format("Undeploy policy result. code: %d body: %s", undeployResponse.code(),
- getResponseBodyStr(undeployResponse)));
+ getResponseBodyStr(undeployResponse)));
logger.info("Start to remove the policy.");
Response<ResponseBody> removeResponse = getPolicyAPICall().removePolicy(policyName, policyVersion)
- .execute();
+ .execute();
logger.info(String.format("Remove policy result. code: %d body: %s", removeResponse.code(),
- getResponseBodyStr(removeResponse)));
+ getResponseBodyStr(removeResponse)));
return true;
}
return true;
@@ -225,4 +232,24 @@ public class PolicyServiceImpl implements PolicyService {
}
return null;
}
+
+ private String updatePolicyVersion(String policyBody) {
+ JSONObject policyJsonBody = JSONObject.parseObject(policyBody);
+ if (policyVersion.charAt(0) == '0') {
+ policyVersion.setCharAt(0, (char)(policyVersion.charAt(0) + 1));
+ }
+ else {
+ policyVersion.setCharAt(4, (char)(policyVersion.charAt(4) + 1));
+ }
+ JSONObject topologyTemplateObject = policyJsonBody.getJSONObject("topology_template");
+ JSONArray policiesArray = topologyTemplateObject.getJSONArray("policies");
+ JSONObject configObject = policiesArray.getJSONObject(0);
+ JSONObject versionObject = configObject.getJSONObject("onap.dcae.slicems.config");
+ versionObject.put("version", policyVersion.toString());
+ configObject.put("onap.dcae.slicems.config", versionObject);
+ policiesArray.set(0, configObject);
+ topologyTemplateObject.put("policies", policiesArray);
+ policyJsonBody.put("topology_template", topologyTemplateObject);
+ return policyJsonBody.toString();
+ }
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/SOService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/SOService.java
index 7b56e17..c95f16b 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/SOService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/SOService.java
@@ -18,10 +18,13 @@ package org.onap.usecaseui.intentanalysis.adapters.so;
import org.onap.usecaseui.intentanalysis.bean.models.CCVPNInstance;
import org.springframework.stereotype.Service;
+import java.util.Map;
+
public interface SOService {
int createCCVPNInstance(CCVPNInstance instance);
int deleteIntentInstance(String instanceId);
+ int createIntentInstance(Map<String, Object> params);
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAPICall.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAPICall.java
index cd07292..0d27cca 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAPICall.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/apicall/SOAPICall.java
@@ -25,15 +25,16 @@ public interface SOAPICall {
"Accept: application/json",
"Content-Type: application/json"
})
- @POST("/so/infra/serviceIntent/v1/create")
+ //@POST("/so/infra/serviceIntent/v1/create")
+ @POST("/api/usecaseui-server/v1/intent/createIntentInstance")
Call<JSONObject> createIntentInstance(@Body RequestBody body);
@Headers({
"Accept: application/json",
"Content-Type: application/json"
})
- @HTTP(method="DELETE", path="/so/infra/serviceIntent/v1/delete", hasBody = true)
- Call<JSONObject> deleteIntentInstance(@Body RequestBody body);
+ @HTTP(method="DELETE", path="/api/usecaseui-server/v1/intent/deleteIntentInstance")
+ Call<JSONObject> deleteIntentInstance(@Query("instanceId") String instanceId);
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/impl/SOServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/impl/SOServiceImpl.java
index 6f5cbcc..0f80853 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/impl/SOServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/adapters/so/impl/SOServiceImpl.java
@@ -20,7 +20,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.onap.usecaseui.intentanalysis.adapters.aai.apicall.AAIAPICall;
import org.onap.usecaseui.intentanalysis.adapters.aai.apicall.AAIAuthConfig;
-import org.onap.usecaseui.intentanalysis.adapters.policy.apicall.PolicyAPICall;
import org.onap.usecaseui.intentanalysis.adapters.so.SOService;
import org.onap.usecaseui.intentanalysis.adapters.so.apicall.SOAPICall;
import org.onap.usecaseui.intentanalysis.adapters.so.apicall.SOAuthConfig;
@@ -108,14 +107,27 @@ public class SOServiceImpl implements SOService {
}
@Override
- public int deleteIntentInstance(String serviceInstanceId) {
+ public int deleteIntentInstance(String instanceId) {
try {
- deleteInstanceToSO(serviceInstanceId);
+ Response<JSONObject> response = getSoApiCall().deleteIntentInstance(instanceId.substring(4)).execute();
+ return 1;
}catch (Exception e) {
logger.error("delete instance to SO error :" + e);
return 0;
}
- return 1;
+ }
+
+
+ @Override
+ public int createIntentInstance(Map<String, Object> params) {
+ try {
+ okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse("application/json"), JSON.toJSONString(params));
+ Response<JSONObject> response = getSoApiCall().createIntentInstance(requestBody).execute();
+ return 1;
+ } catch (IOException e) {
+ logger.error("Details:" + e.getMessage());
+ return 0;
+ }
}
public String createIntentInstanceToSO(CCVPNInstance ccvpnInstance) throws IOException {
@@ -140,7 +152,7 @@ public class SOServiceImpl implements SOService {
additionalProperties.put("enableSdnc", "true");
params.put("additionalProperties", additionalProperties);
okhttp3.RequestBody requestBody = okhttp3.RequestBody.create(okhttp3.MediaType.parse("application/json"), JSON.toJSONString(params));
- getSoApiCall().deleteIntentInstance(requestBody).execute();
+ //getSoApiCall().deleteIntentInstance(requestBody).execute();
}
private int getCreateStatus(CCVPNInstance ccvpnInstance) throws IOException {
@@ -161,7 +173,7 @@ public class SOServiceImpl implements SOService {
/**
* parameter set up for ccpvpn instance creation
- * @param ccvpnInstance
+ * @param ccvpnInstance
* @return
*/
private Map<String, Object> paramsSetUp(CCVPNInstance ccvpnInstance) {
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 1cc6930..62626bc 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
@@ -20,6 +20,8 @@ import org.apache.commons.collections.CollectionUtils;
import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType;
import org.onap.usecaseui.intentanalysis.bean.models.Condition;
import org.onap.usecaseui.intentanalysis.bean.models.Context;
+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;
@@ -45,13 +47,13 @@ public class CLLBusinessActuationModule extends ActuationModule {
@Override
- public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) {
+ public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
processService.setIntentRole(IntentHandler, null);
- processService.intentProcess(intent);
+ processService.intentProcess(intentGoalBean);
}
@Override
- public void directOperation() {
+ public void directOperation(IntentGoalBean intentGoalBean) {
}
@@ -62,7 +64,7 @@ public class CLLBusinessActuationModule extends ActuationModule {
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
- toNextIntentHandler(intentGoalBean.getIntent(),intentHandler);
+ toNextIntentHandler(intentGoalBean, intentHandler);
}
@Override
@@ -89,4 +91,9 @@ public class CLLBusinessActuationModule extends ActuationModule {
intent.setIntentContexts(intentContexts);
intentService.createIntent(intent);
}
+
+ @Override
+ public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
+
+ }
}
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 722fce9..f073cc2 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
@@ -24,8 +24,10 @@ 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.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.contextService.IntentContextService;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
import org.onap.usecaseui.intentanalysis.service.ImfRegInfoService;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
import org.onap.usecaseui.intentanalysis.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@@ -42,6 +44,12 @@ public class CLLBusinessDecisionModule extends DecisionModule {
@Autowired
private ApplicationContext applicationContext;
+ @Autowired
+ IntentService intentService;
+
+ @Autowired
+ IntentContextService intentContextService;
+
@Override
public void determineUltimateGoal() {
}
@@ -125,7 +133,7 @@ public class CLLBusinessDecisionModule extends DecisionModule {
}
@Override
- public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) {
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
boolean needDecompostion = needDecompostion(intentGoalBean);
LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
if (needDecompostion) {
@@ -142,4 +150,46 @@ public class CLLBusinessDecisionModule extends DecisionModule {
}
+ @Override
+ //format is
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean) {
+ //get cll-delivery cll-assurance intent
+ Intent originIntent = intentGoalBean.getIntent();
+ List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations();
+
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
+ List<Intent> subIntentList = intentContextService.getSubIntentInfoFromContext(intentGoalBean.getIntent());
+ for (Intent intent : subIntentList) {
+ IntentManagementFunction intentHandlerInfo = intentContextService.getHandlerInfo(intent);
+ boolean bFindIntent = false;
+ for (Expectation originExpectation : originIntentExpectationList) {
+ if (intent.getIntentName().equals(originExpectation.getExpectationName())){
+ bFindIntent = true;
+ }
+ }
+
+ if (false == bFindIntent){
+ intentContextService.deleteSubIntentContext(originIntent, intent.getIntentId());
+ IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE);
+ intentMap.put(subIntentGoalBean, intentHandlerInfo);
+ }else{
+ IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.UPDATE);
+ intentMap.put(subIntentGoalBean, intentHandlerInfo);
+ }
+ }
+ return intentMap;
+ }
+
+ @Override
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationDeleteProcess(IntentGoalBean intentGoalBean) {
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
+ List<Intent> subIntentList = intentContextService.getSubIntentInfoFromContext(intentGoalBean.getIntent());
+ for (Intent intent : subIntentList) {
+ IntentManagementFunction intentHandlerInfo = intentContextService.getHandlerInfo(intent);
+ IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE);
+ intentMap.put(subIntentGoalBean, intentHandlerInfo);
+ }
+ return intentMap;
+ }
+
}
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 9e4697f..c80c717 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,22 +15,44 @@
*/
package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule;
-import org.onap.usecaseui.intentanalysis.bean.models.Intent;
-import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.adapters.policy.PolicyService;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
+import org.onap.usecaseui.intentanalysis.bean.models.*;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.List;
+
@Component
public class CLLAssuranceActuationModule extends ActuationModule {
+ @Autowired
+ private IntentService intentService;
+
+ @Autowired
+ private PolicyService policyService;
+
@Override
- public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) {
+ public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
}
@Override
- public void directOperation() {
-
+ public void directOperation(IntentGoalBean intentGoalBean) {
+ Intent intent = intentGoalBean.getIntent();
+ String cllId = getCLLId(intent);
+ String bandwidth = getBandwidth(cllId);
+ IntentGoalType intentGoalType = intentGoalBean.getIntentGoalType();
+ if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) {
+ policyService.updateIntentConfigPolicy(cllId, bandwidth, "true");
+ } else if (StringUtils.equalsIgnoreCase("update", intentGoalType.name())) {
+ policyService.updateIntentConfigPolicy(cllId, bandwidth, "false");
+ } else if (StringUtils.equalsIgnoreCase("delete", intentGoalType.name())) {
+ policyService.updateIntentConfigPolicy(cllId, bandwidth, "false");
+ }
}
@Override
@@ -40,6 +62,44 @@ public class CLLAssuranceActuationModule extends ActuationModule {
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
- directOperation();
+ directOperation(intentGoalBean);
+ }
+
+ @Override
+ public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
+
+ }
+
+ private String getBandwidth(String cllId) {
+ List<Intent> deliveryIntentList = intentService.getIntentByName("CLL Delivery Intent");
+ for (Intent deliveryIntent : deliveryIntentList) {
+ List<Expectation> deliveryExpectationList = deliveryIntent.getIntentExpectations();
+ for (Expectation deliveryExpectation : deliveryExpectationList) {
+ if (StringUtils.equalsIgnoreCase(cllId, deliveryExpectation.getExpectationObject().getObjectInstance())) {
+ List<ExpectationTarget> deliveryTargetList = deliveryExpectation.getExpectationTargets();
+ for (ExpectationTarget deliveryTarget : deliveryTargetList) {
+ if (StringUtils.equalsIgnoreCase("bandwidth", deliveryTarget.getTargetName())) {
+ List<Condition> deliveryConditionList = deliveryTarget.getTargetConditions();
+ for (Condition deliveryCondition : deliveryConditionList) {
+ if (StringUtils.equalsIgnoreCase("condition of the cll service bandwidth", deliveryCondition.getConditionName())) {
+ return deliveryCondition.getConditionValue();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getCLLId(Intent intent) {
+ List<Expectation> expectationList = intent.getIntentExpectations();
+ for (Expectation expectation : expectationList) {
+ if (StringUtils.equalsIgnoreCase("assurance", expectation.getExpectationType().name())) {
+ return expectation.getExpectationObject().getObjectInstance();
+ }
+ }
+ return null;
}
}
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 b2bf018..abd10fd 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,6 +15,9 @@
*/
package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule;
+import java.util.List;
+import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
+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.DecisionModule;
@@ -45,7 +48,17 @@ public class CLLAssuranceDecisionModule extends DecisionModule {
}
@Override
- public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) {
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
+ return null;
+ }
+
+ @Override
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean) {
+ return null;
+ }
+
+ @Override
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationDeleteProcess(IntentGoalBean intentGoalBean) {
return null;
}
}
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 10b8cb7..b642586 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,22 +15,72 @@
*/
package org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.clldeliverymodule;
-import org.onap.usecaseui.intentanalysis.bean.models.Intent;
-import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.adapters.so.SOService;
+import org.onap.usecaseui.intentanalysis.bean.models.*;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
+import org.onap.usecaseui.intentanalysis.service.ExpectationObjectService;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
@Component
+@Slf4j
public class CLLDeliveryActuationModule extends ActuationModule {
+
+ @Autowired
+ private SOService soService;
+
+ @Autowired
+ private ExpectationObjectService expectationObjectService;
+
+ @Autowired
+ private IntentService intentService;
+
@Override
- public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) {
+ public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
}
@Override
- public void directOperation() {
-
+ public void directOperation(IntentGoalBean intentGoalBean) {
+ Intent intent = intentGoalBean.getIntent();
+ if (StringUtils.equalsIgnoreCase("create", intentGoalBean.getIntentGoalType().name())) {
+ Map<String, Object> params = new HashMap<>();
+ Map<String, String> accessPointOne = new HashMap<>();
+ List<ExpectationTarget> targetList = intent.getIntentExpectations().get(0).getExpectationTargets();
+ for (ExpectationTarget target : targetList) {
+ String conditionName = target.getTargetConditions().get(0).getConditionName();
+ String conditionValue = target.getTargetConditions().get(0).getConditionValue();
+ if (StringUtils.containsIgnoreCase(conditionName, "source")) {
+ accessPointOne.put("name", conditionValue);
+ } else if (StringUtils.containsIgnoreCase(conditionName, "destination")) {
+ params.put("cloudPointName", conditionValue);
+ } else if (StringUtils.containsIgnoreCase(conditionName, "bandwidth")) {
+ accessPointOne.put("bandwidth", conditionValue);
+ }
+ }
+ params.put("accessPointOne", accessPointOne);
+ params.put("instanceId", getInstanceId());
+ params.put("name", "cll-" + params.get("instanceId"));
+ params.put("protect", false);
+ soService.createIntentInstance(params);
+ String expectationId = intent.getIntentExpectations().get(0).getExpectationId();
+ ExpectationObject expectationObject = expectationObjectService.getExpectationObject(expectationId);
+ expectationObject.setObjectInstance((String) params.get("name"));
+ expectationObjectService.updateExpectationObject(expectationObject, expectationId);
+ } else {
+ String instanceId = intent.getIntentExpectations().get(0).getExpectationObject().getObjectInstance();
+ soService.deleteIntentInstance(instanceId);
+ intentService.deleteIntent(intent.getIntentId());
+ }
}
@Override
@@ -40,6 +90,35 @@ public class CLLDeliveryActuationModule extends ActuationModule {
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
- this.directOperation();
+ this.directOperation(intentGoalBean);
+ }
+
+ public String getInstanceId() {
+ int random = (int) (Math.random() * 9 + 1);
+
+ String randomString = String.valueOf(random);
+ int hashCode = UUID.randomUUID().toString().hashCode();
+ if (hashCode < 0) {
+ hashCode = -hashCode;
+ }
+ return randomString + String.format("%015d", hashCode);
+ }
+
+ public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
+ Intent subIntent = intentGoalBean.getIntent();
+ if (StringUtils.containsIgnoreCase(subIntent.getIntentName(),"delivery")) {
+ List<Expectation> deliveryIntentExpectationList = intentGoalBean.getIntent().getIntentExpectations();
+ List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations();
+ ExpectationObject deliveryExpectationObject = deliveryIntentExpectationList.get(0).getExpectationObject();
+ String objectInstance = deliveryExpectationObject.getObjectInstance();
+
+ for (Expectation originExpectation : originIntentExpectationList) {
+ ExpectationObject originExpectationObject = originExpectation.getExpectationObject();
+ originExpectationObject.setObjectInstance(objectInstance);
+ expectationObjectService.updateExpectationObject(originExpectationObject,originExpectation.getExpectationId());
+ }
+ }
+
+
}
}
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 62d7d4c..c18cb16 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,6 +15,7 @@
*/
package org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.clldeliverymodule;
+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.DecisionModule;
@@ -45,7 +46,17 @@ public class CLLDeliveryDecisionModule extends DecisionModule {
}
@Override
- public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) {
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
+ return null;
+ }
+
+ @Override
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean) {
+ return null;
+ }
+
+ @Override
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationDeleteProcess(IntentGoalBean intentGoalBean) {
return null;
}
}
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 b274dfa..6e5c7d4 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
@@ -17,7 +17,10 @@
package org.onap.usecaseui.intentanalysis.controller;
+import io.swagger.models.auth.In;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
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.intentProcessService.IntentProcessService;
import org.onap.usecaseui.intentanalysis.service.IntentService;
@@ -56,26 +59,44 @@ public class IntentController {
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Intent> createIntent(@RequestBody Intent intent) {
- return ResponseEntity.ok(intentService.createIntent(intent));
+
+ processService.setIntentRole(formatIntentInputManagementFunction, null);
+ //save original intent
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
+ IntentGoalBean newIntentGoalBean = processService.intentProcess(intentGoalBean);
+ return ResponseEntity.ok(intentService.createIntent(newIntentGoalBean.getIntent()));
}
@PutMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Intent> updateIntentById(
@PathVariable(INTENT_ID) String intentId,
@RequestBody Intent intent) {
- return ResponseEntity.ok(intentService.updateIntent(intent));
+
+ processService.setIntentRole(formatIntentInputManagementFunction, null);
+ //save original intent
+
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.UPDATE);
+ IntentGoalBean newIntentGoalBean = processService.intentProcess(intentGoalBean);
+ return ResponseEntity.ok(intentService.updateIntent(newIntentGoalBean.getIntent()));
}
@DeleteMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE)
public void removeIntentById(@PathVariable(INTENT_ID) String intentId) {
- intentService.deleteIntent(intentId);
+
+ processService.setIntentRole(formatIntentInputManagementFunction, null);
+ //save original intent
+ Intent intent = intentService.getIntent(intentId);
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE);
+ processService.intentProcess(intentGoalBean);
}
@PostMapping(value = "/handleIntent", produces = MediaType.APPLICATION_JSON_VALUE)
public void handleIntent(@RequestBody Intent intent) {
processService.setIntentRole(formatIntentInputManagementFunction, null);
//save original intent
- intentService.createIntent(intent);
- processService.intentProcess(intent);
+
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
+ IntentGoalBean newIntentGoalBean = processService.intentProcess(intentGoalBean);
+ intentService.createIntent(newIntentGoalBean.getIntent());
}
}
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 a017b80..2f8756c 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
@@ -41,13 +41,14 @@ public class FormatIntentInputActuationModule extends ActuationModule {
IntentProcessService processService;
@Autowired
IntentService intentService;
+
@Override
- public void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler) {
+ public void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler) {
log.info("do nothing");
}
@Override
- public void directOperation() {
+ public void directOperation(IntentGoalBean intentGoalBean) {
}
@Override
@@ -56,41 +57,13 @@ public class FormatIntentInputActuationModule extends ActuationModule {
@Override
public void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler) {
+
}
- @Override
- public void saveIntentToDb(Intent intent){
- List<Context> intentContexts = intent.getIntentContexts();
- if (CollectionUtils.isEmpty(intentContexts)) {
- intentContexts = new ArrayList<>();
- }
- Context ownerInfoCon = new Context();
- ownerInfoCon.setContextId(CommonUtil.getUUid());
- ownerInfoCon.setContextName("ownerInfo");
- List<Condition> conditionList = new ArrayList<>();
- Condition condition = new Condition();
- condition.setConditionId(CommonUtil.getUUid());
- condition.setConditionName("ownerName");
- condition.setOperator(OperatorType.EQUALTO);
- condition.setConditionValue(FormatIntentInputManagementFunction.class.getSimpleName());
- conditionList.add(condition);
- ownerInfoCon.setContextConditions(conditionList);
- intentContexts.add(ownerInfoCon);
- //ownerId intentId=parent intent id
- Context ownerIdContext = new Context();
- ownerIdContext.setContextId(CommonUtil.getUUid());
- ownerIdContext.setContextName("ownerId");
- List<Condition> idConditionList = new ArrayList<>();
- Condition idCondition = new Condition();
- idCondition.setConditionId(CommonUtil.getUUid());
- idCondition.setConditionName("intentId");
- idCondition.setOperator(OperatorType.EQUALTO);
- idCondition.setConditionValue(intent.getIntentId());
- idConditionList.add(idCondition);
- ownerIdContext.setContextConditions(idConditionList);
- intentContexts.add(ownerIdContext);
- intent.setIntentContexts(intentContexts);
- intentService.createIntent(intent);
+
+
+ public void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean){
+
}
}
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 dddadc6..0a01357 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
@@ -15,12 +15,21 @@
*/
package org.onap.usecaseui.intentanalysis.formatintentinputMgt.formatintentinputModule;
+import java.util.ArrayList;
import org.apache.commons.lang.StringUtils;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
+import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType;
+import org.onap.usecaseui.intentanalysis.bean.models.Condition;
+import org.onap.usecaseui.intentanalysis.bean.models.Context;
import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
+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.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.onap.usecaseui.intentanalysis.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
@@ -34,6 +43,12 @@ public class FormatIntentInputDecisionModule extends DecisionModule {
@Autowired
ApplicationContext applicationContext;
+ @Autowired
+ public IntentContextService intentContextService;
+
+ @Autowired
+ public IntentService intentService;
+
@Override
public void determineUltimateGoal() {
}
@@ -57,7 +72,7 @@ public class FormatIntentInputDecisionModule extends DecisionModule {
}
@Override
- public LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean) {
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean) {
LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
boolean needDecompostion = needDecompostion(intentGoalBean);
if (needDecompostion) {
@@ -87,4 +102,57 @@ public class FormatIntentInputDecisionModule extends DecisionModule {
//todo
return null;
}
+
+ @Override
+ //format is
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean) {
+ //get format-cll intent
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
+ List<Intent> subIntentList = intentContextService.getSubIntentInfoFromContext(intentGoalBean.getIntent());
+ for (Intent intent : subIntentList) {
+ IntentManagementFunction intentHandlerInfo = intentContextService.getHandlerInfo(intent);
+ UpdateIntentInfo(intentGoalBean.getIntent(), intent);
+ IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.UPDATE);
+ intentMap.put(subIntentGoalBean, intentHandlerInfo);
+ }
+ return intentMap;
+ }
+
+ public void UpdateIntentInfo(Intent originIntent, Intent intent){
+
+ List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations();
+ List<Expectation> intentExpectationList = intent.getIntentExpectations();
+ int newIntentExpectationNum = originIntentExpectationList.size();
+ int oldIntentExpectationNum = intentExpectationList.size();
+
+ if (newIntentExpectationNum != oldIntentExpectationNum){
+ if (newIntentExpectationNum < oldIntentExpectationNum){
+ boolean bFindExpectation = false;
+ for (Expectation oldExpectation : intentExpectationList) {
+ for (Expectation newExpectation : originIntentExpectationList) {
+ if (oldExpectation.getExpectationName().equals(newExpectation.getExpectationName())){
+ bFindExpectation = true;
+ }
+ }
+ if (bFindExpectation == false){
+ intentExpectationList.remove(oldExpectation);
+ }
+ }
+ }
+ }
+ intent.setIntentExpectations(intentExpectationList);
+ }
+
+ @Override
+ public LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationDeleteProcess(IntentGoalBean intentGoalBean) {
+ LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
+ List<Intent> subIntentList = intentContextService.getSubIntentInfoFromContext(intentGoalBean.getIntent());
+ for (Intent intent : subIntentList) {
+ IntentManagementFunction intentHandlerInfo = intentContextService.getHandlerInfo(intent);
+ IntentGoalBean subIntentGoalBean = new IntentGoalBean(intent, IntentGoalType.DELETE);
+ intentMap.put(subIntentGoalBean, intentHandlerInfo);
+ }
+ return intentMap;
+ }
+
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/contextService/IntentContextService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/contextService/IntentContextService.java
new file mode 100644
index 0000000..8a97783
--- /dev/null
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/contextService/IntentContextService.java
@@ -0,0 +1,187 @@
+/*
+ * 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.contextService;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType;
+import org.onap.usecaseui.intentanalysis.bean.models.Condition;
+import org.onap.usecaseui.intentanalysis.bean.models.Context;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.CLLBusinessIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.onap.usecaseui.intentanalysis.util.CommonUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class IntentContextService {
+
+ @Autowired
+ private IntentService intentService;
+
+ @Autowired
+ ApplicationContext applicationContext;
+
+ public void updateChindIntentContext(Intent originIntent, Intent intent){
+ List<Context> contextList = intent.getIntentContexts();
+ if (CollectionUtils.isEmpty(contextList)) {
+ contextList = new ArrayList<>();
+ }
+ Condition condition1 = new Condition();
+ condition1.setConditionId(CommonUtil.getUUid());
+ condition1.setConditionName(originIntent.getIntentName() + "id");
+ condition1.setOperator(OperatorType.EQUALTO);
+ condition1.setConditionValue(originIntent.getIntentId());
+
+ Context context = new Context();
+ context.setContextName("parentIntent info");
+ context.setContextId(CommonUtil.getUUid());
+ List<Condition> conditionList = new ArrayList<>();
+ conditionList.add(condition1);
+ context.setContextConditions(conditionList);
+ contextList.add(context);
+ intent.setIntentContexts(contextList);
+
+ }
+
+ public void updateParentIntentContext(Intent originIntent, Intent intent){
+ List<Context> contextList = originIntent.getIntentContexts();
+ if (CollectionUtils.isEmpty(contextList)) {
+ contextList = new ArrayList<>();
+ }
+
+ Condition condition1 = new Condition();
+ condition1.setConditionId(CommonUtil.getUUid());
+ condition1.setConditionName(intent.getIntentName() + "id");
+ condition1.setOperator(OperatorType.EQUALTO);
+ condition1.setConditionValue(intent.getIntentId());
+
+ boolean isSubIntentInfoExist = false;
+ for (Context context : contextList) {
+ if (context.getContextName().contains("subIntent info")){
+ List<Condition> conditionList = context.getContextConditions();
+ if (CollectionUtils.isEmpty(conditionList)) {
+ conditionList = new ArrayList<>();
+ }
+ conditionList.add(condition1);
+ context.setContextConditions(conditionList);
+ isSubIntentInfoExist = true;
+ }
+ }
+
+ if (isSubIntentInfoExist != true){
+ Context context = new Context();
+ context.setContextName("subIntent info");
+ context.setContextId(CommonUtil.getUUid());
+ List<Condition> conditionList = new ArrayList<>();
+ conditionList.add(condition1);
+ context.setContextConditions(conditionList);
+ contextList.add(context);
+ originIntent.setIntentContexts(contextList);
+ }
+ }
+
+ public void updateIntentOwnerHandlerContext(Intent intent, IntentManagementFunction intentOwner, IntentManagementFunction intentHandler){
+ List<Context> contextList = intent.getIntentContexts();
+ if (CollectionUtils.isEmpty(contextList)){
+ contextList = new ArrayList<>();
+ }
+
+ Condition condition1 = new Condition();
+ condition1.setConditionId(CommonUtil.getUUid());
+ condition1.setConditionName("owner class name");
+ condition1.setOperator(OperatorType.EQUALTO);
+ condition1.setConditionValue(intentOwner.getClass().getName());
+
+ Context context = new Context();
+ context.setContextName("owner info");
+ context.setContextId(CommonUtil.getUUid());
+ List<Condition> conditionList = new ArrayList<>();
+ conditionList.add(condition1);
+ context.setContextConditions(conditionList);
+ contextList.add(context);
+
+ Condition condition2 = new Condition();
+ condition2.setConditionId(CommonUtil.getUUid());
+ condition2.setConditionName("handler class name");
+ condition2.setOperator(OperatorType.EQUALTO);
+ condition2.setConditionValue(intentHandler.getClass().getName());
+
+ Context context2 = new Context();
+ context2.setContextName("handler info");
+ context2.setContextId(CommonUtil.getUUid());
+ List<Condition> conditionList2 = new ArrayList<>();
+ conditionList2.add(condition2);
+ context2.setContextConditions(conditionList2);
+ contextList.add(context2);
+
+ intent.setIntentContexts(contextList);
+ }
+
+ public List<Intent> getSubIntentInfoFromContext(Intent originIntent){
+ List<Intent> subIntentList = new ArrayList<>();
+ //form db
+ // List<Context> contextList = originIntent.getIntentContexts();
+ Intent dbIntent = intentService.getIntent(originIntent.getIntentId());
+ List<Context> contextList = dbIntent.getIntentContexts();
+ for (Context context : contextList) {
+ if (context.getContextName().contains("subIntent info")){
+ List<Condition> conditionList = context.getContextConditions();
+ for (Condition condition : conditionList) {
+ String subIntentId = condition.getConditionValue();
+ Intent subInent = intentService.getIntent(subIntentId);
+ subIntentList.add(subInent);
+ }
+ }
+ }
+ return subIntentList;
+ }
+
+ public IntentManagementFunction getHandlerInfo(Intent intent){
+ List<Context> contextList = intent.getIntentContexts();
+ IntentManagementFunction handler = new IntentManagementFunction();
+
+ for (Context context : contextList) {
+ if (context.getContextName().contains("handler info")) {
+ List<Condition> conditionList = context.getContextConditions();
+ String handlerClassName = conditionList.get(0).getConditionValue();
+ handler = (IntentManagementFunction) applicationContext
+ .getBean(CLLBusinessIntentManagementFunction.class.getSimpleName());
+ }
+ }
+ return handler;
+ }
+
+ public void deleteSubIntentContext(Intent intent, String deleteIntentId){
+ List<Context> contextList = intent.getIntentContexts();
+ for (Context context : contextList) {
+ if (context.getContextName().contains("subIntent info")) {
+ List<Condition> conditionList = context.getContextConditions();
+ for (Condition condition : conditionList) {
+ if (condition.getConditionValue() == deleteIntentId){
+ conditionList.remove(condition);
+ }
+ }
+ }
+ }
+ }
+
+}
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 90256eb..5641e99 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
@@ -33,10 +33,10 @@ public abstract class ActuationModule {
IntentService intentService;
//send to the next level intent handler
- public abstract void toNextIntentHandler(Intent intent, IntentManagementFunction IntentHandler);
+ public abstract void toNextIntentHandler(IntentGoalBean intentGoalBean, IntentManagementFunction IntentHandler);
//Direct operation
- public abstract void directOperation();
+ public abstract void directOperation(IntentGoalBean intentGoalBean);
public abstract void interactWithIntentHandle();
@@ -45,6 +45,16 @@ public abstract class ActuationModule {
intentService.createIntent(intent);
}
+ //Update intent information to the intent instance database
+ public void updateIntentToDb(Intent intent) {
+ intentService.updateIntent(intent);
+ }
+
+ //Delete intent information to the intent instance database
+ public void deleteIntentToDb(Intent intent) {
+ intentService.deleteIntent(intent.getIntentId());
+ }
+
public boolean distrubuteIntentToHandler(Map.Entry<IntentGoalBean, IntentManagementFunction> entry) {
IntentGoalType intentGoalType = entry.getKey().getIntentGoalType();
if (StringUtils.equalsIgnoreCase("create", intentGoalType.name())) {
@@ -59,4 +69,6 @@ public abstract class ActuationModule {
//determine if the intent is to be processed directly or sent to the next-level processor
public abstract void fulfillIntent(IntentGoalBean intentGoalBean, IntentManagementFunction intentHandler);
+
+ public abstract void updateIntentOperationInfo(Intent originIntent, IntentGoalBean intentGoalBean);
}
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 7701acc..27ae97c 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
@@ -20,6 +20,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.onap.usecaseui.intentanalysis.bean.models.*;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
import org.onap.usecaseui.intentanalysis.util.CommonUtil;
+import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.Collections;
@@ -32,20 +33,32 @@ public abstract class DecisionModule {
// find intentManageFunction
public abstract IntentManagementFunction exploreIntentHandlers(IntentGoalBean intentGoalBean);
- public Intent intentDefinition(Intent intent) {
- intent.setIntentId(CommonUtil.getUUid());
+ public Intent intentDefinition(Intent originIntent, Intent intent) {
+ Intent newIntent = new Intent();
+ newIntent.setIntentId(CommonUtil.getUUid());
+ newIntent.setIntentName(intent.getIntentName());
+
List<Expectation> originalExpectationList = intent.getIntentExpectations();
- List<Expectation> newExpectationList = getNewExpectationList(originalExpectationList);
- intent.setIntentExpectations(newExpectationList);
- return intent;
+ List<Expectation> newExpectationList = new ArrayList<>();
+ for (Expectation exp:originalExpectationList) {
+ Expectation expectation = new Expectation();
+ BeanUtils.copyProperties(exp,expectation);
+ newExpectationList.add(expectation);
+ }
+ List<Expectation> newIdExpectationList = getNewExpectationList(newExpectationList);
+ newIntent.setIntentExpectations(newIdExpectationList);
+ return newIntent;
}
public abstract void decideSuitableAction();
public abstract void interactWithTemplateDb();
+ public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationCreateProcess(IntentGoalBean intentGoalBean);
+
+ public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationUpdateProcess(IntentGoalBean intentGoalBean);
- public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> findHandler(IntentGoalBean intentGoalBean);
+ public abstract LinkedHashMap<IntentGoalBean, IntentManagementFunction> investigationDeleteProcess(IntentGoalBean intentGoalBean);
/**
* build new Intent with uuid
@@ -66,30 +79,39 @@ public abstract class DecisionModule {
expectation.setExpectationObject(newExpectationObject);
//ExpectationTarget
List<ExpectationTarget> expectationTargets = expectation.getExpectationTargets();
+ List<ExpectationTarget> newExpTargetList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(expectationTargets)) {
for (ExpectationTarget expectationTarget : expectationTargets) {
- expectationTarget.setTargetId(CommonUtil.getUUid());
+ ExpectationTarget expTarget =new ExpectationTarget();
+ BeanUtils.copyProperties(expectationTarget,expTarget);
+ expTarget.setTargetId(CommonUtil.getUUid());
//targetContexts
List<Context> targetContexts = expectationTarget.getTargetContexts();
if (CollectionUtils.isNotEmpty(targetContexts)) {
List<Context> newTargetContexts = new ArrayList<>();
for (Context context : targetContexts) {
- Context newContext = getNewContext(context);
+ Context con=new Context();
+ BeanUtils.copyProperties(context,con);
+ Context newContext = getNewContext(con);
newTargetContexts.add(newContext);
}
- expectationTarget.setTargetContexts(newTargetContexts);
+ expTarget.setTargetContexts(newTargetContexts);
}
//targetConditions
List<Condition> targetConditions = expectationTarget.getTargetConditions();
if (CollectionUtils.isNotEmpty(targetConditions)) {
List<Condition> newTargetConditions = new ArrayList<>();
for (Condition condition : targetConditions) {
- Condition newCondition = getNewCondition(condition);
+ Condition con =new Condition();
+ BeanUtils.copyProperties(condition,con);
+ Condition newCondition = getNewCondition(con);
newTargetConditions.add(newCondition);
}
- expectationTarget.setTargetConditions(newTargetConditions);
+ expTarget.setTargetConditions(newTargetConditions);
}
+ newExpTargetList.add(expTarget);
}
+ expectation.setExpectationTargets(newExpTargetList);
}
//expectationContexts
List<Context> expectationContexts = expectation.getExpectationContexts();
@@ -141,10 +163,14 @@ public abstract class DecisionModule {
if (CollectionUtils.isNotEmpty(contextConditions)) {
List<Condition> newConditionList = new ArrayList<>();
for (Condition condition : contextConditions) {
- newConditionList.add(getNewCondition(condition));
+ Condition con =new Condition();
+ BeanUtils.copyProperties(condition,con);
+ newConditionList.add(getNewCondition(con));
}
context.setContextConditions(newConditionList);
}
return context;
}
+
+
}
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 a0e2eed..4cf00f3 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
@@ -16,11 +16,15 @@
package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
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.contextService.IntentContextService;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.ActuationModule;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
+import org.onap.usecaseui.intentanalysis.service.IntentService;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@@ -31,6 +35,11 @@ public class IntentDefinitionService {
private IntentManagementFunction intentHandler;
private IntentManagementFunction intentOwner;
+ @Autowired
+ public IntentContextService intentContextService;
+ @Autowired
+ public IntentService intentService;
+
public void setIntentRole(IntentManagementFunction intentOwner, IntentManagementFunction intentHandler) {
if (intentOwner != null) {
this.intentOwner = intentOwner;
@@ -40,10 +49,26 @@ public class IntentDefinitionService {
}
}
- public void definitionPorcess(Map.Entry<IntentGoalBean, IntentManagementFunction> entry) {
+ public IntentGoalBean definitionPorcess(Intent originIntent, Map.Entry<IntentGoalBean, IntentManagementFunction> entry) {
DecisionModule intentDecisionModule = intentOwner.getDecisionModule();
ActuationModule intentActuationModule = intentOwner.getActuationModule();
- Intent newIdIntent = intentDecisionModule.intentDefinition(entry.getKey().getIntent());
- intentActuationModule.saveIntentToDb(newIdIntent);//id type
+
+ IntentGoalBean newIntentGoalBean = entry.getKey();
+ if (newIntentGoalBean.getIntentGoalType() == IntentGoalType.CREATE){
+ Intent newIdIntent = intentDecisionModule.intentDefinition(originIntent, entry.getKey().getIntent());
+ intentContextService.updateIntentOwnerHandlerContext(newIdIntent, intentOwner, intentHandler);
+ intentContextService.updateParentIntentContext(originIntent, newIdIntent);
+ intentContextService.updateChindIntentContext(originIntent, newIdIntent);
+ intentActuationModule.saveIntentToDb(newIdIntent);//id type
+ return new IntentGoalBean(newIdIntent,IntentGoalType.CREATE);
+ }
+
+ if (newIntentGoalBean.getIntentGoalType() == IntentGoalType.UPDATE){
+ intentActuationModule.updateIntentToDb(newIntentGoalBean.getIntent());
+ }
+ if (newIntentGoalBean.getIntentGoalType() == IntentGoalType.DELETE){
+ intentActuationModule.deleteIntentToDb(newIntentGoalBean.getIntent());
+ }
+ return newIntentGoalBean;
}
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java
index 60c4f74..37a1819 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentProcessService/IntentDetectionService.java
@@ -15,6 +15,7 @@
*/
package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
@@ -36,9 +37,18 @@ public class IntentDetectionService {
}
}
- public IntentGoalBean detectionProcess(Intent intent) {
+ public IntentGoalBean detectionProcess(IntentGoalBean originIntentGoalBean) {
KnowledgeModule ownerKnowledgeModule = intentOwner.getKnowledgeModule();
- return ownerKnowledgeModule.intentCognition(intent);
+ if (originIntentGoalBean.getIntentGoalType() == IntentGoalType.UPDATE){
+ return new IntentGoalBean(originIntentGoalBean.getIntent(), IntentGoalType.UPDATE);
+ }
+
+ if (originIntentGoalBean.getIntentGoalType() == IntentGoalType.DELETE){
+ return new IntentGoalBean(originIntentGoalBean.getIntent(), IntentGoalType.DELETE);
+ }
+
+ return ownerKnowledgeModule.intentCognition(originIntentGoalBean.getIntent());
+
}
}
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 ac4612f..891f7b3 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
@@ -15,30 +15,45 @@
*/
package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
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.contextService.IntentContextService;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.DecisionModule;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class IntentInvestigationService {
+
+ @Autowired
+ IntentContextService intentContextService;
+
private IntentManagementFunction intentHandler;
private IntentManagementFunction intentOwner;
public void setIntentRole(IntentManagementFunction intentOwner, IntentManagementFunction intentHandler){
- if (intentOwner!= null){
+ if (intentOwner != null){
this.intentOwner = intentOwner;
}
- if (intentHandler!= null){
+ if (intentHandler != null){
this.intentHandler= intentHandler;
}
}
- public LinkedHashMap<IntentGoalBean,IntentManagementFunction> investigationProcess(IntentGoalBean intentGoalBean) {
+ public LinkedHashMap<IntentGoalBean,IntentManagementFunction> investigationProcess(IntentGoalBean intentGoalBean) {
DecisionModule intentDecisionModule = intentOwner.getDecisionModule();
- return intentDecisionModule.findHandler(intentGoalBean);
+
+ if (intentGoalBean.getIntentGoalType() == IntentGoalType.UPDATE){
+ return intentDecisionModule.investigationUpdateProcess(intentGoalBean);
+ }
+
+ if (intentGoalBean.getIntentGoalType() == IntentGoalType.DELETE){
+ return intentDecisionModule.investigationDeleteProcess(intentGoalBean);
+ }
+ return intentDecisionModule.investigationCreateProcess(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 74cd89c..924508a 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
@@ -16,6 +16,7 @@
package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+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;
@@ -37,7 +38,7 @@ public class IntentOperationService {
}
}
- public void operationProcess(IntentGoalBean intentGoalBean) {
+ public void operationProcess(Intent originIntent, IntentGoalBean intentGoalBean) {
DecisionModule intentDecisionModule = intentOwner.getDecisionModule();
ActuationModule intentActuationModule = intentHandler.getActuationModule();
@@ -45,5 +46,8 @@ public class IntentOperationService {
intentActuationModule.interactWithIntentHandle();
//determine whether to operate directly or send to next intent handler
intentActuationModule.fulfillIntent(intentGoalBean, intentHandler);
+
+ //update origin intent if need
+ intentActuationModule.updateIntentOperationInfo(originIntent, intentGoalBean);
}
}
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 3bc58e1..49f6d13 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
@@ -15,6 +15,7 @@
*/
package org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
@@ -53,29 +54,31 @@ public class IntentProcessService {
}
}
- public void intentProcess(Intent intent) {
+ public IntentGoalBean intentProcess(IntentGoalBean originIntentGoalBean) {
+
intentDetectionService.setIntentRole(intentOwner, intentHandler);
- IntentGoalBean intentGoalBean = intentDetectionService.detectionProcess(intent);
+ IntentGoalBean newIntentGoalBean = intentDetectionService.detectionProcess(originIntentGoalBean);
- //investigation process
+ //investigation process Decomposition
intentInvestigationService.setIntentRole(intentOwner, intentHandler);
LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap =
- intentInvestigationService.investigationProcess(intentGoalBean);
+ intentInvestigationService.investigationProcess(newIntentGoalBean);
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(next);
+ intentDefinitionService.setIntentRole(intentOwner, next.getValue());
+ //obtain newID IntentGoalBean
+ IntentGoalBean newIdIntentGoalBean = intentDefinitionService.definitionPorcess(originIntentGoalBean.getIntent(), next);
//distribution process
intentDistributionService.setIntentRole(intentOwner, intentHandler);
intentDistributionService.distributionProcess(next);
intentOperationService.setIntentRole(intentOwner, next.getValue());
- intentOperationService.operationProcess(next.getKey());
+ intentOperationService.operationProcess(originIntentGoalBean.getIntent(), newIdIntentGoalBean);
}
+ return newIntentGoalBean;
}
-
}
diff --git a/intentanalysis/src/main/resources/application.yaml b/intentanalysis/src/main/resources/application.yaml
index 39b03ae..6db6b46 100644
--- a/intentanalysis/src/main/resources/application.yaml
+++ b/intentanalysis/src/main/resources/application.yaml
@@ -11,6 +11,7 @@ spring:
sql:
init:
schema-locations: classpath*:intent-analysis-init.sql
+ data-locations: classpath*:intent-analysis-data.sql
mode: always
mybatis:
configuration:
diff --git a/intentanalysis/src/main/resources/intent-analysis-data.sql b/intentanalysis/src/main/resources/intent-analysis-data.sql
new file mode 100644
index 0000000..16c3739
--- /dev/null
+++ b/intentanalysis/src/main/resources/intent-analysis-data.sql
@@ -0,0 +1,8 @@
+-- ----------------------------
+-- Records of intent_management_function_reg_info
+-- ----------------------------
+
+insert into intent_management_function_reg_info(imfr_info_id, imfr_info_description, support_area, support_model, support_interfaces, handle_name, intent_function_type) select 'CLLBusinessId','CLLBusiness','CLLBUSINESS',null,'CREATE,DELETE,UPDATE,SEARCH','CLLBusinessIntentManagementFunction','INTERNALFUNCTION' where not exists(select * from intent_management_function_reg_info where imfr_info_id='CLLBusinessId' )
+insert into intent_management_function_reg_info(imfr_info_id, imfr_info_description, support_area, support_model, support_interfaces, handle_name, intent_function_type) select 'CLLDeliveryId','CLLDelivery','CLLBUSINESS,DELIVERY',null,'CREATE,DELETE,UPDATE,SEARCH','CLLDeliveryIntentManagementFunction','INTERNALFUNCTION' where not exists(select * from intent_management_function_reg_info where imfr_info_id='CLLDeliveryId' )
+insert into intent_management_function_reg_info(imfr_info_id, imfr_info_description, support_area, support_model, support_interfaces, handle_name, intent_function_type) select 'CLLAssuranceId','CLLAssurance','CLLBUSINESS,ASSURANCE',null,'CREATE,DELETE,UPDATE,SEARCH','CLLAssuranceIntentManagementFunction','INTERNALFUNCTION' where not exists(select * from intent_management_function_reg_info where imfr_info_id='CLLAssuranceId' )
+
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyServiceTest.java
index ea253e7..2f9cf20 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyServiceTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyServiceTest.java
@@ -101,35 +101,35 @@ public class PolicyServiceTest {
@Test
public void testUpdateIntentConfigPolicySuccess() throws IOException {
mockUpPolicyApiCall(0);
- boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", true);
+ boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", "true");
Assert.assertTrue(result);
}
@Test
public void testUpdateIntentConfigPolicySuccessPolicyNotExist(){
mockUpPolicyApiCall(QUERY_POLICY_NOT_EXIST);
- boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", true);
+ boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", "true");
Assert.assertTrue(result);
}
@Test
public void testUpdateIntentConfigPolicyFailedCreatePolicyTypeFailed(){
mockUpPolicyApiCall(CREATE_POLICY_TYPE_FAILED);
- boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", true);
+ boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", "true");
Assert.assertFalse(result);
}
@Test
public void testUpdateIntentConfigPolicyFailedCreatePolicyFailed(){
mockUpPolicyApiCall(CREATE_POLICY_FAILED);
- boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", true);
+ boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", "true");
Assert.assertFalse(result);
}
@Test
public void testUpdateIntentConfigPolicyFailedDeployPolicyFailed(){
mockUpPolicyApiCall(DEPLOY_POLICY_FAILED);
- boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", true);
+ boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", "true");
Assert.assertFalse(result);
}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/so/SOServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/so/SOServiceTest.java
index 033336f..727c47f 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/so/SOServiceTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/so/SOServiceTest.java
@@ -1,3 +1,21 @@
+/*
+ *
+ * * 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.adapters.so;
import static org.mockito.ArgumentMatchers.any;
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java
index 0a3cf04..e5adc01 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java
@@ -1,3 +1,21 @@
+/*
+ *
+ * * 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.cllBusinessIntentMgt.cllBusinessModule;
import org.junit.Assert;
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
index 9050a6f..0e74f1e 100644
--- 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
@@ -86,7 +86,7 @@ public class FormatIntentInputDecisionModuleTest {
}
@Test
public void testFindHandler(){
- formatIntentInputDecisionModule.findHandler(intentGoalBean);
+ formatIntentInputDecisionModule.investigationCreateProcess(intentGoalBean);
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
index 6aaeb02..c31aea1 100644
--- 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
@@ -89,7 +89,7 @@ public class IntentDefinitionServiceTest {
LinkedHashMap<IntentGoalBean, IntentManagementFunction> map = new LinkedHashMap<>();
IntentGoalBean gb = new IntentGoalBean(intent, IntentGoalType.CREATE);
map.put(gb, new IntentManagementFunction());
- intentDefinitionService.definitionPorcess(map.entrySet().iterator().next());
+ 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
index 1957c63..95e319e 100644
--- 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
@@ -25,10 +25,12 @@ 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;
@@ -81,7 +83,8 @@ public class IntentDetectionServiceTest {
@Test
public void testDetectionProcess() {
intentDetectionService.setIntentRole(intentOwner, null);
- intentDetectionService.detectionProcess(intent);
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
+ intentDetectionService.detectionProcess(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
index f52cfa3..65e425c 100644
--- 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
@@ -84,7 +84,7 @@ public class IntentOperationServiceTest {
public void testIntentOperation() {
intentOperationService.setIntentRole(intentOwner, formatIntentInputManagementFunction);
IntentGoalBean intentGoalBean = new IntentGoalBean(intent,IntentGoalType.CREATE);
- intentOperationService.operationProcess(intentGoalBean);
+ 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
index c9a42d7..e961371 100644
--- 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
@@ -104,7 +104,8 @@ public class IntentProcessServiceTest {
LinkedHashMap<IntentGoalBean, IntentManagementFunction> intentMap = new LinkedHashMap<>();
intentMap.put(intentGoalBean,cllBusinessIntentManagementFunction);
when(intentInvestigationService.investigationProcess(any())).thenReturn(intentMap);
- intentProcessService.intentProcess(intent);
+ IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
+ intentProcessService.intentProcess(intentGoalBean);
Assert.assertTrue(true);
}
} \ No newline at end of file
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ContextServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ContextServiceTest.java
index 9ef0c73..503e3df 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ContextServiceTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ContextServiceTest.java
@@ -1,3 +1,21 @@
+/*
+ *
+ * * 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.service;
import java.util.ArrayList;
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationObjectServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationObjectServiceTest.java
index 41f96cb..eb530d5 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationObjectServiceTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationObjectServiceTest.java
@@ -1,3 +1,21 @@
+/*
+ *
+ * * 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.service;
import java.util.ArrayList;
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationServiceTest.java
index 4d029c1..abe4239 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationServiceTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationServiceTest.java
@@ -1,3 +1,21 @@
+/*
+ *
+ * * 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.service;
import java.util.ArrayList;
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationTargetServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationTargetServiceTest.java
index f12ac33..ac5841f 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationTargetServiceTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/ExpectationTargetServiceTest.java
@@ -1,3 +1,21 @@
+/*
+ *
+ * * 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.service;
import java.util.ArrayList;
diff --git a/intentanalysis/src/test/resources/intentdb-test-data.sql b/intentanalysis/src/test/resources/intentdb-test-data.sql
index 78f4d1e..4a1f120 100644
--- a/intentanalysis/src/test/resources/intentdb-test-data.sql
+++ b/intentanalysis/src/test/resources/intentdb-test-data.sql
@@ -106,10 +106,10 @@ values ('intentId2', 'NOT_FULFILLED', 'COMPLIANT', 'NotFulfilledReason');
-- Records of intent_management_function_reg_info
-- ----------------------------
INSERT INTO intent_management_function_reg_info(imfr_info_id,imfr_info_description,support_area,support_model,support_interfaces,handle_name,intent_function_type)
-VALUES ('CLLBusinessId','CLLBusiness','CLLBUSINESS',null,'CREATE,DELETE,UPDATE,SEARCH}','CLLBusinessIntentManagementFunction','INTERNALFUNCTION');
+VALUES ('CLLBusinessId','CLLBusiness','CLLBUSINESS',null,'CREATE,DELETE,UPDATE,SEARCH','CLLBusinessIntentManagementFunction','INTERNALFUNCTION');
INSERT INTO intent_management_function_reg_info(imfr_info_id,imfr_info_description,support_area,support_model,support_interfaces,handle_name,intent_function_type)
-VALUES ('CLLDeliveryId','CLLDelivery','CLLBUSINESS,DELIVERY',null,'CREATE,DELETE,UPDATE,SEARCH}','CLLDeliveryIntentManagementFunction','INTERNALFUNCTION');
+VALUES ('CLLDeliveryId','CLLDelivery','CLLBUSINESS,DELIVERY',null,'CREATE,DELETE,UPDATE,SEARCH','CLLDeliveryIntentManagementFunction','INTERNALFUNCTION');
INSERT INTO intent_management_function_reg_info(imfr_info_id,imfr_info_description,support_area,support_model,support_interfaces,handle_name,intent_function_type)
VALUES ('CLLAssuranceId','CLLAssurance','CLLBUSINESS,ASSURANCE',null,'CREATE,DELETE,UPDATE,SEARCH','CLLAssuranceIntentManagementFunction','INTERNALFUNCTION'); \ No newline at end of file