01: /*
02: * Copyright 2005-2007 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.kuali.workflow.workgroup;
18:
19: import org.junit.Test;
20: import org.kuali.workflow.test.WorkflowTestCase;
21:
22: import edu.iu.uis.eden.KEWServiceLocator;
23: import edu.iu.uis.eden.routetemplate.RuleAttribute;
24:
25: /**
26: * Tests interaction with the default WorkgroupTypeService implementation.
27: *
28: * @author ewestfal
29: */
30: public class WorkgroupTypeServiceTest extends WorkflowTestCase {
31:
32: private WorkgroupTypeService service;
33:
34: @Override
35: protected void setUpTransaction() throws Exception {
36: super .setUpTransaction();
37: service = KEWServiceLocator.getWorkgroupTypeService();
38: }
39:
40: @Test
41: public void testSave() throws Exception {
42: WorkgroupType workgroupType = new WorkgroupType();
43: workgroupType.setName("MyName");
44: workgroupType.setLabel("MyLabel");
45: workgroupType.setDescription("MyDescription");
46: workgroupType.setActive(true);
47:
48: WorkgroupTypeAttribute attribute1 = new WorkgroupTypeAttribute();
49: attribute1.setWorkgroupType(workgroupType);
50: RuleAttribute ruleAttribute1 = KEWServiceLocator
51: .getRuleAttributeService().findByName(
52: "TestRuleAttribute");
53: assertNotNull("Could not locate the 'TestRuleAttribute'",
54: ruleAttribute1);
55: attribute1.setAttribute(ruleAttribute1);
56: workgroupType.getAttributes().add(attribute1);
57:
58: service.save(workgroupType);
59:
60: assertNotNull(workgroupType.getWorkgroupTypeId());
61: assertNotNull(workgroupType.getAttributes().get(0)
62: .getWorkgroupTypeAttributeId());
63:
64: }
65:
66: }
|