diff options
author | zhuguanyu <zhuguanyu5@huawei.com> | 2022-09-01 20:15:30 +0800 |
---|---|---|
committer | zhuguanyu <zhuguanyu5@huawei.com> | 2022-09-06 10:34:47 +0800 |
commit | a822724a4928b19aba349776ac17bdc5c72e8696 (patch) | |
tree | b7a2d89b9562dc71e6e2f9af6ca8b3235700ead9 /intentanalysis/src/main/java/org/onap | |
parent | 7a41339ea8a18aa7a93d73c509a74af1ef13f0a7 (diff) |
Add UT to uui services
Issue-ID: USECASEUI-716
Signed-off-by: zhuguanyu <zhuguanyu5@huawei.com>
Change-Id: I5650e9f859cf80d5ac04062fac851a092184f3e0
Diffstat (limited to 'intentanalysis/src/main/java/org/onap')
2 files changed, 6 insertions, 1 deletions
diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java index d3bfd34..2e7db09 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationObjectServiceImpl.java @@ -51,6 +51,11 @@ public class ExpectationObjectServiceImpl implements ExpectationObjectService { @Override public void createExpectationObject(ExpectationObject expectationObject, String expectationId) { + if (expectationObjectService.getExpectationObject(expectationId) != null) { + String msg = String.format("It already exists an object for the expectation %s, update might work.", expectationId); + log.error(msg); + throw new DataBaseException(msg, ResponseConsts.RET_INSERT_DATA_FAIL); + } contextService.createContextList(expectationObject.getObjectContexts(), expectationObjectMapper.selectExpectationObjectId(expectationId)); if (expectationObjectMapper.insertExpectationObject(expectationObject, expectationId) < 1) { diff --git a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java index ebf430d..1dff5a7 100644 --- a/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java +++ b/intentanalysis/src/main/java/org/onap/usecaseui/intentanalysis/service/impl/ExpectationTargetServiceImpl.java @@ -151,7 +151,7 @@ public class ExpectationTargetServiceImpl implements ExpectationTargetService { } expectationTargetIdListFromDB.remove(expectationTargetId); } else { - expectationTargetService.createExpectationTarget(expectationTarget, expectationTargetId); + expectationTargetService.createExpectationTarget(expectationTarget, expectationId); } } for (String expectationTargetIdFromDB : expectationTargetIdListFromDB) { |