1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.krms.termresolver;
17
18 import org.junit.Before;
19 import org.junit.Ignore;
20 import org.junit.Test;
21 import org.junit.runner.RunWith;
22 import org.kuali.rice.krms.impl.type.KrmsTypeResolver;
23 import org.kuali.student.common.util.krms.RulesExecutionConstants;
24 import org.kuali.student.enrollment.courseregistration.dto.CourseRegistrationInfo;
25 import org.kuali.student.enrollment.courseregistration.service.CourseRegistrationService;
26 import org.kuali.student.krms.util.KSKRMSExecutionConstants;
27 import org.kuali.student.r2.common.dto.ContextInfo;
28 import org.kuali.student.r2.common.dto.LocaleInfo;
29 import org.springframework.test.context.ContextConfiguration;
30 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
31
32 import javax.annotation.Resource;
33 import java.util.HashMap;
34 import java.util.List;
35 import java.util.Map;
36
37 import static org.junit.Assert.assertNotNull;
38
39 @RunWith(SpringJUnit4ClassRunner.class)
40 @ContextConfiguration(locations = {"classpath:ks-krms-test-context-mock.xml"})
41 @Ignore
42 public class TestEnrolledEffectiveDateToTermResolver {
43 private KrmsTypeResolver typeResolver;
44
45 public ContextInfo callContext = null;
46 @Resource(name = "courseRegistrationService")
47 private CourseRegistrationService courseRegistrationService;
48 private String studentID = "12020303";
49 private String TermId = "1001";
50
51 @Before
52 public void setUp() {
53 callContext = new ContextInfo();
54 }
55
56
57 @Test
58 public void testCourseRegistrationServiceNotNull() {
59 assertNotNull(courseRegistrationService);
60 }
61
62 @Test
63 public void testResolve() {
64 EnrolledEffectiveDateToTermResolver termResolver = new EnrolledEffectiveDateToTermResolver();
65 termResolver.setCourseRegistrationService(courseRegistrationService);
66 Map<String, Object> resolvedPrereqs = new HashMap<String, Object>();
67 Map<String, String> parameters = new HashMap<String, String>();
68
69 ContextInfo context = new ContextInfo();
70 context.setLocale(new LocaleInfo());
71 context.setPrincipalId("nina");
72
73 resolvedPrereqs.put(RulesExecutionConstants.CONTEXT_INFO_TERM_NAME, context);
74 parameters.put(KSKRMSExecutionConstants.PERSON_ID_TERM_PROPERTY, studentID);
75 parameters.put(KSKRMSExecutionConstants.TERM_ID_TERM_PROPERTY, TermId);
76
77 List<CourseRegistrationInfo> courseRegistrationRecords = termResolver.resolve(resolvedPrereqs, parameters);
78
79 assertNotNull(courseRegistrationRecords);
80
81 }
82
83 }