01: package edu.iu.uis.eden.lookupable;
02:
03: import java.lang.reflect.Field;
04: import java.util.HashMap;
05: import java.util.Iterator;
06: import java.util.List;
07: import java.util.Map;
08:
09: import junit.framework.TestCase;
10: import edu.iu.uis.eden.SpringServiceLocator;
11: import edu.iu.uis.eden.plugin.attributes.WorkflowLookupable;
12: import edu.iu.uis.eden.workgroup.Workgroup;
13: import edu.iu.uis.eden.workgroup.web.WebWorkgroup;
14:
15: public class WorkGroupLookupableImplTestPENDING extends TestCase {
16: private WorkflowLookupable workflowLookupable;
17: private Map fieldValues;
18: private Map conversionFields;
19:
20: protected void setUp() throws Exception {
21: SpringServiceLocator.setToTestMode(null);
22: workflowLookupable = new WorkGroupLookupableImpl();
23:
24: fieldValues = new HashMap();
25: fieldValues.put("workgroup_fin_coa_cd", "BL");
26: fieldValues.put("workgroupName", "BLACADFINAL1");
27:
28: conversionFields = new HashMap();
29: conversionFields.put("workgroupId", "test_workgroupId");
30: }
31:
32: public void testGetSearchResults() throws Exception {
33: List results = workflowLookupable.getSearchResults(fieldValues,
34: conversionFields);
35: assertEquals("Too many results listed.", 1, results.size());
36: WebWorkgroup workgroup = (WebWorkgroup) results.get(0);
37:
38: /*assertEquals("Chart code is incorrect.", "BL", workgroup.getFinCoaCd());
39: assertEquals("Org code is incorrect.", "DFAC", workgroup.getOrgCd());*/
40: assertTrue(
41: "Return parameter workgroupId is not correct or database has changed. This was in development.",
42: workgroup.getReturnUrl().indexOf(
43: "test_workgroupId=4086") > 0);
44: }
45:
46: public void testGetColumns() {
47: for (Iterator iter = workflowLookupable.getColumns().iterator(); iter
48: .hasNext();) {
49: Column column = (Column) iter.next();
50: try {
51: Field field = Workgroup.class.getDeclaredField(column
52: .getPropertyName());
53: } catch (NoSuchFieldException e) {
54: assertTrue(
55: "Column property name on WorkGroupLookupableImpl does not equal a property on the Workgroup bean. Column: "
56: + column.getPropertyName(), false);
57: }
58: }
59: }
60:
61: public void testGetNoReturnParams() {
62: String parameters = workflowLookupable
63: .getNoReturnParams(conversionFields);
64: assertTrue("Return parameter workgroupId is not correct.",
65: parameters.indexOf("test_workgroupId=") > 0);
66: }
67: }
|