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.academicrecord.dto.GPAInfo;
25  import org.kuali.student.enrollment.academicrecord.service.AcademicRecordService;
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.Map;
35  import static org.junit.Assert.assertNotNull;
36  import static org.junit.Assert.assertNull;
37  
38  @RunWith(SpringJUnit4ClassRunner.class)
39  @ContextConfiguration(locations = {"classpath:ks-krms-test-context.xml"})
40  @Ignore
41  public class TestFreeTextTermResolver {
42          private KrmsTypeResolver typeResolver;
43          private String studentID = "12020303";
44          private String CalcTypeID = "222";
45  
46          public ContextInfo callContext = null;
47          @Resource(name = "acadRecordService")
48          private AcademicRecordService academicRecordService;
49  
50          @Before
51          public void setUp() {
52              callContext = new ContextInfo();
53          }
54  
55  
56          @Test
57          public void testAcadRecordServiceNotNull() {
58              assertNotNull(academicRecordService);
59          }
60  
61          @Test
62          public void testResolve() {
63  
64              FreeTextTermResolver termResolver = new FreeTextTermResolver();
65              Map<String, Object> resolvedPrereqs = new HashMap<String, Object>();
66              Map<String, String> parameters = new HashMap<String, String>();
67  
68              ContextInfo context = new ContextInfo();
69              context.setLocale(new LocaleInfo());
70              context.setPrincipalId("nina");
71  
72              resolvedPrereqs.put(RulesExecutionConstants.CONTEXT_INFO_TERM_NAME, context);
73  
74              parameters.put(KSKRMSExecutionConstants.PERSON_ID_TERM_PROPERTY, studentID);
75              parameters.put(KSKRMSExecutionConstants.CALC_TYPE_KEY_TERM_PROPERTY, CalcTypeID) ;
76  
77              String result =  termResolver.resolve(resolvedPrereqs,parameters ) ;
78              assertNull(result);
79          }
80  
81  
82  
83      }