01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: TestEngineCasefigures.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.engine;
09:
10: import com.meterware.httpunit.GetMethodWebRequest;
11: import com.meterware.httpunit.WebConversation;
12: import com.meterware.httpunit.WebLink;
13: import com.meterware.httpunit.WebRequest;
14: import com.meterware.httpunit.WebResponse;
15: import com.uwyn.rife.TestCaseServerside;
16:
17: public class TestEngineCasefigures extends TestCaseServerside {
18: public TestEngineCasefigures(int siteType, String name) {
19: super (siteType, name);
20: }
21:
22: public void testDatatransfer() throws Exception {
23: setupSite("site/casefigures.xml");
24: WebConversation conversation = new WebConversation();
25: WebRequest request = null;
26: WebResponse response = null;
27:
28: request = new GetMethodWebRequest(
29: "http://localhost:8181/datatransfer/source");
30: request.setParameter("switch", "1");
31: response = conversation.getResponse(request);
32: assertEquals("value4a|value4b,value3", response.getText());
33:
34: request = new GetMethodWebRequest(
35: "http://localhost:8181/datatransfer/source");
36: request.setParameter("switch", "2");
37: response = conversation.getResponse(request);
38: assertEquals("value2a|value2b|value2c,value1", response
39: .getText());
40: }
41:
42: public void testUrltransfer() throws Exception {
43: setupSite("site/casefigures.xml");
44: WebConversation conversation = new WebConversation();
45: WebRequest request = null;
46: WebResponse response = null;
47: WebLink link = null;
48:
49: request = new GetMethodWebRequest(
50: "http://localhost:8181/urltransfer/source");
51: response = conversation.getResponse(request);
52: link = response.getLinkWith("sourceparent");
53: response = link.click();
54: link = response.getLinkWith("source");
55: response = link.click();
56: link = response.getLinkWith("destinationparent");
57: response = link.click();
58: link = response.getLinkWith("destination");
59: response = link.click();
60: assertEquals("arrived", response.getText());
61: }
62: }
|