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.cxf.service.model;
19:
20: import javax.xml.namespace.QName;
21:
22: import org.junit.Assert;
23: import org.junit.Before;
24: import org.junit.Test;
25:
26: public class MessagePartInfoTest extends Assert {
27:
28: private MessagePartInfo messagePartInfo;
29:
30: @Before
31: public void setUp() throws Exception {
32:
33: MessageInfo msg = new MessageInfo(null, new QName(
34: "http://apache.org/hello_world_soap_http/types",
35: "testMessage"));
36: messagePartInfo = new MessagePartInfo(new QName(
37: "http://apache.org/hello_world_soap_http",
38: "testMessagePart"), msg);
39: messagePartInfo.setElement(true);
40: }
41:
42: @Test
43: public void testName() throws Exception {
44: assertEquals(messagePartInfo.getName().getLocalPart(),
45: "testMessagePart");
46: assertEquals(messagePartInfo.getName().getNamespaceURI(),
47: "http://apache.org/hello_world_soap_http");
48: messagePartInfo.setName(new QName(
49: "http://apache.org/hello_world_soap_http1",
50: "testMessagePart1"));
51: assertEquals(messagePartInfo.getName().getLocalPart(),
52: "testMessagePart1");
53: assertEquals(messagePartInfo.getName().getNamespaceURI(),
54: "http://apache.org/hello_world_soap_http1");
55:
56: }
57:
58: @Test
59: public void testElement() {
60: messagePartInfo.setElementQName(new QName(
61: "http://apache.org/hello_world_soap_http/types",
62: "testElement"));
63: assertTrue(messagePartInfo.isElement());
64: assertEquals(messagePartInfo.getElementQName().getLocalPart(),
65: "testElement");
66: assertEquals(messagePartInfo.getElementQName()
67: .getNamespaceURI(),
68: "http://apache.org/hello_world_soap_http/types");
69: assertNull(messagePartInfo.getTypeQName());
70: }
71:
72: @Test
73: public void testType() {
74: messagePartInfo.setTypeQName(new QName(
75: "http://apache.org/hello_world_soap_http/types",
76: "testType"));
77: assertNull(messagePartInfo.getElementQName());
78: assertFalse(messagePartInfo.isElement());
79: assertEquals(messagePartInfo.getTypeQName().getLocalPart(),
80: "testType");
81: assertEquals(messagePartInfo.getTypeQName().getNamespaceURI(),
82: "http://apache.org/hello_world_soap_http/types");
83: }
84: }
|