View Javadoc

1   /**
2    * Copyright 2005-2013 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.routeheader;
17  
18  import org.junit.Ignore;
19  import org.junit.Test;
20  import org.kuali.rice.kew.api.WorkflowDocument;
21  import org.kuali.rice.kew.api.WorkflowDocumentFactory;
22  import org.kuali.rice.kew.test.KEWTestCase;
23  import org.kuali.rice.kew.util.PerformanceLogger;
24  
25  /**
26   *
27   */
28  public class WorkflowDocumentServiceTest extends KEWTestCase {
29      protected void loadTestData() throws Exception {
30          
31      }
32  
33      @Ignore @Test
34      public void testCreatePerformanceWithBranches() {
35          testCreatePerformance("DocTypeWithBranches.xml", "Testing.LongRoutePath");
36      }
37  
38      @Ignore @Test
39      public void testCreatePerformanceWithoutBranches() {
40          testCreatePerformance("DocTypeWithoutBranches.xml", "Testing.LongRoutePathWithoutBranches");
41      }
42      
43      protected void testCreatePerformance(String xml, String doctype) {
44          PerformanceLogger logger = new PerformanceLogger();
45          logger.log("Loading " + xml);
46          loadXmlFile(xml);
47          logger.log("Done loading " + xml);
48  
49          System.err.println("Creating and routing " + doctype);
50          WorkflowDocument document = WorkflowDocumentFactory.createDocument("admin", doctype);
51          // There are no rules associated with this so this doc goes to final as soon as it is routed
52          document.route("");
53          // Setting the title so that routing data actually gets saved
54          document.setTitle("Testing");
55          // Sleep to give it a chance to route, may not be needed
56          logger = new PerformanceLogger();
57          logger.log("starting save routing data");
58          document.saveDocumentData();
59          logger.log("finished save routing data");
60      }
61  }