1 package org.kuali.student.enrollment.class2.acal.service.impl; 2 3 import static org.junit.Assert.*; 4 5 import java.util.List; 6 7 import org.junit.Before; 8 import org.junit.Test; 9 import org.junit.runner.RunWith; 10 import org.kuali.student.enrollment.acal.service.AcademicCalendarService; 11 import org.kuali.student.r2.common.dto.ContextInfo; 12 import org.kuali.student.r2.common.exceptions.AlreadyExistsException; 13 import org.kuali.student.r2.common.exceptions.DataValidationErrorException; 14 import org.kuali.student.r2.common.exceptions.DoesNotExistException; 15 import org.kuali.student.r2.common.exceptions.InvalidParameterException; 16 import org.kuali.student.r2.common.exceptions.MissingParameterException; 17 import org.kuali.student.r2.common.exceptions.OperationFailedException; 18 import org.kuali.student.r2.common.exceptions.PermissionDeniedException; 19 import org.kuali.student.r2.common.exceptions.ReadOnlyException; 20 import org.kuali.student.r2.common.exceptions.VersionMismatchException; 21 import org.kuali.student.r2.core.constants.AtpServiceConstants; 22 import org.kuali.student.r2.core.class1.type.dto.TypeInfo; 23 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Qualifier; 25 import org.springframework.test.context.ContextConfiguration; 26 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 27 import org.springframework.test.context.transaction.TransactionConfiguration; 28 import org.springframework.transaction.annotation.Transactional; 29 30 @RunWith(SpringJUnit4ClassRunner.class) 31 @ContextConfiguration(locations = {"classpath:acal-test-context.xml"}) 32 @TransactionConfiguration(transactionManager = "JtaTxManager", defaultRollback = true) 33 @Transactional 34 public class TestAcademicCalendarServiceJira530Impl { 35 36 @Autowired 37 @Qualifier("acalServiceAuthDecorator") 38 private AcademicCalendarService acalService; 39 public static String principalId = "123"; 40 public ContextInfo callContext = null; 41 42 @Before 43 public void setUp() { 44 principalId = "123"; 45 callContext = new ContextInfo(); 46 callContext.setPrincipalId(principalId); 47 } 48 49 @Test 50 public void testJira530() 51 throws AlreadyExistsException, DataValidationErrorException, 52 InvalidParameterException, MissingParameterException, OperationFailedException, 53 PermissionDeniedException, DoesNotExistException, ReadOnlyException, VersionMismatchException { 54 55 String termType = AtpServiceConstants.ATP_FALL_TYPE_KEY; 56 List<TypeInfo> types = this.acalService.getKeyDateTypesForTermType(termType, callContext); 57 assertNotNull(types); 58 if (types.size () < 2) { 59 fail ("too few key date types"); 60 } 61 System.out.println ("Found " + types.size() + " keydate types for " + termType); 62 for (TypeInfo type : types) { 63 System.out.println(type.getKey() + " " + type.getName()); 64 } 65 } 66 67 }