aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'intentanalysis/src/test')
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/IntentAnalysisApplicationTests.java (renamed from intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/test/IntentAnalysisApplicationTests.java)2
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyServiceTest.java182
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ConditionTest.java53
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ContextTest.java47
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationObjectTest.java49
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTargetTest.java57
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTest.java57
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfoTest.java50
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentGoalBeanTest.java45
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java59
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentTest.java52
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/StateTest.java49
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/IntentServiceTest.java170
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/test/service/IntentServiceTest.java56
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/RestFulServicesTest.java58
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/TestCall.java92
-rw-r--r--intentanalysis/src/test/resources/application.yaml17
-rw-r--r--intentanalysis/src/test/resources/intentdb-test-data.sql71
-rw-r--r--intentanalysis/src/test/resources/intentdb-test-init.sql78
19 files changed, 1163 insertions, 81 deletions
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/test/IntentAnalysisApplicationTests.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/IntentAnalysisApplicationTests.java
index 529f08d..965ec6d 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/test/IntentAnalysisApplicationTests.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/IntentAnalysisApplicationTests.java
@@ -12,7 +12,7 @@
* the License.
*/
-package org.onap.usecaseui.intentanalysis.test;
+package org.onap.usecaseui.intentanalysis;
import java.io.IOException;
import javax.servlet.FilterChain;
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyServiceTest.java
new file mode 100644
index 0000000..ea253e7
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/adapters/policy/PolicyServiceTest.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2022 Huawei Technologies Co., Ltd.
+ *
+ * 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.adapters.policy;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+
+import java.io.IOException;
+import mockit.MockUp;
+import okhttp3.MediaType;
+import okhttp3.ResponseBody;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.usecaseui.intentanalysis.adapters.policy.apicall.PolicyAPICall;
+import org.onap.usecaseui.intentanalysis.adapters.policy.impl.PolicyServiceImpl;
+import org.onap.usecaseui.intentanalysis.IntentAnalysisApplicationTests;
+import org.onap.usecaseui.intentanalysis.util.TestCall;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class PolicyServiceTest {
+
+ private static final int CREATE_POLICY_TYPE_FAILED = 0x01;
+
+ private static final int CREATE_POLICY_FAILED = 0x02;
+
+ private static final int DEPLOY_POLICY_FAILED = 0x04;
+
+ private static final int UNDEPLOY_POLICY_FAILED = 0x08;
+
+ private static final int DELETE_POLICY_FAILED = 0x10;
+
+ private static final int QUERY_POLICY_NOT_EXIST = 0x20;
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(PolicyServiceTest.class);
+
+ @Autowired
+ private PolicyServiceImpl policyService;
+
+ private PolicyAPICall policyAPICall;
+
+ private MockUp mockup;
+
+ @Test
+ public void testCreateAndDeployCLLPolicySuccess() throws IOException {
+ mockUpPolicyApiCall(0);
+ boolean result = policyService.createAndDeployModifyCLLPolicy();
+ Assert.assertTrue(result);
+ }
+
+
+ @Test
+ public void testCreateAndDeployCLLPolicyFailedCreateFailed() throws IOException {
+ mockUpPolicyApiCall(CREATE_POLICY_FAILED);
+ boolean result = policyService.createAndDeployModifyCLLPolicy();
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void testCreateAndDeployCLLPolicyFailedDeployFailed() throws IOException {
+ mockUpPolicyApiCall(DEPLOY_POLICY_FAILED);
+ boolean result = policyService.createAndDeployModifyCLLPolicy();
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void testUndeployAndRemoveCLLPolicySuccess() throws IOException {
+ mockUpPolicyApiCall(0);
+ boolean result = policyService.undeployAndRemoveModifyCLLPolicy();
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void testUndeployAndRemoveCLLPolicySuccessPolicyNotExist() throws IOException {
+ mockUpPolicyApiCall(QUERY_POLICY_NOT_EXIST);
+ boolean result = policyService.undeployAndRemoveModifyCLLPolicy();
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void testUpdateIntentConfigPolicySuccess() throws IOException {
+ mockUpPolicyApiCall(0);
+ boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", true);
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void testUpdateIntentConfigPolicySuccessPolicyNotExist(){
+ mockUpPolicyApiCall(QUERY_POLICY_NOT_EXIST);
+ boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", true);
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void testUpdateIntentConfigPolicyFailedCreatePolicyTypeFailed(){
+ mockUpPolicyApiCall(CREATE_POLICY_TYPE_FAILED);
+ boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", true);
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void testUpdateIntentConfigPolicyFailedCreatePolicyFailed(){
+ mockUpPolicyApiCall(CREATE_POLICY_FAILED);
+ boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", true);
+ Assert.assertFalse(result);
+ }
+
+ @Test
+ public void testUpdateIntentConfigPolicyFailedDeployPolicyFailed(){
+ mockUpPolicyApiCall(DEPLOY_POLICY_FAILED);
+ boolean result = policyService.updateIntentConfigPolicy("testCLLID", "1000", true);
+ Assert.assertFalse(result);
+ }
+
+ private void mockUpPolicyApiCall(int failedFlag) {
+ policyAPICall = mock(PolicyAPICall.class);
+ policyService.setPolicyAPICall(policyAPICall);
+ ResponseBody mockedSuccessResponse = ResponseBody.create(MediaType.parse("application/json"),
+ "Test Success Result");
+ if ((CREATE_POLICY_FAILED & failedFlag) > 0) {
+ when(policyAPICall.createPolicy(anyString(), anyString(), any())).thenReturn(
+ TestCall.failedCall("Create policy failed"));
+ } else {
+ when(policyAPICall.createPolicy(anyString(), anyString(), any())).thenReturn(
+ TestCall.successfulCall(mockedSuccessResponse));
+ }
+ if ((CREATE_POLICY_TYPE_FAILED & failedFlag) > 0) {
+ when(policyAPICall.createPolicyType(any())).thenReturn(TestCall.failedCall("Create policy type failed"));
+ } else {
+ when(policyAPICall.createPolicyType(any())).thenReturn(TestCall.successfulCall(mockedSuccessResponse));
+ }
+
+ if ((DEPLOY_POLICY_FAILED & failedFlag) > 0) {
+ when(policyAPICall.deployPolicy(any())).thenReturn(TestCall.failedCall("Deploy policy failed"));
+ } else {
+ when(policyAPICall.deployPolicy(any())).thenReturn(TestCall.successfulCall(mockedSuccessResponse));
+ }
+
+ if ((UNDEPLOY_POLICY_FAILED & failedFlag) > 0) {
+ when(policyAPICall.undeployPolicy(anyString())).thenReturn(TestCall.failedCall("Undeploy policy failed"));
+ } else {
+ when(policyAPICall.undeployPolicy(anyString())).thenReturn(TestCall.successfulCall(mockedSuccessResponse));
+ }
+
+ if ((DELETE_POLICY_FAILED & failedFlag) > 0) {
+ when(policyAPICall.removePolicy(anyString(), anyString())).thenReturn(
+ TestCall.failedCall("Delete policy failed"));
+ } else {
+ when(policyAPICall.removePolicy(anyString(), anyString())).thenReturn(
+ TestCall.successfulCall(mockedSuccessResponse));
+ }
+
+ if ((QUERY_POLICY_NOT_EXIST & failedFlag) > 0) {
+ when(policyAPICall.getPolicy(anyString(), anyString(), anyString(), anyString())).thenReturn(
+ TestCall.failedCall("Get policy failed"));
+ } else {
+ when(policyAPICall.getPolicy(anyString(), anyString(), anyString(), anyString())).thenReturn(
+ TestCall.successfulCall(mockedSuccessResponse));
+ }
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ConditionTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ConditionTest.java
new file mode 100644
index 0000000..49f2cb5
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ConditionTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.models;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.intentanalysis.bean.enums.OperatorType;
+
+import java.util.ArrayList;
+
+public class ConditionTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testSetConditionTest() throws Exception {
+ Condition condition = new Condition();
+ condition.setConditionId("");
+ condition.setConditionName("");
+ condition.setOperator(OperatorType.valueOf("OR"));
+ condition.setConditionValue("");
+ condition.setConditionList(new ArrayList<Condition>());
+ }
+
+ @Test
+ public void testGetConditionTest() throws Exception{
+ Condition condition = new Condition();
+ condition.getConditionId();
+ condition.getConditionName();
+ condition.getOperator();
+ condition.getConditionValue();
+ condition.getConditionList();
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ContextTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ContextTest.java
new file mode 100644
index 0000000..5ead1c8
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ContextTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.models;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+
+public class ContextTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+ @Test
+ public void testGetContestTest(){
+ Context context = new Context();
+ context.getContextId();
+ context.getContextName();
+ context.getContextConditions();
+ }
+ @Test
+ public void testSetContestTest(){
+ Context context = new Context();
+ context.setContextId("");
+ context.setContextName("");
+ context.setContextConditions(new ArrayList<Condition>());
+ }
+
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationObjectTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationObjectTest.java
new file mode 100644
index 0000000..52d8fbc
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationObjectTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.models;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
+
+import java.util.ArrayList;
+
+public class ExpectationObjectTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testGetExpectationObjectTest() {
+ ExpectationObject test = new ExpectationObject();
+ test.getObjectType();
+ test.getObjectInstance();
+ test.getObjectContexts();
+ }
+
+ @Test
+ public void testSetExpectationObjectTest() {
+ ExpectationObject test = new ExpectationObject();
+ test.setObjectType(ObjectType.OBJECT1);
+ test.setObjectInstance("");
+ test.setObjectContexts(new ArrayList<>());
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTargetTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTargetTest.java
new file mode 100644
index 0000000..e879b11
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTargetTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.models;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType;
+
+import java.util.ArrayList;
+
+public class ExpectationTargetTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testGetExpectationTest() {
+ Expectation test = new Expectation();
+ test.getExpectationId();
+ test.getExpectationName();
+ test.getExpectationType();
+ test.getExpectationObject();
+ test.getExpectationTargets();
+ test.getExpectationContexts();
+ test.getExpectationFulfilmentInfo();
+ }
+
+ @Test
+ public void testSetExpectationTest() {
+ Expectation test = new Expectation();
+ test.setExpectationId("");
+ test.setExpectationName("");
+ test.setExpectationType(ExpectationType.ASSURANCE);
+ test.setExpectationObject(new ExpectationObject());
+ test.setExpectationTargets(new ArrayList<>());
+ test.setExpectationContexts(new ArrayList<>());
+ test.setExpectationFulfilmentInfo(new FulfilmentInfo());
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTest.java
new file mode 100644
index 0000000..a3c2a09
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/ExpectationTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.models;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType;
+
+import java.util.ArrayList;
+
+public class ExpectationTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testGetExpectationTest() {
+ Expectation test = new Expectation();
+ test.getExpectationId();
+ test.getExpectationContexts();
+ test.getExpectationName();
+ test.getExpectationType();
+ test.getExpectationFulfilmentInfo();
+ test.getExpectationObject();
+ test.getExpectationTargets();
+ }
+
+ @Test
+ public void testSetExpectationTest() {
+ Expectation test = new Expectation();
+ test.setExpectationId("");
+ test.setExpectationContexts(new ArrayList<Context>());
+ test.setExpectationName("");
+ test.setExpectationTargets(new ArrayList<ExpectationTarget>());
+ test.setExpectationType(ExpectationType.ASSURANCE);
+ test.setExpectationFulfilmentInfo(new FulfilmentInfo());
+ test.setExpectationObject(new ExpectationObject());
+ }
+}
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
new file mode 100644
index 0000000..24529fd
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/FulfilmentInfoTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.models;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.intentanalysis.bean.enums.FulfilmentStatus;
+import org.onap.usecaseui.intentanalysis.bean.enums.NotFulfilledState;
+
+public class FulfilmentInfoTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testGetFulfilmentInfoTest() {
+ FulfilmentInfo test = new FulfilmentInfo();
+ test.getFulfilmentStatus();
+ test.getNotFulfilledState();
+ test.getNotFulfilledReason();
+
+ }
+
+ @Test
+ public void testSetFulfilmentInfoTest() {
+ FulfilmentInfo test = new FulfilmentInfo();
+ test.setFulfilmentStatus(FulfilmentStatus.FULFILLED);
+ test.setNotFulfilledState(NotFulfilledState.ACKNOWLEDGED);
+ test.setNotFulfilledReason("");
+
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentGoalBeanTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentGoalBeanTest.java
new file mode 100644
index 0000000..8a5ac8a
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentGoalBeanTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.models;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
+
+public class IntentGoalBeanTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testGetIntentGoalBeanTest() {
+ IntentGoalBean test = new IntentGoalBean();
+ test.getIntent();
+ test.getIntentGoalType();
+ }
+
+ @Test
+ public void testSetIntentGoalBeanTest() {
+ IntentGoalBean test = new IntentGoalBean();
+ test.setIntent(new Intent());
+ test.setIntentGoalType(IntentGoalType.DELETE);
+ }
+}
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
new file mode 100644
index 0000000..2368077
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentManagementFunctionRegInfoTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.models;
+
+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
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testGetIntentManagementFunctionRegInfoTest() {
+ IntentManagementFunctionRegInfo test = new IntentManagementFunctionRegInfo();
+ test.getId();
+ test.getDescription();
+ test.getSupportArea();
+ test.getSupportModel();
+ test.getSupportInterfaces();
+ test.getHandleName();
+ test.getIntentFunctionType();
+
+ }
+
+ @Test
+ public void testSetIntentManagementFunctionRegInfoTest() {
+ IntentManagementFunctionRegInfo test = new IntentManagementFunctionRegInfo();
+ test.setId("");
+ test.setDescription("");
+ test.setSupportArea(new ArrayList<SupportArea>());
+ test.setSupportModel("");
+ test.setSupportInterfaces(new ArrayList<>());
+ test.setHandleName("");
+ test.setIntentFunctionType(IntentFunctionType.INTERNALFUNCTION);
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentTest.java
new file mode 100644
index 0000000..33609e9
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/IntentTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.models;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+
+public class IntentTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testGetIntentTest() {
+ Intent test = new Intent();
+ test.getIntentId();
+ test.getIntentName();
+ test.getIntentExpectations();
+ test.getIntentContexts();
+ test.getIntentFulfilmentInfo();
+ }
+
+ @Test
+ public void testSetIntentTest() {
+ Intent test = new Intent();
+ test.setIntentId("");
+ test.setIntentName("");
+ test.setIntentExpectations(new ArrayList<Expectation>());
+ test.setIntentContexts(new ArrayList<Context>());
+ test.setIntentFulfilmentInfo(new FulfilmentInfo());
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/StateTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/StateTest.java
new file mode 100644
index 0000000..e04ea3a
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/bean/models/StateTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.models;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class StateTest {
+ @Before
+ public void before() throws Exception {
+ }
+
+ @After
+ public void after() throws Exception {
+ }
+
+ @Test
+ public void testGetStateTest() {
+ State test = new State();
+ test.getStateId();
+ test.getStateName();
+ test.getCondition();
+ test.getIsSatisfied();
+
+ }
+
+ @Test
+ public void testSetStateTest() {
+ State test = new State();
+ test.setStateId("");
+ test.setStateName("");
+ test.setCondition("");
+ test.setIsSatisfied(true);
+ }
+}
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
new file mode 100644
index 0000000..9e93b87
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/IntentServiceTest.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2022 Huawei Technologies Co., Ltd.
+ *
+ * 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.service;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.usecaseui.intentanalysis.bean.enums.*;
+import org.onap.usecaseui.intentanalysis.bean.models.Intent;
+import org.onap.usecaseui.intentanalysis.bean.models.Condition;
+import org.onap.usecaseui.intentanalysis.bean.models.FulfilmentInfo;
+import org.onap.usecaseui.intentanalysis.bean.models.Context;
+import org.onap.usecaseui.intentanalysis.bean.models.Expectation;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationTarget;
+import org.onap.usecaseui.intentanalysis.bean.models.ExpectationObject;
+import org.onap.usecaseui.intentanalysis.IntentAnalysisApplicationTests;
+import org.onap.usecaseui.intentanalysis.util.SpringContextUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class IntentServiceTest extends AbstractJUnit4SpringContextTests {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(IntentServiceTest.class);
+
+ private static final String TEST_INTENT_ID_1 = "intentId1";
+
+ private static final String TEST_INTENT_ID_2 = "intentId2";
+
+ private static final String TEST_INTENT_NAME = "CLL Business intent";
+
+ @Autowired
+ private IntentService intentService;
+
+ @Before
+ public void setUp() {
+ SpringContextUtil.setApplicationContext(applicationContext);
+ }
+
+ @Test
+ public void testCreateIntentSuccess() throws IOException {
+ Intent intent = new Intent();
+ Expectation expectation1 = new Expectation();
+ ExpectationTarget target1 = new ExpectationTarget();
+ ExpectationObject object1 = new ExpectationObject();
+ Context intentContext = new Context();
+ FulfilmentInfo intentFulfilmentInfo = new FulfilmentInfo();
+ Condition targetCondition1 = new Condition();
+ targetCondition1.setConditionId("conditionId");
+ targetCondition1.setConditionName("conditionName");
+ targetCondition1.setOperator(OperatorType.valueOf("EQUALTO"));
+ targetCondition1.setConditionValue("conditionValue");
+ List<Condition> targetConditionList = new ArrayList<>();
+ targetConditionList.add(targetCondition1);
+ target1.setTargetId("targetId");
+ target1.setTargetName("targetName");
+ target1.setTargetConditions(targetConditionList);
+ List<ExpectationTarget> expectationTargetList = new ArrayList<>();
+ expectationTargetList.add(target1);
+ object1.setObjectType(ObjectType.valueOf("OBJECT1"));
+ object1.setObjectInstance("objectInstance");
+ expectation1.setExpectationId("expectationId");
+ expectation1.setExpectationName("expectationName");
+ expectation1.setExpectationType(ExpectationType.valueOf("DELIVERY"));
+ expectation1.setExpectationObject(object1);
+ expectation1.setExpectationTargets(expectationTargetList);
+ List<Expectation> expectationList = new ArrayList<>();
+ expectationList.add(expectation1);
+ intentContext.setContextId("intentContextId");
+ intentContext.setContextName("intentContextName");
+ List<Context> intentContextList = new ArrayList<>();
+ intentContextList.add(intentContext);
+ intentFulfilmentInfo.setFulfilmentStatus(FulfilmentStatus.valueOf("NOT_FULFILLED"));
+ intentFulfilmentInfo.setNotFulfilledReason("NotFulfilledReason");
+ intentFulfilmentInfo.setNotFulfilledState(NotFulfilledState.valueOf("COMPLIANT"));
+ intent.setIntentId("testIntentId");
+ intent.setIntentName("testIntentName");
+ intent.setIntentContexts(intentContextList);
+ intent.setIntentExpectations(expectationList);
+ intent.setIntentFulfilmentInfo(intentFulfilmentInfo);
+
+ Intent intentTmp = intentService.createIntent(intent);
+ Assert.assertNotNull(intentTmp);
+ }
+
+ @Test
+ public void testGetIntentListSuccess() {
+ List<Intent> intentList = intentService.getIntentList();
+ Assert.assertNotNull(intentList);
+ }
+
+ @Test
+ public void testGetIntentSuccess() {
+ Intent intent = intentService.getIntent(TEST_INTENT_ID_1);
+ Assert.assertNotNull(intent);
+ }
+
+ @Test
+ public void testGetIntentByNameSuccess() {
+ List<Intent> intentList = intentService.getIntentByName(TEST_INTENT_NAME);
+ Assert.assertNotNull(intentList);
+
+ }
+
+ @Test
+ public void testUpdateIntentSuccess() {
+ Intent intent = intentService.getIntent(TEST_INTENT_ID_1);
+ intent.setIntentName("new intent name");
+ List<Context> contextList = intent.getIntentContexts();
+ Context intentContext = contextList.get(0);
+ intentContext.setContextName("new context name");
+ contextList.set(0, intentContext);
+ intent.setIntentContexts(contextList);
+ FulfilmentInfo intentFulfilmentInfo = intent.getIntentFulfilmentInfo();
+ intentFulfilmentInfo.setNotFulfilledReason("new reason");
+ intent.setIntentFulfilmentInfo(intentFulfilmentInfo);
+ List<Expectation> expectationList = intent.getIntentExpectations();
+ Expectation expectation = expectationList.get(0);
+ expectation.setExpectationName("new expectation name");
+ ExpectationObject expectationObject = expectation.getExpectationObject();
+ expectationObject.setObjectInstance("new object instance");
+ expectation.setExpectationObject(expectationObject);
+ List<ExpectationTarget> expectationTargetList = expectation.getExpectationTargets();
+ ExpectationTarget expectationTarget = expectationTargetList.get(0);
+ expectationTarget.setTargetName("new target name");
+ List<Condition> targetConditionList = expectationTarget.getTargetConditions();
+ Condition targetCondition = targetConditionList.get(0);
+ targetCondition.setConditionName("new conditon name");
+ targetConditionList.set(0, targetCondition);
+ expectationTarget.setTargetConditions(targetConditionList);
+ expectationTargetList.remove(2);
+ expectationTargetList.set(0, expectationTarget);
+ expectation.setExpectationTargets(expectationTargetList);
+ expectationList.set(0, expectation);
+ intent.setIntentExpectations(expectationList);
+
+ Intent updatedIntent = intentService.updateIntent(intent);
+ Assert.assertEquals("new intent name", updatedIntent.getIntentName());
+
+ }
+
+ @Test
+ public void testDeleteIntentSuccess() {
+ intentService.deleteIntent(TEST_INTENT_ID_2);
+ Intent intent = intentService.getIntent(TEST_INTENT_ID_2);
+ Assert.assertNull(intent);
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/test/service/IntentServiceTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/test/service/IntentServiceTest.java
deleted file mode 100644
index 3a692c0..0000000
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/test/service/IntentServiceTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2022 Huawei Technologies Co., Ltd.
- *
- * 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.test.service;
-
-import java.io.IOException;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.usecaseui.intentanalysis.bean.models.Intent;
-import org.onap.usecaseui.intentanalysis.service.IntentService;
-import org.onap.usecaseui.intentanalysis.test.IntentAnalysisApplicationTests;
-import org.onap.usecaseui.intentanalysis.util.SpringContextUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
-@RunWith(SpringRunner.class)
-public class IntentServiceTest extends AbstractJUnit4SpringContextTests {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(IntentServiceTest.class);
-
- @Autowired
- private IntentService intentService;
-
- @Before
- public void setUp() {
- SpringContextUtil.setApplicationContext(applicationContext);
- }
-
- @Test
- public void testCreateIntentSuccess() throws IOException {
- Intent intent = new Intent();
- intent.setIntentId("testUUID");
- intent.setIntentName("testIntentName");
- //ToDo
- //Intent intentTmp = intentService.createIntent(intent);
- Assert.assertNotNull(intent);
- }
-}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/RestFulServicesTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/RestFulServicesTest.java
new file mode 100644
index 0000000..b19e9a1
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/RestFulServicesTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2022 Huawei Technologies Co., Ltd.
+ *
+ * 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 java.io.IOException;
+import javax.servlet.http.HttpServletRequest;
+
+import okhttp3.RequestBody;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.usecaseui.intentanalysis.adapters.policy.apicall.PolicyAPICall;
+import org.onap.usecaseui.intentanalysis.IntentAnalysisApplicationTests;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
+@RunWith(SpringRunner.class)
+public class RestFulServicesTest {
+
+ @Test
+ public void testCreateSuccess() {
+ PolicyAPICall call = RestfulServices.create("https://localhost/testurl/", PolicyAPICall.class);
+ Assert.assertNotNull(call);
+ }
+
+ @Test
+ public void testCreateWithAuthSuccess() {
+ PolicyAPICall call = RestfulServices.create(PolicyAPICall.class, "testUser", "testPwd");
+ Assert.assertNotNull(call);
+ }
+
+ @Test
+ public void testGetMSBAddressSuccess() {
+ String msbAddress = RestfulServices.getMSBIAGAddress();
+ Assert.assertNotNull(msbAddress);
+ }
+
+ @Test
+ public void testExtractBodySuccess() throws IOException {
+ HttpServletRequest request = new MockHttpServletRequest();
+ RequestBody requestBody = RestfulServices.extractBody(request);
+ Assert.assertNotNull(requestBody);
+ }
+}
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/TestCall.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/TestCall.java
new file mode 100644
index 0000000..5454097
--- /dev/null
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/TestCall.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2022 Huawei Technologies Co., Ltd.
+ *
+ * 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 java.io.IOException;
+import okhttp3.MediaType;
+import okhttp3.Request;
+import okhttp3.ResponseBody;
+import retrofit2.Call;
+import retrofit2.Callback;
+import retrofit2.Response;
+
+public class TestCall<T> implements Call<T> {
+
+ private int code;
+
+ private T result;
+
+ private String errorMsg;
+
+ private TestCall(int code, T result, String errorMsg) {
+ this.code = code;
+ this.result = result;
+ this.errorMsg = errorMsg;
+ }
+
+ @Override
+ public Response<T> execute() throws IOException {
+ if (code >= 200 && code < 300) {
+ return Response.success(code, result);
+ }
+ if (code >= 400 && code < 500) {
+ return Response.error(code, ResponseBody.create(MediaType.parse("application/json"), errorMsg));
+ }
+ throw new IOException("Exception happens");
+ }
+
+ public static <T> TestCall<T> successfulCall(T result) {
+ return new TestCall<>(200, result, null);
+ }
+
+ public static <T> TestCall<T> failedCall(String errorMsg) {
+ return new TestCall<>(400, null, errorMsg);
+ }
+
+ public static <T> TestCall<T> exceptionCall() {
+ return new TestCall<>(-1, null, null);
+ }
+
+ @Override
+ public void enqueue(Callback<T> callback) {
+
+ }
+
+ @Override
+ public boolean isExecuted() {
+ return false;
+ }
+
+ @Override
+ public void cancel() {
+
+ }
+
+ @Override
+ public boolean isCanceled() {
+ return false;
+ }
+
+ @Override
+ public Call<T> clone() {
+ return null;
+ }
+
+ @Override
+ public Request request() {
+ return null;
+ }
+
+}
diff --git a/intentanalysis/src/test/resources/application.yaml b/intentanalysis/src/test/resources/application.yaml
index 8ddc4d8..aa317ef 100644
--- a/intentanalysis/src/test/resources/application.yaml
+++ b/intentanalysis/src/test/resources/application.yaml
@@ -29,10 +29,12 @@ spring:
username:
password:
driver-class-name: org.h2.Driver
- schema: classpath:intentdb-test-init.sql
- data: classpath:intentdb-test-data.sql
main:
allow-bean-definition-overriding: true
+ sql:
+ init:
+ schema-locations: classpath:intentdb-test-init.sql
+ data-locations: classpath:intentdb-test-data.sql
###mybtis####
mybatis:
@@ -42,3 +44,14 @@ security:
resource:
jwt:
key-value: test
+
+rest:
+ policy:
+ username: policyadmin
+ password: zb!XztG34
+ so:
+ username: InfraPortalClient
+ password: password1$
+ aai:
+ username: AAI
+ password: AAI \ No newline at end of file
diff --git a/intentanalysis/src/test/resources/intentdb-test-data.sql b/intentanalysis/src/test/resources/intentdb-test-data.sql
index 14cbefc..058e055 100644
--- a/intentanalysis/src/test/resources/intentdb-test-data.sql
+++ b/intentanalysis/src/test/resources/intentdb-test-data.sql
@@ -16,7 +16,74 @@
*/
-- ----------------------------
-MERGE INTO intent (intent_id, intent_name)KEY(intent_id)values ('1234','test-intent');
+-- Records of intent
+-- ----------------------------
+MERGE INTO intent (intent_id, intent_name) KEY (intent_id)
+values ('intentId1', 'CLL Business intent');
+MERGE INTO intent (intent_id, intent_name) KEY (intent_id)
+values ('intentId2', 'CLL Business intent');
+
+-- ----------------------------
+-- Records of expectation
+-- ----------------------------
+MERGE INTO expectation (expectation_id, expectation_name, expectation_type, intent_id) KEY (expectation_id)
+values ('expectationId1', 'CLL Service Expectation', 'DELIVERY', 'intentId1');
+MERGE INTO expectation (expectation_id, expectation_name, expectation_type, intent_id) KEY (expectation_id)
+values ('expectationId2', 'CLL Assurance Expectation', 'ASSURANCE', 'intentId1');
+MERGE INTO expectation (expectation_id, expectation_name, expectation_type, intent_id) KEY (expectation_id)
+values ('expectationId3', 'CLL Service Expectation', 'DELIVERY', 'intentId2');
+
+-- ----------------------------
+-- 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');
+MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
+values ('931a8690-fa61-4c2b-a387-9e0fa6152136', 'OBJECT2', '', 'expectationId2');
+MERGE INTO expectation_object (object_id, object_type, object_instance, expectation_id) KEY (object_id)
+values ('3f36bf22-3416-4150-8005-cdc406a43310', 'OBJECT2', '', 'expectationId3');
+
+-- ----------------------------
+-- Records of expectation_target
+-- ----------------------------
+MERGE INTO expectation_target (target_id, target_name, expectation_id) KEY (target_id)
+values ('target1-1', 'source', 'expectationId1');
+MERGE INTO expectation_target (target_id, target_name, expectation_id) KEY (target_id)
+values ('target1-2', 'destination', 'expectationId1');
+MERGE INTO expectation_target (target_id, target_name, expectation_id) KEY (target_id)
+values ('target1-3', 'bandwidth', 'expectationId1');
+MERGE INTO expectation_target (target_id, target_name, expectation_id) KEY (target_id)
+values ('target2-1', 'bandwidthAssurance', 'expectationId2');
+MERGE INTO expectation_target (target_id, target_name, expectation_id) KEY (target_id)
+values ('target3-1', 'source', 'expectationId3');
+-- ----------------------------
+-- Records of condition
+-- ----------------------------
+MERGE INTO condition (condition_id, condition_name, operator_type, condition_value, parent_id) KEY (condition_id)
+values ('condition1-1', 'condition of the cll service source', 'EQUALTO', 'Company A', 'target1-1');
+MERGE INTO condition (condition_id, condition_name, operator_type, condition_value, parent_id) KEY (condition_id)
+values ('condition1-2', 'condition of the cll service destination', 'EQUALTO', 'Cloud 1', 'target1-2');
+MERGE INTO condition (condition_id, condition_name, operator_type, condition_value, parent_id) KEY (condition_id)
+values ('condition1-3', 'condition of the cll service bandwidth', 'EQUALTO', '1000', 'target1-3');
+MERGE INTO condition (condition_id, condition_name, operator_type, condition_value, parent_id) KEY (condition_id)
+values ('condition2-1', 'condition of the cll service bandwidth', 'EQUALTO', 'true', 'target2-1');
+MERGE INTO condition (condition_id, condition_name, operator_type, condition_value, parent_id) KEY (condition_id)
+values ('condition3-1', 'condition of the cll service source', 'EQUALTO', 'Company A', 'target3-1');
+
+-- ----------------------------
+-- Records of context
+-- ----------------------------
+MERGE INTO context (context_id, context_name, parent_id) KEY (context_id)
+values ('d64f3a5f-b091-40a6-bca0-1bc6b1ce8f43', 'intentContextName', 'intentId1');
+MERGE INTO context (context_id, context_name, parent_id) KEY (context_id)
+values ('72f6c546-f234-4be5-a2fe-5740139e20cb', 'intentContextName', 'intentId2');
+
+-- ----------------------------
+-- Records of fulfilment_info
+-- ----------------------------
+MERGE INTO fulfilment_info (fulfilment_info_id, fulfilment_info_status, not_fulfilled_state, not_fulfilled_reason) KEY (fulfilment_info_id)
+values ('intentId1', 'NOT_FULFILLED', 'COMPLIANT', 'NotFulfilledReason');
+MERGE INTO fulfilment_info (fulfilment_info_id, fulfilment_info_status, not_fulfilled_state, not_fulfilled_reason) KEY (fulfilment_info_id)
+values ('intentId2', 'NOT_FULFILLED', 'COMPLIANT', 'NotFulfilledReason');
-MERGE INTO expectation (expectation_id, expectation_name, target_moi, intent_id)KEY(expectation_id)values ('2234','test-expectation',null, '1234');
diff --git a/intentanalysis/src/test/resources/intentdb-test-init.sql b/intentanalysis/src/test/resources/intentdb-test-init.sql
index b84f8e3..211e1cb 100644
--- a/intentanalysis/src/test/resources/intentdb-test-init.sql
+++ b/intentanalysis/src/test/resources/intentdb-test-init.sql
@@ -14,29 +14,67 @@
Date: 30/12/2019 14:40:23
*/
-DROP TABLE IF EXISTS intent;
-DROP TABLE IF EXISTS expectation;
-DROP TABLE IF EXISTS state;
-
-CREATE TABLE if NOT EXISTS intent(
- intent_id varchar(255),
- intent_name varchar(255),
- CONSTRAINT intent_test_task_pkey PRIMARY KEY (intent_id)
+//CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
+
+DROP TABLE IF EXISTS intent;
+DROP TABLE IF EXISTS expectation;
+DROP TABLE IF EXISTS expectation_object;
+DROP TABLE IF EXISTS expectation_target;
+DROP TABLE IF EXISTS context;
+DROP TABLE IF EXISTS fulfilment_info;
+DROP TABLE IF EXISTS condition;
+
+create table if not exists intent
+(
+ intent_id varchar(255) primary key,
+ intent_name varchar(255)
);
-create table if not exists expectation(
- expectation_id varchar(255),
+create table if not exists expectation
+(
+ expectation_id varchar(255) primary key,
expectation_name varchar(255),
- target_moi varchar(255),
- intent_id varchar(255),
- CONSTRAINT expectation_test_task_pkey PRIMARY KEY (expectation_id)
+ expectation_type varchar(255),
+ intent_id varchar(255)
+);
+
+create table if not exists expectation_object
+(
+ object_id varchar(255) DEFAULT random_uuid(),
+ primary key (object_id),
+ object_type varchar(255),
+ object_instance varchar(255),
+ expectation_id varchar(255)
+);
+
+create table if not exists expectation_target
+(
+ target_id varchar(255) primary key,
+ target_name varchar(255),
+ expectation_id varchar(255)
);
-create table if not exists state(
- state_id varchar(255),
- state_name varchar(255),
- is_satisfied boolean,
- condition varchar(255),
- expectation_id varchar(255),
- CONSTRAINT state_test_task_pkey PRIMARY KEY (state_id)
+create table if not exists context
+(
+ context_id varchar(255) primary key,
+ context_name varchar(255),
+ parent_id varchar(255)
);
+
+create table if not exists fulfilment_info
+(
+ fulfilment_info_id varchar(255) primary key,
+ fulfilment_info_status varchar(255),
+ not_fulfilled_state varchar(255),
+ not_fulfilled_reason varchar(255)
+);
+
+create table if not exists condition
+(
+ condition_id varchar(255) primary key,
+ condition_name varchar(255),
+ operator_type varchar(255),
+ condition_value varchar(255),
+ parent_id varchar(255)
+);
+