001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: *
005: * Licensed under the Educational Community License, Version 1.0 (the "License");
006: * you may not use this file except in compliance with the License.
007: * You may obtain a copy of the License at
008: *
009: * http://www.opensource.org/licenses/ecl1.php
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package edu.iu.uis.eden.test.stress;
018:
019: import edu.iu.uis.eden.clientapp.WorkflowInfo;
020: import edu.iu.uis.eden.clientapp.vo.DocumentTypeVO;
021: import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
022: import edu.iu.uis.eden.clientapp.vo.RouteHeaderVO;
023: import edu.iu.uis.eden.clientapp.vo.WorkflowGroupIdVO;
024: import edu.iu.uis.eden.clientapp.vo.WorkgroupNameIdVO;
025: import edu.iu.uis.eden.clientapp.vo.WorkgroupVO;
026:
027: public class WorkflowUtilityTest extends AbstractTest {
028:
029: private int calls;
030:
031: public boolean doWork() throws Exception {
032: Long routeHeaderId = new Long(0);
033: String routeHeaderIdValue = (String) getParameters().get(
034: "routeHeaderId");
035: String networkId = (String) getParameters().get("networkId");
036: calls++;
037: if (routeHeaderIdValue != null
038: && !routeHeaderIdValue.trim().equals("")) {
039: routeHeaderId = Long.valueOf(routeHeaderIdValue);
040: } else {
041: routeHeaderId = TestInfo.getRandomRouteHeaderId();
042: if (routeHeaderId == null && calls < 10) {
043: return false;
044: } else {
045: return true;
046: }
047: }
048: if (networkId == null || networkId.trim().equals("")) {
049: // For simplicities sake, we will assume NetworkIdVO since that's all we are using
050: networkId = TestInfo.getRandomUser().toString();
051: if (networkId == null && calls < 10) {
052: return false;
053: }
054: }
055: NetworkIdVO networkIdVO = new NetworkIdVO(networkId);
056: WorkflowInfo workflowInfo = new WorkflowInfo();
057: TestInfo.markCallToServer();
058:
059: TestInfo.markCallToServer();
060: RouteHeaderVO routeHeader = workflowInfo
061: .getRouteHeader(routeHeaderId);
062: TestInfo.markCallToServer();
063: workflowInfo.getRouteHeader(networkIdVO, routeHeaderId);
064: TestInfo.markCallToServer();
065: workflowInfo.getActionRequests(routeHeaderId);
066: TestInfo.markCallToServer();
067: workflowInfo.getActionsTaken(routeHeaderId);
068: TestInfo.markCallToServer();
069: DocumentTypeVO documentType = workflowInfo
070: .getDocType(routeHeader.getDocTypeName());
071: TestInfo.markCallToServer();
072: workflowInfo.getDocType(documentType.getDocTypeId());
073: TestInfo.markCallToServer();
074: workflowInfo.getNewResponsibilityId();
075: TestInfo.markCallToServer();
076: workflowInfo.getRoute(routeHeader.getDocTypeName());
077: TestInfo.markCallToServer();
078: workflowInfo.getUserWorkgroups(networkIdVO);
079: TestInfo.markCallToServer();
080: WorkgroupVO workgroup = workflowInfo
081: .getWorkgroup("WorkflowAdmin");
082: TestInfo.markCallToServer();
083: workflowInfo.getWorkgroup(workgroup.getWorkgroupId());
084: TestInfo.markCallToServer();
085: workflowInfo
086: .getWorkgroup(new WorkgroupNameIdVO("WorkflowAdmin"));
087: TestInfo.markCallToServer();
088: workflowInfo.getWorkgroup(new WorkflowGroupIdVO(workgroup
089: .getWorkgroupId()));
090: TestInfo.markCallToServer();
091: workflowInfo.isFinalApprover(routeHeaderId, networkIdVO);
092: TestInfo.markCallToServer();
093: workflowInfo.isUserAuthenticatedByRouteLog(routeHeaderId,
094: networkIdVO, true);
095: TestInfo.markCallToServer();
096:
097: return true;
098: }
099:
100: }
|