Clover Coverage Report - Kuali Student 1.2-M4-SNAPSHOT (Aggregated)
Coverage timestamp: Wed Jul 20 2011 11:14:35 EDT
2,056   3,607   161   22.11
0   2,889   0.08   93
93     1.73  
1    
 
  TestLuServiceImpl       Line # 100 2,056 0% 161 92 95.7% 0.9571894
 
  (68)
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
14    */
15   
16    package org.kuali.student.lum.lu.service.impl;
17   
18    import static org.junit.Assert.assertEquals;
19    import static org.junit.Assert.assertFalse;
20    import static org.junit.Assert.assertNotNull;
21    import static org.junit.Assert.assertNull;
22    import static org.junit.Assert.assertTrue;
23    import static org.junit.Assert.fail;
24   
25    import java.text.ParseException;
26    import java.text.SimpleDateFormat;
27    import java.util.ArrayList;
28    import java.util.Arrays;
29    import java.util.Comparator;
30    import java.util.Date;
31    import java.util.List;
32   
33    import org.apache.log4j.Logger;
34    import org.junit.Assert;
35    import org.junit.Test;
36    import org.kuali.student.common.dto.AmountInfo;
37    import org.kuali.student.common.dto.CurrencyAmountInfo;
38    import org.kuali.student.common.dto.RichTextInfo;
39    import org.kuali.student.common.dto.StatusInfo;
40    import org.kuali.student.common.dto.TimeAmountInfo;
41    import org.kuali.student.common.exceptions.AlreadyExistsException;
42    import org.kuali.student.common.exceptions.CircularRelationshipException;
43    import org.kuali.student.common.exceptions.DataValidationErrorException;
44    import org.kuali.student.common.exceptions.DependentObjectsExistException;
45    import org.kuali.student.common.exceptions.DoesNotExistException;
46    import org.kuali.student.common.exceptions.IllegalVersionSequencingException;
47    import org.kuali.student.common.exceptions.InvalidParameterException;
48    import org.kuali.student.common.exceptions.MissingParameterException;
49    import org.kuali.student.common.exceptions.OperationFailedException;
50    import org.kuali.student.common.exceptions.PermissionDeniedException;
51    import org.kuali.student.common.exceptions.UnsupportedActionException;
52    import org.kuali.student.common.exceptions.VersionMismatchException;
53    import org.kuali.student.common.search.dto.SearchParam;
54    import org.kuali.student.common.search.dto.SearchRequest;
55    import org.kuali.student.common.search.dto.SearchResult;
56    import org.kuali.student.common.search.dto.SearchResultCell;
57    import org.kuali.student.common.search.dto.SearchResultRow;
58    import org.kuali.student.common.test.spring.AbstractServiceTest;
59    import org.kuali.student.common.test.spring.Client;
60    import org.kuali.student.common.test.spring.Dao;
61    import org.kuali.student.common.test.spring.Daos;
62    import org.kuali.student.common.test.spring.PersistenceFileLocation;
63    import org.kuali.student.common.validation.dto.ValidationResultInfo;
64    import org.kuali.student.common.versionmanagement.dto.VersionDisplayInfo;
65    import org.kuali.student.lum.lu.dto.AccreditationInfo;
66    import org.kuali.student.lum.lu.dto.AdminOrgInfo;
67    import org.kuali.student.lum.lu.dto.AffiliatedOrgInfo;
68    import org.kuali.student.lum.lu.dto.CluAccountingInfo;
69    import org.kuali.student.lum.lu.dto.CluCluRelationInfo;
70    import org.kuali.student.lum.lu.dto.CluFeeInfo;
71    import org.kuali.student.lum.lu.dto.CluFeeRecordInfo;
72    import org.kuali.student.lum.lu.dto.CluIdentifierInfo;
73    import org.kuali.student.lum.lu.dto.CluInfo;
74    import org.kuali.student.lum.lu.dto.CluInstructorInfo;
75    import org.kuali.student.lum.lu.dto.CluLoRelationInfo;
76    import org.kuali.student.lum.lu.dto.CluPublicationInfo;
77    import org.kuali.student.lum.lu.dto.CluResultInfo;
78    import org.kuali.student.lum.lu.dto.CluSetInfo;
79    import org.kuali.student.lum.lu.dto.CluSetTreeViewInfo;
80    import org.kuali.student.lum.lu.dto.FieldInfo;
81    import org.kuali.student.lum.lu.dto.LuCodeInfo;
82    import org.kuali.student.lum.lu.dto.LuLuRelationTypeInfo;
83    import org.kuali.student.lum.lu.dto.LuiInfo;
84    import org.kuali.student.lum.lu.dto.LuiLuiRelationInfo;
85    import org.kuali.student.lum.lu.dto.MembershipQueryInfo;
86    import org.kuali.student.lum.lu.dto.ResultOptionInfo;
87    import org.kuali.student.lum.lu.dto.ResultUsageTypeInfo;
88    import org.kuali.student.lum.lu.service.LuService;
89    import org.kuali.student.lum.lu.service.LuServiceConstants;
90   
91    import edu.emory.mathcs.backport.java.util.Collections;
92   
93    @Daos( { @Dao(value = "org.kuali.student.lum.lu.dao.impl.LuDaoImpl", testSqlFile = "classpath:ks-lu.sql" /*
94    * ,
95    * testDataFile
96    * =
97    * "classpath:test-beans.xml"
98    */) })
99    @PersistenceFileLocation("classpath:META-INF/lu-persistence.xml")
 
100    public class TestLuServiceImpl extends AbstractServiceTest {
101    @Client(value = "org.kuali.student.lum.lu.service.impl.LuServiceImpl", additionalContextFile = "classpath:lu-additional-context.xml")
102    public LuService client;
103    private static final SimpleDateFormat DF = new SimpleDateFormat("yyyyMMdd");
104    final Logger LOG = Logger.getLogger(TestLuServiceImpl.class);
105   
 
106  1 toggle @Test
107    public void testClu() throws DoesNotExistException,
108    InvalidParameterException, MissingParameterException,
109    OperationFailedException {
110    // getClu
111  1 CluInfo clu = client.getClu("CLU-1");
112  1 assertNotNull(clu);
113  1 assertEquals(clu.getId(), "CLU-1");
114   
115  1 try {
116  1 clu = client.getClu("CLX-1");
117  0 assertTrue(false);
118    } catch (DoesNotExistException e) {
119  1 assertTrue(true);
120    }
121   
122  1 try {
123  1 clu = client.getClu(null);
124  0 assertTrue(false);
125    } catch (MissingParameterException e) {
126  1 assertTrue(true);
127    }
128   
129    // getClusByIdList
130  1 List<String> ids = new ArrayList<String>(1);
131  1 ids.add("CLU-2");
132  1 List<CluInfo> clus = client.getClusByIdList(ids);
133  1 assertNotNull(clus);
134  1 assertEquals(1, clus.size());
135   
136  1 ids.clear();
137  1 ids.add("CLX-42");
138  1 clus = client.getClusByIdList(ids);
139  1 assertTrue(clus == null || clus.size() == 0);
140   
141  1 try {
142  1 clus = client.getClusByIdList(null);
143  0 assertTrue(false);
144    } catch (MissingParameterException e) {
145  1 assertTrue(true);
146    }
147   
148    // getCluIdsByLuType
149  1 ids = client.getCluIdsByLuType("luType.shell.program", "STATE2");
150  1 assertTrue(null != ids);
151  1 assertEquals(1, ids.size());
152  1 assertEquals("CLU-2", ids.get(0));
153   
154  1 ids = client.getCluIdsByLuType("LUTYPE-1X", "STATE1");
155  1 assertTrue(ids == null || ids.size() == 0);
156  1 ids = client.getCluIdsByLuType("luType.shell.course", "STATE1X");
157  1 assertTrue(ids == null || ids.size() == 0);
158   
159  1 try {
160  1 ids = client.getCluIdsByLuType(null, "STATE1");
161  0 assertTrue(false);
162    } catch (MissingParameterException e) {
163  1 assertTrue(true);
164    }
165   
166  1 try {
167  1 ids = client.getCluIdsByLuType("luType.shell.course", null);
168  0 assertTrue(false);
169    } catch (MissingParameterException e) {
170  1 assertTrue(true);
171    }
172   
173    // getClusByLuType
174  1 clus = client.getClusByLuType("luType.shell.program", "STATE2");
175  1 assertTrue(null != clus);
176  1 assertEquals(1, clus.size());
177  1 assertEquals("CLU-2", clus.get(0).getId());
178   
179  1 clus = client.getClusByLuType("LUTYPE-1X", "STATE1");
180  1 assertTrue(clus == null || clus.size() == 0);
181  1 clus = client.getClusByLuType("luType.shell.course", "STATE1X");
182  1 assertTrue(clus == null || clus.size() == 0);
183   
184  1 try {
185  1 clus = client.getClusByLuType(null, "STATE1");
186  0 assertTrue(false);
187    } catch (MissingParameterException e) {
188  1 assertTrue(true);
189    }
190   
191  1 try {
192  1 clus = client.getClusByLuType("luType.shell.course", null);
193  0 assertTrue(false);
194    } catch (MissingParameterException e) {
195  1 assertTrue(true);
196    }
197    }
198   
 
199  1 toggle @Test
200    public void testCluSet() throws DoesNotExistException,
201    InvalidParameterException, MissingParameterException,
202    OperationFailedException, PermissionDeniedException {
203    // getCluSetInfo
204  1 CluSetInfo csi = client.getCluSetInfo("CLUSET-2");
205  1 assertNotNull(csi);
206   
207  1 csi = client.getCluSetInfo("CLUSET-1");
208  1 assertNotNull(csi);
209   
210  1 try {
211  1 csi = client.getCluSetInfo("CLUSETXX-42");
212  0 assertTrue(false);
213    } catch (DoesNotExistException e1) {
214  1 assertTrue(true);
215    }
216   
217  1 try {
218  1 csi = client.getCluSetInfo(null);
219  0 assertTrue(false);
220    } catch (MissingParameterException e) {
221  1 assertTrue(true);
222    }
223   
224    // getCluSetInfoByIdList
225  1 List<String> ids = new ArrayList<String>(1);
226  1 ids.add("CLUSET-2");
227  1 List<CluSetInfo> cluSets = client.getCluSetInfoByIdList(ids);
228  1 assertEquals(1, cluSets.size());
229   
230  1 ids.clear();
231  1 ids.add("CLUSETXXX-42");
232  1 cluSets = client.getCluSetInfoByIdList(ids);
233  1 assertTrue(cluSets == null || cluSets.size() == 0);
234   
235  1 try {
236  1 cluSets = client.getCluSetInfoByIdList(null);
237  0 assertTrue(false);
238    } catch (MissingParameterException e) {
239  1 assertTrue(true);
240    }
241   
242    // getCluIdsFromCluSet
243  1 ids = client.getCluIdsFromCluSet("CLUSET-2");
244  1 assertEquals(2, ids.size());
245  1 assertEquals("CLU-1", ids.get(0));
246   
247  1 try {
248  1 ids = client.getCluIdsFromCluSet("CLUSETXXX-42");
249  0 assertTrue(false);
250    } catch (DoesNotExistException e) {
251  1 assertTrue(true);
252    }
253   
254  1 try {
255  1 ids = client.getCluIdsFromCluSet(null);
256  0 assertTrue(false);
257    } catch (MissingParameterException e) {
258  1 assertTrue(true);
259    }
260   
261    // getAllClusInCluSet
262  1 List<CluInfo> clus = client.getClusFromCluSet("CLUSET-2");
263  1 assertEquals(2, clus.size());
264  1 assertEquals("CLU-1", clus.get(0).getId());
265   
266  1 try {
267  1 clus = client.getClusFromCluSet("CLUSETXXX-42");
268  0 assertTrue(false);
269    } catch (DoesNotExistException e) {
270  1 assertTrue(true);
271    }
272   
273  1 try {
274  1 clus = client.getClusFromCluSet(null);
275  0 assertTrue(false);
276    } catch (MissingParameterException e) {
277  1 assertTrue(true);
278    }
279   
280  1 clus = client.getAllClusInCluSet("CLUSET-4");
281  1 assertEquals(2, clus.size());
282   
283  1 try {
284  1 ids = client.getAllCluIdsInCluSet(null);
285  0 assertTrue(false);
286    } catch (MissingParameterException e) {
287  1 assertTrue(true);
288    }
289   
290  1 clus = client.getAllClusInCluSet("CLUSET-2");
291  1 assertEquals(3, clus.size());
292   
293    // isCluInCluSet
294  1 Boolean inSet = client.isCluInCluSet("CLU-2", "CLUSET-4");
295  1 assertTrue(inSet);
296   
297  1 inSet = client.isCluInCluSet("CLU-3", "CLUSET-4");
298  1 assertTrue(inSet);
299   
300  1 inSet = client.isCluInCluSet("CLUXX-42", "CLUSET-4");
301  1 assertFalse(inSet);
302   
303  1 inSet = client.isCluInCluSet("CLU-2", "CLUSETXX-42");
304  1 assertFalse(inSet);
305   
306  1 try {
307  1 inSet = client.isCluInCluSet(null, "CLUSET-4");
308  0 assertTrue(false);
309    } catch (MissingParameterException e) {
310  1 assertTrue(true);
311    }
312  1 try {
313  1 inSet = client.isCluInCluSet("CLU-2", null);
314  0 assertTrue(false);
315    } catch (MissingParameterException e) {
316  1 assertTrue(true);
317    }
318    }
319   
 
320  1 toggle @Test
321    public void testCluSetCrud() throws AlreadyExistsException,
322    DataValidationErrorException, InvalidParameterException,
323    MissingParameterException, OperationFailedException,
324    PermissionDeniedException, DoesNotExistException, ParseException,
325    VersionMismatchException, UnsupportedActionException,
326    CircularRelationshipException {
327  1 CluSetInfo cluSetInfo = new CluSetInfo();
328   
329  1 RichTextInfo desc = new RichTextInfo();
330  1 desc.setFormatted("<p>Formatted Desc</p>");
331  1 desc.setPlain("plain");
332  1 cluSetInfo.setType("kuali.cluSet.type.CreditCourse");
333  1 cluSetInfo.setState ("draft");
334  1 cluSetInfo.setAdminOrg("uuid-1234");
335  1 cluSetInfo.setDescr(desc);
336  1 cluSetInfo.setEffectiveDate(DF.parse("20080101"));
337  1 cluSetInfo.setExpirationDate(DF.parse("20180101"));
338  1 cluSetInfo.setName("testCluSet1");
339  1 cluSetInfo.getCluIds().add("CLU-1");
340  1 cluSetInfo.getCluIds().add("CLU-2");
341    // cluSetInfo.getCluSetIds().add("CLUSET-1");
342    // cluSetInfo.getCluSetIds().add("CLUSET-2");
343  1 cluSetInfo.getAttributes().put("cluSet1ArrtKey1", "cluSet1ArrtValue1");
344  1 cluSetInfo.getAttributes().put("cluSet1ArrtKey2", "cluSet1ArrtValue2");
345   
346  1 CluSetInfo createdSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", cluSetInfo);
347   
348  1 assertEquals("kuali.cluSet.type.CreditCourse", createdSet1.getType());
349  1 assertEquals("uuid-1234", createdSet1.getAdminOrg());
350  1 assertEquals("<p>Formatted Desc</p>", createdSet1.getDescr().getFormatted());
351  1 assertEquals("plain", createdSet1.getDescr().getPlain());
352  1 assertEquals(DF.parse("20080101"), createdSet1.getEffectiveDate());
353  1 assertEquals(DF.parse("20180101"), createdSet1.getExpirationDate());
354  1 assertEquals("testCluSet1", createdSet1.getName());
355  1 assertEquals("CLU-1", createdSet1.getCluIds().get(0));
356  1 assertEquals("CLU-2", createdSet1.getCluIds().get(1));
357    // assertEquals("CLUSET-1", createdSet1.getCluSetIds().get(0));
358    // assertEquals("CLUSET-2", createdSet1.getCluSetIds().get(1));
359  1 assertEquals("cluSet1ArrtValue1", createdSet1.getAttributes().get("cluSet1ArrtKey1"));
360  1 assertEquals("cluSet1ArrtValue2", createdSet1.getAttributes().get("cluSet1ArrtKey2"));
361  1 assertNotNull(createdSet1.getMetaInfo().getCreateTime());
362  1 assertNotNull(createdSet1.getMetaInfo().getUpdateTime());
363  1 assertNotNull(createdSet1.getId());
364   
365  1 createdSet1.setAdminOrg("uuid-1234-5678");
366  1 createdSet1.getDescr().setFormatted("UP<p>Formatted Desc</p>");
367  1 createdSet1.getDescr().setPlain("UPplain");
368  1 createdSet1.setEffectiveDate(DF.parse("20090101"));
369  1 createdSet1.setExpirationDate(DF.parse("20190101"));
370  1 createdSet1.setName("UPtestCluSet1");
371  1 createdSet1.getCluIds().remove(1);
372  1 createdSet1.getCluIds().add("CLU-3");
373    // createdSet1.getCluSetIds().remove(1);
374    // createdSet1.getCluSetIds().add("CLUSET-3");
375  1 createdSet1.getAttributes().put("cluSet1ArrtKey1", "UPcluSet1ArrtValue1");
376  1 createdSet1.getAttributes().remove("cluSet1ArrtKey2");
377  1 createdSet1.getAttributes().put("cluSet1ArrtKey3", "cluSet1ArrtValue3");
378   
379  1 CluSetInfo updatedSet1 = client.updateCluSet(createdSet1.getId(), createdSet1);
380   
381  1 assertEquals("uuid-1234-5678", updatedSet1.getAdminOrg());
382  1 assertEquals("UP<p>Formatted Desc</p>", updatedSet1.getDescr().getFormatted());
383  1 assertEquals("UPplain", updatedSet1.getDescr().getPlain());
384  1 assertEquals(DF.parse("20090101"), updatedSet1.getEffectiveDate());
385  1 assertEquals(DF.parse("20190101"), updatedSet1.getExpirationDate());
386  1 assertEquals("UPtestCluSet1", updatedSet1.getName());
387  1 assertEquals("CLU-1", updatedSet1.getCluIds().get(0));
388  1 assertEquals("CLU-3", updatedSet1.getCluIds().get(1));
389  1 assertEquals(2, updatedSet1.getCluIds().size());
390    // assertEquals("CLUSET-1", updatedSet1.getCluSetIds().get(0));
391    // assertEquals("CLUSET-3", updatedSet1.getCluSetIds().get(1));
392    // assertEquals(2, updatedSet1.getCluSetIds().size());
393  1 assertEquals("UPcluSet1ArrtValue1", updatedSet1.getAttributes().get(
394    "cluSet1ArrtKey1"));
395  1 assertEquals("cluSet1ArrtValue3", updatedSet1.getAttributes().get(
396    "cluSet1ArrtKey3"));
397  1 assertEquals(2, updatedSet1.getAttributes().size());
398  1 assertNotNull(updatedSet1.getMetaInfo().getUpdateTime());
399    }
400   
 
401  1 toggle @Test
402    public void testRemoveCluFromCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
403  1 CluSetInfo createCluSet = createCluSetInfo();
404  1 createCluSet.getCluIds().add("CLU-1");
405  1 createCluSet.getCluIds().add("CLU-2");
406  1 createCluSet.getCluIds().add("CLU-3");
407   
408  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSet);
409  1 assertEquals(3, createdCluSet1.getCluIds().size());
410   
411  1 StatusInfo status = client.removeCluFromCluSet("CLU-2", createdCluSet1.getId());
412  1 assertTrue(status.getSuccess());
413   
414  1 createdCluSet1 = client.getCluSetInfo(createdCluSet1.getId());
415   
416  1 assertEquals(2, createdCluSet1.getCluIds().size());
417  1 assertTrue(createdCluSet1.getCluIds().contains("CLU-1"));
418  1 assertFalse(createdCluSet1.getCluIds().contains("CLU-2"));
419  1 assertTrue(createdCluSet1.getCluIds().contains("CLU-3"));
420    }
421   
 
422  1 toggle @Test
423    public void testRemoveCluSetFromCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
424  1 CluSetInfo createCluSet = createCluSetInfo();
425  1 createCluSet.getCluSetIds().add("CLUSET-1");
426  1 createCluSet.getCluSetIds().add("CLUSET-2");
427  1 createCluSet.getCluSetIds().add("CLUSET-3");
428   
429  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSet);
430  1 assertEquals(3, createdCluSet1.getCluSetIds().size());
431   
432  1 StatusInfo status = client.removeCluSetFromCluSet(createdCluSet1.getId(), "CLUSET-2");
433  1 assertTrue(status.getSuccess());
434   
435  1 createdCluSet1 = client.getCluSetInfo(createdCluSet1.getId());
436   
437  1 assertEquals(2, createdCluSet1.getCluSetIds().size());
438  1 assertTrue(createdCluSet1.getCluSetIds().contains("CLUSET-1"));
439  1 assertFalse(createdCluSet1.getCluSetIds().contains("CLUSET-2"));
440  1 assertTrue(createdCluSet1.getCluSetIds().contains("CLUSET-3"));
441    }
442   
 
443  1 toggle @Test
444    public void testDeleteCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
445  1 CluSetInfo createCluSet = createCluSetInfo();
446   
447  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSet);
448   
449  1 StatusInfo status = client.deleteCluSet(createdCluSet1.getId());
450  1 assertTrue(status.getSuccess());
451   
452  1 try {
453  1 client.getCluSetInfo(createdCluSet1.getId());
454  0 fail("Should have thrown DoesNotExistException");
455    } catch (DoesNotExistException e) {
456  1 assertTrue(true);
457    }
458    }
459   
 
460  1 toggle @Test
461    public void testCluCluRelation() throws ParseException,
462    AlreadyExistsException, DataValidationErrorException,
463    DoesNotExistException, InvalidParameterException,
464    MissingParameterException, OperationFailedException,
465    PermissionDeniedException, VersionMismatchException,
466    DependentObjectsExistException {
467  1 List<CluCluRelationInfo> ccrs = client.getCluCluRelationsByClu("CLU-1");
468  1 assertNotNull(ccrs);
469  1 assertEquals(2, ccrs.size());
470   
471  1 ccrs = client.getCluCluRelationsByClu("CLUXX-42");
472  1 assertTrue(ccrs == null || ccrs.size() == 0);
473   
474  1 try {
475  1 ccrs = client.getCluCluRelationsByClu(null);
476  0 assertTrue(false);
477    } catch (MissingParameterException e) {
478  1 assertTrue(true);
479    }
480   
481    }
482   
 
483  1 toggle @Test
484    public void testCluCrud() throws ParseException, AlreadyExistsException,
485    DataValidationErrorException, DoesNotExistException,
486    InvalidParameterException, MissingParameterException,
487    OperationFailedException, PermissionDeniedException,
488    VersionMismatchException, DependentObjectsExistException {
489   
490  1 CluInfo clu = createCluInfo();
491   
492  1 clu.getOfficialIdentifier().setCode("offId-divisionoffId-suffixcode");
493  1 clu.getOfficialIdentifier().getAttributes().put("OfficialIdentKey", "OfficialIdentValue");
494   
495  1 clu.getAlternateIdentifiers().get(0).setCode("cluId1-divisioncluId1-suffixcode");
496  1 clu.getAlternateIdentifiers().get(0).getAttributes().put("AltIdentKey", "AltIdentValue");
497  1 clu.getAlternateIdentifiers().get(1).setCode("cluId2-divisioncluId2-suffixcode");
498  1 clu.getAlternateIdentifiers().get(1).getAttributes().put("AltIdentKey", "AltIdentValue");
499   
500   
501    // Do the actual create call
502  1 CluInfo createdClu = client.createClu("luType.shell.course", clu);
503  1 createdClu = client.getClu(createdClu.getId());
504    // Validate Results
505  1 assertNotNull(createdClu);
506   
507  1 assertEquals("AccountingAttrValue1", createdClu.getAccountingInfo()
508    .getAttributes().get("AccountingAttrKey1"));
509  1 assertEquals("AccountingAttrValue2", createdClu.getAccountingInfo()
510    .getAttributes().get("AccountingAttrKey2"));
511   
512  1 assertEquals("offId-divisionoffId-suffixcode", createdClu
513    .getOfficialIdentifier().getCode());
514  1 assertEquals("offId-division", createdClu.getOfficialIdentifier()
515    .getDivision());
516  1 assertEquals("offId-level", createdClu.getOfficialIdentifier()
517    .getLevel());
518  1 assertEquals("offId-longName", createdClu.getOfficialIdentifier()
519    .getLongName());
520  1 assertEquals("offId-shortName", createdClu.getOfficialIdentifier()
521    .getShortName());
522  1 assertEquals("offId-state", createdClu.getOfficialIdentifier()
523    .getState());
524  1 assertEquals("offId-type", createdClu.getOfficialIdentifier().getType());
525  1 assertEquals("offId-variation", createdClu.getOfficialIdentifier()
526    .getVariation());
527  1 assertEquals("offId-suffixcode", createdClu.getOfficialIdentifier()
528    .getSuffixCode());
529  1 assertEquals("offId-orgid", createdClu.getOfficialIdentifier()
530    .getOrgId());
531  1 assertEquals("OfficialIdentValue", createdClu.getOfficialIdentifier().getAttributes().get("OfficialIdentKey"));
532   
533   
534  1 assertEquals("cluId1-divisioncluId1-suffixcode", createdClu
535    .getAlternateIdentifiers().get(0).getCode());
536  1 assertEquals("cluId1-division", createdClu.getAlternateIdentifiers()
537    .get(0).getDivision());
538  1 assertEquals("cluId1-level", createdClu.getAlternateIdentifiers()
539    .get(0).getLevel());
540  1 assertEquals("cluId1-longName", createdClu.getAlternateIdentifiers()
541    .get(0).getLongName());
542  1 assertEquals("cluId1-shortName", createdClu.getAlternateIdentifiers()
543    .get(0).getShortName());
544  1 assertEquals("cluId1-state", createdClu.getAlternateIdentifiers()
545    .get(0).getState());
546  1 assertEquals("cluId1-type", createdClu.getAlternateIdentifiers().get(0)
547    .getType());
548  1 assertEquals("cluId1-variation", createdClu.getAlternateIdentifiers()
549    .get(0).getVariation());
550  1 assertEquals("cluId1-suffixcode", createdClu.getAlternateIdentifiers()
551    .get(0).getSuffixCode());
552  1 assertEquals("cluId1-orgid", createdClu.getAlternateIdentifiers()
553    .get(0).getOrgId());
554  1 assertEquals("AltIdentValue", createdClu.getAlternateIdentifiers().get(0).getAttributes().get("AltIdentKey"));
555   
556   
557  1 assertEquals("cluId2-divisioncluId2-suffixcode", createdClu
558    .getAlternateIdentifiers().get(1).getCode());
559  1 assertEquals("cluId2-division", createdClu.getAlternateIdentifiers()
560    .get(1).getDivision());
561  1 assertEquals("cluId2-level", createdClu.getAlternateIdentifiers()
562    .get(1).getLevel());
563  1 assertEquals("cluId2-longName", createdClu.getAlternateIdentifiers()
564    .get(1).getLongName());
565  1 assertEquals("cluId2-shortName", createdClu.getAlternateIdentifiers()
566    .get(1).getShortName());
567  1 assertEquals("cluId2-state", createdClu.getAlternateIdentifiers()
568    .get(1).getState());
569  1 assertEquals("cluId2-type", createdClu.getAlternateIdentifiers().get(1)
570    .getType());
571  1 assertEquals("cluId2-variation", createdClu.getAlternateIdentifiers()
572    .get(1).getVariation());
573  1 assertEquals("cluId2-suffixcode", createdClu.getAlternateIdentifiers()
574    .get(1).getSuffixCode());
575  1 assertEquals("cluId2-orgid", createdClu.getAlternateIdentifiers()
576    .get(1).getOrgId());
577  1 assertEquals("AltIdentValue", createdClu.getAlternateIdentifiers().get(1).getAttributes().get("AltIdentKey"));
578   
579  1 assertEquals("cluAttrValue1", createdClu.getAttributes().get(
580    "cluAttrKey1"));
581  1 assertEquals("cluAttrValue2", createdClu.getAttributes().get(
582    "cluAttrKey2"));
583   
584  1 assertTrue(createdClu.isCanCreateLui());
585   
586  1 assertEquals(545, createdClu.getDefaultEnrollmentEstimate());
587  1 assertEquals(999, createdClu.getDefaultMaximumEnrollment());
588   
589  1 assertEquals("<p>DESC FORMATTED</p>", createdClu.getDescr()
590    .getFormatted());
591  1 assertEquals("DESC PLAIN", createdClu.getDescr().getPlain());
592   
593  1 assertEquals(DF.parse("20100203"), createdClu.getEffectiveDate());
594  1 assertEquals(DF.parse("21001231"), createdClu.getExpirationDate());
595   
596  1 assertTrue(createdClu.isEnrollable());
597   
598  1 assertEquals("FeeAttrValue1", createdClu.getFeeInfo().getAttributes()
599    .get("FeeAttrKey1"));
600  1 assertEquals("FeeAttrValue2", createdClu.getFeeInfo().getAttributes()
601    .get("FeeAttrKey2"));
602   
603  1 assertEquals("Clu Fee", createdClu.getFeeInfo().getDescr().getPlain());
604  1 assertEquals(2, createdClu.getFeeInfo().getCluFeeRecords().size());
605  1 assertEquals("FEE-TYPE-X", createdClu.getFeeInfo().getCluFeeRecords().get(0).getFeeType());
606  1 assertEquals("RATE-TYPE-X", createdClu.getFeeInfo().getCluFeeRecords().get(0).getRateType());
607  1 assertEquals("Clu Fee Record", createdClu.getFeeInfo().getCluFeeRecords().get(0).getDescr().getPlain());
608  1 assertEquals(3, createdClu.getFeeInfo().getCluFeeRecords().get(0).getFeeAmounts().size());
609  1 assertEquals(Integer.valueOf(200), createdClu.getFeeInfo().getCluFeeRecords().get(0).getFeeAmounts().get(0).getCurrencyQuantity());
610  1 assertEquals(0, createdClu.getFeeInfo().getCluFeeRecords().get(1).getFeeAmounts().size());
611   
612  1 assertEquals(2, createdClu.getFeeInfo().getCluFeeRecords().get(0).getAffiliatedOrgs().size());
613  1 assertEquals(35l, (long)createdClu.getFeeInfo().getCluFeeRecords().get(0).getAffiliatedOrgs().get(0).getPercentage());
614   
615  1 assertTrue(createdClu.isHasEarlyDropDeadline());
616  1 assertTrue(createdClu.isHazardousForDisabledStudents());
617   
618  1 assertEquals("EXT-orgId-1", createdClu.getPrimaryInstructor()
619    .getOrgId());
620  1 assertEquals("EXT-personId-1", createdClu.getPrimaryInstructor()
621    .getPersonId());
622  1 assertEquals("PrimaryInstAttrValue1", createdClu.getPrimaryInstructor()
623    .getAttributes().get("PrimaryInstAttrKey1"));
624  1 assertEquals("PrimaryInstAttrValue2", createdClu.getPrimaryInstructor()
625    .getAttributes().get("PrimaryInstAttrKey2"));
626   
627  1 assertEquals("EXT-orgId-2", createdClu.getInstructors().get(0)
628    .getOrgId());
629  1 assertEquals("EXT-personId-2", createdClu.getInstructors().get(0)
630    .getPersonId());
631  1 assertEquals("Inst1AttrValue1", createdClu.getInstructors().get(0)
632    .getAttributes().get("Inst1AttrKey1"));
633  1 assertEquals("Inst1AttrValue2", createdClu.getInstructors().get(0)
634    .getAttributes().get("Inst1AttrKey2"));
635   
636  1 assertEquals("EXT-orgId-3", createdClu.getInstructors().get(1)
637    .getOrgId());
638  1 assertEquals("EXT-personId-3", createdClu.getInstructors().get(1)
639    .getPersonId());
640  1 assertEquals("Inst2AttrValue1", createdClu.getInstructors().get(1)
641    .getAttributes().get("Inst2AttrKey1"));
642  1 assertEquals("Inst2AttrValue2", createdClu.getInstructors().get(1)
643    .getAttributes().get("Inst2AttrKey2"));
644   
645  1 assertEquals("luCode1.key", createdClu.getLuCodes().get(0).getId());
646  1 assertEquals("luCode1-desc", createdClu.getLuCodes().get(0).getDescr());
647  1 assertEquals("luCode1-value", createdClu.getLuCodes().get(0).getValue());
648  1 assertEquals("luCode1AttrValue1", createdClu.getLuCodes().get(0)
649    .getAttributes().get("luCode1AttrKey1"));
650  1 assertEquals("luCode1AttrValue2", createdClu.getLuCodes().get(0)
651    .getAttributes().get("luCode1AttrKey2"));
652  1 assertNotNull(createdClu.getLuCodes().get(0).getMetaInfo());
653  1 assertNotNull(createdClu.getLuCodes().get(0).getMetaInfo()
654    .getVersionInd());
655  1 assertNotNull(createdClu.getLuCodes().get(0).getMetaInfo()
656    .getCreateTime());
657   
658  1 assertEquals("luCode2.key", createdClu.getLuCodes().get(1).getId());
659  1 assertEquals("luCode2-desc", createdClu.getLuCodes().get(1).getDescr());
660  1 assertEquals("luCode2-value", createdClu.getLuCodes().get(1).getValue());
661  1 assertEquals("luCode2AttrValue1", createdClu.getLuCodes().get(1)
662    .getAttributes().get("luCode2AttrKey1"));
663  1 assertEquals("luCode2AttrValue2", createdClu.getLuCodes().get(1)
664    .getAttributes().get("luCode2AttrKey2"));
665  1 assertNotNull(createdClu.getLuCodes().get(1).getMetaInfo());
666  1 assertNotNull(createdClu.getLuCodes().get(1).getMetaInfo()
667    .getVersionInd());
668  1 assertNotNull(createdClu.getLuCodes().get(1).getMetaInfo()
669    .getCreateTime());
670   
671   
672  1 assertEquals("nextReviewPeriod", createdClu.getNextReviewPeriod());
673   
674  1 assertEquals("offeredAtpType1", createdClu.getOfferedAtpTypes().get(0));
675  1 assertEquals("offeredAtpType2", createdClu.getOfferedAtpTypes().get(1));
676   
677   
678  1 assertEquals("http://student.kuali.org/clus", createdClu
679    .getReferenceURL());
680   
681  1 assertEquals("Clu-state", createdClu.getState());
682   
683  1 assertEquals("EXT-stdDuration-Id1", createdClu.getStdDuration()
684    .getAtpDurationTypeKey());
685  1 assertEquals(Integer.valueOf(7867), createdClu.getStdDuration()
686    .getTimeQuantity());
687   
688  1 assertEquals("luType.shell.course", createdClu.getType());
689   
690  1 assertNotNull(createdClu.getMetaInfo());
691  1 assertNotNull(createdClu.getMetaInfo().getVersionInd());
692  1 assertNotNull(createdClu.getMetaInfo().getCreateTime());
693   
694  1 assertNotNull(createdClu.getId());
695   
696  1 checkCampusLocationCreate(createdClu);
697   
698  1 checkIntensityCreate(createdClu);
699   
700  1 checkAccreditationListCreate(createdClu);
701   
702  1 checkAdminOrgsCreate(createdClu);
703   
704    // Now Update the Clu!
705  1 createdClu.getAccountingInfo().getAttributes().put(
706    "AccountingAttrKey1", "AccountingAttrValue1");
707  1 createdClu.getAccountingInfo().getAttributes().remove(
708    "AccountingAttrKey2");
709  1 createdClu.getAccountingInfo().getAttributes().put(
710    "AccountingAttrKey3", "AccountingAttrValue3");
711   
712  1 createdClu.getOfficialIdentifier().setCode("UPoffId-code");
713  1 createdClu.getOfficialIdentifier().setDivision("UPoffId-division");
714  1 createdClu.getOfficialIdentifier().setLevel("UPoffId-level");
715  1 createdClu.getOfficialIdentifier().setSuffixCode("UPoffId-suffixcode");
716  1 createdClu.getOfficialIdentifier().setLongName("UPoffId-longName");
717  1 createdClu.getOfficialIdentifier().setShortName("UPoffId-shortName");
718  1 createdClu.getOfficialIdentifier().setState("UPoffId-state");
719  1 createdClu.getOfficialIdentifier().setType("UPoffId-type");
720  1 createdClu.getOfficialIdentifier().setVariation("UPoffId-variation");
721  1 createdClu.getOfficialIdentifier().getAttributes().put("OfficialIdentKeyUptd", "OfficialIdentValueUptd");
722   
723   
724  1 createdClu.getAlternateIdentifiers().get(0).setCode("UPcluId1-code");
725  1 createdClu.getAlternateIdentifiers().get(0).setDivision(
726    "UPcluId1-division");
727  1 createdClu.getAlternateIdentifiers().get(0).setLevel("UPcluId1-level");
728  1 createdClu.getAlternateIdentifiers().get(0).setSuffixCode(
729    "UPcluId1-suffixcode");
730  1 createdClu.getAlternateIdentifiers().get(0).setLongName(
731    "UPcluId1-longName");
732  1 createdClu.getAlternateIdentifiers().get(0).setShortName(
733    "UPcluId1-shortName");
734  1 createdClu.getAlternateIdentifiers().get(0).setState("UPcluId1-state");
735  1 createdClu.getAlternateIdentifiers().get(0).setType("UPcluId1-type");
736  1 createdClu.getAlternateIdentifiers().get(0).setVariation(
737    "UPcluId1-variation");
738  1 createdClu.getAlternateIdentifiers().get(0).getAttributes().put("AltIdentKeyUptd", "AltIdentValueUptd");
739   
740  1 createdClu.getAlternateIdentifiers().remove(1);
741   
742  1 CluIdentifierInfo cluId3 = new CluIdentifierInfo();
743  1 cluId3.setCode("cluId3-code");
744  1 cluId3.setDivision("cluId3-division");
745  1 cluId3.setSuffixCode("cluId3-suffixcode");
746  1 cluId3.setLevel("cluId3-level");
747  1 cluId3.setLongName("cluId3-longName");
748  1 cluId3.setShortName("cluId3-shortName");
749  1 cluId3.setState("cluId3-state");
750  1 cluId3.setType("cluId3-type");
751  1 cluId3.setVariation("cluId3-variation");
752   
753   
754  1 createdClu.getAlternateIdentifiers().add(cluId3);
755   
756  1 createdClu.getAttributes().put("cluAttrKey1", "cluAttrValue1");
757  1 createdClu.getAttributes().remove("cluAttrKey2");
758  1 createdClu.getAttributes().put("cluAttrKey3", "cluAttrValue3");
759   
760  1 createdClu.setCanCreateLui(false);
761   
762  1 createdClu.setDefaultEnrollmentEstimate(9545);
763  1 createdClu.setDefaultMaximumEnrollment(9999);
764   
765  1 createdClu.getDescr().setFormatted("UP<p>DESC FORMATTED</p>");
766  1 createdClu.getDescr().setPlain("UPDESC PLAIN");
767   
768  1 createdClu.setEffectiveDate(DF.parse("20190203"));
769  1 createdClu.setExpirationDate(DF.parse("21091231"));
770   
771  1 createdClu.setEnrollable(false);
772   
773  1 createdClu.getFeeInfo().getAttributes().put("FeeAttrKey1",
774    "FeeAttrValue1");
775  1 createdClu.getFeeInfo().getAttributes().remove("FeeAttrKey2");
776  1 createdClu.getFeeInfo().getAttributes().put("FeeAttrKey3",
777    "FeeAttrValue3");
778   
779  1 createdClu.getFeeInfo().getCluFeeRecords().get(0).getAffiliatedOrgs().remove(0);
780  1 createdClu.getFeeInfo().getCluFeeRecords().get(1).setFeeType("FEE-TYPE-Z");
781   
782  1 createdClu.setHasEarlyDropDeadline(false);
783   
784  1 createdClu.setHazardousForDisabledStudents(false);
785   
786  1 createdClu.getPrimaryInstructor().setOrgId("UPEXT-orgId-1");
787  1 createdClu.getPrimaryInstructor().setPersonId("UPEXT-personId-1");
788  1 createdClu.getPrimaryInstructor().getAttributes().put(
789    "PrimaryInstAttrKey1", "PrimaryInstAttrValue1");
790  1 createdClu.getPrimaryInstructor().getAttributes().remove(
791    "PrimaryInstAttrKey2");
792  1 createdClu.getPrimaryInstructor().getAttributes().put(
793    "PrimaryInstAttrKey3", "PrimaryInstAttrValue3");
794   
795  1 createdClu.getInstructors().get(0).setOrgId("UPEXT-orgId-2");
796  1 createdClu.getInstructors().get(0).setPersonId("UPEXT-personId-2");
797  1 createdClu.getInstructors().get(0).getAttributes().put("Inst1AttrKey1",
798    "Inst1AttrValue1");
799  1 createdClu.getInstructors().get(0).getAttributes().remove(
800    "Inst1AttrKey2");
801  1 createdClu.getInstructors().get(0).getAttributes().put("Inst1AttrKey3",
802    "Inst1AttrValue3");
803   
804  1 createdClu.getInstructors().remove(1);
805   
806  1 CluInstructorInfo instructor3 = new CluInstructorInfo();
807  1 instructor3.setOrgId("EXT-orgId-3");
808  1 instructor3.setPersonId("EXT-personId-3");
809  1 instructor3.getAttributes().put("Inst3AttrKey1", "Inst3AttrValue1");
810  1 instructor3.getAttributes().put("Inst3AttrKey2", "Inst3AttrValue2");
811  1 createdClu.getInstructors().add(instructor3);
812   
813  1 createdClu.getLuCodes().get(0).setDescr("UPluCode1-desc");
814  1 createdClu.getLuCodes().get(0).setValue("UPluCode1-value");
815  1 createdClu.getLuCodes().get(0).getAttributes().put("luCode1AttrKey1",
816    "luCode1AttrValue1");
817  1 createdClu.getLuCodes().get(0).getAttributes()
818    .remove("luCode1AttrKey2");
819  1 createdClu.getLuCodes().get(0).getAttributes().put("luCode1AttrKey3",
820    "luCode1AttrValue3");
821  1 createdClu.getLuCodes().get(0).setType("updatedType");
822   
823  1 createdClu.getLuCodes().remove(1);
824   
825  1 LuCodeInfo luCode3 = new LuCodeInfo();
826  1 luCode3.setId("luCode3.key");
827  1 luCode3.setDescr("luCode3-desc");
828  1 luCode3.setValue("luCode3-value");
829  1 luCode3.getAttributes().put("luCode3AttrKey1", "luCode3AttrValue1");
830  1 luCode3.getAttributes().put("luCode3AttrKey2", "luCode3AttrValue2");
831  1 luCode3.setType("updatedType");
832  1 createdClu.getLuCodes().add(luCode3);
833   
834   
835  1 createdClu.setNextReviewPeriod("UPnextReviewPeriod");
836   
837  1 createdClu.getOfferedAtpTypes().remove(1);
838  1 createdClu.getOfferedAtpTypes().add("offeredAtpType3");
839   
840   
841  1 CluInstructorInfo pubInstructor3 = new CluInstructorInfo();
842  1 pubInstructor3.setOrgId("EXT-orgId-3");
843  1 pubInstructor3.setPersonId("EXT-personId-3");
844  1 pubInstructor3.getAttributes().put("PubInst3AttrKey1",
845    "PubInst3AttrValue1");
846  1 pubInstructor3.getAttributes().put("PubInst3AttrKey2",
847    "PubInst3AttrValue2");
848   
849  1 createdClu.setReferenceURL("UPhttp://student.kuali.org/clus");
850   
851  1 createdClu.setState("UPClu-state");
852   
853  1 createdClu.getStdDuration().setAtpDurationTypeKey(
854    "UPEXT-stdDuration-Id1");
855  1 createdClu.getStdDuration().setTimeQuantity(new Integer(97867));
856   
857  1 createdClu.setType("luType.shell.program");
858   
859  1 updateAdminOrgs(createdClu);
860   
861  1 updateAccreditationList(createdClu);
862   
863  1 updateIntensity(createdClu);
864   
865  1 updateCampusLocationList(createdClu);
866   
867    // Do Update
868  1 CluInfo updatedClu = client.updateClu(createdClu.getId(), createdClu);
869   
870    // Validate Results
871  1 assertNotNull(updatedClu);
872   
873  1 assertEquals("AccountingAttrValue1", updatedClu.getAccountingInfo()
874    .getAttributes().get("AccountingAttrKey1"));
875  1 assertEquals("AccountingAttrValue3", updatedClu.getAccountingInfo()
876    .getAttributes().get("AccountingAttrKey3"));
877  1 assertEquals(2, updatedClu.getAccountingInfo().getAttributes().size());
878   
879  1 assertEquals("UPoffId-code", updatedClu
880    .getOfficialIdentifier().getCode());
881  1 assertEquals("UPoffId-division", updatedClu.getOfficialIdentifier()
882    .getDivision());
883  1 assertEquals("UPoffId-level", updatedClu.getOfficialIdentifier()
884    .getLevel());
885  1 assertEquals("UPoffId-suffixcode", updatedClu.getOfficialIdentifier()
886    .getSuffixCode());
887  1 assertEquals("UPoffId-longName", updatedClu.getOfficialIdentifier()
888    .getLongName());
889  1 assertEquals("UPoffId-shortName", updatedClu.getOfficialIdentifier()
890    .getShortName());
891  1 assertEquals("UPoffId-state", updatedClu.getOfficialIdentifier()
892    .getState());
893  1 assertEquals("UPoffId-type", updatedClu.getOfficialIdentifier()
894    .getType());
895  1 assertEquals("UPoffId-variation", updatedClu.getOfficialIdentifier()
896    .getVariation());
897  1 assertEquals(2, updatedClu.getOfficialIdentifier().getAttributes().size());
898  1 assertEquals("OfficialIdentValueUptd", updatedClu.getOfficialIdentifier().getAttributes().get("OfficialIdentKeyUptd"));
899   
900   
901  1 assertEquals("UPcluId1-code", updatedClu
902    .getAlternateIdentifiers().get(0).getCode());
903  1 assertEquals("UPcluId1-division", updatedClu.getAlternateIdentifiers()
904    .get(0).getDivision());
905  1 assertEquals("UPcluId1-level", updatedClu.getAlternateIdentifiers()
906    .get(0).getLevel());
907  1 assertEquals("UPcluId1-suffixcode", updatedClu
908    .getAlternateIdentifiers().get(0).getSuffixCode());
909  1 assertEquals("UPcluId1-longName", updatedClu.getAlternateIdentifiers()
910    .get(0).getLongName());
911  1 assertEquals("UPcluId1-shortName", updatedClu.getAlternateIdentifiers()
912    .get(0).getShortName());
913  1 assertEquals("UPcluId1-state", updatedClu.getAlternateIdentifiers()
914    .get(0).getState());
915  1 assertEquals("UPcluId1-type", updatedClu.getAlternateIdentifiers().get(
916    0).getType());
917  1 assertEquals("UPcluId1-variation", updatedClu.getAlternateIdentifiers()
918    .get(0).getVariation());
919  1 assertEquals(2, updatedClu.getAlternateIdentifiers().get(0).getAttributes().size());
920  1 assertEquals("AltIdentValueUptd", createdClu.getAlternateIdentifiers().get(0).getAttributes().get("AltIdentKeyUptd"));
921   
922  1 assertEquals("cluId3-code", updatedClu
923    .getAlternateIdentifiers().get(1).getCode());
924  1 assertEquals("cluId3-division", updatedClu.getAlternateIdentifiers()
925    .get(1).getDivision());
926  1 assertEquals("cluId3-level", updatedClu.getAlternateIdentifiers()
927    .get(1).getLevel());
928  1 assertEquals("cluId3-suffixcode", updatedClu.getAlternateIdentifiers()
929    .get(1).getSuffixCode());
930  1 assertEquals("cluId3-longName", updatedClu.getAlternateIdentifiers()
931    .get(1).getLongName());
932  1 assertEquals("cluId3-shortName", updatedClu.getAlternateIdentifiers()
933    .get(1).getShortName());
934  1 assertEquals("cluId3-state", updatedClu.getAlternateIdentifiers()
935    .get(1).getState());
936  1 assertEquals("cluId3-type", updatedClu.getAlternateIdentifiers().get(1)
937    .getType());
938  1 assertEquals("cluId3-variation", updatedClu.getAlternateIdentifiers()
939    .get(1).getVariation());
940   
941  1 assertEquals(2, updatedClu.getAlternateIdentifiers().size());
942   
943  1 assertEquals("cluAttrValue1", updatedClu.getAttributes().get(
944    "cluAttrKey1"));
945  1 assertEquals("cluAttrValue3", updatedClu.getAttributes().get(
946    "cluAttrKey3"));
947  1 assertEquals(2, updatedClu.getAttributes().size());
948   
949  1 assertFalse(updatedClu.isCanCreateLui());
950   
951  1 assertEquals(9545, updatedClu.getDefaultEnrollmentEstimate());
952  1 assertEquals(9999, updatedClu.getDefaultMaximumEnrollment());
953   
954  1 assertEquals("UP<p>DESC FORMATTED</p>", updatedClu.getDescr()
955    .getFormatted());
956  1 assertEquals("UPDESC PLAIN", updatedClu.getDescr().getPlain());
957   
958  1 assertEquals(DF.parse("20190203"), updatedClu.getEffectiveDate());
959  1 assertEquals(DF.parse("21091231"), updatedClu.getExpirationDate());
960   
961  1 assertFalse(updatedClu.isEnrollable());
962   
963  1 assertEquals("FeeAttrValue1", updatedClu.getFeeInfo().getAttributes()
964    .get("FeeAttrKey1"));
965  1 assertEquals("FeeAttrValue3", updatedClu.getFeeInfo().getAttributes()
966    .get("FeeAttrKey3"));
967  1 assertEquals(2, updatedClu.getFeeInfo().getAttributes().size());
968   
969  1 assertEquals(2, createdClu.getFeeInfo().getCluFeeRecords().size());
970  1 assertEquals("FEE-TYPE-Z", createdClu.getFeeInfo().getCluFeeRecords().get(1).getFeeType());
971   
972  1 assertEquals(1, createdClu.getFeeInfo().getCluFeeRecords().get(0).getAffiliatedOrgs().size());
973  1 assertEquals(65l, (long)createdClu.getFeeInfo().getCluFeeRecords().get(0).getAffiliatedOrgs().get(0).getPercentage());
974   
975  1 assertFalse(updatedClu.isHasEarlyDropDeadline());
976  1 assertFalse(updatedClu.isHazardousForDisabledStudents());
977   
978  1 assertEquals("UPEXT-orgId-1", updatedClu.getPrimaryInstructor()
979    .getOrgId());
980  1 assertEquals("UPEXT-personId-1", updatedClu.getPrimaryInstructor()
981    .getPersonId());
982  1 assertEquals("PrimaryInstAttrValue1", updatedClu.getPrimaryInstructor()
983    .getAttributes().get("PrimaryInstAttrKey1"));
984  1 assertEquals("PrimaryInstAttrValue3", updatedClu.getPrimaryInstructor()
985    .getAttributes().get("PrimaryInstAttrKey3"));
986  1 assertEquals(2, updatedClu.getPrimaryInstructor().getAttributes()
987    .size());
988   
989  1 assertEquals(2, updatedClu.getInstructors().size());
990   
991  1 assertEquals("UPEXT-orgId-2", updatedClu.getInstructors().get(0)
992    .getOrgId());
993  1 assertEquals("UPEXT-personId-2", updatedClu.getInstructors().get(0)
994    .getPersonId());
995  1 assertEquals("Inst1AttrValue1", updatedClu.getInstructors().get(0)
996    .getAttributes().get("Inst1AttrKey1"));
997  1 assertEquals("Inst1AttrValue3", updatedClu.getInstructors().get(0)
998    .getAttributes().get("Inst1AttrKey3"));
999  1 assertEquals(2, updatedClu.getInstructors().get(0).getAttributes()
1000    .size());
1001   
1002  1 assertEquals("EXT-orgId-3", updatedClu.getInstructors().get(1)
1003    .getOrgId());
1004  1 assertEquals("EXT-personId-3", updatedClu.getInstructors().get(1)
1005    .getPersonId());
1006  1 assertEquals("Inst3AttrValue1", updatedClu.getInstructors().get(1)
1007    .getAttributes().get("Inst3AttrKey1"));
1008  1 assertEquals("Inst3AttrValue2", updatedClu.getInstructors().get(1)
1009    .getAttributes().get("Inst3AttrKey2"));
1010  1 assertEquals(2, updatedClu.getInstructors().get(1).getAttributes()
1011    .size());
1012   
1013  1 assertEquals(2, updatedClu.getLuCodes().size());
1014   
1015  1 assertEquals("luCode1.key", updatedClu.getLuCodes().get(0).getId());
1016  1 assertEquals("UPluCode1-desc", updatedClu.getLuCodes().get(0).getDescr());
1017  1 assertEquals("UPluCode1-value", updatedClu.getLuCodes().get(0)
1018    .getValue());
1019  1 assertEquals("luCode1AttrValue1", updatedClu.getLuCodes().get(0)
1020    .getAttributes().get("luCode1AttrKey1"));
1021  1 assertEquals("luCode1AttrValue3", updatedClu.getLuCodes().get(0)
1022    .getAttributes().get("luCode1AttrKey3"));
1023  1 assertEquals(2, updatedClu.getLuCodes().get(0).getAttributes().size());
1024  1 assertNotNull(updatedClu.getLuCodes().get(0).getMetaInfo());
1025  1 assertNotNull(updatedClu.getLuCodes().get(0).getMetaInfo()
1026    .getVersionInd());
1027  1 assertNotNull(updatedClu.getLuCodes().get(0).getMetaInfo()
1028    .getCreateTime());
1029  1 assertNotNull(updatedClu.getLuCodes().get(0).getMetaInfo()
1030    .getUpdateTime());
1031   
1032  1 assertEquals("luCode3.key", updatedClu.getLuCodes().get(1).getId());
1033  1 assertEquals("luCode3-desc", updatedClu.getLuCodes().get(1).getDescr());
1034  1 assertEquals("luCode3-value", updatedClu.getLuCodes().get(1).getValue());
1035  1 assertEquals("luCode3AttrValue1", updatedClu.getLuCodes().get(1)
1036    .getAttributes().get("luCode3AttrKey1"));
1037  1 assertEquals("luCode3AttrValue2", updatedClu.getLuCodes().get(1)
1038    .getAttributes().get("luCode3AttrKey2"));
1039  1 assertNotNull(updatedClu.getLuCodes().get(1).getMetaInfo());
1040  1 assertNotNull(updatedClu.getLuCodes().get(1).getMetaInfo()
1041    .getVersionInd());
1042  1 assertNotNull(updatedClu.getLuCodes().get(1).getMetaInfo()
1043    .getCreateTime());
1044  1 assertNotNull(updatedClu.getLuCodes().get(1).getMetaInfo()
1045    .getUpdateTime());
1046   
1047  1 assertEquals("UPnextReviewPeriod", updatedClu.getNextReviewPeriod());
1048   
1049  1 assertEquals("offeredAtpType1", updatedClu.getOfferedAtpTypes().get(0));
1050  1 assertEquals("offeredAtpType3", updatedClu.getOfferedAtpTypes().get(1));
1051  1 assertEquals(2, updatedClu.getOfferedAtpTypes().size());
1052   
1053   
1054  1 assertEquals("UPhttp://student.kuali.org/clus", updatedClu
1055    .getReferenceURL());
1056   
1057  1 assertEquals("UPClu-state", updatedClu.getState());
1058   
1059  1 assertEquals("UPEXT-stdDuration-Id1", updatedClu.getStdDuration()
1060    .getAtpDurationTypeKey());
1061  1 assertEquals(Integer.valueOf(97867), updatedClu.getStdDuration()
1062    .getTimeQuantity());
1063   
1064  1 assertEquals("luType.shell.program", updatedClu.getType());
1065   
1066  1 assertEquals(false,updatedClu.isEnrollable());
1067  1 assertEquals(false,updatedClu.isHazardousForDisabledStudents());
1068   
1069  1 assertNotNull(updatedClu.getMetaInfo());
1070  1 assertNotNull(updatedClu.getMetaInfo().getVersionInd());
1071  1 assertNotNull(updatedClu.getMetaInfo().getCreateTime());
1072  1 assertNotNull(updatedClu.getMetaInfo().getUpdateTime());
1073   
1074  1 assertEquals(createdClu.getId(), updatedClu.getId());
1075   
1076  1 checkAdminOrgUpdate(updatedClu);
1077   
1078  1 checkAccreditationListUpdate(updatedClu);
1079   
1080  1 checkCampusLocationUpdate(updatedClu);
1081   
1082  1 checkIntensityUpdate(updatedClu);
1083   
1084    // Test Optimistic locking
1085  1 try {
1086  1 updatedClu = client.updateClu(createdClu.getId(), createdClu);
1087  0 fail("Should have thrown VersionMismatchException");
1088    } catch (VersionMismatchException e) {
1089   
1090    }
1091   
1092    // Test Delete
1093  1 try {
1094  1 client.getClu(createdClu.getId());
1095    } catch (DoesNotExistException e) {
1096  0 fail("Should not have thrown DoesNotExistException");
1097    }
1098   
1099  1 StatusInfo status = client.deleteClu(createdClu.getId());
1100  1 assertTrue(status.getSuccess());
1101   
1102  1 try {
1103  1 client.getClu(createdClu.getId());
1104  0 fail("Should have thrown DoesNotExistException");
1105    } catch (DoesNotExistException e) {
1106   
1107    }
1108   
1109    }
1110   
 
1111  1 toggle @Test
1112    public void testCluCluRelationCrud() throws Exception {
1113   
1114  1 final CluCluRelationInfo cluCluRelationInfo = new CluCluRelationInfo();
1115   
1116  1 final Date effectiveDate = DF.parse("20080101"), expirationDate = DF
1117    .parse("20100101");
1118  1 cluCluRelationInfo.setEffectiveDate(effectiveDate);
1119  1 cluCluRelationInfo.setExpirationDate(expirationDate);
1120  1 cluCluRelationInfo.setIsCluRelationRequired(true);
1121  1 cluCluRelationInfo.setState("hello");
1122  1 cluCluRelationInfo.getAttributes().put("clucluAttrKey1",
1123    "clucluAttrValue1");
1124  1 cluCluRelationInfo.getAttributes().put("clucluAttrKey2",
1125    "clucluAttrValue2");
1126  1 cluCluRelationInfo.getAttributes().put("clucluAttrKey3",
1127    "clucluAttrValue3");
1128   
1129  1 CluCluRelationInfo created = client.createCluCluRelation("CLU-1",
1130    "CLU-2", "luLuType.type1", cluCluRelationInfo);
1131   
1132  1 assertEquals(effectiveDate, created.getEffectiveDate());
1133  1 assertEquals(expirationDate, created.getExpirationDate());
1134  1 assertEquals(true, created.getIsCluRelationRequired());
1135  1 assertEquals("hello", created.getState());
1136  1 assertEquals("CLU-1", created.getCluId());
1137  1 assertEquals("CLU-2", created.getRelatedCluId());
1138  1 assertEquals("luLuType.type1", created.getType());
1139  1 assertEquals("clucluAttrValue1", created.getAttributes().get(
1140    "clucluAttrKey1"));
1141  1 assertEquals("clucluAttrValue2", created.getAttributes().get(
1142    "clucluAttrKey2"));
1143  1 assertEquals("clucluAttrValue3", created.getAttributes().get(
1144    "clucluAttrKey3"));
1145  1 assertNotNull(created.getId());
1146  1 assertNotNull(created.getMetaInfo().getCreateTime());
1147  1 assertNotNull(created.getMetaInfo().getVersionInd());
1148   
1149  1 created.getAttributes().remove("clucluAttrKey2");
1150  1 created.getAttributes().put("clucluAttrKey3", "clucluAttrValue3-A");
1151  1 created.getAttributes().put("clucluAttrKey4", "clucluAttrValue4");
1152  1 created.setCluId("CLU-2");
1153  1 created.setEffectiveDate(expirationDate);
1154  1 created.setExpirationDate(effectiveDate);
1155  1 created.setIsCluRelationRequired(false);
1156  1 created.setRelatedCluId("CLU-3");
1157  1 created.setState("updated hello");
1158  1 created.setType("luLuType.type2");
1159   
1160  1 CluCluRelationInfo updated = client.updateCluCluRelation(created
1161    .getId(), created);
1162   
1163  1 assertEquals(expirationDate, updated.getEffectiveDate());
1164  1 assertEquals(effectiveDate, updated.getExpirationDate());
1165  1 assertEquals(false, updated.getIsCluRelationRequired());
1166  1 assertEquals("updated hello", updated.getState());
1167  1 assertEquals("CLU-2", updated.getCluId());
1168  1 assertEquals("CLU-3", updated.getRelatedCluId());
1169  1 assertEquals("luLuType.type2", updated.getType());
1170  1 assertEquals("clucluAttrValue1", updated.getAttributes().get(
1171    "clucluAttrKey1"));
1172  1 assertNull(updated.getAttributes().get("clucluAttrKey2"));
1173  1 assertEquals("clucluAttrValue3-A", updated.getAttributes().get(
1174    "clucluAttrKey3"));
1175  1 assertEquals("clucluAttrValue4", updated.getAttributes().get(
1176    "clucluAttrKey4"));
1177  1 assertNotNull(created.getId());
1178  1 assertNotNull(created.getMetaInfo().getCreateTime());
1179  1 assertNotNull(created.getMetaInfo().getVersionInd());
1180   
1181    // Test Delete
1182  1 try {
1183  1 client.getCluCluRelation(created.getId());
1184    } catch (DoesNotExistException e) {
1185  0 fail("Should not have thrown DoesNotExistException");
1186    }
1187   
1188  1 StatusInfo status = client.deleteCluCluRelation(created.getId());
1189  1 assertTrue(status.getSuccess());
1190   
1191  1 try {
1192  1 client.getCluCluRelation(created.getId());
1193  0 fail("Should have thrown DoesNotExistException");
1194    } catch (DoesNotExistException e) {
1195   
1196    }
1197   
1198  1 List<String> relatedCluIdsByCluId = client.getRelatedCluIdsByCluId(
1199    "CLU-1", "luLuType.type1");
1200   
1201  1 assertEquals(2, relatedCluIdsByCluId.size());
1202  1 assertTrue(relatedCluIdsByCluId.contains("CLU-2"));
1203  1 assertTrue(relatedCluIdsByCluId.contains("CLU-3"));
1204   
1205  1 List<CluInfo> relatedClusByCluId = client.getRelatedClusByCluId(
1206    "CLU-1", "luLuType.type1");
1207  1 assertEquals(2, relatedClusByCluId.size());
1208    }
1209   
 
1210  1 toggle @Test
1211    public void testLuiLuiRelationCrud() throws Exception {
1212   
1213  1 LuiLuiRelationInfo luiLuiRelationInfo = new LuiLuiRelationInfo();
1214   
1215  1 luiLuiRelationInfo.setEffectiveDate(DF.parse("20080101"));
1216  1 luiLuiRelationInfo.setExpirationDate(DF.parse("20100101"));
1217  1 luiLuiRelationInfo.setState("hello");
1218  1 luiLuiRelationInfo.setType("goodbye");
1219  1 luiLuiRelationInfo.getAttributes().put("luiluiAttrKey1",
1220    "luiluiAttrValue1");
1221  1 luiLuiRelationInfo.getAttributes().put("luiluiAttrKey2",
1222    "luiluiAttrValue2");
1223   
1224  1 LuiLuiRelationInfo created = client.createLuiLuiRelation("LUI-1",
1225    "LUI-2", "luLuType.type1", luiLuiRelationInfo);
1226   
1227  1 assertEquals(DF.parse("20080101"), created.getEffectiveDate());
1228  1 assertEquals(DF.parse("20100101"), created.getExpirationDate());
1229  1 assertEquals("hello", created.getState());
1230  1 assertEquals("luLuType.type1", created.getType());
1231  1 assertEquals("LUI-1", created.getLuiId());
1232  1 assertEquals("LUI-2", created.getRelatedLuiId());
1233  1 assertEquals("luiluiAttrValue1", created.getAttributes().get(
1234    "luiluiAttrKey1"));
1235  1 assertEquals("luiluiAttrValue2", created.getAttributes().get(
1236    "luiluiAttrKey2"));
1237  1 assertNotNull(created.getId());
1238  1 assertNotNull(created.getMetaInfo().getCreateTime());
1239  1 assertNotNull(created.getMetaInfo().getVersionInd());
1240   
1241  1 created.setEffectiveDate(DF.parse("20980101"));
1242  1 created.setExpirationDate(DF.parse("20190101"));
1243  1 created.setState("sawyer");
1244  1 created.setType("luLuType.type2");
1245  1 created.setLuiId("LUI-2");
1246  1 created.setRelatedLuiId("LUI-3");
1247  1 created.getAttributes().put("luiluiAttrKey1", "UPluiluiAttrValue1");
1248  1 created.getAttributes().remove("luiluiAttrKey2");
1249  1 created.getAttributes().put("luiluiAttrKey3", "luiluiAttrValue3");
1250   
1251  1 LuiLuiRelationInfo updated = client.updateLuiLuiRelation(created
1252    .getId(), created);
1253   
1254  1 assertEquals(DF.parse("20980101"), updated.getEffectiveDate());
1255  1 assertEquals(DF.parse("20190101"), updated.getExpirationDate());
1256  1 assertEquals("sawyer", updated.getState());
1257  1 assertEquals("luLuType.type2", updated.getType());
1258  1 assertEquals("LUI-2", updated.getLuiId());
1259  1 assertEquals("LUI-3", updated.getRelatedLuiId());
1260  1 assertEquals("UPluiluiAttrValue1", updated.getAttributes().get(
1261    "luiluiAttrKey1"));
1262  1 assertEquals("luiluiAttrValue3", updated.getAttributes().get(
1263    "luiluiAttrKey3"));
1264  1 assertEquals(2, updated.getAttributes().size());
1265  1 assertEquals(created.getId(), updated.getId());
1266  1 assertNotNull(updated.getMetaInfo().getUpdateTime());
1267   
1268  1 try {
1269  1 updated = client.updateLuiLuiRelation(created.getId(), created);
1270  0 fail("Should have thrown VersionMismatchException");
1271    } catch (VersionMismatchException e) {
1272    }
1273   
1274  1 try {
1275  1 client.getLuiLuiRelation(created.getId());
1276    } catch (DoesNotExistException e) {
1277  0 fail("Should not have thrown DoesNotExistException");
1278    }
1279   
1280  1 StatusInfo status = client.deleteLuiLuiRelation(updated.getId());
1281   
1282  1 assertTrue(status.getSuccess());
1283   
1284  1 try {
1285  1 client.getLuiLuiRelation(created.getId());
1286  0 fail("Should have thrown DoesNotExistException");
1287    } catch (DoesNotExistException e) {
1288   
1289    }
1290   
1291    // TestFind
1292  1 List<LuiLuiRelationInfo> relations = client
1293    .getLuiLuiRelationsByLui("LUI-1");
1294  1 assertEquals(2, relations.size());
1295  1 relations = client.getLuiLuiRelationsByLui("LUI-2");
1296  1 assertEquals(1, relations.size());
1297  1 relations = client.getLuiLuiRelationsByLui("LUI-3");
1298  1 assertTrue(relations == null || relations.size() == 0);
1299   
1300  1 List<String> relatedLuiIdsByLuiId = client.getRelatedLuiIdsByLuiId(
1301    "LUI-1", "luLuType.type1");
1302  1 assertEquals(2, relatedLuiIdsByLuiId.size());
1303  1 assertTrue(relatedLuiIdsByLuiId.contains("LUI-2"));
1304  1 assertTrue(relatedLuiIdsByLuiId.contains("LUI-3"));
1305   
1306  1 List<LuiInfo> relatedLuisByLuiId = client.getRelatedLuisByLuiId(
1307    "LUI-1", "luLuType.type1");
1308  1 assertEquals(2, relatedLuisByLuiId.size());
1309   
1310    }
1311   
 
1312  1 toggle @Test
1313    public void testGetLuisByIdList() throws DoesNotExistException,
1314    InvalidParameterException, MissingParameterException,
1315    OperationFailedException {
1316  1 List<LuiInfo> luiInfos;
1317  1 try {
1318  1 luiInfos = client.getLuisByIdList(null);
1319  0 fail("LuService.getLuiByIdList() did not throw MissingParameterException for null Lui ID");
1320    } catch (MissingParameterException mpe) {
1321    } catch (Exception e) {
1322  0 fail("LuService.getLuiByIdList() threw unexpected "
1323    + e.getClass().getSimpleName() + " for null Lui ID");
1324    }
1325  1 luiInfos = client.getLuisByIdList(Arrays.asList("Not a LUI ID",
1326    "Another one that ain't"));
1327  1 assertTrue(luiInfos == null || luiInfos.size() == 0);
1328   
1329  1 luiInfos = client.getLuisByIdList(Arrays.asList("LUI-1", "LUI-4"));
1330  1 Collections.sort(luiInfos, new Comparator<LuiInfo>() {
 
1331  1 toggle @Override
1332    public int compare(LuiInfo o1, LuiInfo o2) {
1333  1 return o1.getId().compareTo(o2.getId());
1334    }
1335    });
1336  1 assertEquals("CLU-1", luiInfos.get(0).getCluId());
1337  1 assertEquals("CLU-2", luiInfos.get(1).getCluId());
1338    }
1339   
 
1340  1 toggle @Test
1341    public void testLuiCrud() throws AlreadyExistsException,
1342    DataValidationErrorException, DoesNotExistException,
1343    InvalidParameterException, MissingParameterException,
1344    OperationFailedException, PermissionDeniedException,
1345    ParseException, DependentObjectsExistException {
1346   
1347  1 LuiInfo luiInfo;
1348   
1349    // Read
1350  1 try {
1351  1 luiInfo = client.getLui("notARealLui");
1352  0 fail("LuService.getLui() did not throw DoesNotExistException for non-existent Lui");
1353    } catch (DoesNotExistException dnee) {
1354    } catch (Exception e) {
1355  0 fail("LuService.getLui() threw unexpected "
1356    + e.getClass().getSimpleName() + " for null Lui ID");
1357    }
1358  1 try {
1359  1 luiInfo = client.getLui(null);
1360  0 fail("LuService.getLui() did not throw MissingParameterException for null Lui ID");
1361    } catch (MissingParameterException mpe) {
1362    }
1363  1 luiInfo = client.getLui("LUI-1");
1364  1 assertEquals("CLU-1", luiInfo.getCluId());
1365   
1366    // Create
1367  1 luiInfo = new LuiInfo();
1368   
1369  1 luiInfo.setLuiCode("LUI Test Code");
1370  1 luiInfo.setMaxSeats(100);
1371  1 luiInfo.setState("Test Lui State");
1372  1 luiInfo.setEffectiveDate(DF.parse("20101203"));
1373  1 luiInfo.setExpirationDate(DF.parse("20801231"));
1374  1 luiInfo.getAttributes().put("luiAttrKey1", "luiAttrValue1");
1375  1 luiInfo.getAttributes().put("luiAttrKey2", "luiAttrValue2");
1376   
1377  1 LuiInfo createdLui = client.createLui("CLU-2", "ATP-3", luiInfo);
1378   
1379  1 assertEquals("ATP-3", createdLui.getAtpId());
1380  1 assertEquals("LUI Test Code", createdLui.getLuiCode());
1381  1 assertEquals(100L, (long) createdLui.getMaxSeats());
1382  1 assertEquals(DF.parse("20101203"), luiInfo.getEffectiveDate());
1383  1 assertEquals(DF.parse("20801231"), luiInfo.getExpirationDate());
1384  1 assertEquals("CLU-2", createdLui.getCluId());
1385  1 assertEquals(2, createdLui.getAttributes().size());
1386  1 assertEquals("luiAttrValue1", createdLui.getAttributes().get(
1387    "luiAttrKey1"));
1388  1 assertEquals("luiAttrValue2", createdLui.getAttributes().get(
1389    "luiAttrKey2"));
1390   
1391    // update
1392  1 createdLui.setAtpId("ATP-2");
1393  1 createdLui.setCluId("CLU-1");
1394  1 createdLui.setLuiCode("LUI Test Code Update");
1395  1 createdLui.setMaxSeats(75);
1396  1 createdLui.setState("Test Lui State Update");
1397  1 createdLui.setEffectiveDate(DF.parse("20111203"));
1398  1 createdLui.setExpirationDate(DF.parse("20811231"));
1399  1 createdLui.getAttributes().put("luiAttrKey1", "luiAttrValue1Updated");
1400  1 createdLui.getAttributes().put("luiAttrKey2", "luiAttrValue2Updated");
1401   
1402  1 LuiInfo updatedLui = null;
1403  1 try {
1404  1 updatedLui = client.updateLui(createdLui.getId(), createdLui);
1405    } catch (VersionMismatchException vme) {
1406  0 fail("LuService.updateLui() threw unexpected VersionMismatchException");
1407    }
1408   
1409    // confirm update worked
1410  1 assertTrue(null != updatedLui);
1411  1 assertEquals("ATP-2", updatedLui.getAtpId());
1412  1 assertEquals("CLU-1", updatedLui.getCluId());
1413  1 assertEquals("LUI Test Code Update", updatedLui.getLuiCode());
1414  1 assertEquals(75L, (long) createdLui.getMaxSeats());
1415  1 assertEquals(DF.parse("20111203"), updatedLui.getEffectiveDate());
1416  1 assertEquals(DF.parse("20811231"), updatedLui.getExpirationDate());
1417  1 assertEquals(2, updatedLui.getAttributes().size());
1418  1 assertEquals("luiAttrValue1Updated", updatedLui.getAttributes().get(
1419    "luiAttrKey1"));
1420  1 assertEquals("luiAttrValue2Updated", updatedLui.getAttributes().get(
1421    "luiAttrKey2"));
1422   
1423    // optimistic locking working?
1424  1 try {
1425  1 client.updateLui(createdLui.getId(), createdLui);
1426  0 fail("LuService.updateLui did not throw expected VersionMismatchException");
1427    } catch (VersionMismatchException e) {
1428    }
1429   
1430    // delete what we created
1431  1 client.deleteLui(createdLui.getId());
1432    // and try it again
1433  1 try {
1434  1 client.deleteLui(createdLui.getId());
1435  0 fail("LuService.deleteLui() of previously-delete Lui did not throw expected DoesNotExistException");
1436    } catch (DoesNotExistException dnee) {
1437    }
1438    }
1439   
 
1440  1 toggle @Test
1441    public void testGetLuiIdsByCluId() throws DoesNotExistException,
1442    InvalidParameterException, MissingParameterException,
1443    OperationFailedException {
1444  1 List<String> luiIds = null;
1445  1 try {
1446  1 luiIds = client.getLuiIdsByCluId(null);
1447  0 fail("LuService.getLuiIdsByCluId() did not throw MissingParameterException for null Clu ID");
1448    } catch (MissingParameterException e) {
1449    }
1450  1 luiIds = client.getLuiIdsByCluId("CLU-1");
1451   
1452  1 Collections.sort(luiIds);
1453   
1454  1 assertTrue(null != luiIds);
1455  1 assertEquals(3, luiIds.size());
1456   
1457  1 assertEquals("LUI-1", luiIds.get(0));
1458  1 assertEquals("LUI-3", luiIds.get(2));
1459  1 luiIds = client.getLuiIdsByCluId("CLU-2");
1460  1 assertEquals(1, luiIds.size());
1461  1 luiIds = client.getLuiIdsByCluId("Non-existent Clu");
1462  1 assertTrue(null == luiIds || luiIds.size() == 0);
1463    }
1464   
 
1465  1 toggle @Test
1466    public void testGetLuiIdsInAtpByCluId() throws DoesNotExistException,
1467    InvalidParameterException, OperationFailedException,
1468    MissingParameterException {
1469  1 List<String> luiIds = null;
1470  1 try {
1471  1 luiIds = client.getLuiIdsInAtpByCluId(null, "ATP-1");
1472  0 fail("LuService.getLuiIdsInAtpByCluId() did not throw MissingParameterException for null Clu ID");
1473    } catch (MissingParameterException e) {
1474    }
1475  1 try {
1476  1 luiIds = client.getLuiIdsInAtpByCluId("CLU-1", null);
1477  0 fail("LuService.getLuiIdsInAtpByCluId() did not throw MissingParameterException for null AtpKey");
1478    } catch (MissingParameterException e) {
1479    }
1480  1 luiIds = client.getLuiIdsInAtpByCluId("CLU-1", "ATP-2");
1481  1 Collections.sort(luiIds);
1482  1 assertTrue(null != luiIds);
1483  1 assertEquals(2, luiIds.size());
1484  1 assertEquals("LUI-2", luiIds.get(0));
1485  1 assertEquals("LUI-3", luiIds.get(1));
1486  1 luiIds = client.getLuiIdsInAtpByCluId("CLU-1", "ATP-1");
1487  1 assertEquals(1, luiIds.size());
1488  1 luiIds = client.getLuiIdsInAtpByCluId("Non-existent Clu", "ATP-2");
1489  1 assertTrue(null == luiIds || luiIds.size() == 0);
1490  1 luiIds = client.getLuiIdsInAtpByCluId("CLU-2", "Non-existent ATP");
1491  1 assertTrue(null == luiIds || luiIds.size() == 0);
1492    }
1493   
 
1494  1 toggle @Test
1495    public void testGetLuLuRelationTypeInfo() throws OperationFailedException,
1496    DoesNotExistException, MissingParameterException {
1497  1 LuLuRelationTypeInfo luLuRelTypeInfo;
1498   
1499  1 try {
1500  1 client.getLuLuRelationType(null);
1501  0 fail("LuService.getLuLuRelationTypeInfo() did not throw MissingParameterException for null LuLuRelationType key");
1502    } catch (MissingParameterException e) {
1503    }
1504  1 luLuRelTypeInfo = client.getLuLuRelationType("luLuType.type1");
1505  1 assertEquals("bob", luLuRelTypeInfo.getName());
1506  1 luLuRelTypeInfo = client.getLuLuRelationType("luLuType.type2");
1507  1 assertEquals("my desc2", luLuRelTypeInfo.getDescr());
1508  1 assertEquals("rev name2", luLuRelTypeInfo.getRevName());
1509  1 assertEquals("rev desc2", luLuRelTypeInfo.getRevDesc());
1510  1 try {
1511  1 client.getLuLuRelationType("Non-existent LuLuRelationType");
1512  0 fail("LuService.getLuLuRelationTypeInfo() did not throw DoesNotExistException when retrieving non-existent LuLuRelationType");
1513    } catch (DoesNotExistException dnee) {
1514    }
1515    }
1516   
 
1517  1 toggle @Test
1518    public void testGetLuLuRelationTypeInfos() throws OperationFailedException,
1519    DoesNotExistException, MissingParameterException {
1520  1 List<LuLuRelationTypeInfo> luLuRelTypeInfos;
1521  1 luLuRelTypeInfos = client.getLuLuRelationTypes();
1522  1 Collections.sort(luLuRelTypeInfos,
1523    new Comparator<LuLuRelationTypeInfo>() {
 
1524  38 toggle @Override
1525    public int compare(LuLuRelationTypeInfo o1,
1526    LuLuRelationTypeInfo o2) {
1527  38 return o1.getId().compareTo(o2.getId());
1528    }
1529    });
1530  1 assertEquals(13, luLuRelTypeInfos.size());
1531  1 assertEquals("kuali.lu.lu.relation.type.hasCoreProgram", luLuRelTypeInfos.get(0).getId());
1532    }
1533   
 
1534  1 toggle @Test
1535    public void testUpdateLuiState() throws DataValidationErrorException,
1536    DoesNotExistException, InvalidParameterException,
1537    OperationFailedException, PermissionDeniedException,
1538    ParseException, AlreadyExistsException, MissingParameterException,
1539    DependentObjectsExistException {
1540  1 try {
1541  1 client.updateLuiState(null, "Suspended");
1542  0 fail("LuService.updateLuiState() did not throw MissingParameterException for null Lui ID");
1543    } catch (MissingParameterException e) {
1544    }
1545  1 try {
1546  1 client.updateLuiState("LUI-1", null);
1547  0 fail("LuService.updateLuiState() did not throw MissingParameterException for null state");
1548    } catch (MissingParameterException e) {
1549    }
1550   
1551    // create a Lui whose state we'll update. Create a new one so its
1552    // MetaInfo gets created in prePersist()
1553  1 LuiInfo luiInfo = new LuiInfo();
1554   
1555  1 luiInfo.setLuiCode("LUI Test Code");
1556  1 luiInfo.setMaxSeats(100);
1557  1 luiInfo.setState("Approved");
1558  1 luiInfo.setEffectiveDate(DF.parse("20101203"));
1559  1 luiInfo.setExpirationDate(DF.parse("20801231"));
1560  1 luiInfo.getAttributes().put("luiAttrKey1", "luiAttrValue1");
1561  1 luiInfo.getAttributes().put("luiAttrKey2", "luiAttrValue2");
1562   
1563  1 LuiInfo createdLui = client.createLui("CLU-2", "ATP-3", luiInfo);
1564    // make sure the db's in the state we expect
1565  1 assertEquals("Approved", createdLui.getState());
1566   
1567    // update and confirm it was updated
1568  1 LuiInfo updatedLui = client.updateLuiState(createdLui.getId(),
1569    "Active");
1570  1 assertEquals("Active", updatedLui.getState());
1571   
1572    // and now explicitly retrieve it without a call to updateLuiState and
1573    // confirm same
1574  1 updatedLui = client.getLui(createdLui.getId());
1575  1 assertEquals("Active", updatedLui.getState());
1576   
1577    // and delete it to keep db consistent for other tests
1578  1 client.deleteLui(updatedLui.getId());
1579    }
1580   
 
1581  1 toggle @Test
1582    public void testGetLuisByRelation() throws DoesNotExistException,
1583    InvalidParameterException, MissingParameterException,
1584    OperationFailedException {
1585  1 List<LuiInfo> luis = client
1586    .getLuisByRelation("LUI-1", "luLuType.type1");
1587  1 assertTrue(luis == null || luis.size() == 0);
1588  1 luis = client.getLuisByRelation("LUI-2", "luLuType.type1");
1589  1 Collections.sort(luis, new Comparator<LuiInfo>() {
 
1590  0 toggle @Override
1591    public int compare(LuiInfo o1, LuiInfo o2) {
1592  0 return o1.getId().compareTo(o2.getId());
1593    }
1594    });
1595  1 assertEquals(1, luis.size());
1596  1 assertEquals("LUI-1", luis.get(0).getId());
1597    }
1598   
 
1599  1 toggle @Test
1600    public void testGetLuiIdsByRelation() throws DoesNotExistException,
1601    InvalidParameterException, MissingParameterException,
1602    OperationFailedException {
1603  1 List<String> luis = client.getLuiIdsByRelation("LUI-1",
1604    "luLuType.type1");
1605  1 assertTrue(luis == null || luis.size() == 0);
1606  1 luis = client.getLuiIdsByRelation("LUI-2", "luLuType.type1");
1607  1 Collections.sort(luis);
1608  1 assertEquals(1, luis.size());
1609  1 assertEquals("LUI-1", luis.get(0));
1610    }
1611   
 
1612  1 toggle @Test
1613    public void testOutcomeLO() throws AlreadyExistsException,
1614    DoesNotExistException, InvalidParameterException,
1615    MissingParameterException, OperationFailedException,
1616    PermissionDeniedException, DependentObjectsExistException,
1617    ParseException, DataValidationErrorException,
1618    VersionMismatchException {
1619   
1620  1 CluLoRelationInfo reltnInfo = new CluLoRelationInfo();
1621  1 reltnInfo.setCluId("CLU-1");
1622  1 reltnInfo.setLoId("LO-1");
1623  1 reltnInfo.setState("FINAL");
1624  1 reltnInfo.setType("kuali.lu.lo.relation.type.includes");
1625  1 reltnInfo.setEffectiveDate(DF.parse("20101203"));
1626  1 reltnInfo.setExpirationDate(DF.parse("20801231"));
1627   
1628  1 CluLoRelationInfo crReltnInfo = client.createCluLoRelation("CLU-1",
1629    "LO-1", "kuali.lu.lo.relation.type.includes", reltnInfo);
1630   
1631  1 assertEquals(crReltnInfo.getCluId(), "CLU-1");
1632  1 assertEquals(crReltnInfo.getLoId(), "LO-1");
1633  1 assertEquals(crReltnInfo.getState(), "FINAL");
1634  1 assertEquals(crReltnInfo.getType(), "kuali.lu.lo.relation.type.includes");
1635   
1636  1 try {
1637  1 client.createCluLoRelation("CLU-1", "LO-1", "kuali.lu.lo.relation.type.includes", reltnInfo);
1638  0 fail("Should have thrown AlreadyExistsException");
1639    } catch (AlreadyExistsException e) {
1640   
1641    }
1642   
1643  1 try {
1644  1 reltnInfo.setCluId("MISSING CLU");
1645  1 client.createCluLoRelation("MISSING CLU", "LO-1", "kuali.lu.lo.relation.type.includes",
1646    reltnInfo);
1647  0 fail("Should have thrown DoesNotExistException");
1648    } catch (DoesNotExistException e) {
1649   
1650    }
1651   
1652  1 CluLoRelationInfo gtReltnInfo = client.getCluLoRelation(crReltnInfo
1653    .getId());
1654   
1655  1 assertEquals(gtReltnInfo.getCluId(), "CLU-1");
1656  1 assertEquals(gtReltnInfo.getLoId(), "LO-1");
1657  1 assertEquals(gtReltnInfo.getState(), "FINAL");
1658  1 assertEquals(gtReltnInfo.getType(), "kuali.lu.lo.relation.type.includes");
1659   
1660  1 CluLoRelationInfo reltnInfo1 = new CluLoRelationInfo();
1661  1 reltnInfo1.setCluId("CLU-1");
1662  1 reltnInfo1.setLoId("LO-2");
1663  1 reltnInfo1.setState("FINAL");
1664  1 reltnInfo1.setType("kuali.lu.lo.relation.type.includes");
1665  1 reltnInfo1.setEffectiveDate(DF.parse("20101203"));
1666  1 reltnInfo1.setExpirationDate(DF.parse("20801231"));
1667   
1668  1 CluLoRelationInfo crReltnInfo1 = client.createCluLoRelation("CLU-1",
1669    "LO-2", "kuali.lu.lo.relation.type.includes", reltnInfo1);
1670   
1671  1 List<CluLoRelationInfo> reltns = client.getCluLoRelationsByClu("CLU-1");
1672  1 assertEquals(2, reltns.size());
1673   
1674  1 List<CluLoRelationInfo> reltns1 = client.getCluLoRelationsByLo("LO-1");
1675  1 assertEquals(1, reltns1.size());
1676  1 assertEquals(reltns1.get(0).getCluId(), "CLU-1");
1677   
1678    // Test update relation
1679  1 crReltnInfo1.setState("NEW");
1680  1 CluLoRelationInfo updateReltn = client.updateCluLoRelation(crReltnInfo1
1681    .getId(), crReltnInfo1);
1682  1 assertEquals("NEW", updateReltn.getState());
1683   
1684  1 StatusInfo status = client.deleteCluLoRelation(crReltnInfo.getId());
1685  1 assertTrue(status.getSuccess());
1686   
1687  1 status = client.deleteCluLoRelation(updateReltn.getId());
1688  1 assertTrue(status.getSuccess());
1689   
1690    }
1691   
 
1692  1 toggle @Test
1693    public void testResultUsageType() throws DoesNotExistException,
1694    InvalidParameterException, MissingParameterException,
1695    OperationFailedException {
1696  1 ResultUsageTypeInfo lrType = client.getResultUsageType("lrType.finalGrade");
1697  1 assertEquals("Final Grade", lrType.getName());
1698  1 List<ResultUsageTypeInfo> lrTypes = client.getResultUsageTypes();
1699  1 assertEquals(2, lrTypes.size());
1700   
1701    }
1702   
 
1703  1 toggle @Test
1704    public void testGetClusByRelation() throws AlreadyExistsException,
1705    DataValidationErrorException, DoesNotExistException,
1706    InvalidParameterException, MissingParameterException,
1707    OperationFailedException, PermissionDeniedException,
1708    ParseException, VersionMismatchException {
1709  1 List<CluInfo> clus = client
1710    .getClusByRelation("CLU-1", "luLuType.type1");
1711  1 assertNotNull(clus);
1712  1 assertEquals(2, clus.size());
1713   
1714  1 clus = client.getClusByRelation("CLUXX-2", "luLuType.type1");
1715  1 assertTrue(clus == null || clus.size() == 0);
1716   
1717  1 clus = client.getClusByRelation("CLU-2", "luLuType.type1XX");
1718  1 assertTrue(clus == null || clus.size() == 0);
1719   
1720  1 try {
1721  1 clus = client.getClusByRelation(null, "luLuType.type1XX");
1722  0 assertTrue(false);
1723    } catch (MissingParameterException e) {
1724  1 assertTrue(true);
1725    }
1726  1 try {
1727  1 clus = client.getClusByRelation("CLU-2", null);
1728  0 assertTrue(false);
1729    } catch (MissingParameterException e) {
1730  1 assertTrue(true);
1731    }
1732   
1733  1 List<String> ids = client.getCluIdsByRelation("CLU-2", "luLuType.type1");
1734  1 assertNotNull(ids);
1735  1 assertEquals(1, ids.size());
1736   
1737  1 ids = client.getCluIdsByRelation("CLUXX-2", "luLuType.type1");
1738  1 assertTrue(null == ids || ids.size() == 0);
1739   
1740  1 ids = client.getCluIdsByRelation("CLU-2", "luLuType.type1XX");
1741  1 assertTrue(null == ids || ids.size() == 0);
1742   
1743  1 try {
1744  1 ids = client.getCluIdsByRelation(null, "luLuType.type1XX");
1745  0 assertTrue(false);
1746    } catch (MissingParameterException e) {
1747  1 assertTrue(true);
1748    }
1749  1 try {
1750  1 ids = client.getCluIdsByRelation("CLU-2", null);
1751  0 assertTrue(false);
1752    } catch (MissingParameterException e) {
1753  1 assertTrue(true);
1754    }
1755    }
1756   
1757    //@Test
 
1758  0 toggle public void testSearchForResults() throws AlreadyExistsException,
1759    DataValidationErrorException, DoesNotExistException,
1760    InvalidParameterException, MissingParameterException,
1761    OperationFailedException, PermissionDeniedException,
1762    ParseException, VersionMismatchException {
1763  0 List<SearchParam> queryParamValues = new ArrayList<SearchParam>(
1764    0);
1765  0 SearchRequest searchRequest = new SearchRequest();
1766  0 searchRequest.setSearchKey("lu.search.clus");
1767  0 searchRequest.setParams(queryParamValues);
1768  0 SearchResult clus = client.search(searchRequest);
1769  0 Collections.sort(clus.getRows(), new Comparator<SearchResultRow>() {
 
1770  0 toggle @Override
1771    public int compare(SearchResultRow o1, SearchResultRow o2) {
1772  0 return o1.getCells().get(0).getValue().compareTo(
1773    o2.getCells().get(0).getValue());
1774    }
1775    });
1776  0 assertNotNull(clus);
1777  0 assertEquals(103, clus.getRows().size());
1778  0 SearchResultRow result = clus.getRows().get(0);
1779  0 assertNotNull(result);
1780   
1781  0 List<SearchResultCell> resultCells = result.getCells();
1782  0 assertNotNull(resultCells);
1783  0 assertEquals(2, resultCells.size());
1784   
1785  0 SearchResultCell resultCell = resultCells.get(0);
1786  0 assertEquals("lu.resultColumn.cluId", resultCell.getKey());
1787  0 assertEquals("00000000-a389-4fd0-b349-1e649c20fd08", resultCell
1788    .getValue());
1789  0 resultCell = resultCells.get(1);
1790  0 assertEquals("lu.resultColumn.cluOfficialIdentifier.longName",
1791    resultCell.getKey());
1792  0 assertEquals("Advanced Applied Linear Algebra", resultCell.getValue());
1793    }
1794   
 
1795  1 toggle @Test
1796    public void testSearchCourseLevelRanges() throws MissingParameterException {
1797  1 List<SearchParam> queryParamValues = new ArrayList<SearchParam>();
1798  1 SearchParam courseLevelsParam = new SearchParam();
1799  1 courseLevelsParam.setKey("lu.queryParam.luOptionalCrsNoRange");
1800  1 courseLevelsParam.setValue("100 -200");
1801  1 queryParamValues.add(courseLevelsParam);
1802  1 SearchRequest searchRequest = new SearchRequest();
1803  1 searchRequest.setSearchKey("lu.search.generic");
1804  1 searchRequest.setParams(queryParamValues);
1805  1 SearchResult clus = client.search(searchRequest);
1806  1 Collections.sort(clus.getRows(), new Comparator<SearchResultRow>() {
 
1807  12 toggle @Override
1808    public int compare(SearchResultRow o1, SearchResultRow o2) {
1809  12 return o1.getCells().get(0).getValue().compareTo(
1810    o2.getCells().get(0).getValue());
1811    }
1812    });
1813  1 assertNotNull(clus);
1814  1 LOG.warn(clus.getRows().size());
1815    }
1816   
 
1817  1 toggle @Test
1818    public void testCluValidation() throws ParseException, AlreadyExistsException,
1819    DataValidationErrorException, DoesNotExistException,
1820    InvalidParameterException, MissingParameterException,
1821    OperationFailedException, PermissionDeniedException,
1822    VersionMismatchException, DependentObjectsExistException {
1823   
1824  1 CluInfo clu = new CluInfo();
1825   
1826  1 CluAccountingInfo accountingInfo = new CluAccountingInfo();
1827  1 accountingInfo.getAttributes().put("AccountingAttrKey1",
1828    "AccountingAttrValue1");
1829  1 accountingInfo.getAttributes().put("AccountingAttrKey2",
1830    "AccountingAttrValue2");
1831  1 clu.setAccountingInfo(accountingInfo);
1832   
1833  1 CluIdentifierInfo officialIdentifier = new CluIdentifierInfo();
1834  1 officialIdentifier.setType("kuali.lu.type.CreditCourse.identifier.official");
1835  1 officialIdentifier.setState("active");
1836  1 officialIdentifier.setCode("offIdcode");
1837  1 officialIdentifier.setDivision("offIddivision");
1838  1 officialIdentifier.setLevel("offIdlevel");
1839  1 officialIdentifier.setLongName("offIdlongName");
1840    // ERROR: Short name should be less than 20 chars
1841  1 officialIdentifier.setShortName("offId-shortName-should-be-longer-than-twenty-characters");
1842  1 officialIdentifier.setVariation("offIdvariation");
1843  1 officialIdentifier.setSuffixCode("offIdsuffixcode");
1844  1 officialIdentifier.setOrgId("offIdorgid");
1845  1 clu.setOfficialIdentifier(officialIdentifier);
1846   
1847  1 CluIdentifierInfo cluId1 = new CluIdentifierInfo();
1848  1 cluId1.setType("kuali.lu.type.CreditCourse.identifier.cross-listed");
1849  1 cluId1.setState("Sctive");
1850  1 cluId1.setCode("cluIdonecode");
1851  1 cluId1.setDivision("cluIdonedivision");
1852  1 cluId1.setLevel("cluIdonelevel");
1853  1 cluId1.setLongName("cluIdonelongName");
1854  1 cluId1.setShortName("cluIdoneshortName");
1855    // ERROR: Min length 3
1856    // ERROR: Only numbers allowed
1857  1 cluId1.setSuffixCode("cl");
1858  1 cluId1.setOrgId("cluIdoneorgid");
1859   
1860  1 clu.getAlternateIdentifiers().add(cluId1);
1861   
1862  1 CluIdentifierInfo cluId2 = new CluIdentifierInfo();
1863    // Check for different type validations
1864  1 cluId2.setType("kuali.lu.type.CreditCourse.identifier.version");
1865  1 cluId2.setState("Sctive");
1866  1 cluId2.setCode("cluIdtwocode");
1867  1 cluId2.setDivision("cluIdtwodivision");
1868  1 cluId2.setLevel("cluIdtwolevel");
1869  1 cluId2.setLongName("cluIdtwolongName");
1870  1 cluId2.setShortName("cluIdtwoshortName");
1871    // ERROR: Should be uppper case
1872    // ERROR: should be of size 1
1873  1 cluId2.setVariation("ab");
1874  1 cluId2.setSuffixCode("cluIdtwosuffixcode");
1875    // ERROR OrgId required
1876    // cluId.setOrgId();
1877  1 clu.getAlternateIdentifiers().add(cluId2);
1878   
1879  1 clu.getAttributes().put("cluAttrKey1", "cluAttrValue1");
1880  1 clu.getAttributes().put("cluAttrKey2", "cluAttrValue2");
1881   
1882  1 clu.setCanCreateLui(true);
1883   
1884    // ERROR non negative integer
1885  1 clu.setDefaultEnrollmentEstimate(-545);
1886  1 clu.setDefaultMaximumEnrollment(999);
1887   
1888  1 RichTextInfo desc = new RichTextInfo();
1889  1 desc.setFormatted("<p>DESC FORMATTED</p>");
1890  1 desc.setPlain("DESC PLAIN");
1891  1 clu.setDescr(desc);
1892   
1893  1 clu.setEffectiveDate(DF.parse("20100203"));
1894  1 clu.setExpirationDate(DF.parse("21001231"));
1895   
1896  1 clu.setEnrollable(true);
1897   
1898  1 AffiliatedOrgInfo aforg = new AffiliatedOrgInfo();
1899  1 aforg.setOrgId("AFFORGone");
1900  1 aforg.setPercentage(35l);
1901   
1902  1 AffiliatedOrgInfo aforg1 = new AffiliatedOrgInfo();
1903  1 aforg1.setOrgId("AFForgtwo");
1904  1 aforg1.setPercentage(65l);
1905   
1906  1 List<AffiliatedOrgInfo> affiliatedOrgs = new ArrayList<AffiliatedOrgInfo>();
1907  1 affiliatedOrgs.add(aforg);
1908  1 affiliatedOrgs.add(aforg1);
1909   
1910  1 CurrencyAmountInfo ca = new CurrencyAmountInfo();
1911  1 ca.setCurrencyQuantity(100);
1912  1 ca.setCurrencyTypeKey("DLLR");
1913   
1914  1 CurrencyAmountInfo ca1 = new CurrencyAmountInfo();
1915  1 ca.setCurrencyQuantity(200);
1916  1 ca.setCurrencyTypeKey("DLLR");
1917   
1918  1 List<CurrencyAmountInfo> caList = new ArrayList<CurrencyAmountInfo>();
1919  1 caList.add(ca);
1920   
1921  1 List<CurrencyAmountInfo> caList1 = new ArrayList<CurrencyAmountInfo>();
1922  1 caList.add(ca);
1923  1 caList.add(ca1);
1924   
1925  1 RichTextInfo cfRecDesc = new RichTextInfo();
1926  1 cfRecDesc.setPlain("Clu Fee Record");
1927   
1928  1 CluFeeRecordInfo feeRec = new CluFeeRecordInfo();
1929  1 feeRec.setAffiliatedOrgs(affiliatedOrgs);
1930  1 feeRec.setFeeAmounts(caList);
1931  1 feeRec.setFeeType("FEE-TYPE-X");
1932  1 feeRec.setRateType("RATE-TYPE-X");
1933  1 feeRec.setDescr(cfRecDesc);
1934   
1935  1 CluFeeRecordInfo feeRec1 = new CluFeeRecordInfo();
1936  1 feeRec1.setAffiliatedOrgs(affiliatedOrgs);
1937  1 feeRec1.setFeeAmounts(caList1);
1938  1 feeRec1.setFeeType("FEE-TYPE-Y");
1939  1 feeRec1.setRateType("RATE-TYPE-Y");
1940   
1941  1 List<CluFeeRecordInfo> feeRecList = new ArrayList<CluFeeRecordInfo>();
1942  1 feeRecList.add(feeRec);
1943  1 feeRecList.add(feeRec1);
1944   
1945  1 RichTextInfo cfDesc = new RichTextInfo();
1946  1 cfDesc.setPlain("Clu Fee");
1947   
1948  1 CluFeeInfo feeInfo = new CluFeeInfo();
1949  1 feeInfo.getAttributes().put("FeeAttrKey1", "FeeAttrValue1");
1950  1 feeInfo.getAttributes().put("FeeAttrKey2", "FeeAttrValue2");
1951  1 feeInfo.setCluFeeRecords(feeRecList);
1952  1 feeInfo.setDescr(cfDesc);
1953  1 clu.setFeeInfo(feeInfo);
1954   
1955  1 clu.setHasEarlyDropDeadline(true);
1956   
1957  1 clu.setHazardousForDisabledStudents(true);
1958   
1959  1 CluInstructorInfo primaryInstructor = new CluInstructorInfo();
1960  1 primaryInstructor.setOrgId("EXTorgIdone");
1961  1 primaryInstructor.setPersonId("EXTpersonIdone");
1962  1 primaryInstructor.getAttributes().put("PrimaryInstAttrKey1",
1963    "PrimaryInstAttrValue1");
1964  1 primaryInstructor.getAttributes().put("PrimaryInstAttrKey2",
1965    "PrimaryInstAttrValue2");
1966  1 clu.setPrimaryInstructor(primaryInstructor);
1967   
1968  1 CluInstructorInfo instructor1 = new CluInstructorInfo();
1969  1 instructor1.setOrgId("EXTorgIdtwo");
1970  1 instructor1.setPersonId("EXTpersonIdtwo");
1971  1 instructor1.getAttributes().put("Inst1AttrKey1", "Inst1AttrValue1");
1972  1 instructor1.getAttributes().put("Inst1AttrKey2", "Inst1AttrValue2");
1973  1 clu.getInstructors().add(instructor1);
1974   
1975  1 CluInstructorInfo instructor2 = new CluInstructorInfo();
1976  1 instructor2.setOrgId("EXTorgIdthree");
1977  1 instructor2.setPersonId("EXTpersonIdthree");
1978  1 instructor2.getAttributes().put("Inst2AttrKey1", "Inst2AttrValue1");
1979  1 instructor2.getAttributes().put("Inst2AttrKey2", "Inst2AttrValue2");
1980  1 clu.getInstructors().add(instructor2);
1981   
1982  1 LuCodeInfo luCode1 = new LuCodeInfo();
1983  1 luCode1.setId("luCode1.key");
1984  1 luCode1.setDescr("luCode1desc");
1985  1 luCode1.setValue("luCode1value");
1986  1 luCode1.getAttributes().put("luCode1AttrKey1", "luCode1AttrValue1");
1987  1 luCode1.getAttributes().put("luCode1AttrKey2", "luCode1AttrValue2");
1988  1 clu.getLuCodes().add(luCode1);
1989   
1990  1 LuCodeInfo luCode2 = new LuCodeInfo();
1991  1 luCode2.setId("luCode2.key");
1992  1 luCode2.setDescr("luCodetwodesc");
1993  1 luCode2.setValue("luCodetwovalue");
1994  1 luCode2.getAttributes().put("luCode2AttrKey1", "luCode2AttrValue1");
1995  1 luCode2.getAttributes().put("luCode2AttrKey2", "luCode2AttrValue2");
1996  1 clu.getLuCodes().add(luCode2);
1997   
1998  1 RichTextInfo marketingDesc = new RichTextInfo();
1999  1 marketingDesc.setFormatted("<p>marketingDesc FORMATTED</p>");
2000  1 marketingDesc.setPlain("marketingDesc PLAIN");
2001   
2002  1 clu.setNextReviewPeriod("nextReviewPeriod");
2003   
2004  1 clu.getOfferedAtpTypes().add("offeredAtpType1");
2005  1 clu.getOfferedAtpTypes().add("offeredAtpType2");
2006   
2007   
2008  1 CluInstructorInfo pubPrimaryInstructor = new CluInstructorInfo();
2009  1 pubPrimaryInstructor.setOrgId("EXTorgId");
2010  1 pubPrimaryInstructor.setPersonId("EXTpersonId");
2011  1 pubPrimaryInstructor.getAttributes().put("PubPrimaryInstAttrKey1",
2012    "PubPrimaryInstAttrValue1");
2013  1 pubPrimaryInstructor.getAttributes().put("PubPrimaryInstAttrKey2",
2014    "PubPrimaryInstAttrValue2");
2015   
2016  1 CluInstructorInfo pubInstructor1 = new CluInstructorInfo();
2017  1 pubInstructor1.setOrgId("EXTorgIdtwo");
2018  1 pubInstructor1.setPersonId("EXT-personId-two");
2019  1 pubInstructor1.getAttributes().put("PubInst1AttrKey1",
2020    "PubInst1AttrValue1");
2021  1 pubInstructor1.getAttributes().put("PubInst1AttrKey2",
2022    "PubInst1AttrValue2");
2023   
2024  1 CluInstructorInfo pubInstructor2 = new CluInstructorInfo();
2025  1 pubInstructor2.setOrgId("EXTorgIdthree");
2026  1 pubInstructor2.setPersonId("EXTpersonIdthree");
2027  1 pubInstructor2.getAttributes().put("PubInst2AttrKey1",
2028    "PubInst2AttrValue1");
2029  1 pubInstructor2.getAttributes().put("PubInst2AttrKey2",
2030    "PubInst2AttrValue2");
2031   
2032  1 clu.setReferenceURL("http://student.kuali.org/clus");
2033   
2034  1 TimeAmountInfo stdDuration = new TimeAmountInfo();
2035  1 stdDuration.setAtpDurationTypeKey("EXTstdDurationId");
2036  1 stdDuration.setTimeQuantity(new Integer(7867));
2037  1 clu.setStdDuration(stdDuration);
2038   
2039  1 createCampusLocationList(clu);
2040   
2041  1 createIntensity(clu);
2042   
2043  1 createAccreditationList(clu);
2044   
2045  1 createAdminOrgs(clu);
2046   
2047  1 clu.setType("kuali.lu.type.CreditCourse");
2048  1 clu.setState("template");
2049   
2050  1 List<ValidationResultInfo> valerros = client.validateClu("SYSTEM", clu);
2051   
2052  1 assertEquals(2, valerros.size());
2053    }
2054   
 
2055  1 toggle @Test
2056    public void testAddCluToCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2057  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2058   
2059  1 StatusInfo status = client.addCluToCluSet("CLU-1", createdCluSet.getId());
2060  1 CluSetInfo getCluSetInfo = client.getCluSetInfo(createdCluSet.getId());
2061   
2062  1 assertTrue(status.getSuccess());
2063  1 assertEquals(1, getCluSetInfo.getCluIds().size());
2064  1 assertEquals("CLU-1", getCluSetInfo.getCluIds().get(0));
2065    }
2066   
 
2067  1 toggle @Test
2068    public void testAddCluToCluSet_DuplicateCluId() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2069  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2070   
2071  1 StatusInfo status = client.addCluToCluSet("CLU-1", createdCluSet.getId());
2072  1 assertTrue(status.getSuccess());
2073   
2074  1 try {
2075  1 client.addCluToCluSet("CLU-1", createdCluSet.getId());
2076  0 fail("Adding the same CLU more than once should have failed");
2077    } catch(OperationFailedException e) {
2078  1 assertTrue(true);
2079    }
2080    }
2081   
 
2082  1 toggle @Test
2083    public void testAddClusToCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2084  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2085   
2086    // Somehow cannot add 2 CLUs in sequence (JTA rollback exception) but adding a single CLU works
2087    //CluInfo clu1 = createCluInfo();
2088    //CluInfo clu2 = createCluInfo();
2089    //CluInfo createdClu1 = client.createClu("luType.shell.course", clu1);
2090    //CluInfo createdClu2 = client.createClu("luType.shell.course", clu2);
2091    //List<String> cluIdList = Arrays.asList(new String[] {createdClu1.getId(), createdClu2.getId()});
2092   
2093  1 List<String> cluIdList = Arrays.asList(new String[] {"CLU-1", "CLU-2", "CLU-3", "CLU-4"});
2094   
2095  1 StatusInfo status = client.addClusToCluSet(cluIdList, createdCluSet.getId());
2096  1 CluSetInfo getCluSetInfo = client.getCluSetInfo(createdCluSet.getId());
2097  1 assertTrue(status.getSuccess());
2098  1 assertEquals(4, getCluSetInfo.getCluIds().size());
2099  1 assertTrue(getCluSetInfo.getCluIds().contains("CLU-1"));
2100  1 assertTrue(getCluSetInfo.getCluIds().contains("CLU-2"));
2101  1 assertTrue(getCluSetInfo.getCluIds().contains("CLU-3"));
2102  1 assertTrue(getCluSetInfo.getCluIds().contains("CLU-4"));
2103    }
2104   
 
2105  1 toggle @Test
2106    public void testAddClusToCluSet_InvalidCluId() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2107  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2108   
2109  1 List<String> cluIdList = Arrays.asList(new String[] {"CLU-1", "CLU-2", "CLU-INVALID-ID", "CLU-4"});
2110   
2111  1 try {
2112  1 client.addClusToCluSet(cluIdList, createdCluSet.getId());
2113  0 fail("Adding a non-existent CLU (id='CLU-INVALID-ID') to CluSet should have failed");
2114    } catch(DoesNotExistException e) {
2115  1 assertTrue(true);
2116    }
2117    }
2118   
 
2119  1 toggle @Test
2120    public void testAddClusToCluSet_DuplicateCluId() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2121  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2122   
2123  1 List<String> cluIdList = Arrays.asList(new String[] {"CLU-1", "CLU-2", "CLU-2", "CLU-4"});
2124   
2125  1 try {
2126  1 client.addClusToCluSet(cluIdList, createdCluSet.getId());
2127  0 fail("Adding a duplicate CLU (id='CLU-2') to CluSet should have failed");
2128    } catch(OperationFailedException e) {
2129  1 assertTrue(true);
2130    }
2131    }
2132   
 
2133  1 toggle @Test
2134    public void testAddClusToCluSet_InvalidCluSetId() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2135  1 List<String> cluIdList = Arrays.asList(new String[] {"CLU-1", "CLU-2", "CLU-3", "CLU-4"});
2136   
2137  1 try {
2138  1 client.addClusToCluSet(cluIdList, "CLUSET-INVALID-ID");
2139  0 fail("Adding CLUs to a non-existent CluSet (id='CLUSET-INVALID-ID') should have failed");
2140    } catch(DoesNotExistException e) {
2141  1 assertTrue(true);
2142    }
2143    }
2144   
 
2145  1 toggle @Test
2146    public void testAddCluSetToCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, CircularRelationshipException {
2147  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2148   
2149  1 StatusInfo status = client.addCluSetToCluSet(createdCluSet.getId(), "CLUSET-1");
2150  1 CluSetInfo getCluSetInfo = client.getCluSetInfo(createdCluSet.getId());
2151   
2152  1 assertTrue(status.getSuccess());
2153  1 assertEquals(1, getCluSetInfo.getCluSetIds().size());
2154  1 assertTrue(getCluSetInfo.getCluSetIds().contains("CLUSET-1"));
2155    }
2156   
 
2157  1 toggle @Test
2158    public void testAddCluSetToCluSet_CircularRelationshipException() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, CircularRelationshipException {
2159  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2160   
2161  1 try {
2162  1 client.addCluSetToCluSet(createdCluSet.getId(), createdCluSet.getId());
2163  0 fail("Adding a CluSet to itself should have failed");
2164    } catch(CircularRelationshipException e) {
2165  1 assertTrue(true);
2166    }
2167    }
2168   
 
2169  1 toggle @Test
2170    public void testAddCluSetToCluSet_NestedCircularRelationshipException() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, CircularRelationshipException {
2171  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2172  1 CluSetInfo createdCluSet2 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2173  1 CluSetInfo createdCluSet3 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2174   
2175  1 client.addCluSetToCluSet(createdCluSet3.getId(), createdCluSet1.getId());
2176  1 client.addCluSetToCluSet(createdCluSet2.getId(), createdCluSet3.getId());
2177   
2178  1 try {
2179  1 client.addCluSetToCluSet(createdCluSet1.getId(), createdCluSet2.getId());
2180  0 fail("Adding CluSet should have thrown a CircularRelationshipException");
2181    } catch(CircularRelationshipException e) {
2182  1 assertTrue(true);
2183    }
2184    }
2185   
 
2186  1 toggle @Test
2187    public void testAddCluSetToCluSet_DuplicateCluSetId() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, CircularRelationshipException {
2188  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2189   
2190  1 StatusInfo status = client.addCluSetToCluSet(createdCluSet.getId(), "CLUSET-1");
2191  1 assertTrue(status.getSuccess());
2192   
2193  1 try {
2194  1 client.addCluSetToCluSet(createdCluSet.getId(), "CLUSET-1");
2195  0 fail("Adding a duplicate CluSet (id='CLUSET-1') to CluSet should have failed");
2196    } catch(OperationFailedException e) {
2197  1 assertTrue(true);
2198    }
2199    }
2200   
 
2201  1 toggle @Test
2202    public void testAddCluSetToCluSet_InvalidCluSetId() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, CircularRelationshipException {
2203  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2204   
2205  1 try {
2206  1 client.addCluSetToCluSet(createdCluSet.getId(), "CLUSET-INVALID-ID");
2207  0 fail("Adding a non-existent CluSet (id='CLUSET-INVALID-ID') to CluSet should have failed");
2208    } catch(DoesNotExistException e) {
2209  1 assertTrue(true);
2210    }
2211    }
2212   
 
2213  1 toggle @Test
2214    public void testAddCluSetsToCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, CircularRelationshipException {
2215  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2216   
2217  1 List<String> cluIdList = Arrays.asList(new String[] {"CLUSET-1", "CLUSET-2", "CLUSET-3", "CLUSET-4"});
2218   
2219  1 StatusInfo status = client.addCluSetsToCluSet(createdCluSet.getId(), cluIdList);
2220  1 CluSetInfo getCluSetInfo = client.getCluSetInfo(createdCluSet.getId());
2221   
2222  1 assertTrue(status.getSuccess());
2223  1 assertEquals(4, getCluSetInfo.getCluSetIds().size());
2224  1 assertTrue(getCluSetInfo.getCluSetIds().contains("CLUSET-1"));
2225  1 assertTrue(getCluSetInfo.getCluSetIds().contains("CLUSET-2"));
2226  1 assertTrue(getCluSetInfo.getCluSetIds().contains("CLUSET-3"));
2227  1 assertTrue(getCluSetInfo.getCluSetIds().contains("CLUSET-4"));
2228    }
2229   
 
2230  1 toggle @Test
2231    public void testAddCluSetsToCluSet_InvalidCluSetId() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, CircularRelationshipException {
2232  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2233   
2234  1 List<String> cluIdList = Arrays.asList(new String[] {"CLUSET-1", "CLUSET-INVALID-ID", "CLUSET-3", "CLUSET-4"});
2235   
2236  1 try {
2237  1 client.addCluSetsToCluSet(createdCluSet.getId(), cluIdList);
2238  0 fail("Adding a non-existent CluSet (id='CLUSET-INVALID-ID') to CluSet should have failed");
2239    } catch(DoesNotExistException e) {
2240  1 assertTrue(true);
2241    }
2242    }
2243   
 
2244  1 toggle @Test
2245    public void testAddCluSetsToCluSet_DuplicateCluSetId() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, CircularRelationshipException {
2246  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2247   
2248  1 List<String> cluIdList = Arrays.asList(new String[] {"CLUSET-1", "CLUSET-2", "CLUSET-3", "CLUSET-2"});
2249   
2250  1 try {
2251  1 client.addCluSetsToCluSet(createdCluSet.getId(), cluIdList);
2252  0 fail("Adding a duplicate CluSet (id='CLUSET-2') to CluSet should have failed");
2253    } catch(OperationFailedException e) {
2254  1 assertTrue(true);
2255    }
2256    }
2257   
 
2258  1 toggle @Test
2259    public void testAddCluSetsToCluSet_CircularRelationshipException() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, CircularRelationshipException {
2260  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2261    // Adding createdCluSet to itself
2262  1 List<String> cluIdList = Arrays.asList(new String[] {"CLUSET-1", "CLUSET-2", createdCluSet.getId(), "CLUSET-4"});
2263   
2264  1 try {
2265  1 client.addCluSetsToCluSet(createdCluSet.getId(), cluIdList);
2266  0 fail("Adding a CluSet to itself should have failed");
2267    } catch(CircularRelationshipException e) {
2268  1 assertTrue(true);
2269    }
2270    }
2271   
 
2272  1 toggle @Test
2273    public void testAddCluSetsToCluSet_NestedCircularRelationshipException() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, CircularRelationshipException {
2274  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2275  1 CluSetInfo createdCluSet2 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2276  1 CluSetInfo createdCluSet3 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSetInfo());
2277   
2278  1 List<String> cluIdList1 = Arrays.asList(new String[] {"CLUSET-1", "CLUSET-2", createdCluSet1.getId()});
2279  1 client.addCluSetsToCluSet(createdCluSet3.getId(), cluIdList1);
2280   
2281    // Adding createdCluSet to itself
2282  1 List<String> cluIdList2 = Arrays.asList(new String[] {"CLUSET-1",createdCluSet3.getId()});
2283  1 client.addCluSetsToCluSet(createdCluSet2.getId(), cluIdList2);
2284   
2285  1 try {
2286  1 List<String> cluIdList3 = Arrays.asList(new String[] {createdCluSet2.getId(),});
2287  1 client.addCluSetsToCluSet(createdCluSet1.getId(), cluIdList3);
2288  0 fail("Adding CluSet should have thrown a CircularRelationshipException");
2289    } catch(CircularRelationshipException e) {
2290  1 assertTrue(true);
2291    }
2292    }
2293   
 
2294  1 toggle @Test
2295    public void testCreateDynamicCluSet_Simple() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2296  1 CluSetInfo cluSet = createCluSetInfo();
2297   
2298  1 MembershipQueryInfo query = new MembershipQueryInfo();
2299  1 query.setSearchTypeKey("lu.search.clus");
2300   
2301  1 cluSet.setMembershipQuery(query);
2302  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", cluSet);
2303   
2304  1 assertNotNull(createdCluSet);
2305  1 assertNotNull(createdCluSet.getMembershipQuery());
2306  1 assertNotNull(createdCluSet.getMembershipQuery().getId());
2307  1 assertNotNull(createdCluSet.getMembershipQuery().getSearchTypeKey());
2308  1 assertEquals(query.getSearchTypeKey(), createdCluSet.getMembershipQuery().getSearchTypeKey());
2309  1 assertNotNull(createdCluSet.getMembershipQuery().getQueryParamValueList());
2310  1 assertNotNull(createdCluSet.getCluIds());
2311  1 assertEquals(107, createdCluSet.getCluIds().size());
2312    }
2313   
 
2314  3 toggle private MembershipQueryInfo getMembershipQueryInfo() {
2315  3 List<SearchParam> queryParamValues = new ArrayList<SearchParam>();
2316  3 SearchParam sp1 = new SearchParam();
2317  3 sp1.setKey("lu.queryParam.startsWith.cluCode");
2318  3 sp1.setValue("AAST");
2319  3 queryParamValues.add(sp1);
2320  3 SearchParam sp2 = new SearchParam();
2321  3 sp2.setKey("lu.queryParam.cluState");
2322  3 sp2.setValue("Active");
2323  3 queryParamValues.add(sp2);
2324   
2325  3 MembershipQueryInfo query = new MembershipQueryInfo();
2326  3 query.setSearchTypeKey("lu.search.cluByCodeAndState");
2327  3 query.setQueryParamValueList(queryParamValues);
2328   
2329  3 return query;
2330    }
2331   
 
2332  1 toggle @Test
2333    public void testCreateDynamicCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2334  1 CluSetInfo cluSet = createCluSetInfo();
2335   
2336  1 MembershipQueryInfo query = getMembershipQueryInfo();
2337  1 cluSet.setMembershipQuery(query);
2338   
2339  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", cluSet);
2340   
2341  1 assertNotNull(createdCluSet);
2342  1 assertNotNull(createdCluSet.getMembershipQuery());
2343  1 assertNotNull(createdCluSet.getMembershipQuery().getId());
2344  1 assertNotNull(createdCluSet.getMembershipQuery().getSearchTypeKey());
2345  1 assertEquals(query.getSearchTypeKey(), createdCluSet.getMembershipQuery().getSearchTypeKey());
2346  1 assertNotNull(createdCluSet.getMembershipQuery().getQueryParamValueList());
2347  1 assertEquals(query.getQueryParamValueList().size(), createdCluSet.getMembershipQuery().getQueryParamValueList().size());
2348  1 assertNotNull(createdCluSet.getCluIds());
2349  1 assertEquals(10, createdCluSet.getCluIds().size());
2350   
2351  1 CluSetInfo getCluSet = client.getCluSetInfo(createdCluSet.getId());
2352   
2353  1 assertNotNull(getCluSet);
2354  1 assertNotNull(getCluSet.getMembershipQuery());
2355  1 assertNotNull(getCluSet.getMembershipQuery().getId());
2356  1 assertNotNull(getCluSet.getMembershipQuery().getSearchTypeKey());
2357  1 assertEquals(query.getSearchTypeKey(), getCluSet.getMembershipQuery().getSearchTypeKey());
2358  1 assertNotNull(getCluSet.getMembershipQuery().getQueryParamValueList());
2359  1 assertEquals(query.getQueryParamValueList().size(), getCluSet.getMembershipQuery().getQueryParamValueList().size());
2360  1 assertNotNull(getCluSet.getCluIds());
2361  1 assertEquals(10, getCluSet.getCluIds().size());
2362    }
2363   
 
2364  1 toggle @Test
2365    public void testCreateCluSet_InvalidCluSet1() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2366  1 CluSetInfo cluSet = createCluSetInfo();
2367  1 cluSet.getCluIds().add("CLU-1");
2368   
2369  1 MembershipQueryInfo query = new MembershipQueryInfo();
2370  1 query.setSearchTypeKey("lu.search.clus");
2371   
2372  1 cluSet.setMembershipQuery(query);
2373   
2374  1 try {
2375  1 client.createCluSet("kuali.cluSet.type.CreditCourse", cluSet);
2376  0 fail("Creating CluSet should have thrown an UnsupportedActionException. Cannot add CLUs and Dynamic CluSets into one CluSet");
2377    } catch (UnsupportedActionException e) {
2378  1 assertTrue(true);
2379    }
2380   
2381    }
2382   
 
2383  1 toggle @Test
2384    public void testCreateCluSet_InvalidCluSet2() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2385  1 CluSetInfo cluSet = createCluSetInfo();
2386  1 cluSet.getCluSetIds().add("CLUSET-1");
2387   
2388  1 MembershipQueryInfo query = new MembershipQueryInfo();
2389  1 query.setSearchTypeKey("lu.search.clus");
2390   
2391  1 cluSet.setMembershipQuery(query);
2392   
2393  1 try {
2394  1 client.createCluSet("kuali.cluSet.type.CreditCourse", cluSet);
2395  0 fail("Creating CluSet should have thrown an UnsupportedActionException. Cannot add CluSets and Dynamic CluSets into one CluSet");
2396    } catch (UnsupportedActionException e) {
2397  1 assertTrue(true);
2398    }
2399   
2400    }
2401   
 
2402  1 toggle @Test
2403    public void testCreateCluSet_InvalidCluSet3() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2404  1 CluSetInfo cluSet = createCluSetInfo();
2405  1 cluSet.getCluIds().add("CLU-1");
2406  1 cluSet.getCluSetIds().add("CLUSET-1");
2407   
2408  1 try {
2409  1 client.createCluSet("kuali.cluSet.type.CreditCourse", cluSet);
2410  0 fail("Creating CluSet should have thrown an UnsupportedActionException. Cannot add CLUs and CluSets into one CluSet");
2411    } catch (UnsupportedActionException e) {
2412  1 assertTrue(true);
2413    }
2414   
2415    }
2416   
 
2417  1 toggle @Test
2418    public void testGetDynamicCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2419  1 CluSetInfo cluSet = createCluSetInfo();
2420   
2421  1 MembershipQueryInfo query = getMembershipQueryInfo();
2422  1 cluSet.setMembershipQuery(query);
2423  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", cluSet);
2424  1 assertNotNull(createdCluSet);
2425  1 assertNotNull(createdCluSet.getCluIds());
2426   
2427  1 CluSetInfo getCluSet = client.getCluSetInfo(createdCluSet.getId());
2428   
2429  1 assertNotNull(getCluSet);
2430  1 assertNotNull(getCluSet.getMembershipQuery());
2431  1 assertNotNull(getCluSet.getMembershipQuery().getId());
2432  1 assertNotNull(getCluSet.getMembershipQuery().getSearchTypeKey());
2433  1 assertEquals(query.getSearchTypeKey(), getCluSet.getMembershipQuery().getSearchTypeKey());
2434  1 assertNotNull(getCluSet.getMembershipQuery().getQueryParamValueList());
2435  1 assertEquals(query.getQueryParamValueList().size(), getCluSet.getMembershipQuery().getQueryParamValueList().size());
2436  1 assertEquals(createdCluSet.getCluIds().size(), getCluSet.getCluIds().size());
2437  1 assertNotNull(getCluSet.getCluIds());
2438  1 assertEquals(10, getCluSet.getCluIds().size());
2439    }
2440   
 
2441  1 toggle @Test
2442    public void testGetDynamicCluSet_Simple() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException {
2443  1 CluSetInfo cluSet = createCluSetInfo();
2444   
2445  1 MembershipQueryInfo query = new MembershipQueryInfo();
2446  1 query.setSearchTypeKey("lu.search.clus");
2447   
2448  1 cluSet.setMembershipQuery(query);
2449  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", cluSet);
2450  1 assertNotNull(createdCluSet);
2451  1 assertNotNull(createdCluSet.getCluIds());
2452   
2453  1 CluSetInfo getCluSet = client.getCluSetInfo(createdCluSet.getId());
2454  1 assertNotNull(getCluSet);
2455  1 assertNotNull(getCluSet.getCluIds());
2456  1 assertEquals(createdCluSet.getCluIds().size(), getCluSet.getCluIds().size());
2457    }
2458   
 
2459  1 toggle @Test
2460    public void testGetCluSetTreeView() throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
2461  1 CluSetTreeViewInfo treeView = client.getCluSetTreeView("CLUSET-2");
2462  1 assertNotNull(treeView);
2463  1 assertEquals(2, treeView.getCluSets().size());
2464   
2465  1 CluSetTreeViewInfo cluSet = treeView.getCluSets().get(1);
2466  1 assertNotNull(cluSet);
2467  1 assertEquals("CLUSET-4", cluSet.getId());
2468  1 assertEquals(2, cluSet.getClus().size());
2469   
2470  1 CluInfo clu = cluSet.getClus().get(1);
2471  1 assertNotNull(clu);
2472  1 assertEquals("CLU-3", clu.getId());
2473    }
2474   
 
2475  1 toggle @Test
2476    public void testGetCluSetTreeView_dynamicCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, UnsupportedActionException, DoesNotExistException {
2477  1 CluSetInfo cluSet = createCluSetInfo();
2478   
2479  1 MembershipQueryInfo query = new MembershipQueryInfo();
2480  1 query.setSearchTypeKey("lu.search.clus");
2481   
2482  1 cluSet.setMembershipQuery(query);
2483  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", cluSet);
2484  1 assertNotNull(createdCluSet);
2485  1 assertNotNull(createdCluSet.getCluIds());
2486   
2487  1 CluSetTreeViewInfo treeView = client.getCluSetTreeView(createdCluSet.getId());
2488  1 assertNotNull(treeView);
2489  1 assertEquals(createdCluSet.getCluIds().size(), treeView.getClus().size());
2490    }
2491   
 
2492  1 toggle @Test
2493    public void testGetCluSetTreeView_invalidCluSet()
2494    throws InvalidParameterException, MissingParameterException,
2495    OperationFailedException, PermissionDeniedException {
2496  1 try {
2497  1 client.getCluSetTreeView("CLUSET-XX");
2498  0 assertTrue(false);
2499    } catch (DoesNotExistException e) {
2500  1 assertTrue(true);
2501    }
2502    }
2503   
 
2504  1 toggle @Test
2505    public void testGetCluSetTreeView_nullCluSet()
2506    throws DoesNotExistException, InvalidParameterException,
2507    OperationFailedException, PermissionDeniedException {
2508  1 try {
2509  1 client.getCluSetTreeView(null);
2510  0 assertTrue(false);
2511    } catch (MissingParameterException e) {
2512  1 assertTrue(true);
2513    }
2514    }
2515   
 
2516  1 toggle @Test
2517    public void testUpdateDynamicCluSet() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, VersionMismatchException, UnsupportedActionException, CircularRelationshipException {
2518  1 CluSetInfo cluSet1 = createCluSetInfo();
2519   
2520    //Create clu set
2521  1 List<SearchParam> queryParamValues1 = new ArrayList<SearchParam>();
2522  1 MembershipQueryInfo query1 = new MembershipQueryInfo();
2523  1 query1.setSearchTypeKey("lu.search.clus");
2524  1 query1.setQueryParamValueList(queryParamValues1);
2525   
2526  1 cluSet1.setMembershipQuery(query1);
2527    // Version 0
2528  1 CluSetInfo createdCluSet = client.createCluSet("kuali.cluSet.type.CreditCourse", cluSet1);
2529    // createdCluSet should be version 1 but is 0
2530   
2531    //Update clu set
2532  1 MembershipQueryInfo query2 = getMembershipQueryInfo();
2533   
2534  1 createdCluSet.setMembershipQuery(query2);
2535   
2536    // Dynamic CluSet so we can't have any CluSet ids or Clu ids
2537  1 createdCluSet.getCluSetIds().clear();
2538  1 createdCluSet.getCluIds().clear();
2539  1 CluSetInfo updatedCluSet = client.updateCluSet(createdCluSet.getId(), createdCluSet);
2540   
2541  1 assertNotNull(updatedCluSet);
2542  1 assertNotNull(updatedCluSet.getCluIds());
2543  1 assertEquals(10, updatedCluSet.getCluIds().size());
2544  1 assertTrue(updatedCluSet.getCluSetIds().isEmpty());
2545    }
2546   
 
2547  1 toggle @Test
2548    public void testUpdateCluSet_VersionMismatch() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, VersionMismatchException, CircularRelationshipException {
2549  1 CluSetInfo createCluSet = createCluSetInfo();
2550   
2551  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSet);
2552  1 createdCluSet1.getCluSetIds().add("CLUSET-1");
2553  1 createdCluSet1.getCluSetIds().add("CLUSET-2");
2554   
2555  1 CluSetInfo updatedCluSet1 = client.updateCluSet(createdCluSet1.getId(), createdCluSet1);
2556  1 assertEquals(2, updatedCluSet1.getCluSetIds().size());
2557   
2558  1 try {
2559  1 client.updateCluSet(updatedCluSet1.getId(), createdCluSet1);
2560  0 fail("Should have thrown VersionMismatchException.");
2561    } catch (VersionMismatchException e) {
2562  1 assertTrue(true);
2563    }
2564    }
2565   
 
2566  1 toggle @Test
2567    public void testUpdateCluSet_ClearCluSets() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, VersionMismatchException, CircularRelationshipException {
2568  1 CluSetInfo createCluSet = createCluSetInfo();
2569  1 createCluSet.getCluSetIds().add("CLUSET-1");
2570  1 createCluSet.getCluSetIds().add("CLUSET-2");
2571  1 createCluSet.getCluSetIds().add("CLUSET-3");
2572   
2573  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSet);
2574  1 assertEquals(3, createdCluSet1.getCluSetIds().size());
2575   
2576  1 createdCluSet1.getCluSetIds().clear();
2577   
2578  1 CluSetInfo updatedCluSet1 = client.updateCluSet(createdCluSet1.getId(), createdCluSet1);
2579  1 assertEquals(0, updatedCluSet1.getCluSetIds().size());
2580   
2581  1 CluSetInfo getCluSet1 = client.getCluSetInfo(updatedCluSet1.getId());
2582  1 assertEquals(0, getCluSet1.getCluSetIds().size());
2583    }
2584   
 
2585  1 toggle @Test
2586    public void testUpdateCluSet_AddCluSets() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, VersionMismatchException, CircularRelationshipException {
2587  1 CluSetInfo createCluSet = createCluSetInfo();
2588   
2589  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSet);
2590  1 assertEquals(0, createdCluSet1.getCluSetIds().size());
2591   
2592  1 createdCluSet1.getCluSetIds().add("CLUSET-1");
2593  1 createdCluSet1.getCluSetIds().add("CLUSET-2");
2594   
2595  1 CluSetInfo updatedCluSet1 = client.updateCluSet(createdCluSet1.getId(), createdCluSet1);
2596  1 assertEquals(2, updatedCluSet1.getCluSetIds().size());
2597   
2598  1 CluSetInfo getCluSet1 = client.getCluSetInfo(updatedCluSet1.getId());
2599  1 assertEquals(2, getCluSet1.getCluSetIds().size());
2600  1 assertTrue(getCluSet1.getCluSetIds().contains("CLUSET-1"));
2601  1 assertTrue(getCluSet1.getCluSetIds().contains("CLUSET-2"));
2602    }
2603   
 
2604  1 toggle @Test
2605    public void testUpdateCluSet_removeCluSets() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, VersionMismatchException, CircularRelationshipException {
2606  1 CluSetInfo createCluSet = createCluSetInfo();
2607  1 createCluSet.getCluSetIds().add("CLUSET-1");
2608  1 createCluSet.getCluSetIds().add("CLUSET-2");
2609  1 createCluSet.getCluSetIds().add("CLUSET-3");
2610   
2611  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSet);
2612  1 assertEquals(3, createdCluSet1.getCluSetIds().size());
2613   
2614  1 createdCluSet1.getCluSetIds().remove("CLUSET-2");
2615   
2616  1 CluSetInfo updatedCluSet1 = client.updateCluSet(createdCluSet1.getId(), createdCluSet1);
2617  1 assertEquals(2, updatedCluSet1.getCluSetIds().size());
2618   
2619  1 CluSetInfo getCluSet1 = client.getCluSetInfo(updatedCluSet1.getId());
2620  1 assertEquals(2, getCluSet1.getCluSetIds().size());
2621  1 assertTrue(getCluSet1.getCluSetIds().contains("CLUSET-1"));
2622  1 assertTrue(getCluSet1.getCluSetIds().contains("CLUSET-3"));
2623    }
2624   
 
2625  1 toggle @Test
2626    public void testUpdateCluSet_ClearClus() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, VersionMismatchException, CircularRelationshipException {
2627  1 CluSetInfo createCluSet = createCluSetInfo();
2628  1 createCluSet.getCluIds().add("CLU-1");
2629  1 createCluSet.getCluIds().add("CLU-2");
2630  1 assertEquals(2, createCluSet.getCluIds().size());
2631   
2632  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSet);
2633  1 assertEquals(2, createdCluSet1.getCluIds().size());
2634   
2635  1 assertNotNull(createdCluSet1);
2636  1 assertNotNull(createdCluSet1.getCluIds());
2637  1 assertEquals(2, createdCluSet1.getCluIds().size());
2638   
2639    // Remove all CLUs
2640  1 createdCluSet1.getCluIds().clear();
2641   
2642  1 CluSetInfo updatedCluSet1 = client.updateCluSet(createdCluSet1.getId(), createdCluSet1);
2643   
2644  1 assertNotNull(updatedCluSet1);
2645  1 assertNotNull(updatedCluSet1.getCluIds());
2646  1 assertEquals(0, updatedCluSet1.getCluIds().size());
2647   
2648  1 CluSetInfo getCluSet1 = client.getCluSetInfo(updatedCluSet1.getId());
2649   
2650  1 assertNotNull(getCluSet1);
2651  1 assertNotNull(getCluSet1.getCluIds());
2652  1 assertEquals(0, getCluSet1.getCluIds().size());
2653    }
2654   
 
2655  1 toggle @Test
2656    public void testUpdateCluSet_AddClu() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, VersionMismatchException, CircularRelationshipException {
2657  1 CluSetInfo createCluSet = createCluSetInfo();
2658  1 createCluSet.getCluIds().add("CLU-1");
2659  1 createCluSet.getCluIds().add("CLU-2");
2660  1 assertEquals(2, createCluSet.getCluIds().size());
2661   
2662  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSet);
2663  1 assertEquals(2, createdCluSet1.getCluIds().size());
2664   
2665  1 createdCluSet1.getCluIds().add("CLU-3");
2666   
2667  1 assertNotNull(createdCluSet1);
2668  1 assertNotNull(createdCluSet1.getCluIds());
2669  1 assertEquals(3, createdCluSet1.getCluIds().size());
2670   
2671  1 CluSetInfo updatedCluSet1 = client.updateCluSet(createdCluSet1.getId(), createdCluSet1);
2672   
2673  1 assertNotNull(updatedCluSet1);
2674  1 assertNotNull(updatedCluSet1.getCluIds());
2675  1 assertEquals(3, updatedCluSet1.getCluIds().size());
2676   
2677  1 CluSetInfo getCluSet1 = client.getCluSetInfo(updatedCluSet1.getId());
2678   
2679  1 assertNotNull(getCluSet1);
2680  1 assertNotNull(getCluSet1.getCluIds());
2681  1 assertEquals(3, getCluSet1.getCluIds().size());
2682    }
2683   
 
2684  1 toggle @Test
2685    public void testUpdateCluSet_RemoveClu() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, UnsupportedActionException, VersionMismatchException, CircularRelationshipException {
2686  1 CluSetInfo createCluSet = createCluSetInfo();
2687  1 createCluSet.getCluIds().add("CLU-1");
2688  1 createCluSet.getCluIds().add("CLU-2");
2689  1 assertEquals(2, createCluSet.getCluIds().size());
2690   
2691  1 CluSetInfo createdCluSet1 = client.createCluSet("kuali.cluSet.type.CreditCourse", createCluSet);
2692  1 assertEquals(2, createdCluSet1.getCluIds().size());
2693   
2694  1 createdCluSet1.getCluIds().remove("CLU-1");
2695   
2696  1 assertNotNull(createdCluSet1);
2697  1 assertNotNull(createdCluSet1.getCluIds());
2698  1 assertEquals(1, createdCluSet1.getCluIds().size());
2699   
2700  1 CluSetInfo updatedCluSet1 = client.updateCluSet(createdCluSet1.getId(), createdCluSet1);
2701   
2702  1 assertNotNull(updatedCluSet1);
2703  1 assertNotNull(updatedCluSet1.getCluIds());
2704  1 assertEquals(1, updatedCluSet1.getCluIds().size());
2705  1 assertTrue(updatedCluSet1.getCluIds().contains("CLU-2"));
2706   
2707  1 CluSetInfo getCluSet1 = client.getCluSetInfo(updatedCluSet1.getId());
2708   
2709  1 assertNotNull(getCluSet1);
2710  1 assertNotNull(getCluSet1.getCluIds());
2711  1 assertEquals(1, getCluSet1.getCluIds().size());
2712    }
2713   
 
2714  1 toggle @Test
2715    public void testCreateCluResult() throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException {
2716  1 CluResultInfo dto = new CluResultInfo();
2717  1 RichTextInfo desc = new RichTextInfo();
2718  1 desc.setPlain("Plain description");
2719  1 dto.setDesc(desc);
2720  1 dto.setCluId("CLU-1");
2721  1 dto.setState("active");
2722  1 dto.setType("kuali.resultType.gradeCourseResult");
2723  1 dto.setEffectiveDate(new Date());
2724  1 dto.setExpirationDate(new Date());
2725   
2726  1 CluResultInfo cluResult = client.createCluResult("CLU-1", "kuali.resultType.gradeCourseResult", dto);
2727   
2728  1 assertNotNull(cluResult);
2729  1 assertNotNull(cluResult.getDesc());
2730  1 assertEquals(dto.getDesc().getPlain(), cluResult.getDesc().getPlain());
2731  1 assertNotNull(cluResult.getId());
2732  1 assertNotNull(cluResult.getCluId());
2733  1 assertEquals(dto.getCluId(), cluResult.getCluId());
2734  1 assertNotNull(cluResult.getType());
2735  1 assertEquals(dto.getType(), cluResult.getType());
2736  1 assertEquals(dto.getEffectiveDate(), cluResult.getEffectiveDate());
2737  1 assertEquals(dto.getExpirationDate(), cluResult.getExpirationDate());
2738    }
2739   
 
2740  1 toggle @Test
2741    public void testUpdateCluResult() throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, VersionMismatchException {
2742  1 CluResultInfo dto = new CluResultInfo();
2743  1 RichTextInfo desc1 = new RichTextInfo();
2744  1 desc1.setPlain("Plain description");
2745  1 dto.setDesc(desc1);
2746  1 dto.setCluId("CLU-1");
2747  1 dto.setState("Suspended");
2748  1 dto.setType("kuali.resultType.gradeCourseResult");
2749  1 dto.setEffectiveDate(new Date());
2750  1 dto.setExpirationDate(new Date());
2751   
2752  1 List<ResultOptionInfo> resultOptions = new ArrayList<ResultOptionInfo>();
2753  1 ResultOptionInfo option = new ResultOptionInfo();
2754  1 RichTextInfo desc2 = new RichTextInfo();
2755  1 desc2.setPlain("Plain description");
2756  1 option.setDesc(desc2);
2757  1 option.setEffectiveDate(new Date());
2758  1 option.setExpirationDate(new Date());
2759  1 option.setResultComponentId("kuali.resultComponent.grade.letter");
2760  1 option.setResultUsageTypeKey(null);
2761  1 option.setState("Suspended");
2762  1 resultOptions.add(option);
2763   
2764  1 dto.setResultOptions(resultOptions);
2765   
2766  1 CluResultInfo createCluResult = client.createCluResult("CLU-1", "kuali.resultType.gradeCourseResult", dto);
2767  1 createCluResult = client.getCluResult(createCluResult.getId());
2768   
2769  1 assertNotNull(createCluResult);
2770   
2771  1 createCluResult.setCluId("CLU-2");
2772  1 RichTextInfo desc3 = new RichTextInfo();
2773  1 desc3.setPlain("Plain description again");
2774  1 createCluResult.setDesc(desc3);
2775  1 createCluResult.setEffectiveDate(new Date());
2776  1 createCluResult.setExpirationDate(new Date());
2777  1 createCluResult.setState("active");
2778  1 createCluResult.setType("kuali.resultType.creditCourseResult");
2779   
2780  1 RichTextInfo desc4 = new RichTextInfo();
2781  1 desc4.setPlain("Some more plain description");
2782  1 createCluResult.getResultOptions().get(0).setDesc(desc4);
2783  1 createCluResult.getResultOptions().get(0).setEffectiveDate(new Date());
2784  1 createCluResult.getResultOptions().get(0).setExpirationDate(new Date());
2785  1 createCluResult.getResultOptions().get(0).setResultComponentId("kuali.resultComponent.grade.passFail");
2786  1 createCluResult.getResultOptions().get(0).setResultUsageTypeKey("lrType.finalGrade");
2787  1 createCluResult.getResultOptions().get(0).setState("active");
2788   
2789  1 CluResultInfo updateCluResult = client.updateCluResult(createCluResult.getId(), createCluResult);
2790  1 updateCluResult = client.getCluResult(updateCluResult.getId());
2791   
2792  1 assertNotNull(updateCluResult);
2793  1 assertEquals(createCluResult.getId(), updateCluResult.getId());
2794  1 assertEquals(createCluResult.getDesc().getPlain(), updateCluResult.getDesc().getPlain());
2795  1 assertEquals(createCluResult.getEffectiveDate(), updateCluResult.getEffectiveDate());
2796  1 assertEquals(createCluResult.getExpirationDate(), updateCluResult.getExpirationDate());
2797  1 assertEquals(createCluResult.getState(), updateCluResult.getState());
2798  1 assertEquals(createCluResult.getType(), updateCluResult.getType());
2799  1 assertEquals(createCluResult.getResultOptions().get(0).getId(), updateCluResult.getResultOptions().get(0).getId());
2800  1 assertEquals(createCluResult.getResultOptions().get(0).getDesc().getPlain(), updateCluResult.getResultOptions().get(0).getDesc().getPlain());
2801  1 assertEquals(createCluResult.getResultOptions().get(0).getEffectiveDate(), updateCluResult.getResultOptions().get(0).getEffectiveDate());
2802  1 assertEquals(createCluResult.getResultOptions().get(0).getExpirationDate(), updateCluResult.getResultOptions().get(0).getExpirationDate());
2803  1 assertEquals(createCluResult.getResultOptions().get(0).getResultComponentId(), updateCluResult.getResultOptions().get(0).getResultComponentId());
2804  1 assertEquals(createCluResult.getResultOptions().get(0).getResultUsageTypeKey(), updateCluResult.getResultOptions().get(0).getResultUsageTypeKey());
2805  1 assertEquals(createCluResult.getResultOptions().get(0).getState(), updateCluResult.getResultOptions().get(0).getState());
2806    }
2807   
 
2808  1 toggle @Test
2809    public void testUpdateCluResult_RemoveAllCluResultOptions() throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, VersionMismatchException {
2810  1 CluResultInfo dto = new CluResultInfo();
2811  1 RichTextInfo desc1 = new RichTextInfo();
2812  1 desc1.setPlain("Plain description");
2813  1 dto.setDesc(desc1);
2814  1 dto.setCluId("CLU-1");
2815  1 dto.setState("Suspended");
2816  1 dto.setType("kuali.resultType.gradeCourseResult");
2817  1 dto.setEffectiveDate(new Date());
2818  1 dto.setExpirationDate(new Date());
2819   
2820  1 List<ResultOptionInfo> resultOptions = new ArrayList<ResultOptionInfo>();
2821  1 ResultOptionInfo option = new ResultOptionInfo();
2822  1 RichTextInfo desc2 = new RichTextInfo();
2823  1 desc2.setPlain("Plain description");
2824  1 option.setDesc(desc2);
2825  1 option.setEffectiveDate(new Date());
2826  1 option.setExpirationDate(new Date());
2827  1 option.setResultComponentId("kuali.resultComponent.grade.letter");
2828    //option.setResultUsageTypeKey("lrType.finalGrade");
2829  1 option.setState("Suspended");
2830  1 resultOptions.add(option);
2831   
2832  1 dto.setResultOptions(resultOptions);
2833   
2834  1 CluResultInfo createCluResult = client.createCluResult("CLU-1", "kuali.resultType.gradeCourseResult", dto);
2835  1 createCluResult = client.getCluResult(createCluResult.getId());
2836   
2837  1 assertNotNull(createCluResult);
2838   
2839    // Clear all cluResultOptions
2840  1 createCluResult.getResultOptions().clear();
2841   
2842  1 CluResultInfo updateCluResult = client.updateCluResult(createCluResult.getId(), createCluResult);
2843  1 updateCluResult = client.getCluResult(updateCluResult.getId());
2844   
2845  1 assertNotNull(updateCluResult);
2846  1 assertEquals(createCluResult.getId(), updateCluResult.getId());
2847  1 assertEquals(createCluResult.getResultOptions().isEmpty(), updateCluResult.getResultOptions().isEmpty());
2848    }
2849   
 
2850  1 toggle @Test
2851    public void testVersioning() throws ParseException, AlreadyExistsException, DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, VersionMismatchException, IllegalVersionSequencingException{
2852  1 CluInfo clu = createCluInfo();
2853  1 clu.setType("luType.shell.course");
2854  1 CluInfo cluV1 = client.createClu(clu.getType(), clu);
2855   
2856  1 try{
2857    //Try to set the start date in the past
2858  1 client.setCurrentCluVersion(cluV1.getId(), DF.parse("19000101"));
2859  0 assertTrue(false);
2860    }catch(Exception e){}
2861   
2862  1 CluInfo justMadeCurrentClu = client.getClu(cluV1.getId());
2863  1 assertTrue(justMadeCurrentClu.getVersionInfo().getCurrentVersionStart().compareTo(new Date())<1);
2864  1 VersionDisplayInfo versionDisplayInfo = client.getCurrentVersion(LuServiceConstants.CLU_NAMESPACE_URI, justMadeCurrentClu.getVersionInfo().getVersionIndId());
2865    //Try to make a new versions from the current version
2866  1 CluInfo cluV2 = client.createNewCluVersion(cluV1.getVersionInfo().getVersionIndId(),"CommentA");
2867  1 CluInfo cluV3 = client.createNewCluVersion(cluV1.getVersionInfo().getVersionIndId(),"CommentB");
2868  1 versionDisplayInfo = client.getCurrentVersion(LuServiceConstants.CLU_NAMESPACE_URI, cluV1.getVersionInfo().getVersionIndId());
2869  1 assertEquals(cluV1.getId(),versionDisplayInfo.getId());
2870  1 assertEquals(cluV1.getVersionInfo().getVersionIndId(),cluV2.getVersionInfo().getVersionIndId());
2871  1 assertEquals(cluV1.getVersionInfo().getVersionIndId(),cluV3.getVersionInfo().getVersionIndId());
2872  1 client.setCurrentCluVersion(cluV3.getId(), null);
2873  1 versionDisplayInfo = client.getCurrentVersion(LuServiceConstants.CLU_NAMESPACE_URI, cluV1.getVersionInfo().getVersionIndId());
2874  1 assertEquals(versionDisplayInfo.getId(),cluV3.getId());
2875   
2876   
2877  1 SearchRequest searchRequest = new SearchRequest();
2878  1 SearchParam param = new SearchParam();
2879  1 param.setKey("lu.queryParam.cluVersionIndId");
2880  1 param.setValue(versionDisplayInfo.getVersionIndId());
2881  1 searchRequest.getParams().add(param);
2882  1 searchRequest.setSearchKey("lu.search.clu.versions");
2883  1 SearchResult searchResult = client.search(searchRequest);
2884  1 assertEquals(3,searchResult.getRows().size());
2885   
2886    }
2887   
 
2888  38 toggle private CluSetInfo createCluSetInfo() throws ParseException {
2889  38 CluSetInfo cluSetInfo = new CluSetInfo();
2890   
2891  38 RichTextInfo desc = new RichTextInfo();
2892  38 desc.setFormatted("<p>Formatted Desc</p>");
2893  38 desc.setPlain("plain");
2894  38 cluSetInfo.setDescr(desc);
2895  38 cluSetInfo.setEffectiveDate(DF.parse("20080101"));
2896  38 cluSetInfo.setExpirationDate(DF.parse("20180101"));
2897  38 cluSetInfo.setName("Clu set name");
2898  38 cluSetInfo.setState ("draft");
2899  38 cluSetInfo.setType ("kuali.cluset.course");
2900  38 return cluSetInfo;
2901    }
2902   
 
2903  2 toggle private CluInfo createCluInfo() throws ParseException {
2904  2 CluInfo clu = new CluInfo();
2905   
2906  2 CluAccountingInfo accountingInfo = new CluAccountingInfo();
2907  2 accountingInfo.getAttributes().put("AccountingAttrKey1",
2908    "AccountingAttrValue1");
2909  2 accountingInfo.getAttributes().put("AccountingAttrKey2",
2910    "AccountingAttrValue2");
2911  2 clu.setAccountingInfo(accountingInfo);
2912   
2913  2 CluIdentifierInfo officialIdentifier = new CluIdentifierInfo();
2914  2 officialIdentifier.setCode("offId-code");
2915  2 officialIdentifier.setDivision("offId-division");
2916  2 officialIdentifier.setLevel("offId-level");
2917  2 officialIdentifier.setLongName("offId-longName");
2918  2 officialIdentifier.setShortName("offId-shortName");
2919  2 officialIdentifier.setState("offId-state");
2920  2 officialIdentifier.setType("offId-type");
2921  2 officialIdentifier.setVariation("offId-variation");
2922  2 officialIdentifier.setSuffixCode("offId-suffixcode");
2923  2 officialIdentifier.setOrgId("offId-orgid");
2924  2 clu.setOfficialIdentifier(officialIdentifier);
2925   
2926  2 CluIdentifierInfo cluId1 = new CluIdentifierInfo();
2927  2 cluId1.setCode("cluId1-code");
2928  2 cluId1.setDivision("cluId1-division");
2929  2 cluId1.setLevel("cluId1-level");
2930  2 cluId1.setLongName("cluId1-longName");
2931  2 cluId1.setShortName("cluId1-shortName");
2932  2 cluId1.setState("cluId1-state");
2933  2 cluId1.setType("cluId1-type");
2934  2 cluId1.setVariation("cluId1-variation");
2935  2 cluId1.setSuffixCode("cluId1-suffixcode");
2936  2 cluId1.setOrgId("cluId1-orgid");
2937  2 clu.getAlternateIdentifiers().add(cluId1);
2938   
2939  2 CluIdentifierInfo cluId2 = new CluIdentifierInfo();
2940  2 cluId2.setCode("cluId2-code");
2941  2 cluId2.setDivision("cluId2-division");
2942  2 cluId2.setLevel("cluId2-level");
2943  2 cluId2.setLongName("cluId2-longName");
2944  2 cluId2.setShortName("cluId2-shortName");
2945  2 cluId2.setState("cluId2-state");
2946  2 cluId2.setType("cluId2-type");
2947  2 cluId2.setVariation("cluId2-variation");
2948  2 cluId2.setSuffixCode("cluId2-suffixcode");
2949  2 cluId2.setOrgId("cluId2-orgid");
2950  2 clu.getAlternateIdentifiers().add(cluId2);
2951   
2952  2 clu.getAttributes().put("cluAttrKey1", "cluAttrValue1");
2953  2 clu.getAttributes().put("cluAttrKey2", "cluAttrValue2");
2954   
2955  2 clu.setCanCreateLui(true);
2956   
2957  2 clu.setDefaultEnrollmentEstimate(545);
2958  2 clu.setDefaultMaximumEnrollment(999);
2959   
2960  2 RichTextInfo desc = new RichTextInfo();
2961  2 desc.setFormatted("<p>DESC FORMATTED</p>");
2962  2 desc.setPlain("DESC PLAIN");
2963  2 clu.setDescr(desc);
2964   
2965  2 clu.setEffectiveDate(DF.parse("20100203"));
2966  2 clu.setExpirationDate(DF.parse("21001231"));
2967   
2968  2 clu.setEnrollable(true);
2969  2 clu.setHazardousForDisabledStudents(true);
2970   
2971  2 AffiliatedOrgInfo aforg = new AffiliatedOrgInfo();
2972  2 aforg.setOrgId("AFF-ORG1");
2973  2 aforg.setPercentage(35l);
2974   
2975  2 AffiliatedOrgInfo aforg1 = new AffiliatedOrgInfo();
2976  2 aforg1.setOrgId("AFF-ORG2");
2977  2 aforg1.setPercentage(65l);
2978   
2979  2 List<AffiliatedOrgInfo> affiliatedOrgs = new ArrayList<AffiliatedOrgInfo>();
2980  2 affiliatedOrgs.add(aforg);
2981  2 affiliatedOrgs.add(aforg1);
2982   
2983  2 CurrencyAmountInfo ca = new CurrencyAmountInfo();
2984  2 ca.setCurrencyQuantity(100);
2985  2 ca.setCurrencyTypeKey("DLLR");
2986   
2987  2 CurrencyAmountInfo ca1 = new CurrencyAmountInfo();
2988  2 ca.setCurrencyQuantity(200);
2989  2 ca.setCurrencyTypeKey("DLLR");
2990   
2991  2 List<CurrencyAmountInfo> caList = new ArrayList<CurrencyAmountInfo>();
2992  2 caList.add(ca);
2993   
2994  2 List<CurrencyAmountInfo> caList1 = new ArrayList<CurrencyAmountInfo>();
2995  2 caList.add(ca);
2996  2 caList.add(ca1);
2997   
2998  2 RichTextInfo cfRecDesc = new RichTextInfo();
2999  2 cfRecDesc.setPlain("Clu Fee Record");
3000   
3001  2 CluFeeRecordInfo feeRec = new CluFeeRecordInfo();
3002  2 feeRec.setAffiliatedOrgs(affiliatedOrgs);
3003  2 feeRec.setFeeAmounts(caList);
3004  2 feeRec.setFeeType("FEE-TYPE-X");
3005  2 feeRec.setRateType("RATE-TYPE-X");
3006  2 feeRec.setDescr(cfRecDesc);
3007   
3008  2 CluFeeRecordInfo feeRec1 = new CluFeeRecordInfo();
3009  2 feeRec1.setAffiliatedOrgs(affiliatedOrgs);
3010  2 feeRec1.setFeeAmounts(caList1);
3011  2 feeRec1.setFeeType("FEE-TYPE-Y");
3012  2 feeRec1.setRateType("RATE-TYPE-Y");
3013   
3014  2 List<CluFeeRecordInfo> feeRecList = new ArrayList<CluFeeRecordInfo>();
3015  2 feeRecList.add(feeRec);
3016  2 feeRecList.add(feeRec1);
3017   
3018  2 RichTextInfo cfDesc = new RichTextInfo();
3019  2 cfDesc.setPlain("Clu Fee");
3020   
3021  2 CluFeeInfo feeInfo = new CluFeeInfo();
3022  2 feeInfo.getAttributes().put("FeeAttrKey1", "FeeAttrValue1");
3023  2 feeInfo.getAttributes().put("FeeAttrKey2", "FeeAttrValue2");
3024  2 feeInfo.setCluFeeRecords(feeRecList);
3025  2 feeInfo.setDescr(cfDesc);
3026  2 clu.setFeeInfo(feeInfo);
3027   
3028  2 clu.setHasEarlyDropDeadline(true);
3029   
3030  2 clu.setHazardousForDisabledStudents(true);
3031   
3032  2 CluInstructorInfo primaryInstructor = new CluInstructorInfo();
3033  2 primaryInstructor.setOrgId("EXT-orgId-1");
3034  2 primaryInstructor.setPersonId("EXT-personId-1");
3035  2 primaryInstructor.getAttributes().put("PrimaryInstAttrKey1",
3036    "PrimaryInstAttrValue1");
3037  2 primaryInstructor.getAttributes().put("PrimaryInstAttrKey2",
3038    "PrimaryInstAttrValue2");
3039  2 clu.setPrimaryInstructor(primaryInstructor);
3040   
3041  2 CluInstructorInfo instructor1 = new CluInstructorInfo();
3042  2 instructor1.setOrgId("EXT-orgId-2");
3043  2 instructor1.setPersonId("EXT-personId-2");
3044  2 instructor1.getAttributes().put("Inst1AttrKey1", "Inst1AttrValue1");
3045  2 instructor1.getAttributes().put("Inst1AttrKey2", "Inst1AttrValue2");
3046  2 clu.getInstructors().add(instructor1);
3047   
3048  2 CluInstructorInfo instructor2 = new CluInstructorInfo();
3049  2 instructor2.setOrgId("EXT-orgId-3");
3050  2 instructor2.setPersonId("EXT-personId-3");
3051  2 instructor2.getAttributes().put("Inst2AttrKey1", "Inst2AttrValue1");
3052  2 instructor2.getAttributes().put("Inst2AttrKey2", "Inst2AttrValue2");
3053  2 clu.getInstructors().add(instructor2);
3054   
3055  2 LuCodeInfo luCode1 = new LuCodeInfo();
3056  2 luCode1.setId("luCode1.key");
3057  2 luCode1.setDescr("luCode1-desc");
3058  2 luCode1.setValue("luCode1-value");
3059  2 luCode1.getAttributes().put("luCode1AttrKey1", "luCode1AttrValue1");
3060  2 luCode1.getAttributes().put("luCode1AttrKey2", "luCode1AttrValue2");
3061  2 luCode1.setType("kuali.someKindOfLuCode");
3062  2 clu.getLuCodes().add(luCode1);
3063   
3064  2 LuCodeInfo luCode2 = new LuCodeInfo();
3065  2 luCode2.setId("luCode2.key");
3066  2 luCode2.setDescr("luCode2-desc");
3067  2 luCode2.setValue("luCode2-value");
3068  2 luCode2.getAttributes().put("luCode2AttrKey1", "luCode2AttrValue1");
3069  2 luCode2.getAttributes().put("luCode2AttrKey2", "luCode2AttrValue2");
3070  2 luCode2.setType("kuali.someKindOfLuCode");
3071  2 clu.getLuCodes().add(luCode2);
3072   
3073  2 RichTextInfo marketingDesc = new RichTextInfo();
3074  2 marketingDesc.setFormatted("<p>marketingDesc FORMATTED</p>");
3075  2 marketingDesc.setPlain("marketingDesc PLAIN");
3076   
3077  2 clu.setNextReviewPeriod("nextReviewPeriod");
3078   
3079  2 clu.getOfferedAtpTypes().add("offeredAtpType1");
3080  2 clu.getOfferedAtpTypes().add("offeredAtpType2");
3081   
3082   
3083  2 CluInstructorInfo pubPrimaryInstructor = new CluInstructorInfo();
3084  2 pubPrimaryInstructor.setOrgId("EXT-orgId-234");
3085  2 pubPrimaryInstructor.setPersonId("EXT-personId-2451");
3086  2 pubPrimaryInstructor.getAttributes().put("PubPrimaryInstAttrKey1",
3087    "PubPrimaryInstAttrValue1");
3088  2 pubPrimaryInstructor.getAttributes().put("PubPrimaryInstAttrKey2",
3089    "PubPrimaryInstAttrValue2");
3090   
3091  2 CluInstructorInfo pubInstructor1 = new CluInstructorInfo();
3092  2 pubInstructor1.setOrgId("EXT-orgId-2");
3093  2 pubInstructor1.setPersonId("EXT-personId-2");
3094  2 pubInstructor1.getAttributes().put("PubInst1AttrKey1",
3095    "PubInst1AttrValue1");
3096  2 pubInstructor1.getAttributes().put("PubInst1AttrKey2",
3097    "PubInst1AttrValue2");
3098   
3099  2 CluInstructorInfo pubInstructor2 = new CluInstructorInfo();
3100  2 pubInstructor2.setOrgId("EXT-orgId-3");
3101  2 pubInstructor2.setPersonId("EXT-personId-3");
3102  2 pubInstructor2.getAttributes().put("PubInst2AttrKey1",
3103    "PubInst2AttrValue1");
3104  2 pubInstructor2.getAttributes().put("PubInst2AttrKey2",
3105    "PubInst2AttrValue2");
3106   
3107  2 clu.setReferenceURL("http://student.kuali.org/clus");
3108   
3109  2 clu.setState("Clu-state");
3110   
3111  2 TimeAmountInfo stdDuration = new TimeAmountInfo();
3112  2 stdDuration.setAtpDurationTypeKey("EXT-stdDuration-Id1");
3113  2 stdDuration.setTimeQuantity(new Integer(7867));
3114  2 clu.setStdDuration(stdDuration);
3115   
3116  2 clu.setType("kuali.SomeKindOfClu");
3117   
3118  2 createCampusLocationList(clu);
3119   
3120  2 createIntensity(clu);
3121   
3122  2 createAccreditationList(clu);
3123   
3124  2 createAdminOrgs(clu);
3125   
3126  2 return clu;
3127    }
3128   
 
3129  3 toggle private void createAdminOrgs(CluInfo clu) {
3130  3 AdminOrgInfo adminOrg = new AdminOrgInfo();
3131  3 adminOrg.setOrgId("PRIMARY-ADMIN-ORG-ID");
3132  3 adminOrg.getAttributes().put("PrimaryAdminOrgAttrKey1",
3133    "PrimaryAdminOrgAttrValue1");
3134  3 adminOrg.getAttributes().put("PrimaryAdminOrgAttrKey2",
3135    "PrimaryAdminOrgAttrValue2");
3136  3 adminOrg.setType("kuali.altadminType1");
3137   
3138  3 clu.getAdminOrgs().add(adminOrg);
3139  3 AdminOrgInfo altAdminOrg1 = new AdminOrgInfo();
3140  3 altAdminOrg1.setOrgId("ALT-ADMIN-ORG-ID1");
3141  3 altAdminOrg1.getAttributes().put("AltAdminOrg1AttrKey1",
3142    "AltAdminOrg1AttrValue1");
3143  3 altAdminOrg1.getAttributes().put("AltAdminOrg1AttrKey2",
3144    "AltAdminOrg1AttrValue2");
3145  3 altAdminOrg1.getAttributes().put("AltAdminOrg1AttrKey3",
3146    "AltAdminOrg1AttrValue3");
3147  3 altAdminOrg1.setType("kuali.altadminType1");
3148   
3149  3 AdminOrgInfo altAdminOrg2 = new AdminOrgInfo();
3150  3 altAdminOrg2.setOrgId("ALT-ADMIN-ORG-ID2");
3151  3 altAdminOrg2.getAttributes().put("AltAdminOrg2AttrKey1",
3152    "AltAdminOrg2AttrValue1");
3153  3 altAdminOrg2.getAttributes().put("AltAdminOrg2AttrKey2",
3154    "AltAdminOrg2AttrValue2");
3155  3 altAdminOrg2.setType("kuali.altadminType1");
3156   
3157  3 clu.getAdminOrgs().add(altAdminOrg1);
3158  3 clu.getAdminOrgs().add(altAdminOrg2);
3159   
3160    }
3161   
 
3162  1 toggle private void checkAdminOrgsCreate(CluInfo clu) {
3163   
3164  1 assertEquals("PRIMARY-ADMIN-ORG-ID", clu.getAdminOrgs().get(0)
3165    .getOrgId());
3166  1 assertEquals(2, clu.getAdminOrgs().get(0).getAttributes().size());
3167  1 assertEquals("PrimaryAdminOrgAttrValue1", clu.getAdminOrgs().get(0)
3168    .getAttributes().get("PrimaryAdminOrgAttrKey1"));
3169  1 assertEquals("PrimaryAdminOrgAttrValue2", clu.getAdminOrgs().get(0)
3170    .getAttributes().get("PrimaryAdminOrgAttrKey2"));
3171   
3172  1 assertEquals("ALT-ADMIN-ORG-ID1", clu.getAdminOrgs().get(1)
3173    .getOrgId());
3174  1 assertEquals(3, clu.getAdminOrgs().get(1).getAttributes()
3175    .size());
3176  1 assertEquals("AltAdminOrg1AttrValue1", clu.getAdminOrgs().get(
3177    1).getAttributes().get("AltAdminOrg1AttrKey1"));
3178  1 assertEquals("AltAdminOrg1AttrValue2", clu.getAdminOrgs().get(
3179    1).getAttributes().get("AltAdminOrg1AttrKey2"));
3180  1 assertEquals("AltAdminOrg1AttrValue3", clu.getAdminOrgs().get(
3181    1).getAttributes().get("AltAdminOrg1AttrKey3"));
3182   
3183  1 assertEquals("ALT-ADMIN-ORG-ID2", clu.getAdminOrgs().get(2)
3184    .getOrgId());
3185  1 assertEquals(2, clu.getAdminOrgs().get(2).getAttributes()
3186    .size());
3187  1 assertEquals("AltAdminOrg2AttrValue1", clu.getAdminOrgs().get(
3188    2).getAttributes().get("AltAdminOrg2AttrKey1"));
3189  1 assertEquals("AltAdminOrg2AttrValue2", clu.getAdminOrgs().get(
3190    2).getAttributes().get("AltAdminOrg2AttrKey2"));
3191    }
3192   
 
3193  1 toggle private void updateAdminOrgs(CluInfo clu) {
3194    // clu.getAdminOrgs().get(0).setId("adminOrg121");
3195  1 clu.getAdminOrgs().get(0).setOrgId("UPD-PRIMARY-ADMIN-ORG-ID");
3196  1 clu.getAdminOrgs().get(0).getAttributes().put("PrimaryAdminOrgAttrKey3",
3197    "PrimaryAdminOrgAttrValue3");
3198  1 clu.getAdminOrgs().get(0).getAttributes().remove(
3199    "PrimaryAdminOrgAttrKey2");
3200  1 clu.getAdminOrgs().get(0).getAttributes().put("PrimaryAdminOrgAttrKey4",
3201    "PrimaryAdminOrgAttrValue4");
3202   
3203  1 AdminOrgInfo altAdminOrg3 = new AdminOrgInfo();
3204  1 altAdminOrg3.setOrgId("UPD-ADMIN-ORG-ID3");
3205  1 altAdminOrg3.getAttributes().put("UPDAdminOrg3AttrKey1",
3206    "UPDAdminOrg3AttrKey1");
3207  1 altAdminOrg3.getAttributes().put("UPDAdminOrg3AttrKey2",
3208    "UPDAdminOrg3AttrKey1");
3209  1 altAdminOrg3.setType("kuali.testType");
3210   
3211  1 clu.getAdminOrgs().remove(1);
3212  1 clu.getAdminOrgs().add(altAdminOrg3);
3213    }
3214   
 
3215  1 toggle private void checkAdminOrgUpdate(CluInfo clu) {
3216   
3217  1 assertEquals("UPD-PRIMARY-ADMIN-ORG-ID", clu.getAdminOrgs().get(0)
3218    .getOrgId());
3219  1 assertEquals(3, clu.getAdminOrgs().get(0).getAttributes().size());
3220  1 assertEquals("PrimaryAdminOrgAttrValue4", clu.getAdminOrgs().get(0)
3221    .getAttributes().get("PrimaryAdminOrgAttrKey4"));
3222  1 assertNull(clu.getAdminOrgs().get(0).getAttributes().get(
3223    "PrimaryAdminOrgAttrKey2"));
3224  1 assertEquals(3, clu.getAdminOrgs().size());
3225  1 assertEquals("UPD-PRIMARY-ADMIN-ORG-ID", clu.getAdminOrgs().get(0)
3226    .getOrgId());
3227  1 assertEquals(3, clu.getAdminOrgs().get(0).getAttributes()
3228    .size());
3229  1 assertEquals("PrimaryAdminOrgAttrValue1", clu.getAdminOrgs().get(
3230    0).getAttributes().get("PrimaryAdminOrgAttrKey1"));
3231  1 assertEquals("PrimaryAdminOrgAttrValue4", clu.getAdminOrgs().get(
3232    0).getAttributes().get("PrimaryAdminOrgAttrKey4"));
3233  1 assertEquals("PrimaryAdminOrgAttrValue3", clu.getAdminOrgs().get(
3234    0).getAttributes().get("PrimaryAdminOrgAttrKey3"));
3235  1 assertEquals("ALT-ADMIN-ORG-ID2", clu.getAdminOrgs().get(1)
3236    .getOrgId());
3237  1 assertEquals(2, clu.getAdminOrgs().get(1).getAttributes()
3238    .size());
3239  1 assertEquals("AltAdminOrg2AttrValue2", clu.getAdminOrgs().get(
3240    1).getAttributes().get("AltAdminOrg2AttrKey2"));
3241  1 assertEquals("AltAdminOrg2AttrValue1", clu.getAdminOrgs().get(
3242    1).getAttributes().get("AltAdminOrg2AttrKey1"));
3243    }
3244   
 
3245  3 toggle private void createAccreditationList(CluInfo clu) throws ParseException {
3246  3 AccreditationInfo accreditationOrg1 = new AccreditationInfo();
3247  3 accreditationOrg1.setOrgId("EXT-orgId-1");
3248  3 accreditationOrg1.setEffectiveDate(DF.parse("20100203"));
3249  3 accreditationOrg1.setExpirationDate(DF.parse("21001231"));
3250  3 accreditationOrg1.getAttributes().put("Accred1AttrKey1",
3251    "Accred1AttrValue1");
3252  3 accreditationOrg1.getAttributes().put("Accred1AttrKey2",
3253    "Accred1AttrValue2");
3254   
3255  3 AccreditationInfo accreditationOrg2 = new AccreditationInfo();
3256  3 accreditationOrg2.setOrgId("EXT-orgId-2");
3257  3 accreditationOrg2.setEffectiveDate(DF.parse("20110203"));
3258  3 accreditationOrg2.setExpirationDate(DF.parse("21011231"));
3259  3 accreditationOrg2.getAttributes().put("Accred2AttrKey1",
3260    "Accred2AttrValue1");
3261  3 accreditationOrg2.getAttributes().put("Accred2AttrKey2",
3262    "Accred2AttrValue2");
3263   
3264  3 clu.getAccreditations().add(accreditationOrg1);
3265  3 clu.getAccreditations().add(accreditationOrg2);
3266    }
3267   
 
3268  1 toggle private void checkAccreditationListCreate(CluInfo clu)
3269    throws ParseException {
3270   
3271  1 assertEquals(2, clu.getAccreditations().size());
3272   
3273  1 assertEquals("EXT-orgId-1", clu.getAccreditations().get(0)
3274    .getOrgId());
3275  1 assertEquals(DF.parse("20100203"), clu.getAccreditations().get(0)
3276    .getEffectiveDate());
3277  1 assertEquals(DF.parse("21001231"), clu.getAccreditations().get(0)
3278    .getExpirationDate());
3279  1 assertEquals(2, clu.getAccreditations().get(0).getAttributes()
3280    .size());
3281  1 assertEquals("Accred1AttrValue1", clu.getAccreditations().get(0)
3282    .getAttributes().get("Accred1AttrKey1"));
3283  1 assertEquals("Accred1AttrValue2", clu.getAccreditations().get(0)
3284    .getAttributes().get("Accred1AttrKey2"));
3285   
3286  1 assertEquals("EXT-orgId-2", clu.getAccreditations().get(1)
3287    .getOrgId());
3288  1 assertEquals(DF.parse("20110203"), clu.getAccreditations().get(1)
3289    .getEffectiveDate());
3290  1 assertEquals(DF.parse("21011231"), clu.getAccreditations().get(1)
3291    .getExpirationDate());
3292  1 assertEquals(2, clu.getAccreditations().get(1).getAttributes()
3293    .size());
3294  1 assertEquals("Accred2AttrValue1", clu.getAccreditations().get(1)
3295    .getAttributes().get("Accred2AttrKey1"));
3296  1 assertEquals("Accred2AttrValue2", clu.getAccreditations().get(1)
3297    .getAttributes().get("Accred2AttrKey2"));
3298    }
3299   
 
3300  1 toggle private void updateAccreditationList(CluInfo clu) throws ParseException {
3301   
3302  1 AccreditationInfo accreditationOrg3 = new AccreditationInfo();
3303  1 accreditationOrg3.setOrgId("EXT-orgId-3");
3304  1 accreditationOrg3.setEffectiveDate(DF.parse("20120203"));
3305  1 accreditationOrg3.setExpirationDate(DF.parse("21021231"));
3306   
3307  1 AccreditationInfo accreditationOrg4 = new AccreditationInfo();
3308  1 accreditationOrg4.setOrgId("EXT-orgId-4");
3309  1 accreditationOrg4.setEffectiveDate(DF.parse("20130203"));
3310  1 accreditationOrg4.setExpirationDate(DF.parse("21031231"));
3311  1 accreditationOrg4.getAttributes().put("Accred4AttrKey1",
3312    "Accred4AttrValue1");
3313   
3314  1 clu.getAccreditations().add(accreditationOrg3);
3315  1 clu.getAccreditations().add(accreditationOrg4);
3316   
3317  1 clu.getAccreditations().get(0).getAttributes().remove(
3318    "Accred1AttrKey2");
3319  1 clu.getAccreditations().get(0).getAttributes().put(
3320    "Accred1AttrKey1", "Accred1AttrValue1-UPD");
3321  1 clu.getAccreditations().remove(1);
3322    }
3323   
 
3324  1 toggle private void checkAccreditationListUpdate(CluInfo clu)
3325    throws ParseException {
3326   
3327  1 assertEquals(3, clu.getAccreditations().size());
3328   
3329  1 assertEquals("EXT-orgId-1", clu.getAccreditations().get(0)
3330    .getOrgId());
3331  1 assertEquals(1, clu.getAccreditations().get(0).getAttributes()
3332    .size());
3333  1 assertEquals("Accred1AttrValue1-UPD", clu.getAccreditations().get(0)
3334    .getAttributes().get("Accred1AttrKey1"));
3335   
3336  1 assertEquals("EXT-orgId-3", clu.getAccreditations().get(1)
3337    .getOrgId());
3338  1 assertEquals(DF.parse("20120203"), clu.getAccreditations().get(1)
3339    .getEffectiveDate());
3340  1 assertEquals(DF.parse("21021231"), clu.getAccreditations().get(1)
3341    .getExpirationDate());
3342  1 assertEquals(0, clu.getAccreditations().get(1).getAttributes()
3343    .size());
3344   
3345  1 assertEquals("EXT-orgId-4", clu.getAccreditations().get(2)
3346    .getOrgId());
3347  1 assertEquals(DF.parse("20130203"), clu.getAccreditations().get(2)
3348    .getEffectiveDate());
3349  1 assertEquals(DF.parse("21031231"), clu.getAccreditations().get(2)
3350    .getExpirationDate());
3351  1 assertEquals(1, clu.getAccreditations().get(2).getAttributes()
3352    .size());
3353  1 assertEquals("Accred4AttrValue1", clu.getAccreditations().get(2)
3354    .getAttributes().get("Accred4AttrKey1"));
3355   
3356    }
3357   
 
3358  3 toggle private void createIntensity(CluInfo clu) {
3359  3 AmountInfo intensity = new AmountInfo();
3360  3 intensity.setUnitType("EXT-intensity-Id1");
3361  3 intensity.setUnitQuantity("123");
3362  3 clu.setIntensity(intensity);
3363    }
3364   
 
3365  1 toggle private void checkIntensityCreate(CluInfo clu) {
3366  1 assertEquals("EXT-intensity-Id1", clu.getIntensity()
3367    .getUnitType());
3368  1 assertEquals("123", clu.getIntensity().getUnitQuantity());
3369    }
3370   
 
3371  1 toggle private void updateIntensity(CluInfo clu) {
3372  1 clu.getIntensity().setUnitType("UPD-intensity-Id1");
3373  1 clu.getIntensity().setUnitQuantity("456");
3374    }
3375   
 
3376  1 toggle private void checkIntensityUpdate(CluInfo clu) {
3377  1 assertEquals("UPD-intensity-Id1", clu.getIntensity()
3378    .getUnitType());
3379  1 assertEquals("456", clu.getIntensity().getUnitQuantity());
3380   
3381    }
3382   
 
3383  3 toggle private void createCampusLocationList(CluInfo clu) {
3384  3 clu.getCampusLocations().add("EXT-Campus-Location-1");
3385  3 clu.getCampusLocations().add("EXT-Campus-Location-2");
3386    }
3387   
 
3388  1 toggle private void checkCampusLocationCreate(CluInfo clu) {
3389  1 assertEquals(2, clu.getCampusLocations().size());
3390  1 assertEquals("EXT-Campus-Location-1", clu.getCampusLocations()
3391    .get(0));
3392  1 assertEquals("EXT-Campus-Location-2", clu.getCampusLocations()
3393    .get(1));
3394    }
3395   
 
3396  1 toggle private void updateCampusLocationList(CluInfo clu) {
3397  1 clu.getCampusLocations().add("EXT-Campus-Location-3");
3398  1 clu.getCampusLocations().add("EXT-Campus-Location-4");
3399  1 clu.getCampusLocations().remove(0);
3400    }
3401   
 
3402  1 toggle private void checkCampusLocationUpdate(CluInfo clu) {
3403  1 assertEquals(3, clu.getCampusLocations().size());
3404  1 assertEquals("EXT-Campus-Location-2", clu.getCampusLocations()
3405    .get(0));
3406  1 assertEquals("EXT-Campus-Location-3", clu.getCampusLocations()
3407    .get(1));
3408  1 assertEquals("EXT-Campus-Location-4", clu.getCampusLocations()
3409    .get(2));
3410    }
3411   
 
3412  1 toggle @Test
3413    public void testSearchForCluInCluSets() throws Exception {
3414  1 SearchRequest searchRequest = new SearchRequest();
3415  1 searchRequest.setSearchKey("cluset.search.generic");
3416   
3417  1 List<SearchParam> queryParamValues = new ArrayList<SearchParam>();
3418  1 SearchParam searchParam = new SearchParam();
3419  1 searchParam.setKey("cluset.queryParam.luOptionalId");
3420  1 searchParam.setValue("CLU-5");
3421  1 queryParamValues.add(searchParam);
3422   
3423  1 searchRequest.setParams(queryParamValues);
3424  1 SearchResult cluSets = client.search(searchRequest);
3425   
3426  1 Assert.assertEquals(2, cluSets.getRows().size());
3427    }
3428   
 
3429  1 toggle @Test
3430    public void testSearchForCluInCluSets_EmptyResult() throws Exception {
3431  1 SearchRequest searchRequest = new SearchRequest();
3432  1 searchRequest.setSearchKey("cluset.search.generic");
3433   
3434  1 List<SearchParam> queryParamValues = new ArrayList<SearchParam>();
3435  1 SearchParam searchParam = new SearchParam();
3436  1 searchParam.setKey("lu.queryParam.luOptionalId");
3437  1 searchParam.setValue("XXX");
3438  1 queryParamValues.add(searchParam);
3439   
3440  1 searchRequest.setParams(queryParamValues);
3441  1 SearchResult cluSets = client.search(searchRequest);
3442   
3443  1 Assert.assertEquals(0, cluSets.getRows().size());
3444    }
3445   
 
3446  1 toggle @Test
3447    public void testSearchForCluInCluRelations() throws Exception {
3448  1 SearchRequest searchRequest = new SearchRequest();
3449  1 searchRequest.setSearchKey("lu.search.cluCluRelation");
3450   
3451  1 List<SearchParam> queryParamValues = new ArrayList<SearchParam>();
3452  1 SearchParam searchParam = new SearchParam();
3453  1 searchParam.setKey("lu.queryParam.luOptionalId");
3454  1 searchParam.setValue("CLU-1");
3455  1 queryParamValues.add(searchParam);
3456   
3457  1 searchRequest.setParams(queryParamValues);
3458  1 SearchResult clus = client.search(searchRequest);
3459   
3460  1 Assert.assertEquals(2, clus.getRows().size());
3461    }
3462   
 
3463  1 toggle @Test
3464    public void testSearchForCluInCluRelations_EmptyResult() throws Exception {
3465  1 SearchRequest searchRequest = new SearchRequest();
3466  1 searchRequest.setSearchKey("lu.search.cluCluRelation");
3467   
3468  1 List<SearchParam> queryParamValues = new ArrayList<SearchParam>();
3469  1 SearchParam searchParam = new SearchParam();
3470  1 searchParam.setKey("lu.queryParam.luOptionalId");
3471  1 searchParam.setValue("XXX");
3472  1 queryParamValues.add(searchParam);
3473   
3474  1 searchRequest.setParams(queryParamValues);
3475  1 SearchResult clus = client.search(searchRequest);
3476   
3477  1 Assert.assertEquals(0, clus.getRows().size());
3478    }
3479   
 
3480  1 toggle @Test
3481    public void testCluPublicationCrud() throws ParseException, AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, VersionMismatchException{
3482    //Setup
3483  1 FieldInfo variant;
3484   
3485  1 CluPublicationInfo cluPublication1 = new CluPublicationInfo();
3486  1 cluPublication1.setEffectiveDate(DF.parse("20120203"));
3487  1 cluPublication1.setExpirationDate(DF.parse("20130203"));
3488  1 cluPublication1.setStartCycle("StartCycle1");
3489  1 cluPublication1.setEndCycle("EndCycle1");
3490  1 cluPublication1.setState("clupubState1");
3491  1 cluPublication1.setType("cluPublication.Test.Type.1");
3492  1 cluPublication1.setCluId("CLU-1");
3493  1 variant = new FieldInfo();
3494  1 variant.setId("field1.one");
3495  1 variant.setValue("value1.one");
3496  1 cluPublication1.getVariants().add(variant);
3497  1 variant = new FieldInfo();
3498  1 variant.setId("field1.two");
3499  1 variant.setValue("value1.two");
3500  1 cluPublication1.getVariants().add(variant);
3501   
3502  1 CluPublicationInfo cluPublication2 = new CluPublicationInfo();
3503  1 cluPublication2.setEffectiveDate(DF.parse("20120203"));
3504  1 cluPublication2.setExpirationDate(DF.parse("20130203"));
3505  1 cluPublication2.setStartCycle("StartCycle2");
3506  1 cluPublication2.setEndCycle("EndCycle2");
3507  1 cluPublication2.setState("clupubState2");
3508  1 cluPublication2.setType("cluPublication.Test.Type.1");
3509  1 cluPublication2.setCluId("CLU-2");
3510  1 variant = new FieldInfo();
3511  1 variant.setId("field2.one");
3512  1 variant.setValue("value2.one");
3513  1 cluPublication2.getVariants().add(variant);
3514  1 variant = new FieldInfo();
3515  1 variant.setId("field2.two");
3516  1 variant.setValue("value2.two");
3517  1 cluPublication2.getVariants().add(variant);
3518   
3519  1 CluPublicationInfo cluPublication3 = new CluPublicationInfo();
3520  1 cluPublication3.setEffectiveDate(DF.parse("20120203"));
3521  1 cluPublication3.setExpirationDate(DF.parse("20130203"));
3522  1 cluPublication3.setStartCycle("StartCycle3");
3523  1 cluPublication3.setEndCycle("EndCycle3");
3524  1 cluPublication3.setState("clupubState3");
3525  1 cluPublication3.setType("cluPublication.Test.Type.2");
3526  1 cluPublication3.setCluId("CLU-2");
3527  1 variant = new FieldInfo();
3528  1 variant.setId("field3.one");
3529  1 variant.setValue("value3.one");
3530  1 cluPublication3.getVariants().add(variant);
3531  1 variant = new FieldInfo();
3532  1 variant.setId("field3.two");
3533  1 variant.setValue("value3.two");
3534  1 cluPublication3.getVariants().add(variant);
3535   
3536   
3537  1 CluPublicationInfo createdCluPub1 = client.createCluPublication(cluPublication1.getCluId(), cluPublication1.getType(), cluPublication1);
3538  1 CluPublicationInfo createdCluPub2 = client.createCluPublication(cluPublication2.getCluId(), cluPublication2.getType(), cluPublication2);
3539  1 CluPublicationInfo createdCluPub3 = client.createCluPublication(cluPublication3.getCluId(), cluPublication3.getType(), cluPublication3);
3540   
3541   
3542  1 assertNotNull(createdCluPub1.getId());
3543  1 assertEquals(cluPublication1.getEffectiveDate(),createdCluPub1.getEffectiveDate());
3544  1 assertEquals(cluPublication1.getExpirationDate(),createdCluPub1.getExpirationDate());
3545  1 assertEquals(cluPublication1.getStartCycle(),createdCluPub1.getStartCycle());
3546  1 assertEquals(cluPublication1.getEndCycle(),createdCluPub1.getEndCycle());
3547  1 assertEquals(cluPublication1.getState(),createdCluPub1.getState());
3548  1 assertEquals(cluPublication1.getType(),createdCluPub1.getType());
3549  1 assertEquals(cluPublication1.getCluId(),createdCluPub1.getCluId());
3550  1 assertNotNull(createdCluPub3);
3551   
3552    //Test gets
3553  1 CluPublicationInfo gotCluPub1 = client.getCluPublication(createdCluPub1.getId());
3554  1 assertEquals(createdCluPub1.getId(),gotCluPub1.getId());
3555   
3556  1 List<CluPublicationInfo> gotCluPubsByType = client.getCluPublicationsByType("cluPublication.Test.Type.1");
3557  1 assertEquals(2,gotCluPubsByType.size());
3558   
3559  1 List<CluPublicationInfo> gotCluPubsByClu = client.getCluPublicationsByCluId("CLU-2");
3560  1 assertEquals(2,gotCluPubsByClu.size());
3561   
3562    //Change some values
3563  1 createdCluPub2.setEffectiveDate(DF.parse("20020203"));
3564  1 createdCluPub2.setExpirationDate(DF.parse("20030203"));
3565  1 createdCluPub2.setStartCycle("StartCycle2U");
3566  1 createdCluPub2.setEndCycle("EndCycle2U");
3567  1 createdCluPub2.setState("clupubState2U");
3568  1 createdCluPub2.setType("cluPublication.Test.Type.2");
3569  1 createdCluPub2.setCluId("CLU-1");
3570  1 createdCluPub2.getVariants().clear();
3571  1 variant = new FieldInfo();
3572  1 variant.setId("field2.oneU");
3573  1 variant.setValue("value2.oneU");
3574  1 createdCluPub2.getVariants().add(variant);
3575  1 variant = new FieldInfo();
3576  1 variant.setId("field2.twoU");
3577  1 variant.setValue("value2.twoU");
3578  1 createdCluPub2.getVariants().add(variant);
3579   
3580  1 CluPublicationInfo updated = client.updateCluPublication(createdCluPub2.getId(), createdCluPub2);
3581    //Test version mismatch
3582  1 try{
3583  1 client.updateCluPublication(createdCluPub2.getId(), createdCluPub2);
3584  0 assertTrue(false);
3585    }catch( VersionMismatchException e){
3586  1 assertTrue(true);
3587    }
3588   
3589   
3590    //check that updated has correct values
3591  1 assertEquals(createdCluPub2.getId(),updated.getId());
3592  1 assertEquals(createdCluPub2.getEffectiveDate(),updated.getEffectiveDate());
3593  1 assertEquals(createdCluPub2.getExpirationDate(),updated.getExpirationDate());
3594  1 assertEquals(createdCluPub2.getStartCycle(),updated.getStartCycle());
3595  1 assertEquals(createdCluPub2.getEndCycle(),updated.getEndCycle());
3596  1 assertEquals(createdCluPub2.getState(),updated.getState());
3597  1 assertEquals(createdCluPub2.getType(),updated.getType());
3598  1 assertEquals(createdCluPub2.getCluId(),updated.getCluId());
3599   
3600  1 assertEquals(2,updated.getVariants().size());
3601  1 assertTrue(("field2.oneU".equals(updated.getVariants().get(0).getId())
3602    &&"value2.oneU".equals(updated.getVariants().get(0).getValue()))
3603    ||
3604    ("field2.twoU".equals(updated.getVariants().get(0).getId())
3605    &&"value2.twoU".equals(updated.getVariants().get(0).getValue())));
3606    }
3607    }