1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.workflow;
17
18 import org.junit.Test;
19 import org.kuali.rice.kew.doctype.bo.DocumentType;
20 import org.kuali.rice.kew.engine.RouteContext;
21 import org.kuali.rice.kew.service.KEWServiceLocator;
22 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
23 import org.kuali.rice.krad.UserSession;
24 import org.kuali.rice.krad.document.Document;
25 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
26 import org.kuali.rice.krad.test.document.SearchAttributeIndexTestDocumentOjb;
27 import org.kuali.rice.krad.util.GlobalVariables;
28
29
30
31
32
33
34
35
36
37 @Deprecated
38 public class SearchAttributeIndexRequestOjbTest extends SearchAttributeIndexRequestTest {
39
40 private static final String SEARCH_ATTRIBUTE_INDEX_DOCUMENT_TEST_DOC_TYPE = "SearchAttributeIndexTestDocumentOjb";
41
42 private enum DOCUMENT_FIXTURE {
43 NORMAL_DOCUMENT("hippo","routing");
44
45 private String constantString;
46 private String routingString;
47 private DOCUMENT_FIXTURE(String constantString, String routingString) {
48 this.constantString = constantString;
49 this.routingString = routingString;
50 }
51
52 public Document getDocument() throws Exception {
53 Document document = KRADServiceLocatorWeb.getDocumentService().getNewDocument(SEARCH_ATTRIBUTE_INDEX_DOCUMENT_TEST_DOC_TYPE);
54 SearchAttributeIndexTestDocumentOjb searchAttributeIndexTestDocument = (SearchAttributeIndexTestDocumentOjb) document;
55 searchAttributeIndexTestDocument.initialize(constantString, routingString);
56
57 return searchAttributeIndexTestDocument;
58 }
59 }
60
61 @Test
62 public void regularApproveTest() throws Exception {
63 final String principalName = "quickstart";
64 final String principalId = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(principalName).getPrincipalId();
65 GlobalVariables.setUserSession(new UserSession(principalName));
66 RouteContext.clearCurrentRouteContext();
67
68 Document document = DOCUMENT_FIXTURE.NORMAL_DOCUMENT.getDocument();
69 document.getDocumentHeader().setDocumentDescription("Routed SAIndexTestDoc");
70 final DocumentType documentType = KEWServiceLocator.getDocumentTypeService().findByName(SEARCH_ATTRIBUTE_INDEX_DOCUMENT_TEST_DOC_TYPE);
71
72 assertApproveAttributes(document, documentType, principalId);
73 }
74
75 @Test
76 public void blanketApproveTest() throws Exception {
77 final String principalName = "admin";
78 final String principalId = KimApiServiceLocator.getPersonService().getPersonByPrincipalName(principalName).getPrincipalId();
79 GlobalVariables.setUserSession(new UserSession(principalName));
80
81 Document document = DOCUMENT_FIXTURE.NORMAL_DOCUMENT.getDocument();
82 document.getDocumentHeader().setDocumentDescription("Blanket Approved SAIndexTestDoc");
83 final DocumentType documentType = KEWServiceLocator.getDocumentTypeService().findByName(SEARCH_ATTRIBUTE_INDEX_DOCUMENT_TEST_DOC_TYPE);
84
85 assertBlanketApproveAttributes(document, documentType, principalId);
86 }
87
88
89 }