1 package org.onap.usecaseui.intentanalysis.cllBusinessIntentMgt.cllBusinessModule;
3 import org.junit.Assert;
4 import org.junit.Before;
6 import org.junit.runner.RunWith;
7 import org.mockito.InjectMocks;
8 import org.mockito.Mock;
9 import org.mockito.Mockito;
10 import org.onap.usecaseui.intentanalysis.IntentAnalysisApplicationTests;
11 import org.onap.usecaseui.intentanalysis.bean.enums.ExpectationType;
12 import org.onap.usecaseui.intentanalysis.bean.enums.IntentGoalType;
13 import org.onap.usecaseui.intentanalysis.bean.enums.ObjectType;
14 import org.onap.usecaseui.intentanalysis.bean.models.*;
15 import org.onap.usecaseui.intentanalysis.cllassuranceIntentmgt.CLLAssuranceIntentManagementFunction;
16 import org.onap.usecaseui.intentanalysis.clldeliveryIntentmgt.CLLDeliveryIntentManagementFunction;
17 import org.onap.usecaseui.intentanalysis.intentBaseService.IntentManagementFunction;
18 import org.onap.usecaseui.intentanalysis.service.ImfRegInfoService;
19 import org.springframework.boot.test.context.SpringBootTest;
20 import org.springframework.context.ApplicationContext;
21 import org.springframework.test.context.junit4.SpringRunner;
23 import java.util.ArrayList;
24 import java.util.List;
26 import static org.junit.jupiter.api.Assertions.*;
27 @SpringBootTest(classes = IntentAnalysisApplicationTests.class)
28 @RunWith(SpringRunner.class)
29 public class CLLBusinessDecisionModuleTest {
31 CLLBusinessDecisionModule cllBusinessDecisionModule;
34 private ImfRegInfoService imfRegInfoService;
36 private ApplicationContext applicationContext;
38 IntentGoalBean intentGoalBean = new IntentGoalBean();
39 Intent intent = new Intent();
41 public void before() throws Exception {
42 intent.setIntentName("cllIntent");
43 intent.setIntentId("12345");
44 List<Expectation> expectationList = new ArrayList<>();
46 Expectation delivery = new Expectation();
47 delivery.setExpectationId("12345-delivery");
48 delivery.setExpectationName("deliveryExpectation");
49 delivery.setExpectationType(ExpectationType.DELIVERY);
50 ExpectationObject expectationObject = new ExpectationObject();
51 expectationObject.setObjectType(ObjectType.SLICING);
52 //expetationTarget Context FulfilmentInfo is empty
53 delivery.setExpectationObject(expectationObject);
54 expectationList.add(delivery);
56 Expectation assurance = new Expectation();
57 assurance.setExpectationId("12345-assurance");
58 assurance.setExpectationName("assuranceExpectation");
59 assurance.setExpectationType(ExpectationType.ASSURANCE);
60 ExpectationObject expectationObject1 = new ExpectationObject();
61 expectationObject1.setObjectType(ObjectType.CCVPN);
62 //expetationTarget Context FulfilmentInfo is empty
63 assurance.setExpectationObject(expectationObject1);
64 expectationList.add(assurance);
66 intent.setIntentExpectations(expectationList);
67 intent.setIntentExpectations(expectationList);
68 intent.setIntentExpectations(expectationList);
69 intentGoalBean.setIntent(intent);
70 intentGoalBean.setIntentGoalType(IntentGoalType.CREATE);
73 public void testNeedDecompostion(){
74 // IntentManagementFunctionRegInfo imfRegInfo = new IntentManagementFunctionRegInfo();
76 // imfRegInfo.setSupportArea("cll");
77 // imfRegInfo.setSupportInterfaces("CREATE");
78 // imfRegInfo.setHandleName("aaa");
79 // // Mockito.when(imfRegInfoService.getImfRegInfo(intentGoalBean)).thenReturn(imfRegInfo).thenReturn(imfRegInfo);
80 // Mockito.when(cllBusinessDecisionModule.exploreIntentHandlers(intentGoalBean)).thenReturn(new IntentManagementFunction());
81 // Mockito.when(applicationContext.getBean("CLLDeliveryIntentManagementFunction")).thenReturn(new CLLDeliveryIntentManagementFunction());
82 // cllBusinessDecisionModule.findHandler(intentGoalBean);
83 cllBusinessDecisionModule.needDecompostion(intentGoalBean);
84 Assert.assertTrue(true);
87 public void testIntentDecomposition(){
88 cllBusinessDecisionModule.intentDecomposition(intentGoalBean);
89 Assert.assertTrue(true);
93 public void testIntentOrchestration(){
94 List<IntentGoalBean> intentGoalBeanList=new ArrayList<>();
95 IntentGoalBean delivery=new IntentGoalBean();
97 Intent deliveryIntent= new Intent();
98 deliveryIntent.setIntentName("delivery");
100 delivery.setIntentGoalType(IntentGoalType.CREATE);
101 delivery.setIntent(deliveryIntent);
102 intentGoalBeanList.add(delivery);
104 IntentGoalBean assurance=new IntentGoalBean();
106 Intent assuranceIntent= new Intent();
107 deliveryIntent.setIntentName("assurance");
109 assurance.setIntentGoalType(IntentGoalType.CREATE);
110 assurance.setIntent(assuranceIntent);
111 intentGoalBeanList.add(assurance);
113 cllBusinessDecisionModule.intentOrchestration(intentGoalBeanList);
114 Assert.assertTrue(true);