diff options
Diffstat (limited to 'intentanalysis')
6 files changed, 110 insertions, 5 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java index 17ab1b8..52e391c 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfo.java @@ -23,11 +23,14 @@ import org.onap.usecaseui.intentanalysis.bean.enums.NotFulfilledState; @Data public class FulfilmentInfo { + private String fulfillmentId; - private FulfilmentStatus fulfilmentStatus; + private FulfilmentStatus fulfillmentStatus; private NotFulfilledState notFulfilledState; private String notFulfilledReason; + private String achieveValue; + } diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReport.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReport.java new file mode 100644 index 0000000..016fb66 --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/bean/models/IntentReport.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2023 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.models; + +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class IntentReport { + private String intentReportId; + private String intentReference; + private List<FulfilmentInfo> fulfillmentInfos; + private List<String> objectInstance; + private Date reportTime; +} diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentReportController.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentReportController.java new file mode 100644 index 0000000..4d7369f --- /dev/null +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/controller/IntentReportController.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2023 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.controller; + +import lombok.extern.log4j.Log4j2; +import org.onap.usecaseui.intentanalysis.bean.enums.FulfilmentStatus; +import org.onap.usecaseui.intentanalysis.bean.enums.NotFulfilledState; +import org.onap.usecaseui.intentanalysis.bean.models.*; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +import static org.onap.usecaseui.intentanalysis.common.ResponseConsts.RSEPONSE_SUCCESS; + +@Log4j2 +@RestController +@RequestMapping("/intentReport") +public class IntentReportController { + + @GetMapping(value = "/{intentId}", produces = MediaType.APPLICATION_JSON_VALUE) + public ServiceResult getIntentById( + @PathVariable("intentId") String intentId) { + // test connection with ui,real log + IntentReport report = new IntentReport(); + report.setIntentReportId("12345"); + report.setIntentReference("intentReort"); + report.setObjectInstance(Arrays.asList("instance1", "instance2", "instance3")); + //report.setFulfillmentInfos(); + LocalDateTime now = LocalDateTime.now(); + report.setReportTime(Date.from( now.atZone( ZoneId.systemDefault()).toInstant())); + FulfilmentInfo fu1= new FulfilmentInfo(); + fu1.setFulfillmentId("fulfilmentInfo1"); + fu1.setFulfillmentStatus(FulfilmentStatus.FULFILLED); + FulfilmentInfo fu2= new FulfilmentInfo(); + fu2.setFulfillmentId("fulfilmentInfo2"); + fu2.setFulfillmentStatus(FulfilmentStatus.NOT_FULFILLED); + fu2.setNotFulfilledState(NotFulfilledState.DEGRADED); + fu2.setNotFulfilledReason("not fulfilled Reason"); + List<FulfilmentInfo> list = new ArrayList<>(); + list.add(fu1); + list.add(fu2); + report.setFulfillmentInfos(list); + + return new ServiceResult(new ResultHeader(RSEPONSE_SUCCESS, "get report success"), + report); + + } + +} diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfoTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfoTest.java index 24529fd..97dad76 100644 --- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfoTest.java +++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfoTest.java @@ -33,7 +33,7 @@ public class FulfilmentInfoTest { @Test public void testGetFulfilmentInfoTest() { FulfilmentInfo test = new FulfilmentInfo(); - test.getFulfilmentStatus(); + test.getFulfillmentStatus(); test.getNotFulfilledState(); test.getNotFulfilledReason(); @@ -42,7 +42,7 @@ public class FulfilmentInfoTest { @Test public void testSetFulfilmentInfoTest() { FulfilmentInfo test = new FulfilmentInfo(); - test.setFulfilmentStatus(FulfilmentStatus.FULFILLED); + test.setFulfillmentStatus(FulfilmentStatus.FULFILLED); test.setNotFulfilledState(NotFulfilledState.ACKNOWLEDGED); test.setNotFulfilledReason(""); 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 abe4239..6f10f10 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 @@ -84,7 +84,7 @@ class ExpectationServiceTest extends AbstractJUnit4SpringContextTests { expectationTargetList.add(target); FulfilmentInfo expectationFulfilmentInfo = new FulfilmentInfo(); - expectationFulfilmentInfo.setFulfilmentStatus(FulfilmentStatus.valueOf("NOT_FULFILLED")); + expectationFulfilmentInfo.setFulfillmentStatus(FulfilmentStatus.valueOf("NOT_FULFILLED")); expectationFulfilmentInfo.setNotFulfilledReason("NotFulfilledReason"); expectationFulfilmentInfo.setNotFulfilledState(NotFulfilledState.valueOf("COMPLIANT")); diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/IntentServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/IntentServiceTest.java index a1a31de..310c8c9 100644 --- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/IntentServiceTest.java +++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/IntentServiceTest.java @@ -89,7 +89,7 @@ public class IntentServiceTest extends AbstractJUnit4SpringContextTests { intentContext.setContextName("intentContextName"); List<Context> intentContextList = new ArrayList<>(); intentContextList.add(intentContext); - intentFulfilmentInfo.setFulfilmentStatus(FulfilmentStatus.valueOf("NOT_FULFILLED")); + intentFulfilmentInfo.setFulfillmentStatus(FulfilmentStatus.valueOf("NOT_FULFILLED")); intentFulfilmentInfo.setNotFulfilledReason("NotFulfilledReason"); intentFulfilmentInfo.setNotFulfilledState(NotFulfilledState.valueOf("COMPLIANT")); intent.setIntentId("testIntentId"); |