View Javadoc

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