*/
package org.onap.usecaseui.intentanalysis.Thread;
+import lombok.extern.slf4j.Slf4j;
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 java.util.concurrent.Callable;
+@Slf4j
public class CreateCallable implements Callable<String> {
private Intent originalIntent;
private IntentGoalBean intentGoalBean;
String intentStatus = "success";
IntentCreateEvent intentCreateEvent = new IntentCreateEvent(this, originalIntent, intentGoalBean, handler, intentStatus);
applicationContext.publishEvent(intentCreateEvent);
+ log.info(intentGoalBean.getIntent().getIntentName() + " Intent operate finished");
return intentGoalBean.getIntent().getIntentName() +" Intent operate finished";
}
}
package org.onap.usecaseui.intentanalysis.bean.models;
-
import java.util.List;
+
import lombok.Data;
import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
-
@Data
-
public class ExpectationObject {
private ObjectType objectType;
- private String objectInstance;
+ private List<String> objectInstance;
private List<Context> objectContexts;
}
CreateCallable assuranceCallable = new CreateCallable(originalIntent, intentGoalBean, handler, applicationContext);
FutureTask<String> futureTask = new FutureTask<>(assuranceCallable);
executor.submit(futureTask);
- log.info(futureTask.get());
} catch (Exception ex) {
log.error("exception is {}", ex.getMessage());
}
@Override
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");
- }
+ List<String> cllIds = getCLLId(intent);
+ cllIds.forEach(cllId -> {
+ 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
log.info("expectationObject is empty,expectationId is {}", deliveryExpectation.getExpectationId());
continue;
}
- String objectInstance = expectationObject.getObjectInstance();
- if (!StringUtils.equalsIgnoreCase(cllId, objectInstance)) {
- log.info("cllId and objectInstance are not equal,cllId is {},objectInstance is {}", cllId, objectInstance);
+ List<String> objectInstances = expectationObject.getObjectInstance();
+ String object = "";
+ for (String objectInstance : objectInstances) {
+ if (StringUtils.equalsIgnoreCase(cllId, objectInstance)) {
+ object = objectInstance;
+ break;
+ }
+ }
+ if (StringUtils.isEmpty(object)) {
+ log.info("no objectInstance is equal cllId {}", cllId);
continue;
}
List<ExpectationTarget> deliveryTargetList = deliveryExpectation.getExpectationTargets();
return null;
}
- public String getCLLId(Intent intent) {
+ private List<String> getCLLId(Intent intent) {
List<Expectation> expectationList = intent.getIntentExpectations();
for (Expectation expectation : expectationList) {
if (StringUtils.equalsIgnoreCase("assurance", expectation.getExpectationType().name())) {
*/
package org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.cllassurancemodule;
-import com.alibaba.fastjson.JSONObject;
import lombok.extern.log4j.Log4j2;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
-import org.onap.usecaseui.intentanalysis.adapters.aai.apicall.AAIAPICall;
-import org.onap.usecaseui.intentanalysis.adapters.aai.apicall.AAIAuthConfig;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.intentBaseService.intentModule.KnowledgeModule;
-import org.onap.usecaseui.intentanalysis.util.RestfulServices;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import retrofit2.Response;
-
-import java.io.IOException;
@Log4j2
@Component
public class CLLAssuranceKnowledgeModule extends KnowledgeModule {
- private AAIAPICall aaiapiCall;
- @Autowired
- AAIAuthConfig aaiAuthConfig;
-
- public AAIAPICall getAaiApiCall() {
- if (null == aaiapiCall) {
- this.aaiapiCall = RestfulServices.create(AAIAPICall.class,
- aaiAuthConfig.getUserName(), aaiAuthConfig.getPassword());
- }
- return this.aaiapiCall;
- }
-
- public void setAAIApiCall(AAIAPICall aaiApiCall) {
- this.aaiapiCall = aaiApiCall;
- }
-
@Override
public IntentGoalBean intentCognition(Intent intent) {
return null;
public boolean recieveDeleteIntent() {
return true;
}
-
- /**
- * healthy check
- */
- int getSystemStatus(Intent intent) {
- try {
- if (CollectionUtils.isEmpty(intent.getIntentExpectations())) {
- return -1;
- }
- String objectInstance = intent.getIntentExpectations().get(0).getExpectationObject().getObjectInstance();
- if (StringUtils.isEmpty(objectInstance)){
- return -1;
- }
- Response<JSONObject> response = getAaiApiCall().getInstanceInfo(objectInstance).execute();
- log.debug(response.toString());
- if (response.isSuccessful()) {
- // TODO: 2022/9/20 judge by the return result
- }
- log.error("getIntentInstance Create Statue Error:" + response.toString());
- return -1;
- } catch (Exception ex) {
- log.error("Details:" + ex.getMessage());
- return 0;
- }
- }
}
CreateCallable deliveryCallable = new CreateCallable(originalIntent, intentGoalBean, handler, applicationContext);
FutureTask<String> futureTask = new FutureTask<>(deliveryCallable);
executor.submit(futureTask);
- log.info(futureTask.get());
} catch (Exception ex) {
log.error("exception is {}", ex.getMessage());
}
import org.springframework.stereotype.Component;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
updateFulfillment(params, deliveryExpectation.getExpectationId());
// fill and update the objectInstance of intent expectation(include delivery and report)
- String objectInstance = (String) params.get("name");
+ List<String> objectInstance = Collections.singletonList((String) params.get("name"));
intent.getIntentExpectations().forEach(expectation -> {
ExpectationObject expectationObject = expectationObjectService.getExpectationObject(expectation.getExpectationId());
expectationObject.setObjectInstance(objectInstance);
expectationObjectService.updateExpectationObject(expectationObject, expectation.getExpectationId());
});
} else if (StringUtils.equalsIgnoreCase("delete", intentGoalBean.getIntentGoalType().name())) {
- String instanceId = deliveryExpectation.getExpectationObject().getObjectInstance();
- soService.deleteIntentInstance(instanceId);
+ List<String> objectInstance = deliveryExpectation.getExpectationObject().getObjectInstance();
+ objectInstance.forEach(instanceId->soService.deleteIntentInstance(instanceId));
} else {
- String instanceId = deliveryExpectation.getExpectationObject().getObjectInstance();
- soService.deleteIntentInstance(instanceId);
+ List<String> objectInstance = deliveryExpectation.getExpectationObject().getObjectInstance();
+ objectInstance.forEach(instanceId->soService.deleteIntentInstance(instanceId));
intentService.deleteIntent(intent.getIntentId());
}
}
.filter(expectation -> ExpectationType.DELIVERY.equals(expectation.getExpectationType()))
.collect(Collectors.toList());
List<Expectation> originIntentExpectationList = originIntent.getIntentExpectations();
- String objectInstance = deliveryIntentExpectationList.get(0).getExpectationObject().getObjectInstance();
+ List<String> objectInstance = deliveryIntentExpectationList.get(0).getExpectationObject().getObjectInstance();
for (Expectation originExpectation : originIntentExpectationList) {
ExpectationObject originExpectationObject = originExpectation.getExpectationObject();
originExpectationObject.setObjectInstance(objectInstance);
protected void saveFulfillmentAndObjectInstance(String intentId, FulfillmentInfo fulfillmentInfo) {
// save fulfillmentInfo and objectInstance
fulfillmentInfoService.saveFulfillmentInfo(intentId, fulfillmentInfo);
- objectInstanceService.saveObjectInstances(intentId, fulfillmentInfo);
+ objectInstanceService.saveObjectInstances(intentId, fulfillmentInfo.getObjectInstances());
}
protected void generationIntentReport(IntentGoalBean intentGoalBean) {
package org.onap.usecaseui.intentanalysis.mapper;
-
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
-import java.util.List;
-
@Mapper
public interface ExpectationObjectMapper {
@Param(value = "expectationId") String expectationId);
int deleteExpectationObject(@Param(value = "expectationId") String expectationId);
-
- List<String> getExpectationIdByObjectInstance(@Param(value = "objectInstance") String objectInstance);
-
- List<String> getAllObjectInstances();
}
List<String> getObjectInstances(@Param(value = "parentId") String parentId);
int deleteObjectInstances(@Param(value = "parentId") String parentId);
+
+ List<String> queryAllObjectInstances();
+
+ List<String> getParentIdByInstance(@Param(value = "objectInstance") String objectInstance);
}
package org.onap.usecaseui.intentanalysis.service;
-import org.onap.usecaseui.intentanalysis.bean.models.FulfillmentInfo;
+import java.util.List;
public interface ObjectInstanceService {
- void saveObjectInstances(String intentId, FulfillmentInfo eventModel);
+ void saveObjectInstances(String parentId, List<String> objectInstance);
}
import org.onap.usecaseui.intentanalysis.exception.CommonException;
import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
-import org.onap.usecaseui.intentanalysis.intentBaseService.intentinterfaceservice.IntentInterfaceService;
import org.onap.usecaseui.intentanalysis.mapper.*;
import org.onap.usecaseui.intentanalysis.service.ComponentNotificationService;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@Service
public class ComponentNotificationServiceImpl implements ComponentNotificationService {
-
- @Autowired
- private ExpectationObjectMapper expectationObjectMapper;
-
@Autowired
private ExpectationMapper expectationMapper;
private ApplicationContext applicationContext;
@Autowired
- private IntentInterfaceService intentInterfaceService;
+ private ObjectInstanceMapper objectInstanceMapper;
/**
* Generate a new FulfillmentInfo based on third-party FulfillmentOperation
throw new CommonException(msg, ResponseConsts.EMPTY_PARAM);
}
log.info("Get objectInstances is {}", objectInstances);
- List<String> expectationIds = expectationObjectMapper.getExpectationIdByObjectInstance(objectInstances.get(0));
+ List<String> expectationIds = objectInstanceMapper.getParentIdByInstance(objectInstances.get(0));
if (CollectionUtils.isEmpty(expectationIds)) {
String msg = "Get expectationId is null from database";
log.error(msg);
} else {
function = (IntentManagementFunction) applicationContext.getBean(CLLDeliveryIntentManagementFunction.class.getSimpleName());
}
- intentInterfaceService.reportInterface(function, intentId, eventModel);
+ function.createReport(intentId, eventModel);
}
private ExpectationType getExpectationType(String operation) {
package org.onap.usecaseui.intentanalysis.service.impl;
-
-import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
import org.onap.usecaseui.intentanalysis.exception.DataBaseException;
+import org.onap.usecaseui.intentanalysis.mapper.ObjectInstanceMapper;
+import org.onap.usecaseui.intentanalysis.service.ObjectInstanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import org.onap.usecaseui.intentanalysis.bean.enums.ContextParentType;
import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
import org.onap.usecaseui.intentanalysis.bean.models.Context;
import org.onap.usecaseui.intentanalysis.mapper.ExpectationObjectMapper;
import org.onap.usecaseui.intentanalysis.service.ExpectationObjectService;
import org.springframework.util.CollectionUtils;
-
@Service
@Slf4j
public class ExpectationObjectServiceImpl implements ExpectationObjectService {
-
- private ContextParentType contextParentType;
-
@Autowired
private ExpectationObjectMapper expectationObjectMapper;
@Autowired
private ContextService contextService;
+ @Autowired
+ private ObjectInstanceService objectInstanceService;
+
+ @Autowired
+ private ObjectInstanceMapper objectInstanceMapper;
+
@Override
public void createExpectationObject(ExpectationObject expectationObject, String expectationId) {
if (expectationObjectService.getExpectationObject(expectationId) != null) {
log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
}
- contextService.createContextList(expectationObject.getObjectContexts(),
- expectationObjectMapper.selectExpectationObjectId(expectationId));
+
+ List<String> objectInstance = expectationObject.getObjectInstance();
+ if (!CollectionUtils.isEmpty(objectInstance)) {
+ objectInstanceService.saveObjectInstances(expectationId, objectInstance);
+ }
+
if (expectationObjectMapper.insertExpectationObject(expectationObject, expectationId) < 1) {
String msg = "Failed to create expectation object to database.";
log.error(msg);
throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL);
}
+
+ String objectId = expectationObjectMapper.selectExpectationObjectId(expectationId);
+ List<Context> objectContexts = expectationObject.getObjectContexts();
+ if(!CollectionUtils.isEmpty(objectContexts)){
+ contextService.createContextList(objectContexts, objectId);
+ }
log.info("Successfully created expectation object to database.");
}
@Override
public ExpectationObject getExpectationObject(String expectationId) {
ExpectationObject expectationObject = expectationObjectMapper.selectExpectationObject(expectationId);
+ if (expectationObject == null) {
+ log.info("get expectationObject is empty,expectationId is {}", expectationId);
+ return null;
+ }
String expectationObjectId = expectationObjectMapper.selectExpectationObjectId(expectationId);
List<Context> contextList = contextService.getContextList(expectationObjectId);
if (!CollectionUtils.isEmpty(contextList)) {
} else {
log.info(String.format("Expectation object is null, expectationObjectId = %s", expectationObjectId));
}
+ List<String> objectInstances = objectInstanceMapper.getObjectInstances(expectationId);
+ expectationObject.setObjectInstance(objectInstances);
return expectationObject;
}
} else if (expectationObject != null && expectationObjectFromDB == null) {
expectationObjectService.createExpectationObject(expectationObject, expectationId);
} else if (expectationObject != null) {
- contextService.updateContextList(expectationObject.getObjectContexts(),
- expectationObjectMapper.selectExpectationObjectId(expectationId));
+ String objectId = expectationObjectMapper.selectExpectationObjectId(expectationId);
+ contextService.updateContextList(expectationObject.getObjectContexts(), objectId);
+ objectInstanceService.saveObjectInstances(expectationId, expectationObject.getObjectInstance());
if (expectationObjectMapper.updateExpectationObject(expectationObject, expectationId) < 1) {
String msg = "Failed to update expectation object to database.";
log.error(msg);
public void deleteExpectationObject(String expectationId) {
ExpectationObject expectationObject = expectationObjectService.getExpectationObject(expectationId);
if (expectationObject != null) {
- contextService.deleteContextList(expectationObjectMapper.selectExpectationObjectId(expectationId));
+ String objectId = expectationObjectMapper.selectExpectationObjectId(expectationId);
+ contextService.deleteContextList(objectId);
+ objectInstanceMapper.deleteObjectInstances(expectationId);
if (expectationObjectMapper.deleteExpectationObject(expectationId) < 1) {
String msg = "Failed to update expectation object to database.";
log.error(msg);
private ObjectInstanceMapper objectInstanceMapper;
@Override
- public void saveObjectInstances(String intentId, FulfillmentInfo eventModel) {
- List<String> instances = new ArrayList<>(eventModel.getObjectInstances());
- List<String> objectInstancesDb = objectInstanceMapper.getObjectInstances(intentId);
+ public void saveObjectInstances(String parentId, List<String> objectInstance) {
+ List<String> instances = new ArrayList<>(objectInstance);
+ List<String> objectInstancesDb = objectInstanceMapper.getObjectInstances(parentId);
if (!CollectionUtils.isEmpty(objectInstancesDb)) {
instances.removeAll(objectInstancesDb);
if (CollectionUtils.isEmpty(instances)) {
return;
}
}
- int objectInstanceNum = objectInstanceMapper.insertObjectInstanceList(instances, intentId);
+ int objectInstanceNum = objectInstanceMapper.insertObjectInstanceList(instances, parentId);
if (objectInstanceNum < 1) {
String msg = "Failed to insert objectInstances to database.";
log.error(msg);
object_id varchar(255) DEFAULT uuid_generate_v4 (),
primary key(object_id),
object_type varchar(255),
- object_instance varchar(255),
expectation_id varchar(255)
);
<insert id="insertExpectationObject">
<if test="expectationObject != null">
- insert into expectation_object(object_type, object_instance, expectation_id)
+ insert into expectation_object(object_type, expectation_id)
values
- (#{expectationObject.objectType}, #{expectationObject.objectInstance}, #{expectationId})
+ (#{expectationObject.objectType}, #{expectationId})
</if>
</insert>
<select id="selectExpectationObject" resultType="org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject">
- select object_type objectType, object_instance objectInstance
+ select object_type objectType
from expectation_object
where expectation_id = #{expectationId}
</select>
update expectation_object
<trim prefix="set" suffixOverrides=",">
<if test="expectationObject.objectType != null">object_type = #{expectationObject.objectType},</if>
- <if test="expectationObject.objectInstance != null">object_instance = #{expectationObject.objectInstance},</if>
</trim>
where expectation_id = #{expectationId}
</update>
delete from expectation_object
where expectation_id = #{expectationId}
</delete>
-
- <select id="getExpectationIdByObjectInstance" resultType="java.lang.String">
- select expectation_id
- from expectation_object
- where object_instance = #{objectInstance}
- </select>
-
- <select id="getAllObjectInstances" resultType="java.lang.String">
- select object_instance
- from expectation_object
- </select>
</mapper>
delete from object_instance where parent_id = #{parentId}
</delete>
+ <select id="queryAllObjectInstances" resultType="java.lang.String">
+ select object_instance
+ from object_instance
+ </select>
+
+ <select id="getParentIdByInstance" resultType="java.lang.String">
+ select parent_id from object_instance where object_instance = #{objectInstance}
+ </select>
+
</mapper>
import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
import java.util.ArrayList;
+import java.util.Collections;
public class ExpectationObjectTest {
@Before
public void testSetExpectationObjectTest() {
ExpectationObject test = new ExpectationObject();
test.setObjectType(ObjectType.SLICING);
- test.setObjectInstance("");
+ test.setObjectInstance(Collections.singletonList(""));
test.setObjectContexts(new ArrayList<>());
}
}
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import static org.mockito.ArgumentMatchers.any;
deliveryExpectation.setExpectationName("CLL Delivery Expectation");
deliveryExpectation.setExpectationType(ExpectationType.DELIVERY);
ExpectationObject expectationObject = new ExpectationObject();
- expectationObject.setObjectInstance("");
+ expectationObject.setObjectInstance(Collections.singletonList(""));
deliveryExpectation.setExpectationObject(expectationObject);
List<ExpectationTarget> targetList = new ArrayList<>();
Expectation assuranceExceptation = new Expectation();
assuranceExceptation.setExpectationType(ExpectationType.ASSURANCE);
ExpectationObject expectationObject2 = new ExpectationObject();
- expectationObject2.setObjectInstance("");
+ expectationObject2.setObjectInstance(Collections.singletonList(""));
assuranceExceptation.setExpectationObject(expectationObject2);
expectationList.add(assuranceExceptation);
intent.setIntentExpectations(expectationList);
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import static org.mockito.ArgumentMatchers.any;
List<Expectation> expectationList = new ArrayList<>();
Expectation exp = new Expectation();
ExpectationObject expectationObject = new ExpectationObject();
- expectationObject.setObjectInstance("objectInstance");
+ expectationObject.setObjectInstance(Collections.singletonList("objectInstance"));
exp.setExpectationObject(expectationObject);
expectationList.add(exp);
originalIntent.setIntentExpectations(expectationList);
Expectation deliveryExpectation = new Expectation();
ExpectationObject deliveryExpectationObject = new ExpectationObject();
- deliveryExpectationObject.setObjectInstance("deliveryObjectInstance");
+ deliveryExpectationObject.setObjectInstance(Collections.singletonList("deliveryObjectInstance"));
deliveryExpectation.setExpectationObject(deliveryExpectationObject);
deliveryExpectation.setExpectationType(ExpectationType.DELIVERY);
package org.onap.usecaseui.intentanalysis.service;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.BeforeEach;
public ExpectationObject createTestObject(String testName) {
ExpectationObject expectationObject = new ExpectationObject();
expectationObject.setObjectType(ObjectType.SLICING);
- expectationObject.setObjectInstance("true");
+ expectationObject.setObjectInstance(Collections.singletonList("true"));
List<Context> contextList = new ArrayList<>();
Context context = new Context();
package org.onap.usecaseui.intentanalysis.service;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.junit.Assert;
import org.junit.jupiter.api.BeforeEach;
ExpectationObject object = new ExpectationObject();
object.setObjectType(ObjectType.valueOf("SLICING"));
- object.setObjectInstance("objectInstance");
+ object.setObjectInstance(Collections.singletonList("objectInstance"));
Condition targetCondition = new Condition();
targetCondition.setConditionId(testName + "-conditionId");
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.junit.Assert;
List<ExpectationTarget> expectationTargetList = new ArrayList<>();
expectationTargetList.add(target1);
object1.setObjectType(ObjectType.valueOf("SLICING"));
- object1.setObjectInstance("objectInstance");
+ object1.setObjectInstance(Collections.singletonList("objectInstance"));
expectation1.setExpectationId("expectationId");
expectation1.setExpectationName("expectationName");
expectation1.setExpectationType(ExpectationType.valueOf("DELIVERY"));
Expectation expectation = expectationList.get(0);
expectation.setExpectationName("new expectation name");
ExpectationObject expectationObject = expectation.getExpectationObject();
- expectationObject.setObjectInstance("new object instance");
+ expectationObject.setObjectInstance(Collections.singletonList("new object instance"));
expectation.setExpectationObject(expectationObject);
List<ExpectationTarget> expectationTargetList = expectation.getExpectationTargets();
ExpectationTarget expectationTarget = expectationTargetList.get(0);
import org.junit.runner.RunWith;
import org.onap.usecaseui.intentanalysis.IntentAnalysisApplicationTests;
import org.onap.usecaseui.intentanalysis.bean.models.*;
-import org.onap.usecaseui.intentanalysis.mapper.ExpectationObjectMapper;
+import org.onap.usecaseui.intentanalysis.mapper.ObjectInstanceMapper;
import org.onap.usecaseui.intentanalysis.service.IntentReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
ComponentNotificationServiceImpl componentNotificationService;
@Autowired
- private ExpectationObjectMapper expectationObjectMapper;
+ private ObjectInstanceMapper objectInstanceMapper;
@Test
public void getIntentReportByIntentIdTest() {
- List<String> allObjectInstances = expectationObjectMapper.getAllObjectInstances();
+ List<String> allObjectInstances = objectInstanceMapper.queryAllObjectInstances();
List<String> cll = new ArrayList<>();
for (String target : allObjectInstances) {
if (target != null && target.contains("cll")) {
"expectationType":"DELIVERY",
"expectationObject":{
"objectType":"CCVPN",
- "objectInstance":""
+ "objectInstance":[]
},
"expectationTargets":[
{
"expectationType":"ASSURANCE",
"expectationObject":{
"objectType":"CCVPN",
- "objectInstance":""
+ "objectInstance":[]
},
"expectationTargets":[
{
"expectationType":"REPORT",
"expectationObject":{
"objectType":"CCVPN",
- "objectInstance":""
+ "objectInstance":[]
},
"expectationTargets":[
{
-- ----------------------------
-- Records of expectation_object
-- ----------------------------
-MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
-values ('b1bc45a6-f396-4b65-857d-6d2312bfb352', 'SLICING', '', 'expectationId1');
-MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
-values ('931a8690-fa61-4c2b-a387-9e0fa6152136', 'CCVPN', '', 'expectationId2');
-MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
-values ('3f36bf22-3416-4150-8005-cdc406a43310', 'CCVPN', '', 'expectationId3');
+MERGE INTO expectation_object (object_id, object_type, expectation_id) KEY (object_id)
+values ('b1bc45a6-f396-4b65-857d-6d2312bfb352', 'SLICING', 'expectationId1');
+MERGE INTO expectation_object (object_id, object_type, expectation_id) KEY (object_id)
+values ('931a8690-fa61-4c2b-a387-9e0fa6152136', 'CCVPN', 'expectationId2');
+MERGE INTO expectation_object (object_id, object_type, expectation_id) KEY (object_id)
+values ('3f36bf22-3416-4150-8005-cdc406a43310', 'CCVPN', 'expectationId3');
-- ----------------------------
-- Records of expectation_target
object_id varchar(255) DEFAULT random_uuid(),
primary key (object_id),
object_type varchar(255),
- object_instance varchar(255),
expectation_id varchar(255)
);