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