@Test public void testSearchService() throws Exception { before(); ActivityOfferingClusterInfo expected = _createAOC(); // test createActivityOfferingCluster ActivityOfferingClusterInfo actual = coServiceImpl.createActivityOfferingCluster( "Lui-6", CourseOfferingServiceConstants.AOC_ROOT_TYPE_KEY, expected, contextInfo); assertNotNull(actual.getId()); // test generateRegistrationGroupsForCluster and deleteRegistrationGroupsForCluster coServiceImpl.generateRegistrationGroupsForCluster(actual.getId(), contextInfo); List<RegistrationGroupInfo> rgList = coServiceImpl.getRegistrationGroupsByActivityOfferingCluster(actual.getId(), contextInfo); assertEquals(2, rgList.size()); // make sure the data is in the db for the searches entityManager.flush(); AutogenCount counts = courseOfferingServiceFacade.getAutogenCountByCourseOffering("Lui-1", contextInfo); assertEquals(1, counts.getNumberOfActivityOfferingClusters().intValue()); assertEquals(3, counts.getNumberOfActivityOfferings().intValue()); assertEquals(2, counts.getNumberOfRegistrationGroups().intValue()); assertEquals(0, counts.getNumberOfInvalidRegistrationGroups().intValue()); counts = courseOfferingServiceFacade.getAutogenCountByFormatOffering("Lui-6", contextInfo); assertEquals(1, counts.getNumberOfActivityOfferingClusters().intValue()); assertEquals(3, counts.getNumberOfActivityOfferings().intValue()); assertEquals(2, counts.getNumberOfRegistrationGroups().intValue()); assertEquals(0, counts.getNumberOfInvalidRegistrationGroups().intValue()); counts = courseOfferingServiceFacade.getAutogenCountByActivtyOfferingCluster( actual.getId(), contextInfo); assertEquals(1, counts.getNumberOfActivityOfferingClusters().intValue()); assertEquals(3, counts.getNumberOfActivityOfferings().intValue()); assertEquals(2, counts.getNumberOfRegistrationGroups().intValue()); assertEquals(0, counts.getNumberOfInvalidRegistrationGroups().intValue()); log.info(""); }
@Test public void testGetAoIdAndAoTypeByFO() throws Exception { before(); // This below given expected output is taken by executing // CourseOfferingServiceImpl.getActivityOfferingsByFormatOffering separately. String formatOfferingId = "Lui-6"; String str[] = { "Lui-2-->kuali.lui.type.activity.offering.lecture", "Lui-5-->kuali.lui.type.activity.offering.lab", "Lui-8-->kuali.lui.type.activity.offering.lecture" }; List<String> expectedList = Arrays.asList(str); List<KeyValue> aoKVList = courseOfferingServiceFacade.getAoIdAndAoTypeByFO(formatOfferingId, contextInfo); List<String> resultList = new ArrayList<String>(); assertNotNull(aoKVList); for (KeyValue aoIdType : aoKVList) { resultList.add(aoIdType.getKey() + "-->" + aoIdType.getValue()); } assertEquals(expectedList.size(), aoKVList.size()); assertEquals(expectedList.containsAll(resultList), true); }