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: */package org.apache.header_test.rpc;
19:
20: import java.lang.annotation.Annotation;
21: import java.lang.reflect.Method;
22:
23: import javax.jws.WebParam;
24:
25: import org.junit.Assert;
26: import org.junit.Test;
27:
28: public class TestRPCHeaderTest extends Assert {
29: Class<TestRPCHeader> cls = TestRPCHeader.class;
30:
31: @Test
32: public void testHeader1() {
33: Method meths[] = cls.getMethods();
34: for (Method m : meths) {
35: if ("testHeader1".equals(m.getName())) {
36: Annotation annotations[][] = m
37: .getParameterAnnotations();
38: assertEquals(2, annotations.length);
39: assertEquals(1, annotations[1].length);
40: assertTrue(annotations[1][0] instanceof WebParam);
41: WebParam parm = (WebParam) annotations[1][0];
42: assertEquals("http://apache.org/header_test/rpc/types",
43: parm.targetNamespace());
44: assertEquals("inHeader", parm.partName());
45: assertEquals("headerMessage", parm.name());
46: assertTrue(parm.header());
47: }
48: }
49:
50: }
51:
52: @Test
53: public void testInOutHeader() {
54: Method meths[] = cls.getMethods();
55: for (Method m : meths) {
56: if ("testInOutHeader".equals(m.getName())) {
57: Annotation annotations[][] = m
58: .getParameterAnnotations();
59: assertEquals(2, annotations.length);
60: assertEquals(1, annotations[1].length);
61: assertTrue(annotations[1][0] instanceof WebParam);
62: WebParam parm = (WebParam) annotations[1][0];
63: assertEquals("http://apache.org/header_test/rpc/types",
64: parm.targetNamespace());
65: assertEquals("inOutHeader", parm.partName());
66: assertEquals("headerMessage", parm.name());
67: assertTrue(parm.header());
68: }
69: }
70: }
71:
72: }
|