01: package com.sun.portal.samples.asc.tests;
02:
03: import java.util.HashMap;
04: import java.util.Map;
05:
06: /**
07: * U2: Client requests channel's edit content
08: *
09: * URL: provider=AJAXEditContainer&action=edit&targetProvider=channelName&containerName=AJAXTableContainer
10: * Request: XMLHttpRequest
11: * success: channel edit content
12: * failure: JSON message
13: * @author gregz
14: *
15: */
16: public class TestUseCase2 extends AJAXTestCase {
17:
18: public void testU2Success() {
19: try {
20: getChannelEdit(Configuration.editChannel);
21: String expected = Configuration.editChannel + "-edit.html";
22: compareExpected(expected);
23: } catch (Exception e) {
24: TestUtils.fail(this , e);
25: }
26: }
27:
28: public void testU2Failure() {
29: try {
30: getChannelEdit("UnknownChannel");
31: String expected = "DesktopError.js";
32: compareExpected(expected);
33: } catch (Exception e) {
34: TestUtils.fail(this , e);
35: }
36: }
37:
38: private void getChannelEdit(String channelName) throws Exception {
39: Map p = new HashMap();
40: p.put("provider", Configuration.editContainer);
41: p.put("action", "edit");
42: p.put("targetprovider", channelName);
43: p.put("containerName", Configuration.defaultContainer);
44: int responseCode = asyncGet(p);
45: assertEquals(200, responseCode);
46:
47: }
48:
49: }
|