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