当前位置: 首页>>代码示例>>Java>>正文


Java Bus.shutdown方法代码示例

本文整理汇总了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);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:CxfCustomerStartStopTest.java

示例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);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:22,代码来源:CamelDestinationTest.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:30,代码来源:WSTrustTestCase.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:26,代码来源:ClientServerLifeCycleTestCase.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:27,代码来源:HelloDigestTestCase.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:25,代码来源:WSReliableMessagingWithAPITestCase.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:31,代码来源:WSTrustTestCase.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:23,代码来源:Helper.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:31,代码来源:PolicyInterceptorProviderTestCase.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:16,代码来源:SignEncryptHelper.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:29,代码来源:UDPEndpointAPITestCase.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:12,代码来源:ClientServerLifeCycleTestCase.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:36,代码来源:WSReliableMessagingWithAPITestCase.java

示例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);
   }
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:35,代码来源:WSTrustTestCase.java

示例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());
}
 
开发者ID:jbossws,项目名称:jbossws-cxf,代码行数:14,代码来源:BusHolderLifeCycleTestCase.java


注:本文中的org.apache.cxf.Bus.shutdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。