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/test/java/org | |
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/test/java/org')
3 files changed, 116 insertions, 5 deletions
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 index 3cc406d..d01ebc7 100644 --- 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 @@ -19,9 +19,6 @@ 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 diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java new file mode 100644 index 0000000..0a3cf04 --- /dev/null +++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/cllBusinessIntentMgt/cllBusinessModule/CLLBusinessDecisionModuleTest.java @@ -0,0 +1,116 @@ +package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule; + +import org.junit.Assert; +import org.junit.Before; +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.ExpectationType; +import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType; +import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType; +import org.onap.usecaseui.intentanalysis.bean.models.*; +import org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.CLLAssuranceIntentManagementFunction; +import org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.CLLDeliveryIntentManagementFunction; +import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction; +import org.onap.usecaseui.intentanalysis.service.ImfRegInfoService; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; +@SpringBootTest(classes = IntentAnalysisApplicationTests.class) +@RunWith(SpringRunner.class) +public class CLLBusinessDecisionModuleTest { + @InjectMocks + CLLBusinessDecisionModule cllBusinessDecisionModule; + + @Mock + private ImfRegInfoService imfRegInfoService; + @Mock + private ApplicationContext applicationContext; + + IntentGoalBean intentGoalBean = new IntentGoalBean(); + Intent intent = new Intent(); + @Before + public void before() throws Exception { + intent.setIntentName("cllIntent"); + intent.setIntentId("12345"); + List<Expectation> expectationList = new ArrayList<>(); + + Expectation delivery = new Expectation(); + delivery.setExpectationId("12345-delivery"); + delivery.setExpectationName("deliveryExpectation"); + delivery.setExpectationType(ExpectationType.DELIVERY); + ExpectationObject expectationObject = new ExpectationObject(); + expectationObject.setObjectType(ObjectType.SLICING); + //expetationTarget Context FulfilmentInfo is empty + delivery.setExpectationObject(expectationObject); + expectationList.add(delivery); + + Expectation assurance = new Expectation(); + assurance.setExpectationId("12345-assurance"); + assurance.setExpectationName("assuranceExpectation"); + assurance.setExpectationType(ExpectationType.ASSURANCE); + ExpectationObject expectationObject1 = new ExpectationObject(); + expectationObject1.setObjectType(ObjectType.CCVPN); + //expetationTarget Context FulfilmentInfo is empty + assurance.setExpectationObject(expectationObject1); + expectationList.add(assurance); + + intent.setIntentExpectations(expectationList); + intent.setIntentExpectations(expectationList); + intent.setIntentExpectations(expectationList); + intentGoalBean.setIntent(intent); + intentGoalBean.setIntentGoalType(IntentGoalType.CREATE); + } + @Test + public void testNeedDecompostion(){ +// IntentManagementFunctionRegInfo imfRegInfo = new IntentManagementFunctionRegInfo(); +// +// imfRegInfo.setSupportArea("cll"); +// imfRegInfo.setSupportInterfaces("CREATE"); +// imfRegInfo.setHandleName("aaa"); +// // Mockito.when(imfRegInfoService.getImfRegInfo(intentGoalBean)).thenReturn(imfRegInfo).thenReturn(imfRegInfo); +// Mockito.when(cllBusinessDecisionModule.exploreIntentHandlers(intentGoalBean)).thenReturn(new IntentManagementFunction()); +// Mockito.when(applicationContext.getBean("CLLDeliveryIntentManagementFunction")).thenReturn(new CLLDeliveryIntentManagementFunction()); +// cllBusinessDecisionModule.findHandler(intentGoalBean); + cllBusinessDecisionModule.needDecompostion(intentGoalBean); + Assert.assertTrue(true); + } + @Test + public void testIntentDecomposition(){ + cllBusinessDecisionModule.intentDecomposition(intentGoalBean); + Assert.assertTrue(true); + } + + @Test + public void testIntentOrchestration(){ + List<IntentGoalBean> intentGoalBeanList=new ArrayList<>(); + IntentGoalBean delivery=new IntentGoalBean(); + + Intent deliveryIntent= new Intent(); + deliveryIntent.setIntentName("delivery"); + + delivery.setIntentGoalType(IntentGoalType.CREATE); + delivery.setIntent(deliveryIntent); + intentGoalBeanList.add(delivery); + + IntentGoalBean assurance=new IntentGoalBean(); + + Intent assuranceIntent= new Intent(); + deliveryIntent.setIntentName("assurance"); + + assurance.setIntentGoalType(IntentGoalType.CREATE); + assurance.setIntent(assuranceIntent); + intentGoalBeanList.add(assurance); + + cllBusinessDecisionModule.intentOrchestration(intentGoalBeanList); + Assert.assertTrue(true); + } +}
\ No newline at end of file diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java index 4067b4f..164df70 100644 --- a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java +++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/service/impl/ImfRegInfoServiceImplTest.java @@ -23,8 +23,6 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; 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.Intent; import org.onap.usecaseui.intentanalysis.bean.models.IntentGoalBean; import org.onap.usecaseui.intentanalysis.bean.models.IntentManagementFunctionRegInfo; |