1 |
|
package org.kuali.student.lum.program.service.impl; |
2 |
|
|
3 |
|
import static org.junit.Assert.assertEquals; |
4 |
|
import static org.junit.Assert.assertNotNull; |
5 |
|
import static org.junit.Assert.assertTrue; |
6 |
|
import static org.junit.Assert.fail; |
7 |
|
|
8 |
|
import java.beans.IntrospectionException; |
9 |
|
import java.lang.reflect.InvocationTargetException; |
10 |
|
import java.lang.reflect.Method; |
11 |
|
import java.util.ArrayList; |
12 |
|
import java.util.Collection; |
13 |
|
import java.util.Date; |
14 |
|
import java.util.HashMap; |
15 |
|
import java.util.List; |
16 |
|
import java.util.Map; |
17 |
|
|
18 |
|
import org.apache.commons.lang.builder.EqualsBuilder; |
19 |
|
import org.junit.Ignore; |
20 |
|
import org.junit.Test; |
21 |
|
import org.junit.runner.RunWith; |
22 |
|
import org.kuali.student.common.assembly.data.Metadata; |
23 |
|
import org.kuali.student.common.assembly.dictionary.MetadataServiceImpl; |
24 |
|
import org.kuali.student.common.dto.DtoConstants; |
25 |
|
import org.kuali.student.common.dto.RichTextInfo; |
26 |
|
import org.kuali.student.common.exceptions.AlreadyExistsException; |
27 |
|
import org.kuali.student.common.exceptions.CircularRelationshipException; |
28 |
|
import org.kuali.student.common.exceptions.DataValidationErrorException; |
29 |
|
import org.kuali.student.common.exceptions.DependentObjectsExistException; |
30 |
|
import org.kuali.student.common.exceptions.DoesNotExistException; |
31 |
|
import org.kuali.student.common.exceptions.IllegalVersionSequencingException; |
32 |
|
import org.kuali.student.common.exceptions.InvalidParameterException; |
33 |
|
import org.kuali.student.common.exceptions.MissingParameterException; |
34 |
|
import org.kuali.student.common.exceptions.OperationFailedException; |
35 |
|
import org.kuali.student.common.exceptions.PermissionDeniedException; |
36 |
|
import org.kuali.student.common.exceptions.UnsupportedActionException; |
37 |
|
import org.kuali.student.common.exceptions.VersionMismatchException; |
38 |
|
import org.kuali.student.core.statement.dto.ReqCompFieldInfo; |
39 |
|
import org.kuali.student.core.statement.dto.ReqCompFieldTypeInfo; |
40 |
|
import org.kuali.student.core.statement.dto.ReqComponentInfo; |
41 |
|
import org.kuali.student.core.statement.dto.ReqComponentTypeInfo; |
42 |
|
import org.kuali.student.core.statement.dto.StatementOperatorTypeKey; |
43 |
|
import org.kuali.student.core.statement.dto.StatementTreeViewInfo; |
44 |
|
import org.kuali.student.core.statement.service.StatementService; |
45 |
|
import org.kuali.student.lum.course.dto.LoDisplayInfo; |
46 |
|
import org.kuali.student.lum.course.service.assembler.CourseAssemblerConstants; |
47 |
|
import org.kuali.student.lum.lo.dto.LoCategoryInfo; |
48 |
|
import org.kuali.student.lum.lo.dto.LoInfo; |
49 |
|
import org.kuali.student.lum.lu.dto.AdminOrgInfo; |
50 |
|
import org.kuali.student.lum.program.dto.CoreProgramInfo; |
51 |
|
import org.kuali.student.lum.program.dto.CredentialProgramInfo; |
52 |
|
import org.kuali.student.lum.program.dto.MajorDisciplineInfo; |
53 |
|
import org.kuali.student.lum.program.dto.ProgramRequirementInfo; |
54 |
|
import org.kuali.student.lum.program.dto.ProgramVariationInfo; |
55 |
|
import org.kuali.student.lum.program.service.ProgramService; |
56 |
|
import org.kuali.student.lum.program.service.assembler.MajorDisciplineDataGenerator; |
57 |
|
import org.kuali.student.lum.program.service.assembler.ProgramAssemblerConstants; |
58 |
|
import org.springframework.beans.BeanUtils; |
59 |
|
import org.springframework.beans.factory.annotation.Autowired; |
60 |
|
import org.springframework.test.context.ContextConfiguration; |
61 |
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
62 |
|
|
63 |
|
@RunWith(SpringJUnit4ClassRunner.class) |
64 |
|
@ContextConfiguration(locations = {"classpath:program-test-context.xml"}) |
|
|
| 91.4% |
Uncovered Elements: 89 (1,030) |
Complexity: 102 |
Complexity Density: 0.11 |
|
65 |
|
public class TestProgramServiceImpl { |
66 |
|
|
67 |
|
@Autowired |
68 |
|
public ProgramService programService; |
69 |
|
@Autowired |
70 |
|
public StatementService statementService; |
71 |
|
private static final String OTHER_LO_CAT_ID = "550e8400-e29b-41d4-a716-446655440000"; |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
private final String[] DUMMY_SERVICE_METHODS = {"createHonorsProgram", "createMinorDiscipline", "deleteHonorsProgram", |
78 |
|
"deleteMinorDiscipline", "getCredentialProgramType", "getCredentialProgramTypes", |
79 |
|
"getHonorsByCredentialProgramType", "getHonorsProgram", "getMajorIdsByCredentialProgramType", |
80 |
|
"getMinorDiscipline", "getMinorsByCredentialProgramType", "updateHonorsProgram", "updateMinorDiscipline", |
81 |
|
"validateHonorsProgram", "validateMinorDiscipline", "getSearchCriteriaType", "getSearchCriteriaTypes", |
82 |
|
"getSearchResultType", "getSearchResultTypes", "getSearchType", "getSearchTypes", "getSearchTypesByCriteria", |
83 |
|
"getSearchTypesByResult", "search"}; |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1
PASS
|
|
85 |
1
|
@Test... |
86 |
|
public void testProgramServiceSetup() { |
87 |
1
|
assertNotNull(programService); |
88 |
1
|
assertNotNull(statementService); |
89 |
|
} |
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1
PASS
|
|
91 |
1
|
@Test... |
92 |
|
public void testGetMetaData() { |
93 |
1
|
MetadataServiceImpl metadataService = new MetadataServiceImpl(programService); |
94 |
1
|
metadataService.setUiLookupContext("classpath:lum-ui-test-lookup-context.xml"); |
95 |
1
|
Metadata metadata = metadataService.getMetadata("org.kuali.student.lum.program.dto.MajorDisciplineInfo"); |
96 |
1
|
assertNotNull(metadata); |
97 |
|
|
98 |
1
|
Map<String, Metadata> properties = metadata.getProperties(); |
99 |
1
|
assertTrue(properties.size() > 0); |
100 |
|
|
101 |
1
|
assertTrue(properties.containsKey("universityClassification")); |
102 |
1
|
metadata = properties.get("universityClassification"); |
103 |
1
|
assertEquals("STRING", metadata.getDataType().name()); |
104 |
|
} |
105 |
|
|
106 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1
PASS
|
|
107 |
1
|
@Test... |
108 |
|
public void testGetProgramRequirement() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
109 |
1
|
ProgramRequirementInfo progReqInfo = programService.getProgramRequirement("PROGREQ-1", null, null); |
110 |
1
|
assertNotNull(progReqInfo); |
111 |
|
|
112 |
1
|
checkTreeView(progReqInfo, false); |
113 |
|
|
114 |
|
|
115 |
1
|
List<LoDisplayInfo> los = progReqInfo.getLearningObjectives(); |
116 |
1
|
assertNotNull(los); |
117 |
1
|
assertEquals(1, los.size()); |
118 |
1
|
LoDisplayInfo ldi1 = los.get(0); |
119 |
1
|
assertNotNull(ldi1); |
120 |
|
|
121 |
1
|
LoInfo loInfo1 = ldi1.getLoInfo(); |
122 |
1
|
assertNotNull(loInfo1); |
123 |
1
|
assertEquals("81abea67-3bcc-4088-8348-e265f3670145", loInfo1.getId()); |
124 |
1
|
assertEquals("Desc4", loInfo1.getDesc().getPlain()); |
125 |
1
|
assertEquals("Edit Wiki Message Structure", loInfo1.getName()); |
126 |
1
|
assertEquals("kuali.loRepository.key.singleUse", loInfo1.getLoRepositoryKey()); |
127 |
1
|
assertEquals(DtoConstants.STATE_DRAFT, loInfo1.getState()); |
128 |
1
|
assertEquals("kuali.lo.type.singleUse", loInfo1.getType()); |
129 |
|
} |
130 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1
PASS
|
|
131 |
0
|
@Test... |
132 |
|
@Ignore |
133 |
|
public void testGetProgramRequirementNL() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
134 |
0
|
ProgramRequirementInfo progReqInfo = programService.getProgramRequirement("PROGREQ-1", "KUALI.RULE", "en"); |
135 |
0
|
assertNotNull(progReqInfo); |
136 |
|
|
137 |
0
|
checkTreeView(progReqInfo, true); |
138 |
|
} |
139 |
|
|
|
|
| 79.3% |
Uncovered Elements: 6 (29) |
Complexity: 3 |
Complexity Density: 0.12 |
|
140 |
1
|
private void checkTreeView(final ProgramRequirementInfo progReqInfo, final boolean checkNaturalLanguage) {... |
141 |
1
|
StatementTreeViewInfo rootTree = progReqInfo.getStatement(); |
142 |
1
|
assertNotNull(rootTree); |
143 |
1
|
List<StatementTreeViewInfo> subTreeView = rootTree.getStatements(); |
144 |
1
|
assertNotNull(subTreeView); |
145 |
1
|
assertEquals(2, subTreeView.size()); |
146 |
1
|
StatementTreeViewInfo subTree1 = subTreeView.get(0); |
147 |
1
|
StatementTreeViewInfo subTree2 = subTreeView.get(1); |
148 |
|
|
149 |
|
|
150 |
1
|
assertNotNull(rootTree); |
151 |
1
|
assertEquals(2, subTreeView.size()); |
152 |
1
|
assertNotNull(subTree1); |
153 |
1
|
assertNotNull(subTree2); |
154 |
|
|
155 |
|
|
156 |
1
|
assertEquals("STMT-TV-2", subTree1.getId()); |
157 |
1
|
assertEquals(2, subTree1.getReqComponents().size()); |
158 |
1
|
assertEquals("REQCOMP-TV-1", subTree1.getReqComponents().get(0).getId()); |
159 |
1
|
assertEquals("REQCOMP-TV-2", subTree1.getReqComponents().get(1).getId()); |
160 |
1
|
if (checkNaturalLanguage) { |
161 |
0
|
assertEquals("Student must have completed all of MATH 152, MATH 180", subTree1.getReqComponents().get(0).getNaturalLanguageTranslation()); |
162 |
0
|
assertEquals("Student needs a minimum GPA of 3.5 in MATH 152, MATH 180", subTree1.getReqComponents().get(1).getNaturalLanguageTranslation()); |
163 |
|
} |
164 |
|
|
165 |
|
|
166 |
1
|
assertEquals("STMT-TV-3", subTree2.getId()); |
167 |
1
|
assertEquals(2, subTree2.getReqComponents().size()); |
168 |
1
|
assertEquals("REQCOMP-TV-3", subTree2.getReqComponents().get(0).getId()); |
169 |
1
|
assertEquals("REQCOMP-TV-4", subTree2.getReqComponents().get(1).getId()); |
170 |
1
|
if (checkNaturalLanguage) { |
171 |
0
|
assertEquals("Student must have completed 1 of MATH 152, MATH 180", subTree2.getReqComponents().get(0).getNaturalLanguageTranslation()); |
172 |
0
|
assertEquals("Student needs a minimum GPA of 4.0 in MATH 152, MATH 180", subTree2.getReqComponents().get(1).getNaturalLanguageTranslation()); |
173 |
|
} |
174 |
|
} |
175 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
176 |
1
|
@Test(expected = MissingParameterException.class)... |
177 |
|
public void testGetProgramRequirement_nullId() throws Exception { |
178 |
1
|
programService.getProgramRequirement(null, null, null); |
179 |
|
} |
180 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
181 |
1
|
@Test(expected = DoesNotExistException.class)... |
182 |
|
public void testGetProgramRequirement_badId() throws Exception { |
183 |
1
|
programService.getProgramRequirement("CLU-XXX ", null, null); |
184 |
|
} |
185 |
|
|
|
|
| 98.2% |
Uncovered Elements: 1 (55) |
Complexity: 2 |
Complexity Density: 0.04 |
1
PASS
|
|
186 |
1
|
@Test... |
187 |
|
public void testGetCoreProgram() throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException { |
188 |
1
|
CoreProgramInfo core = null; |
189 |
1
|
try { |
190 |
1
|
core = programService.getCoreProgram("d4ea77dd-b492-4554-b104-863e42c5f8b7"); |
191 |
0
|
fail("Should have received DoesNotExistException"); |
192 |
|
} catch (DoesNotExistException dnee) { |
193 |
1
|
String expectedExceptionMessage = "Specified CLU is not a CoreProgram"; |
194 |
1
|
assertEquals("Expected DoesNotExistException has incorrect message:", expectedExceptionMessage, dnee.getMessage()); |
195 |
|
} |
196 |
1
|
core = programService.getCoreProgram("00f5f8c5-fff1-4c8b-92fc-789b891e0849"); |
197 |
|
|
198 |
1
|
assertNotNull(core); |
199 |
|
|
200 |
1
|
assertNotNull(core.getReferenceURL()); |
201 |
1
|
assertEquals("http://www.google.ca", core.getReferenceURL()); |
202 |
1
|
assertNotNull(core.getUniversityClassification()); |
203 |
1
|
assertEquals(core.getUniversityClassification(), "UNIVERSITYCLASSIFICATIONCODE"); |
204 |
1
|
assertNotNull(core.getStartTerm()); |
205 |
1
|
assertEquals("start_term", core.getStartTerm()); |
206 |
1
|
assertNotNull(core.getEndTerm()); |
207 |
1
|
assertEquals("end_term", core.getEndTerm()); |
208 |
1
|
assertNotNull(core.getEndProgramEntryTerm()); |
209 |
1
|
assertEquals("end_admit_term", core.getEndProgramEntryTerm()); |
210 |
1
|
assertNotNull(core.getCode()); |
211 |
1
|
assertEquals("BS", core.getCode()); |
212 |
1
|
assertNotNull(core.getShortTitle()); |
213 |
1
|
assertEquals("B.S.", core.getShortTitle()); |
214 |
1
|
assertNotNull(core.getLongTitle()); |
215 |
1
|
assertEquals("Bachelor of Science", core.getLongTitle()); |
216 |
1
|
assertNotNull(core.getTranscriptTitle()); |
217 |
1
|
assertEquals(core.getTranscriptTitle(), "TRANSCRIPT-TITLE"); |
218 |
1
|
assertNotNull(core.getDescr()); |
219 |
1
|
assertEquals("Anthropology Major", core.getDescr().getPlain()); |
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
1
|
assertNotNull(core.getLearningObjectives()); |
225 |
1
|
assertTrue(core.getLearningObjectives().size() ==1); |
226 |
1
|
assertEquals("Core Program Learning objectives", core.getLearningObjectives().get(0).getLoInfo().getDesc().getPlain()); |
227 |
|
|
228 |
1
|
assertNotNull(core.getDivisionsContentOwner()); |
229 |
1
|
assertTrue(core.getDivisionsContentOwner().size() == 1); |
230 |
1
|
assertEquals(core.getDivisionsContentOwner().get(0), "48"); |
231 |
1
|
assertNotNull(core.getDivisionsStudentOversight()); |
232 |
1
|
assertTrue(core.getDivisionsStudentOversight().size() == 1); |
233 |
1
|
assertEquals(core.getDivisionsStudentOversight().get(0), "50"); |
234 |
1
|
assertNotNull(core.getUnitsContentOwner()); |
235 |
1
|
assertTrue(core.getUnitsContentOwner().size() == 1); |
236 |
1
|
assertEquals(core.getUnitsContentOwner().get(0), "49"); |
237 |
1
|
assertNotNull(core.getUnitsStudentOversight()); |
238 |
1
|
assertTrue(core.getUnitsStudentOversight().size() == 1); |
239 |
1
|
assertEquals(core.getUnitsStudentOversight().get(0), "51"); |
240 |
|
|
241 |
1
|
assertNotNull(core.getAttributes()); |
242 |
1
|
assertTrue(core.getAttributes().size() ==2); |
243 |
1
|
assertEquals("GINGER GEM", core.getAttributes().get("COOKIES")); |
244 |
1
|
assertEquals("JAM TART", core.getAttributes().get("CAKES")); |
245 |
|
|
246 |
1
|
assertNotNull(core.getMetaInfo()); |
247 |
1
|
assertEquals("1", core.getMetaInfo().getVersionInd()); |
248 |
1
|
assertNotNull(core.getType()); |
249 |
1
|
assertEquals(ProgramAssemblerConstants.CORE_PROGRAM, core.getType()); |
250 |
1
|
assertNotNull(core.getState()); |
251 |
1
|
assertEquals(DtoConstants.STATE_ACTIVE, core.getState()); |
252 |
1
|
assertNotNull(core.getId()); |
253 |
1
|
assertEquals("00f5f8c5-fff1-4c8b-92fc-789b891e0849", core.getId()); |
254 |
|
} |
|
|
| 99.2% |
Uncovered Elements: 1 (122) |
Complexity: 2 |
Complexity Density: 0.02 |
1
PASS
|
|
255 |
1
|
@Test... |
256 |
|
public void testGetMajorDiscipline() throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException { |
257 |
1
|
MajorDisciplineInfo major = null; |
258 |
|
|
259 |
|
|
260 |
1
|
try { |
261 |
1
|
major = programService.getMajorDiscipline("0d8c42bc-77ba-450e-ae0e-eecd76fae779"); |
262 |
0
|
fail("Should have received DoesNotExistException"); |
263 |
|
} catch (DoesNotExistException dnee) { |
264 |
1
|
String expectedExceptionMessage = "Specified CLU is not a Major Discipline"; |
265 |
1
|
assertEquals("Expected DoesNotExistException has incorrect message:", expectedExceptionMessage, dnee.getMessage()); |
266 |
|
} |
267 |
1
|
major = programService.getMajorDiscipline("d4ea77dd-b492-4554-b104-863e42c5f8b7"); |
268 |
|
|
269 |
1
|
assertNotNull(major); |
270 |
|
|
271 |
1
|
assertNotNull(major.getIntensity()); |
272 |
1
|
assertEquals("kuali.atp.duration.full", major.getIntensity()); |
273 |
1
|
assertNotNull(major.getReferenceURL()); |
274 |
1
|
assertEquals("http://www.google.ca", major.getReferenceURL()); |
275 |
1
|
assertEquals(1, major.getPublishedInstructors().size()); |
276 |
|
|
277 |
1
|
assertEquals("INSTR-1", major.getPublishedInstructors().get(0).getPersonId()); |
278 |
1
|
assertNotNull(major.getCredentialProgramId()); |
279 |
1
|
assertEquals("d02dbbd3-20e2-410d-ab52-1bd6d362748b", major.getCredentialProgramId()); |
280 |
|
|
281 |
1
|
assertNotNull(major.getVariations()); |
282 |
1
|
assertTrue(major.getVariations().size() == 2); |
283 |
1
|
assertEquals("ZOOA", major.getVariations().get(0).getCode()); |
284 |
1
|
assertEquals("ARCB", major.getVariations().get(1).getCode()); |
285 |
|
|
286 |
1
|
assertNotNull(major.getCode()); |
287 |
1
|
assertEquals("ANTH", major.getCode()); |
288 |
1
|
assertNotNull(major.getCip2000Code()); |
289 |
1
|
assertEquals("45.0202", major.getCip2000Code()); |
290 |
1
|
assertNotNull(major.getCip2010Code()); |
291 |
1
|
assertEquals("45.0201", major.getCip2010Code()); |
292 |
1
|
assertNotNull(major.getHegisCode()); |
293 |
1
|
assertEquals("220200", major.getHegisCode()); |
294 |
1
|
assertNotNull(major.getUniversityClassification()); |
295 |
1
|
assertEquals("UNIVERSITYCLASSIFICATIONCODE", major.getUniversityClassification()); |
296 |
1
|
assertNotNull(major.getSelectiveEnrollmentCode()); |
297 |
1
|
assertEquals("SELECTIVEENROLLMENTCODE", major.getSelectiveEnrollmentCode()); |
298 |
|
|
299 |
1
|
assertNotNull(major.getResultOptions()); |
300 |
1
|
assertTrue(major.getResultOptions().size() == 2); |
301 |
1
|
assertEquals("kuali.resultComponent.degree.ba", major.getResultOptions().get(0)); |
302 |
1
|
assertEquals("kuali.resultComponent.degree.bsc", major.getResultOptions().get(1)); |
303 |
|
|
304 |
1
|
assertNotNull(major.getStdDuration()); |
305 |
1
|
assertEquals("kuali.atp.duration.Week", major.getStdDuration().getAtpDurationTypeKey()); |
306 |
1
|
assertEquals(new Integer(100), major.getStdDuration().getTimeQuantity()); |
307 |
1
|
assertNotNull(major.getStartTerm()); |
308 |
1
|
assertEquals("start_term", major.getStartTerm()); |
309 |
1
|
assertNotNull(major.getEndTerm()); |
310 |
1
|
assertEquals("end_term", major.getEndTerm()); |
311 |
1
|
assertNotNull(major.getEndProgramEntryTerm()); |
312 |
1
|
assertEquals("end_admit_term", major.getEndProgramEntryTerm()); |
313 |
|
|
314 |
1
|
assertNotNull(major.getNextReviewPeriod()); |
315 |
1
|
assertEquals("kuali.atp.SU2009-2010S1", major.getNextReviewPeriod()); |
316 |
|
|
317 |
1
|
assertNotNull(major.getEffectiveDate()); |
318 |
|
|
319 |
|
|
320 |
|
|
321 |
|
|
322 |
|
|
323 |
|
|
324 |
1
|
assertNotNull(major.getShortTitle()); |
325 |
1
|
assertEquals("Anthro", major.getShortTitle()); |
326 |
1
|
assertNotNull(major.getLongTitle()); |
327 |
1
|
assertEquals("Anthropology", major.getLongTitle()); |
328 |
1
|
assertNotNull(major.getTranscriptTitle()); |
329 |
1
|
assertEquals("TRANSCRIPT-TITLE", major.getTranscriptTitle()); |
330 |
1
|
assertNotNull(major.getDiplomaTitle()); |
331 |
1
|
assertEquals("DIPLOMA-TITLE", major.getDiplomaTitle() ); |
332 |
1
|
assertNotNull(major.getDescr()); |
333 |
1
|
assertEquals("Anthropology Major", major.getDescr().getPlain()); |
334 |
|
|
335 |
|
|
336 |
|
|
337 |
1
|
assertNotNull(major.getCatalogDescr()); |
338 |
1
|
assertEquals("This is the catalog description", major.getCatalogDescr().getPlain()); |
339 |
1
|
assertNotNull(major.getCatalogPublicationTargets()); |
340 |
1
|
assertEquals(1, major.getCatalogPublicationTargets().size()); |
341 |
1
|
assertEquals("kuali.lu.publication.UndergradCatalog", major.getCatalogPublicationTargets().get(0)); |
342 |
1
|
assertNotNull(major.getLearningObjectives()); |
343 |
1
|
assertTrue(major.getLearningObjectives().size() ==1); |
344 |
1
|
assertEquals("Annihilate Wiki", major.getLearningObjectives().get(0).getLoInfo().getDesc().getPlain()); |
345 |
1
|
assertNotNull(major.getCampusLocations()); |
346 |
1
|
assertTrue(major.getCampusLocations().size() == 2); |
347 |
1
|
assertEquals("NO", major.getCampusLocations().get(0)); |
348 |
1
|
assertEquals("SO", major.getCampusLocations().get(1)); |
349 |
|
|
350 |
1
|
assertNotNull(major.getOrgCoreProgram()); |
351 |
1
|
assertEquals("kuali.lu.type.CoreProgram", major.getOrgCoreProgram().getType()); |
352 |
1
|
assertEquals("00f5f8c5-fff1-4c8b-92fc-789b891e0849", major.getOrgCoreProgram().getId()); |
353 |
1
|
assertNotNull(major.getProgramRequirements()); |
354 |
1
|
assertTrue(major.getProgramRequirements().size() == 1); |
355 |
1
|
assertEquals("REQ-200", major.getProgramRequirements().get(0)); |
356 |
|
|
357 |
1
|
assertNotNull(major.getAccreditingAgencies()); |
358 |
1
|
assertTrue(major.getAccreditingAgencies().size() == 1); |
359 |
1
|
assertEquals("23", major.getAccreditingAgencies().get(0).getOrgId()); |
360 |
1
|
assertNotNull(major.getDivisionsContentOwner()); |
361 |
1
|
assertTrue(major.getDivisionsContentOwner().size() == 1); |
362 |
1
|
assertEquals(major.getDivisionsContentOwner().get(0), "31"); |
363 |
1
|
assertNotNull(major.getDivisionsStudentOversight()); |
364 |
1
|
assertTrue(major.getDivisionsStudentOversight().size() == 1); |
365 |
1
|
assertEquals(major.getDivisionsStudentOversight().get(0), "32"); |
366 |
1
|
assertNotNull(major.getDivisionsDeployment()); |
367 |
1
|
assertTrue(major.getDivisionsDeployment().size() == 1); |
368 |
1
|
assertEquals(major.getDivisionsDeployment().get(0), "33"); |
369 |
1
|
assertNotNull(major.getDivisionsFinancialResources()); |
370 |
1
|
assertTrue(major.getDivisionsFinancialResources().size() == 1); |
371 |
1
|
assertEquals(major.getDivisionsFinancialResources().get(0), "34"); |
372 |
1
|
assertNotNull(major.getDivisionsFinancialControl()); |
373 |
1
|
assertTrue(major.getDivisionsFinancialControl().size() == 1); |
374 |
1
|
assertEquals(major.getDivisionsFinancialControl().get(0), "36"); |
375 |
|
|
376 |
1
|
assertNotNull(major.getUnitsContentOwner()); |
377 |
1
|
assertTrue(major.getUnitsContentOwner().size() == 1); |
378 |
1
|
assertEquals(major.getUnitsContentOwner().get(0), "41"); |
379 |
1
|
assertNotNull(major.getUnitsStudentOversight()); |
380 |
1
|
assertTrue(major.getUnitsStudentOversight().size() == 1); |
381 |
1
|
assertEquals(major.getUnitsStudentOversight().get(0), "42"); |
382 |
1
|
assertNotNull(major.getUnitsDeployment()); |
383 |
1
|
assertTrue(major.getUnitsDeployment().size() == 1); |
384 |
1
|
assertEquals(major.getUnitsDeployment().get(0), "43"); |
385 |
1
|
assertNotNull(major.getUnitsFinancialResources()); |
386 |
1
|
assertTrue(major.getUnitsFinancialResources().size() == 1); |
387 |
1
|
assertEquals(major.getUnitsFinancialResources().get(0), "44"); |
388 |
1
|
assertNotNull(major.getUnitsFinancialControl()); |
389 |
1
|
assertTrue(major.getUnitsFinancialControl().size() == 2); |
390 |
1
|
assertEquals(major.getUnitsFinancialControl().get(0), "46"); |
391 |
1
|
assertEquals(major.getUnitsFinancialControl().get(1), "47"); |
392 |
1
|
assertNotNull(major.getAttributes()); |
393 |
1
|
assertEquals(2, major.getAttributes().size()); |
394 |
1
|
assertEquals("GINGER GEM", major.getAttributes().get("COOKIES")); |
395 |
1
|
assertEquals("JAM TART", major.getAttributes().get("CAKES")); |
396 |
|
|
397 |
1
|
assertNotNull(major.getMetaInfo()); |
398 |
1
|
assertEquals("1", major.getMetaInfo().getVersionInd()); |
399 |
|
|
400 |
|
|
401 |
|
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
1
|
assertNotNull(major.getType()); |
406 |
1
|
assertEquals(ProgramAssemblerConstants.MAJOR_DISCIPLINE, major.getType()); |
407 |
1
|
assertNotNull(major.getState()); |
408 |
1
|
assertEquals(DtoConstants.STATE_ACTIVE, major.getState()); |
409 |
1
|
assertNotNull(major.getId()); |
410 |
1
|
assertEquals("d4ea77dd-b492-4554-b104-863e42c5f8b7", major.getId()); |
411 |
|
|
412 |
|
|
413 |
|
} |
414 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1
PASS
|
|
415 |
1
|
@Test... |
416 |
|
public void testGetVariationsByMajorDisciplineId() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException{ |
417 |
1
|
MajorDisciplineInfo majorDisciplineInfo = null; |
418 |
|
|
419 |
1
|
majorDisciplineInfo = programService.getMajorDiscipline("d4ea77dd-b492-4554-b104-863e42c5f8b7"); |
420 |
1
|
assertNotNull(majorDisciplineInfo); |
421 |
|
|
422 |
1
|
List<ProgramVariationInfo> pvInfos = programService.getVariationsByMajorDisciplineId("d4ea77dd-b492-4554-b104-863e42c5f8b7"); |
423 |
1
|
assertNotNull(pvInfos); |
424 |
1
|
assertEquals(pvInfos.size(), majorDisciplineInfo.getVariations().size()); |
425 |
|
|
426 |
1
|
ProgramVariationInfo pvInfo = pvInfos.get(0); |
427 |
1
|
assertEquals("ZOOA", pvInfo.getCode()); |
428 |
1
|
assertEquals("Zooarchaeology", pvInfo.getDescr().getPlain()); |
429 |
1
|
assertEquals("Zooarchaeology", pvInfo.getLongTitle()); |
430 |
1
|
assertEquals("ZooArch", pvInfo.getShortTitle()); |
431 |
1
|
assertEquals("VAR-200", pvInfo.getId()); |
432 |
1
|
assertEquals("Active", pvInfo.getState()); |
433 |
|
|
434 |
|
} |
435 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1
PASS
|
|
436 |
1
|
@Test... |
437 |
|
public void testGetBaccCredentialProgram() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException{ |
438 |
|
|
439 |
1
|
String credentialProgramId = "d02dbbd3-20e2-410d-ab52-1bd6d362748b"; |
440 |
1
|
CredentialProgramInfo credentialProgramInfo = null; |
441 |
1
|
credentialProgramInfo = programService.getCredentialProgram(credentialProgramId); |
442 |
1
|
assertNotNull(credentialProgramInfo); |
443 |
1
|
assertEquals("BS", credentialProgramInfo.getCode()); |
444 |
1
|
assertEquals("B.S.", credentialProgramInfo.getShortTitle()); |
445 |
1
|
assertEquals("Bachelor of Science", credentialProgramInfo.getLongTitle()); |
446 |
1
|
assertEquals("Bachelor of Science", credentialProgramInfo.getDescr().getPlain()); |
447 |
1
|
assertEquals(DtoConstants.STATE_ACTIVE, credentialProgramInfo.getState()); |
448 |
1
|
assertEquals(ProgramAssemblerConstants.BACCALAUREATE_PROGRAM, credentialProgramInfo.getCredentialProgramType()); |
449 |
1
|
assertEquals("52", credentialProgramInfo.getInstitution().getOrgId()); |
450 |
1
|
assertEquals(ProgramAssemblerConstants.UNDERGRAD_PROGRAM_LEVEL, credentialProgramInfo.getProgramLevel()); |
451 |
1
|
assertNotNull(credentialProgramInfo.getCoreProgramIds()); |
452 |
1
|
assertEquals(1, credentialProgramInfo.getCoreProgramIds().size()); |
453 |
1
|
assertEquals("00f5f8c5-fff1-4c8b-92fc-789b891e0849", credentialProgramInfo.getCoreProgramIds().get(0)); |
454 |
|
} |
455 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (118) |
Complexity: 1 |
Complexity Density: 0.01 |
1
PASS
|
|
456 |
1
|
@Test... |
457 |
|
public void testCreateMajorDiscipline() throws IllegalArgumentException, SecurityException, IntrospectionException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
458 |
1
|
MajorDisciplineDataGenerator mdGenerator = new MajorDisciplineDataGenerator(); |
459 |
1
|
MajorDisciplineInfo major; |
460 |
1
|
assertNotNull(major = mdGenerator.getMajorDisciplineInfoTestData()); |
461 |
|
|
462 |
1
|
MajorDisciplineInfo createdMD = programService.createMajorDiscipline(major); |
463 |
|
|
464 |
1
|
assertNotNull(createdMD); |
465 |
|
|
466 |
1
|
assertNotNull(createdMD.getId()); |
467 |
|
|
468 |
1
|
assertNotNull(createdMD.getState()); |
469 |
1
|
assertEquals(DtoConstants.STATE_DRAFT, createdMD.getState()); |
470 |
|
|
471 |
1
|
assertNotNull(createdMD.getType()); |
472 |
1
|
assertEquals(ProgramAssemblerConstants.MAJOR_DISCIPLINE, createdMD.getType()); |
473 |
|
|
474 |
1
|
assertNotNull(createdMD.getIntensity()); |
475 |
1
|
assertEquals("intensity-test", createdMD.getIntensity()); |
476 |
1
|
assertNotNull(createdMD.getReferenceURL()); |
477 |
1
|
assertEquals("referenceURL-test", createdMD.getReferenceURL()); |
478 |
|
|
479 |
1
|
assertEquals(2, createdMD.getPublishedInstructors().size()); |
480 |
1
|
assertEquals("personId-test", createdMD.getPublishedInstructors().get(0).getPersonId()); |
481 |
|
|
482 |
1
|
assertNotNull(createdMD.getCredentialProgramId()); |
483 |
1
|
assertEquals("00f5f8c5-fff1-4c8b-92fc-789b891e0849", createdMD.getCredentialProgramId()); |
484 |
|
|
485 |
1
|
assertNotNull(createdMD.getVariations()); |
486 |
1
|
assertTrue(createdMD.getVariations().size() == 2); |
487 |
1
|
assertNotNull(createdMD.getVariations().get(0).getId()); |
488 |
1
|
assertNotNull(createdMD.getVariations().get(1).getId()); |
489 |
1
|
assertEquals("kuali.lu.type.Variation", createdMD.getVariations().get(0).getType()); |
490 |
1
|
assertEquals("kuali.lu.type.Variation", createdMD.getVariations().get(1).getType()); |
491 |
|
|
492 |
1
|
assertNotNull(createdMD.getCode()); |
493 |
|
|
494 |
|
|
495 |
1
|
assertNotNull(createdMD.getCip2000Code()); |
496 |
1
|
assertEquals(createdMD.getCip2000Code(), "cip2000Code-test"); |
497 |
1
|
assertNotNull(createdMD.getCip2010Code()); |
498 |
1
|
assertEquals(createdMD.getCip2010Code(), "cip2010Code-test"); |
499 |
1
|
assertNotNull(createdMD.getHegisCode()); |
500 |
1
|
assertEquals(createdMD.getHegisCode(), "hegisCode-test"); |
501 |
1
|
assertNotNull(createdMD.getUniversityClassification()); |
502 |
1
|
assertEquals(createdMD.getUniversityClassification(), "universityClassification-test"); |
503 |
1
|
assertNotNull(createdMD.getSelectiveEnrollmentCode()); |
504 |
1
|
assertEquals(createdMD.getSelectiveEnrollmentCode(), "selectiveEnrollmentCode-test"); |
505 |
|
|
506 |
1
|
assertNotNull(createdMD.getResultOptions()); |
507 |
1
|
assertTrue(createdMD.getResultOptions().size() == 2); |
508 |
1
|
assertEquals("resultOptions-test", createdMD.getResultOptions().get(0)); |
509 |
|
|
510 |
1
|
assertNotNull(createdMD.getStdDuration()); |
511 |
1
|
assertEquals("atpDurationTypeKey-test", createdMD.getStdDuration().getAtpDurationTypeKey()); |
512 |
1
|
assertEquals(new Integer(63), createdMD.getStdDuration().getTimeQuantity()); |
513 |
|
|
514 |
1
|
assertNotNull(createdMD.getStartTerm()); |
515 |
1
|
assertEquals("startTerm-test", createdMD.getStartTerm()); |
516 |
1
|
assertNotNull(createdMD.getEndTerm()); |
517 |
1
|
assertEquals("endTerm-test", createdMD.getEndTerm()); |
518 |
1
|
assertNotNull(createdMD.getEndProgramEntryTerm()); |
519 |
1
|
assertEquals("endProgramEntryTerm-test", createdMD.getEndProgramEntryTerm()); |
520 |
1
|
assertNotNull(createdMD.getNextReviewPeriod()); |
521 |
1
|
assertEquals("nextReviewPeriod-test", createdMD.getNextReviewPeriod()); |
522 |
|
|
523 |
1
|
assertNotNull(createdMD.getEffectiveDate()); |
524 |
|
|
525 |
|
|
526 |
|
|
527 |
|
|
528 |
|
|
529 |
|
|
530 |
1
|
assertNotNull(createdMD.getShortTitle()); |
531 |
1
|
assertEquals("shortTitle-test", createdMD.getShortTitle()); |
532 |
1
|
assertNotNull(createdMD.getLongTitle()); |
533 |
1
|
assertEquals("longTitle-test", createdMD.getLongTitle()); |
534 |
1
|
assertNotNull(createdMD.getTranscriptTitle()); |
535 |
1
|
assertEquals(createdMD.getTranscriptTitle(), "transcriptTitle-test"); |
536 |
1
|
assertNotNull(createdMD.getDiplomaTitle()); |
537 |
1
|
assertEquals(createdMD.getDiplomaTitle(), "diplomaTitle-test"); |
538 |
1
|
assertNotNull(createdMD.getDescr()); |
539 |
1
|
assertEquals("plain-test", createdMD.getDescr().getPlain()); |
540 |
1
|
assertEquals("formatted-test", createdMD.getDescr().getFormatted()); |
541 |
|
|
542 |
1
|
assertNotNull(createdMD.getCatalogDescr()); |
543 |
1
|
assertEquals("plain-test", createdMD.getCatalogDescr().getPlain()); |
544 |
1
|
assertEquals("formatted-test", createdMD.getCatalogDescr().getFormatted()); |
545 |
|
|
546 |
1
|
assertNotNull(createdMD.getCatalogPublicationTargets()); |
547 |
1
|
assertTrue(createdMD.getCatalogPublicationTargets().size() == 2); |
548 |
1
|
assertEquals("kuali.lu.publication.Catalog", createdMD.getCatalogPublicationTargets().get(0)); |
549 |
|
|
550 |
1
|
assertNotNull(createdMD.getLearningObjectives()); |
551 |
1
|
assertTrue(createdMD.getLearningObjectives().size() == 2); |
552 |
1
|
assertEquals("plain-test", createdMD.getLearningObjectives().get(0).getLoInfo().getDesc().getPlain()); |
553 |
|
|
554 |
1
|
assertNotNull(createdMD.getCampusLocations()); |
555 |
1
|
assertTrue(createdMD.getCampusLocations().size() == 2); |
556 |
1
|
assertEquals("SO", createdMD.getCampusLocations().get(0)); |
557 |
1
|
assertEquals("NO", createdMD.getCampusLocations().get(1)); |
558 |
|
|
559 |
1
|
assertNotNull(createdMD.getOrgCoreProgram()); |
560 |
1
|
assertEquals(ProgramAssemblerConstants.CORE_PROGRAM, createdMD.getOrgCoreProgram().getType()); |
561 |
|
|
562 |
|
|
563 |
1
|
assertNotNull(createdMD.getProgramRequirements()); |
564 |
1
|
assertTrue(createdMD.getProgramRequirements().size() == 2); |
565 |
1
|
assertEquals("REQ-200", createdMD.getProgramRequirements().get(0)); |
566 |
|
|
567 |
1
|
assertNotNull(createdMD.getAccreditingAgencies()); |
568 |
1
|
assertTrue(createdMD.getAccreditingAgencies().size() == 2); |
569 |
1
|
assertEquals("orgId-test", createdMD.getAccreditingAgencies().get(0).getOrgId()); |
570 |
|
|
571 |
1
|
assertNotNull(createdMD.getDivisionsContentOwner()); |
572 |
1
|
assertTrue(createdMD.getDivisionsContentOwner().size() == 2); |
573 |
1
|
assertEquals("divisionsContentOwner-test", createdMD.getDivisionsContentOwner().get(0)); |
574 |
|
|
575 |
1
|
assertNotNull(createdMD.getDivisionsStudentOversight()); |
576 |
1
|
assertTrue(createdMD.getDivisionsStudentOversight().size() == 2); |
577 |
1
|
assertEquals("divisionsStudentOversight-test", createdMD.getDivisionsStudentOversight().get(0)); |
578 |
|
|
579 |
1
|
assertNotNull(createdMD.getDivisionsDeployment()); |
580 |
1
|
assertTrue(createdMD.getDivisionsDeployment().size() == 2); |
581 |
1
|
assertEquals("divisionsDeployment-test", createdMD.getDivisionsDeployment().get(0)); |
582 |
|
|
583 |
1
|
assertNotNull(createdMD.getDivisionsFinancialResources()); |
584 |
1
|
assertTrue(createdMD.getDivisionsFinancialResources().size() == 2); |
585 |
1
|
assertEquals("divisionsFinancialResources-test", createdMD.getDivisionsFinancialResources().get(0)); |
586 |
|
|
587 |
1
|
assertNotNull(createdMD.getDivisionsFinancialControl()); |
588 |
1
|
assertTrue(createdMD.getDivisionsFinancialControl().size() == 2); |
589 |
1
|
assertEquals("divisionsFinancialControl-test", createdMD.getDivisionsFinancialControl().get(0)); |
590 |
|
|
591 |
1
|
assertNotNull(createdMD.getUnitsContentOwner()); |
592 |
1
|
assertTrue(createdMD.getUnitsContentOwner().size() == 2); |
593 |
1
|
assertEquals("unitsContentOwner-test", createdMD.getUnitsContentOwner().get(0)); |
594 |
|
|
595 |
1
|
assertNotNull(createdMD.getUnitsStudentOversight()); |
596 |
1
|
assertTrue(createdMD.getUnitsStudentOversight().size() == 2); |
597 |
1
|
assertEquals("unitsStudentOversight-test", createdMD.getUnitsStudentOversight().get(0)); |
598 |
|
|
599 |
1
|
assertNotNull(createdMD.getUnitsDeployment()); |
600 |
1
|
assertTrue(createdMD.getUnitsDeployment().size() == 2); |
601 |
1
|
assertEquals("unitsDeployment-test", createdMD.getUnitsDeployment().get(0)); |
602 |
|
|
603 |
1
|
assertNotNull(createdMD.getUnitsFinancialResources()); |
604 |
1
|
assertTrue(createdMD.getUnitsFinancialResources().size() == 2); |
605 |
1
|
assertEquals("unitsFinancialResources-test", createdMD.getUnitsFinancialResources().get(0)); |
606 |
|
|
607 |
1
|
assertNotNull(createdMD.getUnitsFinancialControl()); |
608 |
1
|
assertTrue(createdMD.getUnitsFinancialControl().size() == 2); |
609 |
1
|
assertEquals("unitsFinancialControl-test", createdMD.getUnitsFinancialControl().get(0)); |
610 |
|
|
611 |
1
|
assertNotNull(createdMD.getAttributes()); |
612 |
1
|
assertTrue(createdMD.getAttributes().size() ==2); |
613 |
1
|
assertEquals("attributes-1", createdMD.getAttributes().get("attributes-1")); |
614 |
1
|
assertEquals("attributes-2", createdMD.getAttributes().get("attributes-2")); |
615 |
|
|
616 |
1
|
assertNotNull(createdMD.getMetaInfo()); |
617 |
1
|
assertEquals("0", createdMD.getMetaInfo().getVersionInd()); |
618 |
|
|
619 |
|
|
620 |
|
|
621 |
|
|
622 |
|
|
623 |
|
} |
624 |
|
|
|
|
| 92.9% |
Uncovered Elements: 1 (14) |
Complexity: 2 |
Complexity Density: 0.14 |
1
PASS
|
|
625 |
1
|
@Test... |
626 |
|
public void testMajorDisciplineVersioning() throws IllegalArgumentException, SecurityException, IntrospectionException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException, DoesNotExistException, CircularRelationshipException, DependentObjectsExistException, UnsupportedActionException, IllegalVersionSequencingException { |
627 |
1
|
MajorDisciplineDataGenerator mdGenerator = new MajorDisciplineDataGenerator(); |
628 |
1
|
MajorDisciplineInfo mdInfo = mdGenerator.getMajorDisciplineInfoTestData(); |
629 |
1
|
mdInfo.getProgramRequirements().clear(); |
630 |
1
|
for(ProgramVariationInfo variation :mdInfo.getVariations()){ |
631 |
2
|
variation.getProgramRequirements().clear(); |
632 |
|
} |
633 |
1
|
MajorDisciplineInfo createdMajor = programService.createMajorDiscipline(mdInfo); |
634 |
|
|
635 |
1
|
MajorDisciplineInfo newMajorDiscipline = programService.createNewMajorDisciplineVersion(createdMajor.getVersionInfo().getVersionIndId(), "test make a new version"); |
636 |
|
|
637 |
|
|
638 |
1
|
programService.setCurrentMajorDisciplineVersion(newMajorDiscipline.getId(), null); |
639 |
|
|
640 |
1
|
MajorDisciplineInfo newMajor = null; |
641 |
1
|
try { |
642 |
1
|
newMajor = programService.createNewMajorDisciplineVersion(createdMajor.getVersionInfo().getVersionIndId(), "test make a new version"); |
643 |
1
|
assertTrue(true); |
644 |
|
} catch (Exception e) { |
645 |
0
|
assertTrue(false); |
646 |
|
} |
647 |
|
|
648 |
1
|
assertNotNull(newMajor); |
649 |
|
|
650 |
|
} |
651 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
1
PASS
|
|
652 |
1
|
@Test... |
653 |
|
public void testCreateMajorDisciplineDeleteRule() throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, IllegalArgumentException, SecurityException, IntrospectionException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException { |
654 |
1
|
MajorDisciplineDataGenerator mdGenerator = new MajorDisciplineDataGenerator(); |
655 |
1
|
MajorDisciplineInfo major; |
656 |
1
|
assertNotNull(major = mdGenerator.getMajorDisciplineInfoTestData()); |
657 |
|
|
658 |
1
|
MajorDisciplineInfo createdMD = programService.createMajorDiscipline(major); |
659 |
|
|
660 |
1
|
ProgramRequirementInfo progReq = createProgramRequirementTestData(); |
661 |
1
|
ProgramRequirementInfo createdProgReq = programService.createProgramRequirement(progReq); |
662 |
|
} |
663 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1
PASS
|
|
664 |
1
|
@Test(expected = MissingParameterException.class)... |
665 |
|
public void testCreateProgramRequirement_null() throws Exception { |
666 |
1
|
programService.createProgramRequirement(null); |
667 |
|
} |
668 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1
PASS
|
|
669 |
1
|
@Test... |
670 |
|
public void testCreateProgramRequirement() throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException { |
671 |
1
|
ProgramRequirementInfo progReq = createProgramRequirementTestData(); |
672 |
1
|
ProgramRequirementInfo createdProgReq = programService.createProgramRequirement(progReq); |
673 |
1
|
checkProgramRequirement(progReq, createdProgReq); |
674 |
|
|
675 |
1
|
ProgramRequirementInfo progReq2 = programService.getProgramRequirement(createdProgReq.getId(), null, null); |
676 |
1
|
checkProgramRequirement(progReq, progReq2); |
677 |
|
} |
678 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
|
679 |
6
|
private ProgramRequirementInfo createProgramRequirementTestData() {... |
680 |
6
|
ProgramRequirementInfo progReq = new ProgramRequirementInfo(); |
681 |
6
|
progReq.setShortTitle("Short Title"); |
682 |
6
|
progReq.setLongTitle("Long title"); |
683 |
6
|
progReq.setDescr(toRichText("Program Requirement")); |
684 |
|
|
685 |
6
|
List<LoDisplayInfo> los = new ArrayList<LoDisplayInfo>(0); |
686 |
|
|
687 |
6
|
LoDisplayInfo loDisplayInfo = new LoDisplayInfo(); |
688 |
6
|
LoInfo loInfo = new LoInfo(); |
689 |
6
|
loInfo.setDesc(toRichText("Program Requirement LO Info")); |
690 |
6
|
loInfo.setLoRepositoryKey("lo rep key"); |
691 |
6
|
loDisplayInfo.setLoInfo(loInfo); |
692 |
6
|
los.add(loDisplayInfo); |
693 |
6
|
progReq.setLearningObjectives(los); |
694 |
|
|
695 |
6
|
StatementTreeViewInfo statement = createStatementTree(); |
696 |
6
|
progReq.setStatement(statement); |
697 |
6
|
progReq.setType(ProgramAssemblerConstants.PROGRAM_REQUIREMENT); |
698 |
6
|
return progReq; |
699 |
|
} |
700 |
|
|
|
|
| 78.6% |
Uncovered Elements: 3 (14) |
Complexity: 4 |
Complexity Density: 0.4 |
|
701 |
3
|
private static void checkProgramRequirement(... |
702 |
|
ProgramRequirementInfo orig, ProgramRequirementInfo created) { |
703 |
3
|
assertNotNull(orig); |
704 |
3
|
assertNotNull(created); |
705 |
3
|
assertTrue(EqualsBuilder.reflectionEquals(orig, created, new String[]{"id", "descr", "learningObjectives","statement","attributes","metaInfo"})); |
706 |
3
|
checkLoDisplays(orig.getLearningObjectives(), created.getLearningObjectives()); |
707 |
3
|
if (orig.getId() == null && created.getId() == null) { |
708 |
0
|
fail("both ProgramRequirements ids are null"); |
709 |
3
|
} else if (orig.getId() != null) { |
710 |
3
|
assertEquals(orig.getId(), created.getId()); |
711 |
|
} |
712 |
|
|
713 |
3
|
checkRichText(orig.getDescr(), created.getDescr()); |
714 |
3
|
checkStatementTreeView(orig.getStatement(), created.getStatement()); |
715 |
|
} |
716 |
|
|
|
|
| 78.6% |
Uncovered Elements: 3 (14) |
Complexity: 4 |
Complexity Density: 0.4 |
|
717 |
9
|
private static void checkStatementTreeView(StatementTreeViewInfo statement,... |
718 |
|
StatementTreeViewInfo statement2) { |
719 |
9
|
assertNotNull(statement); |
720 |
9
|
assertNotNull(statement2); |
721 |
9
|
assertTrue(EqualsBuilder.reflectionEquals(statement, statement2, new String[]{"id", "desc", "attributes", "metaInfo", "statements", "reqComponents"})); |
722 |
9
|
if (statement.getId() == null && statement2.getId() == null) { |
723 |
0
|
fail("Both StatementTreeView ids are null"); |
724 |
9
|
} else if (statement.getId() != null) { |
725 |
9
|
assertEquals(statement.getId(), statement2.getId()); |
726 |
|
} |
727 |
9
|
checkRichText(statement.getDesc(), statement2.getDesc()); |
728 |
9
|
checkStatementTreeViews(statement.getStatements(), statement2.getStatements()); |
729 |
9
|
checkReqComponents(statement.getReqComponents(), statement2.getReqComponents()); |
730 |
|
} |
731 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
732 |
9
|
private static void checkReqComponents(List<ReqComponentInfo> reqComponents,... |
733 |
|
List<ReqComponentInfo> reqComponents2) { |
734 |
9
|
assertNotNull(reqComponents); |
735 |
9
|
assertNotNull(reqComponents2); |
736 |
9
|
assertEquals(reqComponents.size(), reqComponents2.size()); |
737 |
21
|
for (int i = 0; i < reqComponents.size(); i++) { |
738 |
12
|
checkReqComponent(reqComponents.get(i), reqComponents2.get(i)); |
739 |
|
} |
740 |
|
} |
741 |
|
|
|
|
| 76.9% |
Uncovered Elements: 3 (13) |
Complexity: 4 |
Complexity Density: 0.44 |
|
742 |
12
|
private static void checkReqComponent(ReqComponentInfo reqComponent,... |
743 |
|
ReqComponentInfo reqComponent2) { |
744 |
12
|
assertNotNull(reqComponent); |
745 |
12
|
assertNotNull(reqComponent2); |
746 |
12
|
assertTrue(EqualsBuilder.reflectionEquals(reqComponent, reqComponent2, new String[]{"id", "desc", "reqCompFields", "requiredComponentType", "naturalLanguageTranslation", "metaInfo"})); |
747 |
12
|
if (reqComponent.getId() == null && reqComponent2.getId() == null) { |
748 |
0
|
fail("Both ReqComponent ids are null"); |
749 |
12
|
} else if (reqComponent.getId() != null) { |
750 |
12
|
assertEquals(reqComponent.getId(), reqComponent2.getId()); |
751 |
|
} |
752 |
12
|
checkRichText(reqComponent.getDesc(), reqComponent2.getDesc()); |
753 |
12
|
checkReqCompFields(reqComponent.getReqCompFields(), reqComponent.getReqCompFields()); |
754 |
|
|
755 |
|
} |
756 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
757 |
0
|
private static void checkReqComponentType(... |
758 |
|
ReqComponentTypeInfo requiredComponentType, |
759 |
|
ReqComponentTypeInfo requiredComponentType2) { |
760 |
0
|
assertNotNull(requiredComponentType); |
761 |
0
|
assertNotNull(requiredComponentType2); |
762 |
0
|
checkReqCompFieldTypes(requiredComponentType.getReqCompFieldTypeInfos(), requiredComponentType2.getReqCompFieldTypeInfos()); |
763 |
|
} |
764 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
765 |
0
|
private static void checkReqCompFieldTypes(... |
766 |
|
List<ReqCompFieldTypeInfo> reqCompFieldTypeInfos, |
767 |
|
List<ReqCompFieldTypeInfo> reqCompFieldTypeInfos2) { |
768 |
0
|
assertNotNull(reqCompFieldTypeInfos); |
769 |
0
|
assertNotNull(reqCompFieldTypeInfos2); |
770 |
0
|
assertEquals(reqCompFieldTypeInfos.size(), reqCompFieldTypeInfos2.size()); |
771 |
0
|
for (int i = 0; i < reqCompFieldTypeInfos.size(); i++) { |
772 |
0
|
checkReqCompFieldType(reqCompFieldTypeInfos.get(i), reqCompFieldTypeInfos2.get(i)); |
773 |
|
} |
774 |
|
} |
775 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
776 |
0
|
private static void checkReqCompFieldType(... |
777 |
|
ReqCompFieldTypeInfo reqCompFieldTypeInfo, |
778 |
|
ReqCompFieldTypeInfo reqCompFieldTypeInfo2) { |
779 |
0
|
assertNotNull(reqCompFieldTypeInfo); |
780 |
0
|
assertNotNull(reqCompFieldTypeInfo2); |
781 |
|
|
782 |
|
} |
783 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
784 |
12
|
private static void checkReqCompFields(List<ReqCompFieldInfo> reqCompFields,... |
785 |
|
List<ReqCompFieldInfo> reqCompFields2) { |
786 |
12
|
assertNotNull(reqCompFields); |
787 |
12
|
assertNotNull(reqCompFields2); |
788 |
12
|
assertEquals(reqCompFields.size(), reqCompFields2.size()); |
789 |
12
|
for (int i = 0; i < reqCompFields.size(); i++) { |
790 |
0
|
checkReqCompField(reqCompFields.get(i), reqCompFields2.get(i)); |
791 |
|
} |
792 |
|
} |
793 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
794 |
0
|
private static void checkReqCompField(ReqCompFieldInfo reqCompField,... |
795 |
|
ReqCompFieldInfo reqCompField2) { |
796 |
0
|
assertNotNull(reqCompField); |
797 |
0
|
assertNotNull(reqCompField2); |
798 |
0
|
assertTrue(EqualsBuilder.reflectionEquals(reqCompField,reqCompField2)); |
799 |
|
} |
800 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
801 |
9
|
private static void checkStatementTreeViews(List<StatementTreeViewInfo> statements,... |
802 |
|
List<StatementTreeViewInfo> statements2) { |
803 |
9
|
assertNotNull(statements); |
804 |
9
|
assertNotNull(statements2); |
805 |
9
|
assertEquals(statements.size(), statements2.size()); |
806 |
15
|
for (int i = 0; i < statements.size(); i++) { |
807 |
6
|
checkStatementTreeView(statements.get(i), statements2.get(i)); |
808 |
|
} |
809 |
|
} |
810 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
811 |
3
|
private static void checkLoDisplays(List<LoDisplayInfo> los,... |
812 |
|
List<LoDisplayInfo> los2) { |
813 |
3
|
assertNotNull(los); |
814 |
3
|
assertNotNull(los2); |
815 |
3
|
assertEquals(los.size(), los2.size()); |
816 |
6
|
for (int i = 0; i < los.size(); i++) { |
817 |
3
|
LoDisplayInfo ldi1 = los.get(i); |
818 |
3
|
LoDisplayInfo ldi2 = los2.get(i); |
819 |
3
|
checkLoDisplay(ldi1, ldi2); |
820 |
|
} |
821 |
|
} |
822 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
823 |
3
|
private static void checkLoDisplay(LoDisplayInfo ldi1, LoDisplayInfo ldi2) {... |
824 |
3
|
assertNotNull(ldi1); |
825 |
3
|
assertNotNull(ldi2); |
826 |
3
|
assertTrue(EqualsBuilder.reflectionEquals(ldi1, ldi2, new String[]{"loInfo","loDisplayInfoList","loCategoryInfoList"})); |
827 |
|
|
828 |
3
|
LoInfo li1 = ldi1.getLoInfo(); |
829 |
3
|
LoInfo li2 = ldi2.getLoInfo(); |
830 |
3
|
checkLo(li1, li2); |
831 |
3
|
checkLoDisplayLists(ldi1.getLoDisplayInfoList(), ldi2.getLoDisplayInfoList()); |
832 |
3
|
checkLoCategorys(ldi1.getLoCategoryInfoList(), ldi2.getLoCategoryInfoList()); |
833 |
|
} |
834 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
835 |
3
|
private static void checkLoCategorys(List<LoCategoryInfo> loCategoryInfoList,... |
836 |
|
List<LoCategoryInfo> loCategoryInfoList2) { |
837 |
3
|
assertNotNull(loCategoryInfoList); |
838 |
3
|
assertNotNull(loCategoryInfoList2); |
839 |
3
|
assertEquals(loCategoryInfoList.size(), loCategoryInfoList2.size()); |
840 |
3
|
for (int i = 0; i < loCategoryInfoList.size(); i++) { |
841 |
0
|
checkLoCategory(loCategoryInfoList.get(i), loCategoryInfoList2.get(i)); |
842 |
|
} |
843 |
|
} |
844 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
845 |
0
|
private static void checkLoCategory(LoCategoryInfo loCategoryInfo,... |
846 |
|
LoCategoryInfo loCategoryInfo2) { |
847 |
0
|
assertNotNull(loCategoryInfo); |
848 |
0
|
assertNotNull(loCategoryInfo2); |
849 |
0
|
assertTrue(EqualsBuilder.reflectionEquals(loCategoryInfo, loCategoryInfo2, new String[]{"desc","attributes","metaInfo"})); |
850 |
0
|
checkRichText(loCategoryInfo.getDesc(), loCategoryInfo2.getDesc()); |
851 |
|
} |
852 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
853 |
3
|
private static void checkLoDisplayLists(List<LoDisplayInfo> di1, List<LoDisplayInfo> di2) {... |
854 |
3
|
assertNotNull(di1); |
855 |
3
|
assertNotNull(di2); |
856 |
3
|
assertEquals(di1.size(), di2.size()); |
857 |
3
|
for (int i = 0; i < di1.size(); i++) { |
858 |
0
|
checkLoDisplay(di1.get(i), di2.get(i)); |
859 |
|
} |
860 |
|
} |
861 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
862 |
3
|
private static void checkLo(LoInfo li1, LoInfo li2) {... |
863 |
3
|
assertNotNull(li1); |
864 |
3
|
assertNotNull(li2); |
865 |
|
|
866 |
3
|
assertTrue(EqualsBuilder.reflectionEquals(li1, li2, new String[]{"desc","attributes","metaInfo"})); |
867 |
3
|
checkRichText(li1.getDesc(), li2.getDesc()); |
868 |
|
} |
869 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
870 |
27
|
private static void checkRichText(RichTextInfo desc, RichTextInfo desc2) {... |
871 |
27
|
assertNotNull(desc); |
872 |
27
|
assertNotNull(desc2); |
873 |
|
|
874 |
27
|
assertTrue(EqualsBuilder.reflectionEquals(desc, desc2)); |
875 |
|
} |
876 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (37) |
Complexity: 1 |
Complexity Density: 0.03 |
|
877 |
6
|
private static StatementTreeViewInfo createStatementTree() {... |
878 |
|
|
879 |
|
|
880 |
|
|
881 |
|
|
882 |
|
|
883 |
|
|
884 |
|
|
885 |
6
|
List<StatementTreeViewInfo> subStatements = new ArrayList<StatementTreeViewInfo>(3); |
886 |
6
|
List<ReqComponentInfo> reqCompList1 = new ArrayList<ReqComponentInfo>(3); |
887 |
6
|
List<ReqComponentInfo> reqCompList2 = new ArrayList<ReqComponentInfo>(3); |
888 |
|
|
889 |
|
|
890 |
6
|
ReqComponentInfo rc1 = new ReqComponentInfo(); |
891 |
6
|
rc1.setDesc(toRichText("REQCOMP-1")); |
892 |
6
|
rc1.setType("kuali.reqComponent.type.course.courseset.completed.all"); |
893 |
6
|
ReqComponentInfo rc2 = new ReqComponentInfo(); |
894 |
6
|
rc2.setDesc(toRichText("REQCOMP-2")); |
895 |
6
|
rc2.setType("kuali.reqComponent.type.course.courseset.gpa.min"); |
896 |
6
|
ReqComponentInfo rc3 = new ReqComponentInfo(); |
897 |
6
|
rc3.setDesc(toRichText("REQCOMP-3")); |
898 |
6
|
rc3.setType("kuali.reqComponent.type.course.courseset.completed.nof"); |
899 |
6
|
ReqComponentInfo rc4 = new ReqComponentInfo(); |
900 |
6
|
rc4.setDesc(toRichText("REQCOMP-4")); |
901 |
6
|
rc4.setType("kuali.reqComponent.type.course.permission.instructor.required"); |
902 |
|
|
903 |
|
|
904 |
6
|
StatementTreeViewInfo statementTree = new StatementTreeViewInfo(); |
905 |
6
|
statementTree.setDesc(toRichText("STMT-1")); |
906 |
6
|
statementTree.setOperator(StatementOperatorTypeKey.OR); |
907 |
6
|
statementTree.setType("kuali.statement.type.program.entrance"); |
908 |
|
|
909 |
6
|
StatementTreeViewInfo subTree1 = new StatementTreeViewInfo(); |
910 |
6
|
subTree1.setDesc(toRichText("STMT-2")); |
911 |
6
|
subTree1.setOperator(StatementOperatorTypeKey.AND); |
912 |
6
|
subTree1.setType("kuali.statement.type.program.entrance"); |
913 |
|
|
914 |
6
|
StatementTreeViewInfo subTree2 = new StatementTreeViewInfo(); |
915 |
6
|
subTree2.setDesc(toRichText("STMT-3")); |
916 |
6
|
subTree2.setOperator(StatementOperatorTypeKey.AND); |
917 |
6
|
subTree2.setType("kuali.statement.type.program.entrance"); |
918 |
|
|
919 |
|
|
920 |
6
|
reqCompList1.add(rc1); |
921 |
6
|
reqCompList1.add(rc2); |
922 |
6
|
subTree1.setReqComponents(reqCompList1); |
923 |
6
|
reqCompList2.add(rc3); |
924 |
6
|
reqCompList2.add(rc4); |
925 |
6
|
subTree2.setReqComponents(reqCompList2); |
926 |
6
|
subStatements.add(subTree1); |
927 |
6
|
subStatements.add(subTree2); |
928 |
6
|
statementTree.setStatements(subStatements); |
929 |
|
|
930 |
6
|
return statementTree; |
931 |
|
} |
932 |
|
|
|
|
| 75% |
Uncovered Elements: 2 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
933 |
57
|
private static RichTextInfo toRichText(String text) {... |
934 |
57
|
RichTextInfo richTextInfo = new RichTextInfo(); |
935 |
57
|
if (text == null) { |
936 |
0
|
return null; |
937 |
|
} |
938 |
57
|
richTextInfo.setPlain(text); |
939 |
57
|
richTextInfo.setFormatted("<p>" + text + "</p>"); |
940 |
57
|
return richTextInfo; |
941 |
|
} |
942 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 1 |
Complexity Density: 0.05 |
1
PASS
|
|
943 |
1
|
@Test(expected=DoesNotExistException.class)... |
944 |
|
public void testUpdateProgramRequirement() throws Exception { |
945 |
1
|
ProgramRequirementInfo progReq = programService.createProgramRequirement(createProgramRequirementTestData()); |
946 |
1
|
StatementTreeViewInfo treeView = progReq.getStatement(); |
947 |
|
|
948 |
1
|
List<ReqComponentInfo> reqCompList1 = new ArrayList<ReqComponentInfo>(3); |
949 |
1
|
ReqComponentInfo rc1 = new ReqComponentInfo(); |
950 |
1
|
rc1.setDesc(toRichText("REQCOMP-1")); |
951 |
1
|
rc1.setType("kuali.reqComponent.type.course.courseset.completed.all"); |
952 |
1
|
ReqComponentInfo rc2 = new ReqComponentInfo(); |
953 |
1
|
rc2.setDesc(toRichText("REQCOMP-2")); |
954 |
1
|
rc2.setType("kuali.reqComponent.type.course.courseset.gpa.min"); |
955 |
1
|
StatementTreeViewInfo subTree1 = new StatementTreeViewInfo(); |
956 |
1
|
subTree1.setDesc(toRichText("STMT-5")); |
957 |
1
|
subTree1.setOperator(StatementOperatorTypeKey.AND); |
958 |
1
|
subTree1.setType("kuali.statement.type.program.entrance"); |
959 |
1
|
reqCompList1.add(rc1); |
960 |
1
|
reqCompList1.add(rc2); |
961 |
1
|
subTree1.setReqComponents(reqCompList1); |
962 |
|
|
963 |
1
|
StatementTreeViewInfo oldSubTree1 = treeView.getStatements().get(0); |
964 |
1
|
treeView.getStatements().set(0, subTree1); |
965 |
1
|
ProgramRequirementInfo updated = programService.updateProgramRequirement(progReq); |
966 |
1
|
checkProgramRequirement(progReq, updated); |
967 |
1
|
statementService.getStatement(oldSubTree1.getId()); |
968 |
|
} |
969 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 2 |
Complexity Density: 0.12 |
1
PASS
|
|
970 |
0
|
@Test... |
971 |
|
@Ignore public void testDeleteMajorDiscipline() throws IllegalArgumentException, SecurityException, IntrospectionException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, AlreadyExistsException, DataValidationErrorException { |
972 |
0
|
MajorDisciplineDataGenerator generator = new MajorDisciplineDataGenerator(); |
973 |
0
|
MajorDisciplineInfo majorDisciplineInfo = generator.getMajorDisciplineInfoTestData(); |
974 |
0
|
assertNotNull(majorDisciplineInfo); |
975 |
0
|
fixLoCategoryIds(majorDisciplineInfo.getLearningObjectives()); |
976 |
0
|
MajorDisciplineInfo createdMD = programService.createMajorDiscipline(majorDisciplineInfo); |
977 |
0
|
assertNotNull(createdMD); |
978 |
0
|
assertEquals(DtoConstants.STATE_DRAFT, createdMD.getState()); |
979 |
0
|
assertEquals(ProgramAssemblerConstants.MAJOR_DISCIPLINE, createdMD.getType()); |
980 |
0
|
assertEquals("00f5f8c5-fff1-4c8b-92fc-789b891e0849", createdMD.getCredentialProgramId()); |
981 |
|
|
982 |
0
|
String majorDisciplineId = createdMD.getId(); |
983 |
0
|
MajorDisciplineInfo retrievedMD = programService.getMajorDiscipline(majorDisciplineId); |
984 |
0
|
assertNotNull(retrievedMD); |
985 |
|
|
986 |
0
|
programService.deleteMajorDiscipline(majorDisciplineId); |
987 |
0
|
try { |
988 |
0
|
retrievedMD = programService.getMajorDiscipline(majorDisciplineId); |
989 |
0
|
fail("Retrieval of deleted MajorDiscipline should have thrown exception"); |
990 |
|
} catch (DoesNotExistException e) {} |
991 |
|
} |
992 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
993 |
15
|
private void fixLoCategoryIds(List<LoDisplayInfo> loDisplayInfoList) {... |
994 |
15
|
for (LoDisplayInfo parentLo : loDisplayInfoList) { |
995 |
14
|
fixLoCategoryId(parentLo.getLoCategoryInfoList()); |
996 |
14
|
fixLoCategoryIds(parentLo.getLoDisplayInfoList()); |
997 |
|
} |
998 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
999 |
14
|
private void fixLoCategoryId(List<LoCategoryInfo> loCategoryInfoList) {... |
1000 |
14
|
loCategoryInfoList.get(1).setId(OTHER_LO_CAT_ID); |
1001 |
|
} |
1002 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (39) |
Complexity: 1 |
Complexity Density: 0.03 |
1
PASS
|
|
1003 |
1
|
@Test... |
1004 |
|
public void testUpdateMajorDiscipline() throws IllegalArgumentException, SecurityException, IntrospectionException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, VersionMismatchException, OperationFailedException, PermissionDeniedException { |
1005 |
1
|
MajorDisciplineDataGenerator generator = new MajorDisciplineDataGenerator(); |
1006 |
1
|
MajorDisciplineInfo majorDisciplineInfo = generator.getMajorDisciplineInfoTestData(); |
1007 |
1
|
assertNotNull(majorDisciplineInfo); |
1008 |
|
|
1009 |
1
|
MajorDisciplineInfo major = programService.getMajorDiscipline("d4ea77dd-b492-4554-b104-863e42c5f8b7"); |
1010 |
1
|
assertNotNull(major); |
1011 |
|
|
1012 |
|
|
1013 |
1
|
assertNotNull(major.getCode()); |
1014 |
1
|
assertEquals("ANTH", major.getCode()); |
1015 |
1
|
assertNotNull(major.getType()); |
1016 |
1
|
assertEquals(ProgramAssemblerConstants.MAJOR_DISCIPLINE, major.getType()); |
1017 |
1
|
assertNotNull(major.getState()); |
1018 |
1
|
assertEquals(DtoConstants.STATE_ACTIVE, major.getState()); |
1019 |
1
|
assertNotNull(major.getId()); |
1020 |
1
|
assertEquals("d4ea77dd-b492-4554-b104-863e42c5f8b7", major.getId()); |
1021 |
1
|
assertNotNull(major.getShortTitle()); |
1022 |
1
|
assertEquals("Anthro", major.getShortTitle()); |
1023 |
1
|
assertNotNull(major.getLongTitle()); |
1024 |
1
|
assertEquals("Anthropology", major.getLongTitle()); |
1025 |
|
|
1026 |
|
|
1027 |
1
|
major.getCampusLocations().add("MAIN"); |
1028 |
1
|
major.setLongTitle(major.getLongTitle() + "-updated"); |
1029 |
1
|
major.getAttributes().put("PIES", "APPLE"); |
1030 |
|
|
1031 |
1
|
major.setCip2000Code(major.getCip2000Code() + "-updated"); |
1032 |
1
|
major.setDiplomaTitle(major.getDiplomaTitle() + "-updated"); |
1033 |
1
|
major.setTranscriptTitle(major.getTranscriptTitle() + "-updated"); |
1034 |
|
|
1035 |
|
|
1036 |
|
|
1037 |
1
|
major.getCatalogDescr().setPlain(major.getCatalogDescr().getPlain() + "-updated"); |
1038 |
1
|
major.getCatalogPublicationTargets().add("kuali.lu.publication.GradCatalog"); |
1039 |
|
|
1040 |
1
|
for (String orgInfoId : major.getDivisionsFinancialControl()) { |
1041 |
1
|
orgInfoId = orgInfoId + "-updated"; |
1042 |
|
} |
1043 |
1
|
for (String orgInfoId : major.getUnitsDeployment()) { |
1044 |
1
|
orgInfoId = orgInfoId + "-updated"; |
1045 |
|
} |
1046 |
|
|
1047 |
1
|
List<String> reqIds = new ArrayList<String>(); |
1048 |
1
|
reqIds.add("REQ-200"); |
1049 |
1
|
reqIds.add("REQ-300"); |
1050 |
1
|
major.setProgramRequirements(reqIds); |
1051 |
|
|
1052 |
|
|
1053 |
1
|
MajorDisciplineInfo updatedMD = programService.updateMajorDiscipline(major); |
1054 |
|
|
1055 |
|
|
1056 |
1
|
verifyUpdate(updatedMD); |
1057 |
1
|
assertEquals(2, updatedMD.getProgramRequirements().size()); |
1058 |
|
|
1059 |
|
|
1060 |
1
|
MajorDisciplineInfo retrievedMD = programService.getMajorDiscipline(major.getId()); |
1061 |
1
|
verifyUpdate(retrievedMD); |
1062 |
1
|
assertEquals(2, retrievedMD.getProgramRequirements().size()); |
1063 |
|
|
1064 |
|
|
1065 |
|
} |
1066 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1
PASS
|
|
1067 |
1
|
@Test... |
1068 |
|
public void testUpdateMajorDisciplineRemoveRule() throws IllegalArgumentException, SecurityException, IntrospectionException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, VersionMismatchException { |
1069 |
1
|
MajorDisciplineInfo major = programService.getMajorDiscipline("d4ea77dd-b492-4554-b104-863e42c5f8b7"); |
1070 |
|
|
1071 |
1
|
List<String> reqIds = new ArrayList<String>(1); |
1072 |
1
|
ProgramRequirementInfo req1 = programService.createProgramRequirement(createProgramRequirementTestData()); |
1073 |
1
|
reqIds.add(req1.getId()); |
1074 |
1
|
major.setProgramRequirements(reqIds); |
1075 |
|
|
1076 |
|
|
1077 |
1
|
MajorDisciplineInfo updatedMD = programService.updateMajorDiscipline(major); |
1078 |
1
|
MajorDisciplineInfo retrievedMD = programService.getMajorDiscipline(major.getId()); |
1079 |
|
|
1080 |
|
|
1081 |
1
|
programService.deleteProgramRequirement(req1.getId()); |
1082 |
1
|
retrievedMD.getProgramRequirements().clear(); |
1083 |
1
|
MajorDisciplineInfo updatedMD2 = programService.updateMajorDiscipline(retrievedMD); |
1084 |
1
|
assertEquals(0, updatedMD2.getProgramRequirements().size()); |
1085 |
1
|
retrievedMD = programService.getMajorDiscipline(major.getId()); |
1086 |
1
|
assertEquals(0, retrievedMD.getProgramRequirements().size()); |
1087 |
|
} |
1088 |
|
|
1089 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
|
1090 |
2
|
private void verifyUpdate(MajorDisciplineInfo updatedMD) {... |
1091 |
2
|
assertNotNull(updatedMD); |
1092 |
|
|
1093 |
2
|
assertEquals(3, updatedMD.getAttributes().size()); |
1094 |
2
|
assertNotNull(updatedMD.getAttributes().get("PIES")); |
1095 |
2
|
assertEquals("APPLE", updatedMD.getAttributes().get("PIES")); |
1096 |
|
|
1097 |
2
|
assertEquals(3, updatedMD.getCampusLocations().size()); |
1098 |
2
|
assertEquals("NO", updatedMD.getCampusLocations().get(0)); |
1099 |
2
|
assertEquals("SO", updatedMD.getCampusLocations().get(1)); |
1100 |
2
|
assertEquals("MAIN", updatedMD.getCampusLocations().get(2)); |
1101 |
|
|
1102 |
|
|
1103 |
|
|
1104 |
2
|
assertNotNull(updatedMD.getCatalogDescr()); |
1105 |
2
|
assertEquals("This is the catalog description-updated", updatedMD.getCatalogDescr().getPlain()); |
1106 |
|
|
1107 |
2
|
assertNotNull(updatedMD.getCatalogPublicationTargets()); |
1108 |
2
|
assertEquals(2, updatedMD.getCatalogPublicationTargets().size()); |
1109 |
|
|
1110 |
2
|
assertEquals("Anthropology-updated", updatedMD.getLongTitle()); |
1111 |
2
|
assertEquals("45.0202-updated", updatedMD.getCip2000Code()); |
1112 |
2
|
assertEquals("TRANSCRIPT-TITLE-updated", updatedMD.getTranscriptTitle()); |
1113 |
2
|
assertEquals("DIPLOMA-TITLE-updated", updatedMD.getDiplomaTitle() ); |
1114 |
|
} |
1115 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1
PASS
|
|
1116 |
1
|
@Test... |
1117 |
|
public void testCreateBaccCredentialProgram() throws IllegalArgumentException, SecurityException, IntrospectionException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
1118 |
1
|
CredentialProgramDataGenerator generator = new CredentialProgramDataGenerator(ProgramAssemblerConstants.BACCALAUREATE_PROGRAM); |
1119 |
1
|
CredentialProgramInfo credentialProgramInfo = null; |
1120 |
1
|
assertNotNull(credentialProgramInfo = generator.getCPTestData()); |
1121 |
1
|
List<String> coreProgramIds = new ArrayList<String>(); |
1122 |
1
|
coreProgramIds.add("00f5f8c5-fff1-4c8b-92fc-789b891e0849"); |
1123 |
1
|
credentialProgramInfo.setCoreProgramIds(coreProgramIds); |
1124 |
1
|
CredentialProgramInfo createdCP = programService.createCredentialProgram(credentialProgramInfo); |
1125 |
1
|
assertNotNull(createdCP); |
1126 |
1
|
assertEquals(DtoConstants.STATE_DRAFT, createdCP.getState()); |
1127 |
1
|
assertEquals(ProgramAssemblerConstants.BACCALAUREATE_PROGRAM, createdCP.getCredentialProgramType()); |
1128 |
|
} |
1129 |
|
|
|
|
| 62.5% |
Uncovered Elements: 3 (8) |
Complexity: 3 |
Complexity Density: 0.38 |
1
PASS
|
|
1130 |
1
|
@Test... |
1131 |
|
public void testDeleteBaccCredentialProgram() throws DoesNotExistException, InvalidParameterException, MissingParameterException, PermissionDeniedException, OperationFailedException { |
1132 |
1
|
String credentialProgramId = "d02dbbd3-20e2-410d-ab52-1bd6d362748b"; |
1133 |
1
|
CredentialProgramInfo retrievedCP = programService.getCredentialProgram(credentialProgramId); |
1134 |
1
|
assertNotNull(retrievedCP); |
1135 |
|
|
1136 |
1
|
try{ |
1137 |
1
|
programService.deleteCredentialProgram(credentialProgramId); |
1138 |
0
|
try { |
1139 |
0
|
retrievedCP = programService.getCredentialProgram(credentialProgramId); |
1140 |
0
|
fail("Retrieval of deleted CredentialProgram should have thrown exception"); |
1141 |
|
} catch (DoesNotExistException e) {} |
1142 |
|
}catch (OperationFailedException e) {} |
1143 |
|
} |
1144 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1
PASS
|
|
1145 |
1
|
@Test... |
1146 |
|
public void testUpdateBaccCredentialProgram() throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, VersionMismatchException, OperationFailedException, PermissionDeniedException { |
1147 |
1
|
String credentialProgramId = "d02dbbd3-20e2-410d-ab52-1bd6d362748b"; |
1148 |
1
|
CredentialProgramInfo credentialProgramInfo = programService.getCredentialProgram(credentialProgramId); |
1149 |
1
|
assertNotNull(credentialProgramInfo); |
1150 |
|
|
1151 |
|
|
1152 |
1
|
assertEquals("BS", credentialProgramInfo.getCode()); |
1153 |
1
|
assertEquals("B.S.", credentialProgramInfo.getShortTitle()); |
1154 |
1
|
assertEquals("Bachelor of Science", credentialProgramInfo.getLongTitle()); |
1155 |
1
|
assertEquals("Bachelor of Science", credentialProgramInfo.getDescr().getPlain()); |
1156 |
1
|
assertEquals(DtoConstants.STATE_ACTIVE, credentialProgramInfo.getState()); |
1157 |
1
|
assertEquals("52", credentialProgramInfo.getInstitution().getOrgId()); |
1158 |
1
|
assertEquals(ProgramAssemblerConstants.UNDERGRAD_PROGRAM_LEVEL, credentialProgramInfo.getProgramLevel()); |
1159 |
|
|
1160 |
|
|
1161 |
|
|
1162 |
|
|
1163 |
|
|
1164 |
1
|
credentialProgramInfo.setProgramLevel(ProgramAssemblerConstants.GRADUATE_PROGRAM_LEVEL); |
1165 |
1
|
AdminOrgInfo institution = new AdminOrgInfo(); |
1166 |
1
|
institution.setOrgId("51"); |
1167 |
1
|
credentialProgramInfo.setInstitution(institution); |
1168 |
|
|
1169 |
|
|
1170 |
1
|
CredentialProgramInfo updatedCP = programService.updateCredentialProgram(credentialProgramInfo); |
1171 |
|
|
1172 |
|
|
1173 |
1
|
verifyUpdate(updatedCP); |
1174 |
|
|
1175 |
|
|
1176 |
1
|
CredentialProgramInfo retrievedCP = programService.getCredentialProgram(credentialProgramInfo.getId()); |
1177 |
1
|
verifyUpdate(retrievedCP); |
1178 |
|
|
1179 |
|
|
1180 |
|
|
1181 |
|
} |
1182 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
1183 |
2
|
private void verifyUpdate(CredentialProgramInfo updatedCP) {... |
1184 |
2
|
assertNotNull(updatedCP); |
1185 |
|
|
1186 |
|
|
1187 |
|
|
1188 |
|
|
1189 |
2
|
assertEquals(ProgramAssemblerConstants.GRADUATE_PROGRAM_LEVEL, updatedCP.getProgramLevel()); |
1190 |
2
|
assertEquals("51", updatedCP.getInstitution().getOrgId()); |
1191 |
|
} |
1192 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1
PASS
|
|
1193 |
1
|
@Test... |
1194 |
|
public void testCreateCoreProgram() throws IllegalArgumentException, SecurityException, IntrospectionException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
1195 |
1
|
CoreProgramDataGenerator generator = new CoreProgramDataGenerator(); |
1196 |
1
|
CoreProgramInfo coreProgramInfo = null; |
1197 |
1
|
assertNotNull(coreProgramInfo = generator.getCoreProgramTestData()); |
1198 |
1
|
CoreProgramInfo createdCP = programService.createCoreProgram(coreProgramInfo); |
1199 |
1
|
assertNotNull(createdCP); |
1200 |
1
|
assertEquals(DtoConstants.STATE_DRAFT, createdCP.getState()); |
1201 |
1
|
assertEquals(ProgramAssemblerConstants.CORE_PROGRAM, createdCP.getType()); |
1202 |
|
} |
1203 |
|
|
|
|
| 94.3% |
Uncovered Elements: 2 (35) |
Complexity: 2 |
Complexity Density: 0.06 |
1
PASS
|
|
1204 |
1
|
@Test... |
1205 |
|
public void testUpdateVariationsByMajorDiscipline() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DataValidationErrorException, VersionMismatchException{ |
1206 |
1
|
MajorDisciplineInfo majorDisciplineInfo = null; |
1207 |
|
|
1208 |
1
|
majorDisciplineInfo = programService.getMajorDiscipline("d4ea77dd-b492-4554-b104-863e42c5f8b7"); |
1209 |
1
|
assertNotNull(majorDisciplineInfo); |
1210 |
|
|
1211 |
1
|
List<ProgramVariationInfo> pvInfos = majorDisciplineInfo.getVariations(); |
1212 |
1
|
assertNotNull(pvInfos); |
1213 |
|
|
1214 |
|
|
1215 |
1
|
ProgramVariationInfo pvInfo = pvInfos.get(0); |
1216 |
|
|
1217 |
1
|
pvInfo.setLongTitle(pvInfo.getLongTitle() + "-updated"); |
1218 |
1
|
pvInfo.setCode(pvInfo.getCode() + "-updated"); |
1219 |
1
|
pvInfo.setShortTitle(pvInfo.getShortTitle() + "-updated"); |
1220 |
1
|
RichTextInfo testDesc = pvInfo.getDescr(); |
1221 |
1
|
testDesc.setPlain(testDesc.getPlain() + "-updated"); |
1222 |
1
|
pvInfo.setDescr(testDesc); |
1223 |
1
|
pvInfo.setCip2000Code(pvInfo.getCip2000Code() + "-updated"); |
1224 |
1
|
pvInfo.setCip2010Code(pvInfo.getCip2010Code() + "-updated"); |
1225 |
1
|
pvInfo.setTranscriptTitle("transcriptTitle-updated"); |
1226 |
1
|
pvInfo.setDiplomaTitle(pvInfo.getDiplomaTitle() + "-updated"); |
1227 |
|
|
1228 |
1
|
List<String> campusLocations = new ArrayList<String>(); |
1229 |
1
|
campusLocations.add(CourseAssemblerConstants.COURSE_CAMPUS_LOCATION_CD_NORTH); |
1230 |
1
|
campusLocations.add(CourseAssemblerConstants.COURSE_CAMPUS_LOCATION_CD_SOUTH); |
1231 |
1
|
pvInfo.setCampusLocations(campusLocations); |
1232 |
|
|
1233 |
1
|
List<String> testOrgs = new ArrayList<String>(); |
1234 |
1
|
testOrgs.add("testOrgId"); |
1235 |
1
|
if (pvInfo.getDivisionsContentOwner() != null) { |
1236 |
1
|
pvInfo.getDivisionsContentOwner().clear(); |
1237 |
1
|
pvInfo.getDivisionsContentOwner().add("testOrgId"); |
1238 |
|
} |
1239 |
|
else { |
1240 |
0
|
pvInfo.setDivisionsContentOwner(testOrgs); |
1241 |
|
} |
1242 |
|
|
1243 |
|
|
1244 |
1
|
MajorDisciplineInfo updatedMD = programService.updateMajorDiscipline(majorDisciplineInfo); |
1245 |
1
|
List<ProgramVariationInfo> updatedPvInfos = updatedMD.getVariations(); |
1246 |
1
|
assertNotNull(updatedPvInfos); |
1247 |
|
|
1248 |
|
|
1249 |
1
|
verifyUpdatedPVinList(pvInfo, updatedPvInfos); |
1250 |
|
|
1251 |
|
|
1252 |
1
|
List<ProgramVariationInfo> retrievedPVs = programService.getVariationsByMajorDisciplineId(majorDisciplineInfo.getId()); |
1253 |
1
|
assertNotNull(retrievedPVs); |
1254 |
|
|
1255 |
|
|
1256 |
1
|
verifyUpdatedPVinList(pvInfo, retrievedPVs); |
1257 |
|
} |
1258 |
|
|
|
|
| 83.3% |
Uncovered Elements: 2 (12) |
Complexity: 4 |
Complexity Density: 0.5 |
|
1259 |
4
|
private void verifyUpdatedPVinList(ProgramVariationInfo pvInfo, List<ProgramVariationInfo> updatedPvInfos) {... |
1260 |
4
|
boolean found = false; |
1261 |
4
|
for (ProgramVariationInfo updatedPV : updatedPvInfos) { |
1262 |
8
|
if (updatedPV.getId().equals(pvInfo.getId()) && updatedPV.getState().equals("Active")) { |
1263 |
4
|
verifyUpdate(pvInfo, updatedPV); |
1264 |
4
|
found = true; |
1265 |
4
|
break; |
1266 |
|
} |
1267 |
|
} |
1268 |
4
|
if (!found) { |
1269 |
0
|
fail("Unable to find updated ProgramVariationInfo for comparison"); |
1270 |
|
} |
1271 |
|
} |
1272 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
|
1273 |
4
|
private void verifyUpdate(ProgramVariationInfo source, ProgramVariationInfo target) {... |
1274 |
4
|
assertNotNull(target); |
1275 |
|
|
1276 |
4
|
assertEquals(source.getDescr().getPlain(), target.getDescr().getPlain()); |
1277 |
4
|
assertEquals(source.getLongTitle(), target.getLongTitle()); |
1278 |
4
|
assertEquals(source.getShortTitle(), target.getShortTitle()); |
1279 |
|
|
1280 |
4
|
assertEquals(source.getCip2000Code(), target.getCip2000Code()); |
1281 |
4
|
assertEquals(source.getCip2010Code(), target.getCip2010Code()); |
1282 |
4
|
assertEquals(source.getTranscriptTitle(), target.getTranscriptTitle()); |
1283 |
4
|
assertEquals(source.getDiplomaTitle(), target.getDiplomaTitle()); |
1284 |
|
|
1285 |
4
|
assertNotNull(target.getCampusLocations()); |
1286 |
4
|
for(String loc : target.getCampusLocations()){ |
1287 |
8
|
assertTrue(CourseAssemblerConstants.COURSE_CAMPUS_LOCATION_CD_NORTH.equals(loc) || CourseAssemblerConstants.COURSE_CAMPUS_LOCATION_CD_SOUTH.equals(loc)); |
1288 |
|
} |
1289 |
|
|
1290 |
4
|
assertNotNull(target.getDivisionsContentOwner()); |
1291 |
|
|
1292 |
|
|
1293 |
|
|
1294 |
|
} |
1295 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (29) |
Complexity: 1 |
Complexity Density: 0.03 |
1
PASS
|
|
1296 |
1
|
@Test... |
1297 |
|
public void testCreateVariationsByMajorDiscipline() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, DataValidationErrorException, VersionMismatchException, PermissionDeniedException{ |
1298 |
1
|
MajorDisciplineInfo majorDisciplineInfo = null; |
1299 |
|
|
1300 |
1
|
majorDisciplineInfo = programService.getMajorDiscipline("d4ea77dd-b492-4554-b104-863e42c5f8b7"); |
1301 |
1
|
assertNotNull(majorDisciplineInfo); |
1302 |
|
|
1303 |
1
|
List<ProgramVariationInfo> pvInfos = majorDisciplineInfo.getVariations(); |
1304 |
1
|
assertNotNull(pvInfos); |
1305 |
|
|
1306 |
1
|
ProgramVariationInfo pvInfoS = pvInfos.get(0); |
1307 |
1
|
ProgramVariationInfo pvInfoT = new ProgramVariationInfo(); |
1308 |
|
|
1309 |
1
|
BeanUtils.copyProperties(pvInfoS, pvInfoT, new String[]{"id"}); |
1310 |
|
|
1311 |
1
|
pvInfoT.setLongTitle(pvInfoT.getLongTitle() + "-created"); |
1312 |
1
|
pvInfoT.setShortTitle(pvInfoT.getShortTitle() + "-created"); |
1313 |
1
|
RichTextInfo testDesc = pvInfoT.getDescr(); |
1314 |
1
|
testDesc.setPlain(testDesc.getPlain() + "-created"); |
1315 |
1
|
pvInfoT.setDescr(testDesc); |
1316 |
1
|
pvInfoT.setCip2000Code(pvInfoT.getCip2000Code() + "-created"); |
1317 |
1
|
pvInfoT.setCip2010Code(pvInfoT.getCip2010Code() + "-created"); |
1318 |
1
|
pvInfoT.setTranscriptTitle(pvInfoT.getTranscriptTitle() + "-created"); |
1319 |
1
|
pvInfoT.setDiplomaTitle(pvInfoT.getDiplomaTitle() + "-created"); |
1320 |
|
|
1321 |
|
|
1322 |
1
|
pvInfos.add(pvInfoT); |
1323 |
1
|
MajorDisciplineInfo updatedMD = programService.updateMajorDiscipline(majorDisciplineInfo); |
1324 |
1
|
List<ProgramVariationInfo> updatedPvInfos = updatedMD.getVariations(); |
1325 |
1
|
assertNotNull(updatedPvInfos); |
1326 |
1
|
assertEquals(3, updatedPvInfos.size()); |
1327 |
|
|
1328 |
|
|
1329 |
1
|
verifyUpdatedPVinList(pvInfoT, updatedPvInfos); |
1330 |
|
|
1331 |
|
|
1332 |
1
|
MajorDisciplineInfo retrievedMD = programService.getMajorDiscipline(majorDisciplineInfo.getId()); |
1333 |
1
|
assertEquals(3, retrievedMD.getVariations().size()); |
1334 |
|
|
1335 |
1
|
List<ProgramVariationInfo> retrievedPVs = programService.getVariationsByMajorDisciplineId(majorDisciplineInfo.getId()); |
1336 |
1
|
assertNotNull(retrievedPVs); |
1337 |
1
|
assertEquals(3, updatedPvInfos.size()); |
1338 |
|
|
1339 |
1
|
verifyUpdatedPVinList(pvInfoT, retrievedPVs); |
1340 |
|
} |
1341 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 2 |
Complexity Density: 0.11 |
1
PASS
|
|
1342 |
1
|
@Test... |
1343 |
|
public void testDeleteVariationsByMajorDiscipline() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DataValidationErrorException, VersionMismatchException{ |
1344 |
1
|
MajorDisciplineInfo majorDisciplineInfo = null; |
1345 |
|
|
1346 |
1
|
majorDisciplineInfo = programService.getMajorDiscipline("d4ea77dd-b492-4554-b104-863e42c5f8b7"); |
1347 |
1
|
assertNotNull(majorDisciplineInfo); |
1348 |
|
|
1349 |
1
|
List<ProgramVariationInfo> pvInfos = majorDisciplineInfo.getVariations(); |
1350 |
1
|
assertNotNull(pvInfos); |
1351 |
|
|
1352 |
|
|
1353 |
1
|
String var1 = pvInfos.get(1).getId(); |
1354 |
1
|
pvInfos.remove(1); |
1355 |
1
|
MajorDisciplineInfo updatedMD = programService.updateMajorDiscipline(majorDisciplineInfo); |
1356 |
1
|
List<ProgramVariationInfo> updatedPvInfos = updatedMD.getVariations(); |
1357 |
1
|
assertNotNull(updatedPvInfos); |
1358 |
1
|
assertEquals(2, updatedPvInfos.size()); |
1359 |
|
|
1360 |
|
|
1361 |
1
|
MajorDisciplineInfo retrievedMD = programService.getMajorDiscipline(majorDisciplineInfo.getId()); |
1362 |
1
|
assertEquals(2, retrievedMD.getVariations().size()); |
1363 |
|
|
1364 |
1
|
List<ProgramVariationInfo> retrievedPVs = programService.getVariationsByMajorDisciplineId(majorDisciplineInfo.getId()); |
1365 |
1
|
assertNotNull(retrievedPVs); |
1366 |
1
|
for(ProgramVariationInfo pvi : retrievedPVs){ |
1367 |
3
|
if(pvi.getId().equals(var1)){ |
1368 |
1
|
assertEquals("Inactive", pvi.getState()); |
1369 |
|
} |
1370 |
|
} |
1371 |
|
} |
1372 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
1373 |
1
|
@Test(expected=DoesNotExistException.class)... |
1374 |
|
public void testDeleteProgramRequirement() throws Exception { |
1375 |
1
|
ProgramRequirementInfo progReq = createProgramRequirementTestData(); |
1376 |
1
|
ProgramRequirementInfo createdProgReq = programService.createProgramRequirement(progReq); |
1377 |
1
|
programService.deleteProgramRequirement(createdProgReq.getId()); |
1378 |
1
|
programService.getProgramRequirement(createdProgReq.getId(), null, null); |
1379 |
|
} |
1380 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 1 |
Complexity Density: 0.05 |
1
PASS
|
|
1381 |
1
|
@Test... |
1382 |
|
public void testUpdateCoreProgram() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DataValidationErrorException, VersionMismatchException { |
1383 |
1
|
CoreProgramInfo core = null; |
1384 |
1
|
core = programService.getCoreProgram("00f5f8c5-fff1-4c8b-92fc-789b891e0849"); |
1385 |
|
|
1386 |
|
|
1387 |
1
|
assertNotNull(core); |
1388 |
1
|
assertEquals("BS", core.getCode()); |
1389 |
1
|
assertNotNull(core.getShortTitle()); |
1390 |
1
|
assertEquals("B.S.", core.getShortTitle()); |
1391 |
1
|
assertNotNull(core.getLongTitle()); |
1392 |
1
|
assertEquals("Bachelor of Science", core.getLongTitle()); |
1393 |
1
|
assertNotNull(core.getDescr()); |
1394 |
1
|
assertEquals("Anthropology Major", core.getDescr().getPlain()); |
1395 |
1
|
assertEquals(ProgramAssemblerConstants.CORE_PROGRAM, core.getType()); |
1396 |
1
|
assertEquals(DtoConstants.STATE_ACTIVE, core.getState()); |
1397 |
|
|
1398 |
|
|
1399 |
1
|
core.setCode(core.getCode() + "-updated"); |
1400 |
1
|
core.setShortTitle(core.getShortTitle() + "-updated"); |
1401 |
1
|
core.setLongTitle(core.getLongTitle() + "-updated"); |
1402 |
1
|
core.setTranscriptTitle(core.getTranscriptTitle() + "-updated"); |
1403 |
1
|
core.setState(DtoConstants.STATE_RETIRED); |
1404 |
|
|
1405 |
|
|
1406 |
1
|
CoreProgramInfo updatedCP = programService.updateCoreProgram(core); |
1407 |
|
|
1408 |
|
|
1409 |
1
|
verifyUpdate(updatedCP); |
1410 |
|
|
1411 |
|
|
1412 |
1
|
CoreProgramInfo retrievedCP = programService.getCoreProgram(core.getId()); |
1413 |
1
|
verifyUpdate(retrievedCP); |
1414 |
|
|
1415 |
|
|
1416 |
|
} |
1417 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
1418 |
2
|
private void verifyUpdate(CoreProgramInfo updatedCP) {... |
1419 |
2
|
assertNotNull(updatedCP); |
1420 |
2
|
assertEquals("BS-updated", updatedCP.getCode()); |
1421 |
2
|
assertEquals("B.S.-updated", updatedCP.getShortTitle()); |
1422 |
2
|
assertEquals("Bachelor of Science-updated", updatedCP.getLongTitle()); |
1423 |
2
|
assertEquals("TRANSCRIPT-TITLE-updated", updatedCP.getTranscriptTitle()); |
1424 |
2
|
assertEquals(DtoConstants.STATE_RETIRED, updatedCP.getState()); |
1425 |
|
} |
1426 |
|
|
|
|
| 81.2% |
Uncovered Elements: 3 (16) |
Complexity: 3 |
Complexity Density: 0.19 |
1
PASS
|
|
1427 |
1
|
@Test... |
1428 |
|
public void testDeleteCoreProgram() throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, IllegalArgumentException, SecurityException, IntrospectionException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchFieldException, DoesNotExistException { |
1429 |
1
|
CoreProgramDataGenerator generator = new CoreProgramDataGenerator(); |
1430 |
1
|
CoreProgramInfo coreProgramInfo = generator.getCoreProgramTestData(); |
1431 |
|
|
1432 |
1
|
assertNotNull(coreProgramInfo); |
1433 |
1
|
fixLoCategoryIds(coreProgramInfo.getLearningObjectives()); |
1434 |
1
|
CoreProgramInfo createdCP = programService.createCoreProgram(coreProgramInfo); |
1435 |
1
|
assertNotNull(createdCP); |
1436 |
1
|
assertEquals(DtoConstants.STATE_DRAFT, createdCP.getState()); |
1437 |
1
|
assertEquals(ProgramAssemblerConstants.CORE_PROGRAM, createdCP.getType()); |
1438 |
|
|
1439 |
|
|
1440 |
1
|
String coreProgramId = createdCP.getId(); |
1441 |
1
|
CoreProgramInfo retrievedCP = programService.getCoreProgram(coreProgramId); |
1442 |
1
|
assertNotNull(retrievedCP); |
1443 |
|
|
1444 |
1
|
try{ |
1445 |
1
|
programService.deleteCoreProgram(coreProgramId); |
1446 |
0
|
try { |
1447 |
0
|
retrievedCP = programService.getCoreProgram(coreProgramId); |
1448 |
0
|
fail("Retrieval of deleted coreProgram should have thrown exception"); |
1449 |
|
} catch (DoesNotExistException e) {} |
1450 |
|
}catch (OperationFailedException e) {} |
1451 |
|
|
1452 |
|
} |
1453 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1
PASS
|
|
1454 |
1
|
@Test... |
1455 |
|
public void testCreditsProgramRequirement() throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException { |
1456 |
1
|
ProgramRequirementInfo progReq = createProgramRequirementTestData(); |
1457 |
1
|
progReq.setMinCredits(3); |
1458 |
1
|
progReq.setMaxCredits(45); |
1459 |
1
|
ProgramRequirementInfo createdProgReq = programService.createProgramRequirement(progReq); |
1460 |
1
|
assertEquals("3", Integer.toString(createdProgReq.getMinCredits())); |
1461 |
1
|
assertEquals("45", Integer.toString(createdProgReq.getMaxCredits())); |
1462 |
|
|
1463 |
1
|
ProgramRequirementInfo progReq2 = programService.getProgramRequirement(createdProgReq.getId(), null, null); |
1464 |
1
|
assertEquals("3", Integer.toString(progReq2.getMinCredits())); |
1465 |
1
|
assertEquals("45", Integer.toString(progReq2.getMaxCredits())); |
1466 |
|
} |
1467 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
1468 |
|
private class ServiceMethodInvocationData { |
1469 |
|
String methodName; |
1470 |
|
Object[] parameters; |
1471 |
|
Class<?>[] paramterTypes; |
1472 |
|
} |
1473 |
|
|
|
|
| 71.4% |
Uncovered Elements: 4 (14) |
Complexity: 5 |
Complexity Density: 0.42 |
|
1474 |
1
|
private void invokeForExpectedException(Collection<ServiceMethodInvocationData> methods, Class<? extends Exception> expectedExceptionClass) throws Exception {... |
1475 |
1
|
for(ServiceMethodInvocationData methodData : methods) { |
1476 |
6
|
Method method = programService.getClass().getMethod(methodData.methodName, methodData.paramterTypes); |
1477 |
6
|
Throwable expected = null; |
1478 |
6
|
Exception unexpected = null; |
1479 |
6
|
try { |
1480 |
6
|
method.invoke(programService, methodData.parameters); |
1481 |
|
} |
1482 |
|
catch(InvocationTargetException ex) { |
1483 |
6
|
if(ex.getCause() != null && ex.getCause().getClass().equals(expectedExceptionClass)) { |
1484 |
6
|
expected = ex.getCause(); |
1485 |
|
} |
1486 |
|
else { |
1487 |
0
|
unexpected = ex; |
1488 |
0
|
unexpected.printStackTrace(); |
1489 |
|
} |
1490 |
|
} |
1491 |
|
catch(Exception other) { |
1492 |
0
|
unexpected = other; |
1493 |
|
} |
1494 |
|
finally { |
1495 |
6
|
assertNotNull("An exception of class: " + expectedExceptionClass.toString() + " was expected, but the method: " + methodData.methodName + " threw this exception: " + unexpected, expected); |
1496 |
|
} |
1497 |
|
} |
1498 |
|
} |
1499 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 2 |
Complexity Density: 0.15 |
1
PASS
|
|
1500 |
1
|
@Test... |
1501 |
|
public void testGetVersionMethodsForInvalidParameters() throws Exception { |
1502 |
1
|
String[] getVersionMethods = {"getVersionBySequenceNumber", "getVersions", "getFirstVersion", "getVersionsInDateRange", "getCurrentVersion", "getCurrentVersionOnDate"}; |
1503 |
|
|
1504 |
|
|
1505 |
1
|
Object[][] getVersionParams = {new Object[3], new Object[2], new Object[2], new Object[4], new Object[2], new Object[3]}; |
1506 |
|
|
1507 |
|
|
1508 |
1
|
Class<?>[][] getVersionParamTypes = {{String.class, String.class, Long.class}, |
1509 |
|
{String.class, String.class}, |
1510 |
|
{String.class, String.class}, |
1511 |
|
{String.class, String.class, Date.class, Date.class}, |
1512 |
|
{String.class, String.class}, |
1513 |
|
{String.class, String.class, Date.class}}; |
1514 |
|
|
1515 |
1
|
String badRefObjectTypeURI = "BADBADBAD"; |
1516 |
1
|
Collection<ServiceMethodInvocationData> methods = new ArrayList<ServiceMethodInvocationData>(getVersionMethods.length); |
1517 |
7
|
for(int i = 0; i < getVersionMethods.length; i++) { |
1518 |
6
|
ServiceMethodInvocationData invocationData = new ServiceMethodInvocationData(); |
1519 |
6
|
invocationData.methodName = getVersionMethods[i]; |
1520 |
|
|
1521 |
|
|
1522 |
6
|
getVersionParams[i][0] = badRefObjectTypeURI; |
1523 |
|
|
1524 |
6
|
invocationData.parameters = getVersionParams[i]; |
1525 |
6
|
invocationData.paramterTypes = getVersionParamTypes[i]; |
1526 |
|
|
1527 |
6
|
methods.add(invocationData); |
1528 |
|
} |
1529 |
|
|
1530 |
1
|
invokeForExpectedException(methods, InvalidParameterException.class); |
1531 |
|
} |
1532 |
|
|
1533 |
|
|
1534 |
|
|
1535 |
|
|
1536 |
|
|
1537 |
|
|
1538 |
|
|
1539 |
|
|
1540 |
|
|
1541 |
|
|
1542 |
|
@throws |
1543 |
|
|
|
|
| 81.2% |
Uncovered Elements: 3 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
1
PASS
|
|
1544 |
1
|
@Test... |
1545 |
|
public void testCallDummyMethods() throws Exception { |
1546 |
|
|
1547 |
|
|
1548 |
1
|
Method[] serviceMethods = ProgramService.class.getMethods(); |
1549 |
1
|
Map<String, Method> methodMap = new HashMap<String, Method>(); |
1550 |
|
|
1551 |
1
|
for(Method m : serviceMethods) { |
1552 |
|
|
1553 |
60
|
if(!methodMap.containsKey(m.getName())) { |
1554 |
60
|
methodMap.put(m.getName(), m); |
1555 |
|
} |
1556 |
|
} |
1557 |
|
|
1558 |
1
|
for(String s : DUMMY_SERVICE_METHODS) { |
1559 |
24
|
Method dummyMethod = methodMap.get(s); |
1560 |
|
|
1561 |
24
|
if(dummyMethod == null) { |
1562 |
0
|
throw new Exception("No method " + s + " defined in ProgramService"); |
1563 |
|
} |
1564 |
|
|
1565 |
|
|
1566 |
24
|
Object[] params = new Object[dummyMethod.getParameterTypes().length]; |
1567 |
|
|
1568 |
24
|
Object returned = dummyMethod.invoke(programService, params); |
1569 |
|
|
1570 |
24
|
assertTrue("The invocation of " + s + " returned a non-null value", returned == null); |
1571 |
|
} |
1572 |
|
} |
1573 |
|
|
|
|
| 92.9% |
Uncovered Elements: 1 (14) |
Complexity: 2 |
Complexity Density: 0.14 |
1
PASS
|
|
1574 |
1
|
@Test... |
1575 |
|
public void testCoreProgramVersioning() throws Exception { |
1576 |
1
|
CoreProgramDataGenerator dataGen = new CoreProgramDataGenerator(); |
1577 |
1
|
CoreProgramInfo coreData = dataGen.getCoreProgramTestData(); |
1578 |
|
|
1579 |
1
|
coreData.getProgramRequirements().clear(); |
1580 |
|
|
1581 |
1
|
CoreProgramInfo core = programService.createCoreProgram(coreData); |
1582 |
|
|
1583 |
1
|
CoreProgramInfo newCore = programService.createNewCoreProgramVersion(core.getVersionInfo().getVersionIndId(), "test core program versioning"); |
1584 |
|
|
1585 |
1
|
assertNotNull(newCore); |
1586 |
|
|
1587 |
1
|
programService.setCurrentCoreProgramVersion(newCore.getId(), null); |
1588 |
|
|
1589 |
|
|
1590 |
1
|
CoreProgramInfo secondVersion = null; |
1591 |
|
|
1592 |
1
|
try { |
1593 |
1
|
secondVersion = programService.createNewCoreProgramVersion(core.getVersionInfo().getVersionIndId(), "test core program second version"); |
1594 |
1
|
assertTrue(true); |
1595 |
|
} |
1596 |
|
catch (Exception e) { |
1597 |
0
|
assertTrue(false); |
1598 |
|
} |
1599 |
|
|
1600 |
1
|
assertNotNull(secondVersion); |
1601 |
|
|
1602 |
1
|
assertTrue(newCore.getVersionInfo().getSequenceNumber() != secondVersion.getVersionInfo().getSequenceNumber()); |
1603 |
|
|
1604 |
|
} |
1605 |
|
|
1606 |
|
} |