01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.axis2.util;
20:
21: import org.apache.axis2.AbstractTestCase;
22:
23: /**
24: * Test that things break
25: */
26:
27: public class UtilsParseRequestTest extends AbstractTestCase {
28:
29: public UtilsParseRequestTest(String testName) {
30: super (testName);
31: }
32:
33: public void testfailure() throws Exception {
34: //fail("here");
35: }
36:
37: // public void testService() throws Exception {
38: // assertParsesTo("http://localhost:8081/services/System",
39: // "System");
40: // }
41:
42: public void testServiceCalledServices() throws Exception {
43: assertParsesTo("http://localhost:8081/services/services",
44: "services");
45: }
46:
47: public void testServiceWithQuery() throws Exception {
48: assertParsesTo(
49: "http://localhost:8081/services/System?system=ecb2f",
50: "System");
51: }
52:
53: public void testServiceWithDoubleQuery() throws Exception {
54: assertParsesTo(
55: "http://localhost:8081/services/System?system=ecb2f?job=3",
56: "System");
57: }
58:
59: public void testOperation() throws Exception {
60: assertParsesTo(
61: "http://localhost:8081/services/System/operation",
62: "System", "operation");
63: }
64:
65: public void testOperationWithQuery() throws Exception {
66: assertParsesTo(
67: "http://localhost:8081/services/System/operation?system=ecb2f",
68: "System", "operation");
69: }
70:
71: public void testOperationServiceCalledServices() throws Exception {
72: assertParsesTo(
73: "http://localhost:8081/services/services/operation",
74: "services", "operation");
75: }
76:
77: private void assertParsesTo(String path, String service) {
78: assertParsesTo(path, service, null);
79: }
80:
81: private void assertParsesTo(String path, String service,
82: String operation) {
83: String[] strings = Utils.parseRequestURLForServiceAndOperation(
84: path, "/axis2/services");
85: assertEquals(service, strings[0]);
86: assertEquals(operation, strings[1]);
87: }
88:
89: }
|