本文整理匯總了Java中org.apache.cxf.Bus.shutdown方法的典型用法代碼示例。如果您正苦於以下問題:Java Bus.shutdown方法的具體用法?Java Bus.shutdown怎麽用?Java Bus.shutdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.cxf.Bus
的用法示例。
在下文中一共展示了Bus.shutdown方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startAndStopService
import org.apache.cxf.Bus; //導入方法依賴的package包/類
@Test
public void startAndStopService() throws Exception {
CamelContext context = new DefaultCamelContext();
// start a server
context.addRoutes(new RouteBuilder() {
public void configure() {
from("cxf:http://localhost:" + PORT1 + "/test?serviceClass=org.apache.camel.component.cxf.HelloService")
.to("log:endpoint");
}
});
context.start();
Thread.sleep(300);
context.stop();
Bus bus = BusFactory.getDefaultBus();
JettyHTTPServerEngineFactory factory = bus.getExtension(JettyHTTPServerEngineFactory.class);
JettyHTTPServerEngine engine = factory.retrieveJettyHTTPServerEngine(PORT1);
assertNotNull("Jetty engine should be found there", engine);
// Need to call the bus shutdown ourselves.
String orig = System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort", "false");
bus.shutdown(true);
System.setProperty("org.apache.cxf.transports.http_jetty.DontClosePort",
orig == null ? "true" : "false");
engine = factory.retrieveJettyHTTPServerEngine(PORT1);
assertNull("Jetty engine should be removed", engine);
}
示例2: testCamelDestinationConfiguration
import org.apache.cxf.Bus; //導入方法依賴的package包/類
@Test
public void testCamelDestinationConfiguration() throws Exception {
QName testEndpointQName = new QName("http://camel.apache.org/camel-test", "port");
// set up the bus with configure file
SpringBusFactory bf = new SpringBusFactory();
BusFactory.setDefaultBus(null);
Bus bus = bf.createBus("/org/apache/camel/component/cxf/transport/CamelDestination.xml");
BusFactory.setDefaultBus(bus);
endpointInfo.setAddress("camel://direct:EndpointA");
endpointInfo.setName(testEndpointQName);
CamelDestination destination = new CamelDestination(null, bus, null, endpointInfo);
assertEquals("{http://camel.apache.org/camel-test}port.camel-destination", destination.getBeanName());
CamelContext context = destination.getCamelContext();
assertNotNull("The camel context which get from camel destination is not null", context);
assertEquals("Get the wrong camel context", context.getName(), "dest_context");
assertEquals("The camel context should has two routers", context.getRoutes().size(), 2);
bus.shutdown(false);
}
示例3: testNoClientCallback
import org.apache.cxf.Bus; //導入方法依賴的package包/類
/**
* No CallbackHandler is provided in STSCLient. Username and password provided instead.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testNoClientCallback() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl");
WSTrustTestUtils.setupWsseAndSTSClientNoCallbackHandler(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
assertEquals("WS-Trust Hello World!", proxy.sayHello());
} finally {
bus.shutdown(true);
}
}
示例4: testCustomClientLifeCycleListener
import org.apache.cxf.Bus; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testCustomClientLifeCycleListener() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
BusFactory.setThreadDefaultBus(bus);
try {
URL wsdlOneURL = new URL(baseURL + "/ServiceOne/EndpointOne?wsdl");
QName serviceOneName = new QName("http://org.jboss.ws.jaxws.cxf/jbws3098", "ServiceOne");
Service serviceOne = Service.create(wsdlOneURL, serviceOneName, new UseThreadBusFeature());
CustomClientLifeCycleListener listener = new CustomClientLifeCycleListener();
ClientLifeCycleManager mgr = bus.getExtension(ClientLifeCycleManager.class);
try {
mgr.registerListener(listener);
assertEquals(0, listener.getCount());
EndpointOne portOne = (EndpointOne)serviceOne.getPort(EndpointOne.class);
assertEquals(1, listener.getCount());
assertEquals("Foo", portOne.echo("Foo"));
} finally {
mgr.unRegisterListener(listener);
}
} finally {
bus.shutdown(true);
}
}
示例5: testDigestAuthFail
import org.apache.cxf.Bus; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testDigestAuthFail() throws Exception
{
final Bus bus = BusFactory.newInstance().createBus();
BusFactory.setThreadDefaultBus(bus);
try {
QName serviceName = new QName("http://jboss.org/http/security", "HelloService");
URL wsdlURL = getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
Hello proxy = (Hello)service.getPort(Hello.class);
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL.toString());
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "jbossws");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "wrongPwd");
HTTPConduit cond = (HTTPConduit)ClientProxy.getClient(proxy).getConduit();
cond.setAuthSupplier(new DigestAuthSupplier());
try {
proxy.helloRequest("number");
fail("Authorization exception expected!");
} catch (Exception e) {
assertTrue(e.getCause().getMessage().contains("Authorization"));
}
} finally {
bus.shutdown(true);
}
}
示例6: testWithFeatureProperty
import org.apache.cxf.Bus; //導入方法依賴的package包/類
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void testWithFeatureProperty() throws Exception
{
final Bus bus = BusFactory.newInstance().createBus();
BusFactory.setThreadDefaultBus(bus);
try {
QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsrm", "SimpleService");
URL wsdlURL = getResourceURL("jaxws/samples/wsrm/WEB-INF/wsdl/SimpleService.wsdl");
Service service = Service.create(wsdlURL, serviceName);
SimpleService proxy = (SimpleService)service.getPort(SimpleService.class);
ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
configurer.setConfigProperties(proxy, "META-INF/jaxws-client-config.xml", "Custom Client Config");
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL + "/jaxws-samples-wsrm-api/SimpleService");
assertEquals("Hello World!", proxy.echo("Hello World!")); // request response call
proxy.ping(); // one way call
} finally {
bus.shutdown(true);
}
}
示例7: testActAs
import org.apache.cxf.Bus; //導入方法依賴的package包/類
/**
* Request a security token that allows it to act as if it were somebody else.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(ACT_AS_SERVER_DEP)
@WrapThreadContextClassLoader
public void testActAs() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
try
{
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/actaswssecuritypolicy", "ActAsService");
final URL wsdlURL = new URL(serviceURL + "ActAsService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ActAsServiceIface proxy = (ActAsServiceIface) service.getPort(ActAsServiceIface.class);
WSTrustTestUtils.setupWsseAndSTSClientActAs((BindingProvider) proxy, bus);
assertEquals("ActAs WS-Trust Hello World!", proxy.sayHello(getServerHost(), String.valueOf(getServerPort())));
}
finally
{
bus.shutdown(true);
}
}
示例8: testGZIPServerSideOnlyInterceptorOnClient
import org.apache.cxf.Bus; //導入方法依賴的package包/類
public boolean testGZIPServerSideOnlyInterceptorOnClient() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
try
{
BusFactory.setThreadDefaultBus(bus);
HelloWorld port = getPort();
Client client = ClientProxy.getClient(port);
HTTPConduit conduit = (HTTPConduit)client.getConduit();
HTTPClientPolicy policy = conduit.getClient();
//enable Accept gzip, otherwise the server will not try to reply using gzip
policy.setAcceptEncoding("gzip;q=1.0, identity; q=0.5, *;q=0");
//add interceptor for decoding gzip message
client.getInInterceptors().add(new GZIPEnforcingInInterceptor());
return ("foo".equals(port.echo("foo")));
}
finally
{
bus.shutdown(true);
}
}
示例9: testUnsupportedPolicy
import org.apache.cxf.Bus; //導入方法依賴的package包/類
/**
* Verifies the policy-enabled client can be configured to ignore a given policy in the wsdl contract
*
* @throws Exception
*/
@Test
@RunAsClient
public void testUnsupportedPolicy() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
try
{
BusFactory.setThreadDefaultBus(bus);
PolicyInterceptorProviderRegistry reg = bus.getExtension(PolicyInterceptorProviderRegistry.class);
reg.register(new IgnorablePolicyInterceptorProvider(new QName("http://my.custom.org/policy", "MyPolicy")));
URL wsdlURL = new URL(baseURL + "/jaxws-cxf-policy/PIPService/PIPEndpoint?wsdl");
QName serviceName = new QName("http://policy.cxf.jaxws.ws.test.jboss.org/", "PIPService");
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
QName portQName = new QName("http://policy.cxf.jaxws.ws.test.jboss.org/", "PIPEndpointPort");
PIPEndpoint port = (PIPEndpoint)service.getPort(portQName, PIPEndpoint.class);
assertEquals("foo", port.echo("foo"));
}
finally
{
bus.shutdown(true);
}
}
示例10: testSignEncryptUsingConfigProperties
import org.apache.cxf.Bus; //導入方法依賴的package包/類
public boolean testSignEncryptUsingConfigProperties() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
try
{
BusFactory.setThreadDefaultBus(bus);
ServiceIface proxy = getProxy();
ClientConfigUtil.setConfigProperties(proxy, "META-INF/jaxws-client-config.xml", "Custom WS-Security Client");
return invoke(proxy);
}
finally
{
bus.shutdown(true);
}
}
示例11: testClientSide
import org.apache.cxf.Bus; //導入方法依賴的package包/類
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void testClientSide() throws Exception
{
if (!isProperNetworkSetup()) {
System.out.println("Skipping broadcast test: no non-loopback IPv4 interface available"); //IPv6 does not support broadcast, so some IPv4 nonloopback interface with broacast is required
return;
}
Bus bus = BusFactory.newInstance().createBus();
BusFactory.setThreadDefaultBus(bus);
Object implementor = new HelloWorldImpl();
Endpoint ep = Endpoint.publish("soap.udp://:9436", implementor);
try
{
final QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/udp", "HelloWorldService");
final QName udpPortName = new QName("http://org.jboss.ws/jaxws/cxf/udp", "UDPHelloWorldImplPort");
Service service = Service.create(serviceName);
service.addPort(udpPortName, "http://schemas.xmlsoap.org/soap/", "soap.udp://:9436");
HelloWorld proxy = (HelloWorld) service.getPort(udpPortName, HelloWorld.class);
assertEquals("Hi", proxy.echo("Hi"));
}
finally
{
ep.stop();
bus.shutdown(true);
}
}
示例12: testClientLifeCycleManager
import org.apache.cxf.Bus; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testClientLifeCycleManager()
{
Bus bus = BusFactory.newInstance().createBus();
try {
assertNotNull("Cannot find ClientLifeCycleManager impl in current bus", bus.getExtension(ClientLifeCycleManager.class));
} finally {
bus.shutdown(true);
}
}
示例13: testWithFeature
import org.apache.cxf.Bus; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testWithFeature() throws Exception
{
final Bus bus = BusFactory.newInstance().createBus();
BusFactory.setThreadDefaultBus(bus);
try {
QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsrm", "SimpleService");
URL wsdlURL = getResourceURL("jaxws/samples/wsrm/WEB-INF/wsdl/SimpleService.wsdl");
Service service = Service.create(wsdlURL, serviceName);
RMFeature feature = new RMFeature();
RMAssertion rma = new RMAssertion();
RMAssertion.BaseRetransmissionInterval bri = new RMAssertion.BaseRetransmissionInterval();
bri.setMilliseconds(4000L);
rma.setBaseRetransmissionInterval(bri);
AcknowledgementInterval ai = new AcknowledgementInterval();
ai.setMilliseconds(2000L);
rma.setAcknowledgementInterval(ai);
feature.setRMAssertion(rma);
DestinationPolicyType dp = new DestinationPolicyType();
AcksPolicyType ap = new AcksPolicyType();
ap.setIntraMessageThreshold(0);
dp.setAcksPolicy(ap);
feature.setDestinationPolicy(dp);
SimpleService proxy = (SimpleService)service.getPort(SimpleService.class, feature);
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL + "/jaxws-samples-wsrm-api/SimpleService");
assertEquals("Hello World!", proxy.echo("Hello World!")); // request response call
proxy.ping(); // one way call
} finally {
bus.shutdown(true);
}
}
示例14: testNoSignatureUsername
import org.apache.cxf.Bus; //導入方法依賴的package包/類
/**
* No SIGNATURE_USERNAME is provided to the service. Service will use the
* client's keystore alias in its place.
*
* @throws Exception
*/
@Test
@RunAsClient
@OperateOnDeployment(SERVER_DEP)
@WrapThreadContextClassLoader
public void testNoSignatureUsername() throws Exception
{
Bus bus = BusFactory.newInstance().createBus();
try
{
BusFactory.setThreadDefaultBus(bus);
final QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
final URL wsdlURL = new URL(serviceURL + "SecurityService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
final QName stsServiceName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "SecurityTokenService");
final QName stsPortName = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/", "UT_Port");
URL stsURL = new URL(serviceURL.getProtocol(), serviceURL.getHost(), serviceURL.getPort(), "/jaxws-samples-wsse-policy-trust-sts/SecurityTokenService?wsdl");
WSTrustTestUtils.setupWsseAndSTSClientNoSignatureUsername(proxy, bus, stsURL.toString(), stsServiceName, stsPortName);
assertEquals("WS-Trust Hello World!", proxy.sayHello());
}
finally
{
bus.shutdown(true);
}
}
示例15: shutdownTestWithInnerShutdown
import org.apache.cxf.Bus; //導入方法依賴的package包/類
private static void shutdownTestWithInnerShutdown(BusHolder holder)
{
Bus bus = holder.getBus();
TestLifeCycleListener listener = new TestLifeCycleListener();
bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(listener);
Deployment dep = new DefaultDeploymentModelFactory().newDeployment("testDeployment", null, null);
dep.addAttachment(SOAPAddressRewriteMetadata.class, new SOAPAddressRewriteMetadata(getTestServerConfig(), null));
holder.configure(null, null, null, dep);
bus.shutdown(true);
holder.close();
assertEquals("preShutdown method on listener should be called exactly once; number of actual calls: "
+ listener.getCount(), 1, listener.getCount());
}