|
Apache CXF example source code file (CorbaBindingFactoryTest.java)
The Apache CXF CorbaBindingFactoryTest.java source code/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.cxf.binding.corba; import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Set; import javax.xml.namespace.QName; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.binding.BindingFactoryManager; import org.apache.cxf.binding.corba.wsdl.CorbaConstants; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.message.Message; import org.apache.cxf.service.Service; import org.apache.cxf.service.model.BindingInfo; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.Conduit; import org.apache.cxf.transport.Destination; import org.apache.cxf.transport.MessageObserver; import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.apache.cxf.wsdl11.WSDLServiceFactory; import org.easymock.classextension.EasyMock; import org.easymock.classextension.IMocksControl; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class CorbaBindingFactoryTest extends Assert { protected Bus bus; protected EndpointInfo endpointInfo; protected EndpointReferenceType target; protected MessageObserver observer; protected Message inMessage; CorbaBindingFactory factory; @Before public void setUp() throws Exception { bus = BusFactory.getDefaultBus(); BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class); factory = (CorbaBindingFactory)bfm.getBindingFactory("http://cxf.apache.org/bindings/corba"); bfm.registerBindingFactory(CorbaConstants.NU_WSDL_CORBA, factory); } @After public void tearDown() { bus.shutdown(true); } protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) { URL wsdlUrl = getClass().getResource(wsdl); assertNotNull(wsdlUrl); WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl, new QName(ns, serviceName)); Service service = f.create(); endpointInfo = service.getEndpointInfo(new QName(ns, portName)); } @Test public void testCreateBinding() throws Exception { IMocksControl control = EasyMock.createNiceControl(); BindingInfo bindingInfo = control.createMock(BindingInfo.class); CorbaBinding binding = (CorbaBinding)factory.createBinding(bindingInfo); assertNotNull(binding); assertTrue(CorbaBinding.class.isInstance(binding)); List<Interceptor inInterceptors = binding.getInInterceptors(); assertNotNull(inInterceptors); List<Interceptor outInterceptors = binding.getOutInterceptors(); assertNotNull(outInterceptors); assertEquals(2, inInterceptors.size()); assertEquals(2, outInterceptors.size()); } @Test public void testGetCorbaConduit() throws Exception { setupServiceInfo("http://cxf.apache.org/bindings/corba/simple", "/wsdl_corbabinding/simpleIdl.wsdl", "SimpleCORBAService", "SimpleCORBAPort"); Conduit conduit = factory.getConduit(endpointInfo); assertNotNull(conduit); conduit = factory.getConduit(endpointInfo, null); assertNotNull(conduit); target = EasyMock.createMock(EndpointReferenceType.class); conduit = factory.getConduit(endpointInfo, target); assertNotNull(conduit); } @Test public void testGetDestination() throws Exception { setupServiceInfo("http://cxf.apache.org/bindings/corba/simple", "/wsdl_corbabinding/simpleIdl.wsdl", "SimpleCORBAService", "SimpleCORBAPort"); Destination destination = factory.getDestination(endpointInfo); assertNotNull(destination); target = destination.getAddress(); assertNotNull(target); } @Test public void testTransportIds() throws Exception { setupServiceInfo("http://cxf.apache.org/bindings/corba/simple", "/wsdl_corbabinding/simpleIdl.wsdl", "SimpleCORBAService", "SimpleCORBAPort"); List<String> strs = new ArrayList Other Apache CXF examples (source code examples)Here is a short list of links related to this Apache CXF CorbaBindingFactoryTest.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.