View Javadoc

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