View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.actions;
17  
18  import org.junit.Test;
19  import org.kuali.rice.kew.actionitem.ActionItem;
20  import org.kuali.rice.kew.actions.BlanketApproveTest.NotifySetup;
21  import org.kuali.rice.kew.actiontaken.ActionTakenValue;
22  import org.kuali.rice.kew.api.WorkflowDocument;
23  import org.kuali.rice.kew.api.WorkflowDocumentFactory;
24  import org.kuali.rice.kew.service.KEWServiceLocator;
25  import org.kuali.rice.kew.test.KEWTestCase;
26  
27  import java.util.Collection;
28  import java.util.List;
29  
30  import static org.junit.Assert.*;
31  
32  public class LogDocumentActionTest extends KEWTestCase {
33  
34      protected void loadTestData() throws Exception {
35          loadXmlFile("ActionsConfig.xml");
36      }
37  
38      @Test public void testLogAnnotation() throws Exception {
39          WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), NotifySetup.DOCUMENT_TYPE_NAME);
40          Collection actionsTaken = KEWServiceLocator.getActionTakenService().findByDocumentId(document.getDocumentId());
41          assertEquals(0, actionsTaken.size());
42          
43          document.logAnnotation("going to route doc");
44          actionsTaken = KEWServiceLocator.getActionTakenService().findByDocumentId(document.getDocumentId());
45          assertEquals(1, actionsTaken.size());
46          ActionTakenValue actionTaken = (ActionTakenValue) actionsTaken.iterator().next();
47          assertTrue(actionTaken.getCurrentIndicator());
48      }
49  }