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.academicrecord.dto.StudentCourseRecordInfo;
010    import org.kuali.student.enrollment.academicrecord.service.AcademicRecordService;
011    import org.kuali.student.enrollment.courseregistration.dto.CourseRegistrationInfo;
012    import org.kuali.student.enrollment.courseregistration.service.CourseRegistrationService;
013    import org.kuali.student.krms.util.KSKRMSExecutionConstants;
014    import org.kuali.student.r2.common.dto.ContextInfo;
015    import org.kuali.student.r2.common.dto.LocaleInfo;
016    import org.springframework.test.context.ContextConfiguration;
017    import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
018    
019    import javax.annotation.Resource;
020    import java.util.HashMap;
021    import java.util.List;
022    import java.util.Map;
023    
024    import static org.junit.Assert.assertNotNull;
025    
026    @RunWith(SpringJUnit4ClassRunner.class)
027    @ContextConfiguration(locations = {"classpath:ks-krms-test-context-mock.xml"})
028    @Ignore
029    public class TestEnrolledCourseCodeTermResolver {
030            private KrmsTypeResolver typeResolver;
031    
032        public ContextInfo callContext = null;
033        @Resource(name = "courseRegistrationService")
034        private CourseRegistrationService courseRegistrationService;
035        private String studentID = "12020303";
036    
037        @Before
038        public void setUp() {
039            callContext = new ContextInfo();
040        }
041    
042    
043        @Test
044        public void testCourseRegistrationServiceNotNull() {
045            assertNotNull(courseRegistrationService);
046        }
047    
048        @Test
049        public void testResolve() {
050            EnrolledCourseCodeTermResolver termResolver = new EnrolledCourseCodeTermResolver();
051            termResolver.setCourseRegistrationService(courseRegistrationService);
052            Map<String, Object> resolvedPrereqs = new HashMap<String, Object>();
053            Map<String, String> parameters = new HashMap<String, String>();
054    
055            ContextInfo context = new ContextInfo();
056            context.setLocale(new LocaleInfo());
057            context.setPrincipalId("nina");
058    
059            resolvedPrereqs.put(RulesExecutionConstants.CONTEXT_INFO_TERM_NAME, context);
060    
061            parameters.put(KSKRMSExecutionConstants.PERSON_ID_TERM_PROPERTY, studentID);
062            String personId = parameters.get(KSKRMSExecutionConstants.PERSON_ID_TERM_PROPERTY);
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