View Javadoc

1   /**
2    * Copyright 2011 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
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          // TODO Do some assert statements on the expected returned list.
79          assertNotNull(courseRegistrationRecords);
80  
81      }
82  
83  }