001: /*
002: * Copyright 2005-2006 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.clientapp;
018:
019: import java.util.List;
020:
021: import javax.xml.namespace.QName;
022:
023: import org.apache.commons.httpclient.HttpClient;
024: import org.apache.commons.httpclient.methods.GetMethod;
025: import org.junit.Test;
026: import org.kuali.rice.config.Config;
027: import org.kuali.rice.core.Core;
028: import org.kuali.rice.lifecycle.Lifecycle;
029: import org.kuali.rice.resourceloader.GlobalResourceLoader;
030: import org.kuali.rice.resourceloader.ResourceLoader;
031: import org.kuali.workflow.config.KEWConfigurer;
032: import org.kuali.workflow.config.ThinClientResourceLoader;
033: import org.kuali.workflow.test.WorkflowTestCase;
034:
035: import edu.iu.uis.eden.EdenConstants;
036: import edu.iu.uis.eden.clientapp.vo.NetworkIdVO;
037: import edu.iu.uis.eden.clientapp.vo.RouteHeaderVO;
038: import edu.iu.uis.eden.server.TestClient3;
039:
040: /**
041: * Uses TestClient3 to test a simple web-service only client to verfiy backward compatability
042: * with the 2.2.x version of workflow.
043: *
044: * @author ewestfal
045: */
046: public class SimpleWebServiceClientTest extends WorkflowTestCase {
047:
048: @Override
049: public void tearDown() throws Exception {
050: QName thinRLName = new QName(Core.getCurrentContextConfig()
051: .getMessageEntity(), "ThinClientResourceLoader");
052: GlobalResourceLoader.getResourceLoader().removeResourceLoader(
053: thinRLName);
054: ResourceLoader tempThinRL = GlobalResourceLoader
055: .getResourceLoader(thinRLName);
056: if (tempThinRL != null) {
057: throw new RuntimeException(
058: "Unable to remove ThinClientResourceLoader the remaining tests are probably messed up");
059: }
060: }
061:
062: /**
063: * Verifies that we can aquire a reference to a WorkflowDocument without the need to
064: * wire up a KSBConfigurer. This verifies backward compatability for EN-364.
065: */
066: @Test
067: public void testAquiringWorkflowDocument() throws Exception {
068: this .setUpWebservices();
069:
070: //verify the ThinClientResourceLoader is in the GRL.
071: ResourceLoader rl = GlobalResourceLoader.getResourceLoader();
072: ResourceLoader tempThinRL = rl.getResourceLoaders().get(0);
073: assertTrue("First resource loader should be thin",
074: tempThinRL instanceof ThinClientResourceLoader);
075: ThinClientResourceLoader thinRL = (ThinClientResourceLoader) tempThinRL;
076:
077: thinRL.getWorkflowUtility().getWorkflowUser(
078: new NetworkIdVO("rkirkend"));
079:
080: RouteHeaderVO routeHeader = new RouteHeaderVO();
081: routeHeader.setDocTypeName("TestDocumentType");
082:
083: thinRL.getWorkflowDoucment().createDocument(
084: new NetworkIdVO("rkirkend"), routeHeader);
085:
086: }
087:
088: protected void setUpWebservices() throws Exception {
089: try {
090: Core.getCurrentContextConfig().overrideProperty(
091: Config.CLIENT_PROTOCOL,
092: EdenConstants.WEBSERVICE_CLIENT_PROTOCOL);
093: Core
094: .getCurrentContextConfig()
095: .overrideProperty(
096: "workflowutility.javaservice.endpoint",
097: "http://localhost:9912/en-test/remoting/%7BKEW%7DWorkflowUtilityService");
098: Core
099: .getCurrentContextConfig()
100: .overrideProperty(
101: "workflowdocument.javaservice.endpoint",
102: "http://localhost:9912/en-test/remoting/%7BKEW%7DWorkflowDocumentActionsService");
103: Core.getCurrentContextConfig().overrideProperty(
104: "secure.workflowdocument.javaservice.endpoint",
105: "true");
106: Core.getCurrentContextConfig().overrideProperty(
107: "secure.workflowutility.javaservice.endpoint",
108: "true");
109: KEWConfigurer kewConfigurer = new KEWConfigurer();
110: kewConfigurer.start();
111: } catch (Exception e) {
112: if (e instanceof RuntimeException) {
113: throw (RuntimeException) e;
114: }
115: throw new RuntimeException(
116: "Failed to start the ksb configurer to run the remotable test.",
117: e);
118: }
119: }
120:
121: }
|