diff options
author | hekeguang <hekeguang@chinamobile.com> | 2022-09-29 11:11:13 +0800 |
---|---|---|
committer | hekeguang <hekeguang@chinamobile.com> | 2022-09-29 11:12:09 +0800 |
commit | 4ba5d5c124ee84adac7dd0b97f6e42f5954bd7dc (patch) | |
tree | 08efac2451ccb8620bea177d863345e27f6c17ed /intentanalysis/src/main/java/org/onap/usecaseui | |
parent | 4f006378f24d0a890214e6567b78c5e0d9881738 (diff) |
Add test code.
Issue-ID: USECASEUI-696
Change-Id: I39f1dd498ef2a8d4f2d4373575401eb1feb03dd3
Signed-off-by: hekeguang <hekeguang@chinamobile.com>
Diffstat (limited to 'intentanalysis/src/main/java/org/onap/usecaseui')
7 files changed, 4 insertions, 169 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)); - } -} |