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.ws.rm;
19:
20: import javax.xml.namespace.QName;
21:
22: import org.apache.cxf.endpoint.Endpoint;
23: import org.apache.cxf.service.model.EndpointInfo;
24: import org.apache.cxf.service.model.ServiceInfo;
25: import org.easymock.classextension.EasyMock;
26: import org.easymock.classextension.IMocksControl;
27: import org.junit.After;
28: import org.junit.Assert;
29: import org.junit.Before;
30: import org.junit.Test;
31:
32: /**
33: *
34: */
35: public class RMUtilsTest extends Assert {
36:
37: private IMocksControl control;
38:
39: @Before
40: public void setUp() {
41: control = EasyMock.createNiceControl();
42: }
43:
44: @After
45: public void tearDown() {
46: control.verify();
47: }
48:
49: @Test
50: public void testGetName() {
51: Endpoint e = control.createMock(Endpoint.class);
52: EndpointInfo ei = control.createMock(EndpointInfo.class);
53: EasyMock.expect(e.getEndpointInfo()).andReturn(ei).times(2);
54: QName eqn = new QName("ns2", "endpoint");
55: EasyMock.expect(ei.getName()).andReturn(eqn);
56: ServiceInfo si = control.createMock(ServiceInfo.class);
57: EasyMock.expect(ei.getService()).andReturn(si);
58: QName sqn = new QName("ns1", "service");
59: EasyMock.expect(si.getName()).andReturn(sqn);
60: control.replay();
61: assertEquals("{ns1}service.{ns2}endpoint", RMUtils
62: .getEndpointIdentifier(e));
63: }
64: }
|