aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis/src')
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java34
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java34
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java8
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModule.java3
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java21
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java6
-rw-r--r--intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/ListArrayTypeHandler.java67
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java3
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java116
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java2
-rw-r--r--intentanalysis/src/test/resources/intentdb-test-data.sql6
11 files changed, 123 insertions, 177 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java
deleted file mode 100644
index f71651a..0000000
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportArea.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2022 CMCC, Inc. and others. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.usecaseui.intentanalysis.bean.enums;
-
-import lombok.Getter;
-
-@Getter
-public enum SupportArea {
- SLICING(0, "slicing"),
- CLLBUSINESS(1, "cllbusiness"),
- DELIVERY(2, "delivery"),
- ASSURANCE(3, "assurance");
- private int type;
- private String desc;
-
-
- SupportArea(int type, String desc) {
- this.type = type;
- this.desc = desc;
- }
-}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java
deleted file mode 100644
index 19d3d7d..0000000
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/enums/SupportInterface.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2022 CMCC, Inc. and others. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.usecaseui.intentanalysis.bean.enums;
-
-import lombok.Getter;
-
-@Getter
-public enum SupportInterface {
- //CREATE,DELETE,UPDATE,SEARCH;
- CREATE(0, "CREATE"),
- DELETE(1, "DELETE"),
- UPDATE(2, "UPDATE"),
- SEARCH(3, "SEARCH");
- private int type;
- private String name;
- SupportInterface(int type, String name) {
- this.type = type;
- this.name = name;
- }
-
-}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java
index d6ab5b8..00591f5 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfo.java
@@ -17,18 +17,14 @@ package org.onap.usecaseui.intentanalysis.bean.models;
import lombok.Data;
import org.onap.usecaseui.intentanalysis.bean.enums.IntentFunctionType;
-import org.onap.usecaseui.intentanalysis.bean.enums.SupportArea;
-import org.onap.usecaseui.intentanalysis.bean.enums.SupportInterface;
-
-import java.util.List;
@Data
public class IntentManagementFunctionRegInfo {
private String id;
private String description;
- private String supportArea;//Separate multiple values with commas
+ private String supportArea;//Separate multiple values with commas:SLICING,CLLBUSINESS,DELIVERY,ASSURANCE
private String supportModel;
- private String supportInterfaces;//Separate multiple values with commas
+ private String supportInterfaces;//Separate multiple values with commas:CREATE,DELETE,UPDATE,SEARCH
private String handleName;
//distinguish internal or external function
private IntentFunctionType intentFunctionType;
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 bc07b79..2a324e3 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
@@ -136,9 +136,8 @@ public class CLLBusinessDecisionModule extends DecisionModule {
List<IntentGoalBean> subIntentGoalList = intentDecomposition(intentGoalBean);
List<IntentGoalBean> sortList = intentOrchestration(subIntentGoalList);
for (IntentGoalBean subIntentGoal : sortList) {
- Map<IntentGoalBean, IntentManagementFunction> map = new HashMap<>();
IntentManagementFunction imf = exploreIntentHandlers(subIntentGoal);
- map.put(subIntentGoal, imf);
+ intentMap.put(subIntentGoal, imf);
}
} else {
intentMap.put(intentGoalBean, exploreIntentHandlers(intentGoalBean));
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java
index 6d40996..5d46d1e 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/intentBaseService/intentFunctionManageService/impl/IMFRegInfoServiceImpl.java
@@ -29,11 +29,6 @@ import java.util.List;
@Service("intentFunctionManageService")
public class IMFRegInfoServiceImpl implements IMFRegInfoService {
- @Autowired
- private ApplicationContext applicationContext;
-
- @Autowired
- private IMFRegInfoMapper imfRegInfoMapper;
@Override
public int createFunctionManage(IntentManagementFunctionRegInfo intentManage) {
return 0;
@@ -53,20 +48,4 @@ public class IMFRegInfoServiceImpl implements IMFRegInfoService {
public List<IntentManagementFunctionRegInfo> getIntentManage() {
return null;
}
-
- public List<IntentManagementFunction> filterHandleFunction(IntentManagementFunctionRegInfo managementRegInfo) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
- String managetFunctionRegName =managementRegInfo.getHandleName();
-
- IntentManagementFunction function =
- (IntentManagementFunction)applicationContext.getBean(managetFunctionRegName);
-
- ActuationModule actuationModule = function.getActuationModule();
- actuationModule.directOperation();
- IntentManagementFunction intentManagementFunction =
- (IntentManagementFunction) Class.forName(managetFunctionRegName)
- .getDeclaredConstructor().newInstance();
- ActuationModule actuationModule1 = intentManagementFunction.getActuationModule();
- return null;
- }
-
}
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java
index ad636d8..6309b1b 100644
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java
+++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImpl.java
@@ -19,8 +19,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
-import org.onap.usecaseui.intentanalysis.bean.enums.SupportArea;
-import org.onap.usecaseui.intentanalysis.bean.enums.SupportInterface;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo;
import org.onap.usecaseui.intentanalysis.mapper.IMFRegInfoMapper;
@@ -30,8 +28,6 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
@Service
@Slf4j
@@ -65,7 +61,7 @@ public class ImfRegInfoServiceImpl implements ImfRegInfoService {
break;
}
}
- if (!containsArea) break;
+ if (!containsArea) continue;
for (String supInterface : imfr.getSupportInterfaces().split(",")) {
if (StringUtils.containsIgnoreCase(supInterface, intentGoalType.name())) {
containsInterface = true;
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/ListArrayTypeHandler.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/ListArrayTypeHandler.java
deleted file mode 100644
index 9f9b51d..0000000
--- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/util/ListArrayTypeHandler.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2022 CMCC, Inc. and others. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onap.usecaseui.intentanalysis.util;
-
-import org.apache.ibatis.type.BaseTypeHandler;
-import org.apache.ibatis.type.JdbcType;
-import org.apache.ibatis.type.MappedJdbcTypes;
-import org.apache.ibatis.type.MappedTypes;
-
-import java.sql.*;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-@MappedJdbcTypes({ JdbcType.ARRAY })
-@MappedTypes({ Object.class })
-public class ListArrayTypeHandler extends BaseTypeHandler<List<?>> {
-
- @Override
- public void setNonNullParameter(PreparedStatement ps, int i,
- List<?> parameter, JdbcType jdbcType) throws SQLException {
- // JDBC type is required
- Array array = ps.getConnection().createArrayOf("TEXT", parameter.toArray());
- try {
- ps.setArray(i, array);
- } finally {
- array.free();
- }
- }
-
- @Override
- public List<?> getNullableResult(ResultSet rs, String columnName) throws SQLException {
- return extractArray(rs.getArray(columnName));
- }
-
- @Override
- public List<?> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
- return extractArray(rs.getArray(columnIndex));
- }
-
- @Override
- public List<?> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
- return extractArray(cs.getArray(columnIndex));
- }
-
- protected List<?> extractArray(Array array) throws SQLException {
- if (array == null) {
- return null;
- }
- Object javaArray = array.getArray();
- array.free();
- return new ArrayList<>(Arrays.asList((Object[])javaArray));
- }
-}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java
index 3cc406d..d01ebc7 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java
@@ -19,9 +19,6 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.onap.usecaseui.intentanalysis.bean.enums.IntentFunctionType;
-import org.onap.usecaseui.intentanalysis.bean.enums.SupportArea;
-
-import java.util.ArrayList;
public class IntentManagementFunctionRegInfoTest {
@Before
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
new file mode 100644
index 0000000..0a3cf04
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java
@@ -0,0 +1,116 @@
+package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.usecaseui.intentanalysis.IntentAnalysisApplicationTests;
+import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
+import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
+import org.onap.usecaseui.intentanalysis.bean.models.*;
+import org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.CLLAssuranceIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.CLLDeliveryIntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
+import org.onap.usecaseui.intentanalysis.service.ImfRegInfoService;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.*;
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class CLLBusinessDecisionModuleTest {
+ @InjectMocks
+ CLLBusinessDecisionModule cllBusinessDecisionModule;
+
+ @Mock
+ private ImfRegInfoService imfRegInfoService;
+ @Mock
+ private ApplicationContext applicationContext;
+
+ IntentGoalBean intentGoalBean = new IntentGoalBean();
+ Intent intent = new Intent();
+ @Before
+ public void before() throws Exception {
+ intent.setIntentName("cllIntent");
+ intent.setIntentId("12345");
+ List<Expectation> expectationList = new ArrayList<>();
+
+ Expectation delivery = new Expectation();
+ delivery.setExpectationId("12345-delivery");
+ delivery.setExpectationName("deliveryExpectation");
+ delivery.setExpectationType(ExpectationType.DELIVERY);
+ ExpectationObject expectationObject = new ExpectationObject();
+ expectationObject.setObjectType(ObjectType.SLICING);
+ //expetationTarget Context FulfilmentInfo is empty
+ delivery.setExpectationObject(expectationObject);
+ expectationList.add(delivery);
+
+ Expectation assurance = new Expectation();
+ assurance.setExpectationId("12345-assurance");
+ assurance.setExpectationName("assuranceExpectation");
+ assurance.setExpectationType(ExpectationType.ASSURANCE);
+ ExpectationObject expectationObject1 = new ExpectationObject();
+ expectationObject1.setObjectType(ObjectType.CCVPN);
+ //expetationTarget Context FulfilmentInfo is empty
+ assurance.setExpectationObject(expectationObject1);
+ expectationList.add(assurance);
+
+ intent.setIntentExpectations(expectationList);
+ intent.setIntentExpectations(expectationList);
+ intent.setIntentExpectations(expectationList);
+ intentGoalBean.setIntent(intent);
+ intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
+ }
+ @Test
+ public void testNeedDecompostion(){
+// IntentManagementFunctionRegInfo imfRegInfo = new IntentManagementFunctionRegInfo();
+//
+// imfRegInfo.setSupportArea("cll");
+// imfRegInfo.setSupportInterfaces("CREATE");
+// imfRegInfo.setHandleName("aaa");
+// // Mockito.when(imfRegInfoService.getImfRegInfo(intentGoalBean)).thenReturn(imfRegInfo).thenReturn(imfRegInfo);
+// Mockito.when(cllBusinessDecisionModule.exploreIntentHandlers(intentGoalBean)).thenReturn(new IntentManagementFunction());
+// Mockito.when(applicationContext.getBean("CLLDeliveryIntentManagementFunction")).thenReturn(new CLLDeliveryIntentManagementFunction());
+// cllBusinessDecisionModule.findHandler(intentGoalBean);
+ cllBusinessDecisionModule.needDecompostion(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+ @Test
+ public void testIntentDecomposition(){
+ cllBusinessDecisionModule.intentDecomposition(intentGoalBean);
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testIntentOrchestration(){
+ List<IntentGoalBean> intentGoalBeanList=new ArrayList<>();
+ IntentGoalBean delivery=new IntentGoalBean();
+
+ Intent deliveryIntent= new Intent();
+ deliveryIntent.setIntentName("delivery");
+
+ delivery.setIntentGoalType(IntentGoalType.CREATE);
+ delivery.setIntent(deliveryIntent);
+ intentGoalBeanList.add(delivery);
+
+ IntentGoalBean assurance=new IntentGoalBean();
+
+ Intent assuranceIntent= new Intent();
+ deliveryIntent.setIntentName("assurance");
+
+ assurance.setIntentGoalType(IntentGoalType.CREATE);
+ assurance.setIntent(assuranceIntent);
+ intentGoalBeanList.add(assurance);
+
+ cllBusinessDecisionModule.intentOrchestration(intentGoalBeanList);
+ Assert.assertTrue(true);
+ }
+} \ No newline at end of file
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java
index 4067b4f..164df70 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java
@@ -23,8 +23,6 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
-import org.onap.usecaseui.intentanalysis.bean.enums.SupportArea;
-import org.onap.usecaseui.intentanalysis.bean.enums.SupportInterface;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo;
diff --git a/intentanalysis/src/test/resources/intentdb-test-data.sql b/intentanalysis/src/test/resources/intentdb-test-data.sql
index a20f814..78f4d1e 100644
--- a/intentanalysis/src/test/resources/intentdb-test-data.sql
+++ b/intentanalysis/src/test/resources/intentdb-test-data.sql
@@ -45,11 +45,11 @@ values ('expectation without affiliate 2', 'CLL Assurance Expectation', 'ASSURAN
-- 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', 'OBJECT1', '', 'expectationId1');
+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', 'OBJECT2', '', 'expectationId2');
+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', 'OBJECT2', '', 'expectationId3');
+values ('3f36bf22-3416-4150-8005-cdc406a43310', 'CCVPN', '', 'expectationId3');
-- ----------------------------
-- Records of expectation_target