本文整理汇总了Java中org.apache.cxf.BusFactory.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java BusFactory.newInstance方法的具体用法?Java BusFactory.newInstance怎么用?Java BusFactory.newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.BusFactory
的用法示例。
在下文中一共展示了BusFactory.newInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.apache.cxf.BusFactory; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
BusFactory bf = BusFactory.newInstance();
//setup the camel transport for the bus
bus = bf.createBus();
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
CamelTransportFactory camelTransportFactory = new CamelTransportFactory();
//set the context here to the transport factory;
camelTransportFactory.setCamelContext(context);
ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
dfm.registerDestinationFactory(CamelTransportFactory.TRANSPORT_ID, camelTransportFactory);
cim.registerConduitInitiator(CamelTransportFactory.TRANSPORT_ID, camelTransportFactory);
BusFactory.setDefaultBus(bus);
endpointInfo = new EndpointInfo();
}
示例2: testBusCreation
import org.apache.cxf.BusFactory; //导入方法依赖的package包/类
public static void testBusCreation() throws BusTestException
{
Bus initialDefaultBus = BusFactory.getDefaultBus(false);
Bus initialThreadBus = BusFactory.getThreadDefaultBus(false);
BusFactory factory = BusFactory.newInstance();
Bus bus = factory.createBus();
assert (bus != null);
if (initialThreadBus == null) //if the thread bus was not set before, it should now be
{
checkThreadBus(bus);
}
checkDefaultBus(initialDefaultBus);
BusFactory.setThreadDefaultBus(initialThreadBus);
checkThreadBus(initialThreadBus);
checkDefaultBus(initialDefaultBus);
}
示例3: testWebServiceRef
import org.apache.cxf.BusFactory; //导入方法依赖的package包/类
public static void testWebServiceRef(Endpoint port) throws BusTestException
{
Bus initialDefaultBus = BusFactory.getDefaultBus(false);
Bus threadBus = BusFactory.getThreadDefaultBus(false);
performInvocation(port); //does not change anything to the bus, as the port is already created when injecting serviceref
checkDefaultBus(initialDefaultBus);
checkThreadBus(threadBus);
try
{
BusFactory.setThreadDefaultBus(null);
performInvocation(port); //does not change anything to the bus, as the port is already created when injecting serviceref
checkDefaultBus(initialDefaultBus);
checkThreadBus(null);
BusFactory factory = BusFactory.newInstance();
Bus bus = factory.createBus(); //internally sets the thread bus
performInvocation(port); //does not change anything to the bus, as the port is already created when injecting serviceref
checkDefaultBus(initialDefaultBus);
checkThreadBus(bus);
}
finally
{
BusFactory.setThreadDefaultBus(threadBus);
}
}
示例4: verifyCXF
import org.apache.cxf.BusFactory; //导入方法依赖的package包/类
public static void verifyCXF()
{
//check BusFactory customization; this is required by the JBWS-CXF Configurer integration (HTTPConduit customization, JAXBIntros, ...)
BusFactory factory = BusFactory.newInstance();
if (!(factory instanceof JBossWSBusFactory))
throw new RuntimeException("Expected " + JBossWSBusFactory.class + " but got " + (factory == null ? null : factory.getClass()));
//check the Apache CXF JAXWS implementation is actually used
Object obj = getImplementationObject();
if (!obj.getClass().getName().contains("cxf"))
throw new RuntimeException("JAXWS implementation is not properly selected or endorsed!");
}
示例5: testJBossWSCXFBus
import org.apache.cxf.BusFactory; //导入方法依赖的package包/类
/**
* Verify the BusFactory.newInstance() still return the JBossWS-CXF version of BusFactory
* (the web app has a dependency on jbossws-cxf-client) and that still create a plain bus
* version, without being fooled by the Spring availability in the TCCL when Spring is not
* installed in the AS.
*
* @return
*/
public boolean testJBossWSCXFBus()
{
BusFactory factory = BusFactory.newInstance();
if (!(factory instanceof JBossWSBusFactory))
{
throw new RuntimeException("Expected JBossWSBusFactory");
}
Bus bus = null;
try
{
//set Configurer.USER_CFG_FILE_PROPERTY_NAME so that if the SpringBusFactory is
//internally erroneously used, that won't fallback delegating to the non Spring
//one, which would shade the issue
final String prop = System.getProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME);
try
{
System.setProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME, "unexistentfile.xml");
bus = factory.createBus();
//the created bus should not be a SpringBus, as the classloader for CXF has no visibility over the deployment spring jars
return !isSpringBus(bus);
}
finally
{
if (prop == null)
{
System.clearProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME);
}
else
{
System.setProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME, prop);
}
}
}
finally
{
if (bus != null)
{
bus.shutdown(true);
}
}
}