001 package org.kuali.student.krms.termresolver; 002 003 import org.junit.Before; 004 import org.junit.Ignore; 005 import org.junit.Test; 006 import org.junit.runner.RunWith; 007 import org.kuali.rice.krms.impl.type.KrmsTypeResolver; 008 import org.kuali.student.common.util.krms.RulesExecutionConstants; 009 import org.kuali.student.enrollment.courseregistration.dto.CourseRegistrationInfo; 010 import org.kuali.student.enrollment.courseregistration.service.CourseRegistrationService; 011 import org.kuali.student.krms.util.KSKRMSExecutionConstants; 012 import org.kuali.student.r2.common.dto.ContextInfo; 013 import org.kuali.student.r2.common.dto.LocaleInfo; 014 import org.springframework.test.context.ContextConfiguration; 015 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 016 017 import javax.annotation.Resource; 018 import java.util.HashMap; 019 import java.util.List; 020 import java.util.Map; 021 022 import static org.junit.Assert.assertNotNull; 023 024 @RunWith(SpringJUnit4ClassRunner.class) 025 @ContextConfiguration(locations = {"classpath:ks-krms-test-context-mock.xml"}) 026 @Ignore 027 public class TestEnrolledCoursesByTermTermResolver { 028 private KrmsTypeResolver typeResolver; 029 030 public ContextInfo callContext = null; 031 @Resource(name = "courseRegistrationService") 032 private CourseRegistrationService courseRegistrationService; 033 private String studentID = "12020303"; 034 private String TermId = "1001"; 035 036 @Before 037 public void setUp() { 038 callContext = new ContextInfo(); 039 } 040 041 042 @Test 043 public void testCourseRegistrationServiceNotNull() { 044 assertNotNull(courseRegistrationService); 045 } 046 047 @Test 048 public void testResolve() { 049 EnrolledCoursesByTermTermResolver termResolver = new EnrolledCoursesByTermTermResolver(); 050 termResolver.setCourseRegistrationService(courseRegistrationService); 051 Map<String, Object> resolvedPrereqs = new HashMap<String, Object>(); 052 Map<String, String> parameters = new HashMap<String, String>(); 053 054 ContextInfo context = new ContextInfo(); 055 context.setLocale(new LocaleInfo()); 056 context.setPrincipalId("nina"); 057 058 resolvedPrereqs.put(RulesExecutionConstants.CONTEXT_INFO_TERM_NAME, context); 059 060 parameters.put(KSKRMSExecutionConstants.PERSON_ID_TERM_PROPERTY, studentID); 061 parameters.put(KSKRMSExecutionConstants.TERM_ID_TERM_PROPERTY, TermId); 062 063 064 List<CourseRegistrationInfo> courseRegistrationRecords = termResolver.resolve(resolvedPrereqs, parameters); 065 // TODO Do some assert statements on the expected returned list. 066 assertNotNull(courseRegistrationRecords); 067 068 } 069 070 071 072 } 073