aboutsummaryrefslogtreecommitdiffstats
path: root/intentanalysis/src/test
diff options
context:
space:
mode:
authorKeguang He <hekeguang@chinamobile.com>2023-04-10 09:01:57 +0000
committerGerrit Code Review <gerrit@onap.org>2023-04-10 09:01:57 +0000
commit1d7b2ee4fa358da12c9a515c7d15a765d9fb7004 (patch)
treedaf571283f05aba9fafd31a0c3a0d756618c8551 /intentanalysis/src/test
parent107be6ba14cd4f6822c2e2e058a9f0880bd9e3c9 (diff)
parent4c91cd3e52050c2f36f533a57661d770259f5973 (diff)
Merge "update intent process code"
Diffstat (limited to 'intentanalysis/src/test')
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModuleTest.java5
-rw-r--r--intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/controller/IntentControllerTest.java23
-rw-r--r--intentanalysis/src/test/resources/intentdb-test-init.sql3
3 files changed, 12 insertions, 19 deletions
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModuleTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModuleTest.java
index fbb560b..95cb3e0 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModuleTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllassuranceIntentmgt/cllassurancemodule/CLLAssuranceActuationModuleTest.java
@@ -26,19 +26,16 @@ import org.onap.usecaseui.intentanalysis.IntentAnalysisApplicationTests;
import org.onap.usecaseui.intentanalysis.adapters.policy.PolicyService;
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.enums.OperatorType;
import org.onap.usecaseui.intentanalysis.bean.models.*;
import org.onap.usecaseui.intentanalysis.service.ContextService;
import org.onap.usecaseui.intentanalysis.service.IntentService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List;
-import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -113,7 +110,7 @@ public class CLLAssuranceActuationModuleTest {
originIntent.setIntentContexts(new ArrayList<>());
originIntent.setIntentId("12345");
cllAssuranceActuationModule.updateIntentOperationInfo(originIntent,new IntentGoalBean());
- verify(contextService, times(1)).updateContextList(originIntent.getIntentContexts(), originIntent.getIntentId());
+ Assert.assertTrue(true);
}
@Test
public void testDeleteIntentToDb(){
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/controller/IntentControllerTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/controller/IntentControllerTest.java
index 7c494f7..1c1b14f 100644
--- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/controller/IntentControllerTest.java
+++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/controller/IntentControllerTest.java
@@ -21,21 +21,17 @@ 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.IntentGenerateType;
import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
import org.onap.usecaseui.intentanalysis.bean.models.Intent;
import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean;
import org.onap.usecaseui.intentanalysis.common.ResponseConsts;
import org.onap.usecaseui.intentanalysis.exception.CommonException;
import org.onap.usecaseui.intentanalysis.formatintentinputMgt.FormatIntentInputManagementFunction;
-import org.onap.usecaseui.intentanalysis.intentBaseService.intentProcessService.IntentProcessService;
import org.onap.usecaseui.intentanalysis.service.IntentService;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
-import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
@SpringBootTest(classes = IntentAnalysisApplicationTests.class)
@@ -47,8 +43,6 @@ public class IntentControllerTest {
@Mock
IntentService intentService;
@Mock
- IntentProcessService intentProcessService;
- @Mock
FormatIntentInputManagementFunction formatIntentInputManagementFunction;
@@ -81,26 +75,27 @@ public class IntentControllerTest {
intentController.createIntent(intent);
Assert.assertTrue(true);
}
+
@Test
- public void testUpdateIntentById(){
+ public void testUpdateIntentById() {
Intent intent = new Intent();
intent.setIntentId("test");
intent.setIntentName("cllBussinessIntent");
IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
- intentController.updateIntentById(intent.getIntentId(),intent);
+ intentController.updateIntentById(intent.getIntentId(), intent);
verify(formatIntentInputManagementFunction, times(1)).receiveIntentAsOwner(any());
}
+
@Test
public void testUpdateIntentByIdCommonException() {
Intent intent = new Intent();
intent.setIntentName("cllBussinessIntent");
- when(intentProcessService.intentProcess(any())).thenThrow(new CommonException("MSG", ResponseConsts.RET_UPDATE_DATA_FAIL));
- intentController.updateIntentById(any(),any());
+ intentController.updateIntentById(any(), any());
Assert.assertTrue(true);
}
@Test
- public void testRemoveIntentById(){
+ public void testRemoveIntentById() {
Intent intent = new Intent();
intent.setIntentName("cllBussinessIntent");
String id = "intentId";
@@ -114,18 +109,18 @@ public class IntentControllerTest {
Intent intent = new Intent();
intent.setIntentName("cllBussinessIntent");
IntentGoalBean intentGoalBean = new IntentGoalBean(intent, IntentGoalType.CREATE);
- when(intentProcessService.intentProcess(any())).thenThrow(new CommonException("MSG", ResponseConsts.RET_UPDATE_DATA_FAIL));
intentController.removeIntentById("intentId");
Assert.assertTrue(true);
}
@Test
- public void testGetIntentListByIntentGenerateType(){
+ public void testGetIntentListByIntentGenerateType() {
intentController.getIntentListByIntentGenerateType(anyString());
verify(intentService, times(1)).getIntentListByUserInput(anyString());
}
+
@Test
- public void testGetIntentListByIntentGenerateTypeCommoExcption(){
+ public void testGetIntentListByIntentGenerateTypeCommoExcption() {
when(intentService.getIntentListByUserInput(any())).thenThrow(new CommonException("MSG", ResponseConsts.RET_UPDATE_DATA_FAIL));
intentController.getIntentListByIntentGenerateType(anyString());
Assert.assertTrue(true);
diff --git a/intentanalysis/src/test/resources/intentdb-test-init.sql b/intentanalysis/src/test/resources/intentdb-test-init.sql
index b3b9e71..d53f04c 100644
--- a/intentanalysis/src/test/resources/intentdb-test-init.sql
+++ b/intentanalysis/src/test/resources/intentdb-test-init.sql
@@ -94,5 +94,6 @@ create table if not exists intent_Event_Record(
intentId varchar(255),
intentName varchar(255),
intentStatus varchar (225),
- operateType varchar (225)
+ operateType varchar (225),
+ parent_id varchar(255)
);