org.apache.cxf.Bus Java Examples

The following examples show how to use org.apache.cxf.Bus. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServiceInvocationAckBase.java    From cxf with Apache License 2.0 7 votes vote down vote up
protected void run() {
    SpringBusFactory factory = new SpringBusFactory();
    Bus bus = factory.createBus();
    BusFactory.setDefaultBus(bus);
    setBus(bus);

    ControlImpl implementor = new ControlImpl();
    implementor.setDbName(pfx + "-server");
    implementor.setAddress("http://localhost:" + port + "/SoapContext/GreeterPort");
    GreeterImpl greeterImplementor = new GreeterImpl();
    implementor.setImplementor(greeterImplementor);
    ep = Endpoint.publish("http://localhost:" + port + "/SoapContext/ControlPort", implementor);
    LOG.fine("Published control endpoint.");
    BusFactory.setDefaultBus(null);
    BusFactory.setThreadDefaultBus(null);
}
 
Example #2
Source File: SSLNettyServerTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void start() throws Exception {
    Bus b = createStaticBus("/org/apache/cxf/transport/http/netty/server/integration/ServerConfig.xml");
    // setup the ssl interceptor
    MySSLInterceptor myInterceptor = new MySSLInterceptor();
    b.getInInterceptors().add(myInterceptor);
    BusFactory.setThreadDefaultBus(b);

    address = "https://localhost:" + PORT + "/SoapContext/SoapPort";
    ep = Endpoint.publish(address,
            new org.apache.hello_world_soap_http.GreeterImpl());

    URL wsdl = NettyServerTest.class.getResource("/wsdl/hello_world.wsdl");
    assertNotNull("WSDL is null", wsdl);

    SOAPService service = new SOAPService(wsdl);
    assertNotNull("Service is null", service);

    g = service.getSoapPort();
    assertNotNull("Port is null", g);
}
 
Example #3
Source File: SecurityContextTokenUnitTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void testSecurityContextTokenEncrypted() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = SecurityContextTokenUnitTest.class.getResource("cxf-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    String wsdlLocation =
        "https://localhost:" + test.getStsPort() + "/SecurityTokenService/TransportSCTEncrypted?wsdl";
    SecurityToken token =
        requestSecurityToken(bus, wsdlLocation, true);
    assertTrue(token.getSecret() != null && token.getSecret().length > 0);

    bus.shutdown(true);
}
 
Example #4
Source File: BusDefinitionParserTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("deprecation")
public void testFeatures() {
    String cfgFile = "org/apache/cxf/bus/spring/bus.xml";
    Bus bus = new SpringBusFactory().createBus(cfgFile, true);

    List<Interceptor<? extends Message>> in = bus.getInInterceptors();
    assertTrue("could not find logging interceptor.",
            in.stream().anyMatch(i -> i.getClass() == org.apache.cxf.interceptor.LoggingInInterceptor.class));

    Collection<Feature> features = bus.getFeatures();
    TestFeature tf = null;
    for (Feature f : features) {
        if (f instanceof TestFeature) {
            tf = (TestFeature)f;
            break;
        }
    }

    assertNotNull(tf);
    assertTrue("test feature  has not been initialised", tf.initialised);
    assertNotNull("test feature has not been injected", tf.testBean);
    assertTrue("bean injected into test feature has not been initialised", tf.testBean.initialised);
}
 
Example #5
Source File: WSDLAddrPolicyAttachmentJaxwsMMProviderTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testUsingAddressing() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();

    Bus bus = bf.createBus("org/apache/cxf/systest/ws/policy/addr-inline-policy-old.xml");

    BusFactory.setDefaultBus(bus);

    URL wsdlURL = new URL(WSDL_ADDRESS);

    AsyncMessagingService ams = new AsyncMessagingService(wsdlURL, ENDPOINT_NAME);
    AsyncMessaging am = ams.getAsyncMessagingImplPort();

    ConnectionHelper.setKeepAliveConnection(am, true);
    testInterceptors(bus);

    // oneway
    am.deliver("This is a test");
    am.deliver("This is another test");
    bus.shutdown(true);
}
 
Example #6
Source File: EHCacheManagerHolder.java    From steady with Apache License 2.0 6 votes vote down vote up
public static CacheManager getCacheManager(Bus bus, URL configFileURL) {
    CacheManager cacheManager = null;
    if (configFileURL == null) {
        //using the default
        cacheManager = findDefaultCacheManager(bus);
    }
    if (cacheManager == null) {
        if (configFileURL == null) {
            cacheManager = CacheManager.create();
        } else {
            cacheManager = CacheManager.create(configFileURL);
        }
    }
    AtomicInteger a = COUNTS.get(cacheManager.getName());
    if (a == null) {
        COUNTS.putIfAbsent(cacheManager.getName(), new AtomicInteger());
        a = COUNTS.get(cacheManager.getName());
    }
    if (a.incrementAndGet() == 1) {
        //System.out.println("Create!! " + cacheManager.getName());
    }
    return cacheManager;
}
 
Example #7
Source File: NettyServerTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void start() throws Exception {
    Bus b = createStaticBus();
    BusFactory.setThreadDefaultBus(b);
    ep = Endpoint.publish("netty://http://localhost:" + PORT + "/SoapContext/SoapPort",
            new org.apache.hello_world_soap_http.GreeterImpl());

    URL wsdl = NettyServerTest.class.getResource("/wsdl/hello_world.wsdl");
    assertNotNull("WSDL is null", wsdl);

    SOAPService service = new SOAPService(wsdl);
    assertNotNull("Service is null", service);

    g = service.getSoapPort();
    assertNotNull("Port is null", g);
}
 
Example #8
Source File: ColocOutInterceptorTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testColocOutInvalidEndpoint() throws Exception {

    Bus bus = setupBus();
    ServerRegistry sr = control.createMock(ServerRegistry.class);
    EasyMock.expect(bus.getExtension(ServerRegistry.class)).andReturn(sr);

    control.replay();
    try {
        colocOut.handleMessage(msg);
        fail("Should have thrown a fault");
    } catch (Fault f) {
        assertEquals("Consumer Endpoint not found in exchange.",
                     f.getMessage());
    }
}
 
Example #9
Source File: SecurityContextTokenUnitTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void testSecurityContextTokenNoEntropy() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = SecurityContextTokenUnitTest.class.getResource("cxf-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    String wsdlLocation =
        "https://localhost:" + test.getStsPort() + "/SecurityTokenService/TransportSCT?wsdl";
    SecurityToken token =
        requestSecurityToken(bus, wsdlLocation, false);
    assertTrue(token.getSecret() != null && token.getSecret().length > 0);

    bus.shutdown(true);
}
 
Example #10
Source File: SAMLRenewUnitTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private SecurityToken renewSecurityToken(
    Bus bus, String wsdlLocation, SecurityToken securityToken, boolean enableAppliesTo
) throws Exception {
    STSClient stsClient = new STSClient(bus);
    stsClient.setWsdlLocation(wsdlLocation);
    stsClient.setServiceName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}SecurityTokenService");
    stsClient.setEndpointName("{http://docs.oasis-open.org/ws-sx/ws-trust/200512/}Transport_Port");

    Map<String, Object> properties = new HashMap<>();
    properties.put(SecurityConstants.USERNAME, "alice");
    properties.put(
        SecurityConstants.CALLBACK_HANDLER,
        "org.apache.cxf.systest.sts.common.CommonCallbackHandler"
    );
    properties.put(SecurityConstants.STS_TOKEN_PROPERTIES, "serviceKeystore.properties");

    stsClient.setEnableAppliesTo(enableAppliesTo);
    // Request a token with a TTL of 60 minutes
    stsClient.setTtl(60 * 60);
    stsClient.setEnableLifetime(true);
    stsClient.setProperties(properties);
    stsClient.setAddressingNamespace("http://www.w3.org/2005/08/addressing");

    return stsClient.renewSecurityToken(securityToken);
}
 
Example #11
Source File: ManagedBusTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testManagedSpringBus() throws Exception {
    SpringBusFactory factory = new SpringBusFactory();
    Bus bus = factory.createBus();
    InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
    assertNotNull(im);

    InstrumentationManagerImpl imi = (InstrumentationManagerImpl)im;
    assertFalse(imi.isEnabled());
    assertNull(imi.getMBeanServer());

    //Test that registering without an MBeanServer is a no-op
    im.register(imi, new ObjectName("org.apache.cxf:foo=bar"));

    bus.shutdown(true);
}
 
Example #12
Source File: RMPolicyWsdlTestBase.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void run()  {
    SpringBusFactory bf = new SpringBusFactory();
    Bus bus = bf.createBus(getConfigPath());
    BusFactory.setDefaultBus(bus);
    setBus(bus);

    ServerRegistry sr = bus.getExtension(ServerRegistry.class);
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);

    List<PolicyAssertion> assertions1
        = getAssertions(pe, sr.getServers().get(0));
    assertEquals("2 assertions should be available", 2, assertions1.size());
    List<PolicyAssertion> assertions2 =
        getAssertions(pe, sr.getServers().get(1));
    assertEquals("1 assertion should be available", 1, assertions2.size());

    LOG.info("Published greeter endpoints.");
}
 
Example #13
Source File: PolicyExtensionsTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testCXF4258() {
    Bus bus = null;
    try {
        bus = new SpringBusFactory().createBus("/org/apache/cxf/ws/policy/disable-policy-bus.xml", false);

        AssertionBuilderRegistry abr = bus.getExtension(AssertionBuilderRegistry.class);
        assertNotNull(abr);

        PolicyEngine e = bus.getExtension(PolicyEngine.class);
        assertNotNull(e);

        assertNoPolicyInterceptors(bus.getInInterceptors());
        assertNoPolicyInterceptors(bus.getInFaultInterceptors());
        assertNoPolicyInterceptors(bus.getOutFaultInterceptors());
        assertNoPolicyInterceptors(bus.getOutInterceptors());

    } finally {
        if (null != bus) {
            bus.shutdown(true);
            BusFactory.setDefaultBus(null);
        }
    }
}
 
Example #14
Source File: MetricsFeature.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void createDefaultProvidersIfNeeded(Bus bus) {
    if (providers == null) {
        ConfiguredBeanLocator b = bus.getExtension(ConfiguredBeanLocator.class);
        if (b != null) {
            Collection<?> coll = b.getBeansOfType(MetricsProvider.class);
            if (coll != null) {
                providers = coll.toArray(new MetricsProvider[]{});
            }
        }
    }
    if (providers == null) {
        try {
            Class<?> cls = ClassLoaderUtils.loadClass("org.apache.cxf.metrics.codahale.CodahaleMetricsProvider",
                    org.apache.cxf.metrics.MetricsFeature.class);
            Constructor<?> c = cls.getConstructor(Bus.class);
            providers = new MetricsProvider[] {(MetricsProvider)c.newInstance(bus)};
        } catch (Throwable t) {
            // ignore;
        }
    }
}
 
Example #15
Source File: ActionTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void test3DESEncryptionGivenKey() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = ActionTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleIt3DESEncryptionPort");
    DoubleItPortType port =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, PORT);
    assertEquals(50, port.doubleIt(25));

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}
 
Example #16
Source File: BusWiringBeanFactoryPostProcessor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private Object getBusForName(String name,
                             ConfigurableListableBeanFactory factory,
                             boolean create,
                             String cn) {
    if (!factory.containsBeanDefinition(name) && (create || Bus.DEFAULT_BUS_ID.equals(name))) {
        DefaultListableBeanFactory df = (DefaultListableBeanFactory)factory;
        RootBeanDefinition rbd = new RootBeanDefinition(SpringBus.class);
        if (cn != null) {
            rbd.setAttribute("busConfig", new RuntimeBeanReference(cn));
        }
        df.registerBeanDefinition(name, rbd);
    } else if (cn != null) {
        BeanDefinition bd = factory.getBeanDefinition(name);
        bd.getPropertyValues().addPropertyValue("busConfig", new RuntimeBeanReference(cn));
    }
    return new RuntimeBeanReference(name);
}
 
Example #17
Source File: MTOMSecurityTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@org.junit.Test
public void testAsymmetricBytesInAttachment() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = MTOMSecurityTest.class.getResource("client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricPort");
    DoubleItPortType port =
            service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, PORT);

    int result = port.doubleIt(25);
    assertEquals(result, 50);

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}
 
Example #18
Source File: BusCompleter.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Override
public int complete(Session session,
                    CommandLine commandLine,
                    List<String> list) {
    StringsCompleter delegate = new StringsCompleter();
    try {
        List<Bus> busses = getBusses();

        for (Bus bus : busses) {
            delegate.getStrings().add(bus.getId());
        }

    } catch (Exception e) {
        // Ignore
    }
    return delegate.complete(session, commandLine, list);
}
 
Example #19
Source File: AbstractPolicySecurityTest.java    From steady with Apache License 2.0 6 votes vote down vote up
/**
 * Gets a SoapMessage, but with the needed SecurityConstants in the context properties
 * so that it can be passed to PolicyBasedWSS4JOutInterceptor.
 *
 * @see #getSoapMessageForDom(Document, AssertionInfoMap)
 */
protected SoapMessage getOutSoapMessageForDom(Document doc, AssertionInfoMap aim)
    throws SOAPException {
    SoapMessage msg = this.getSoapMessageForDom(doc, aim);
    msg.put(SecurityConstants.SIGNATURE_PROPERTIES, "outsecurity.properties");
    msg.put(SecurityConstants.ENCRYPT_PROPERTIES, "outsecurity.properties");
    msg.put(SecurityConstants.CALLBACK_HANDLER, TestPwdCallback.class.getName());
    msg.put(SecurityConstants.SIGNATURE_USERNAME, "myalias");
    msg.put(SecurityConstants.ENCRYPT_USERNAME, "myalias");
    
    msg.getExchange().put(Endpoint.class, new MockEndpoint());
    msg.getExchange().put(Bus.class, this.bus);
    msg.put(Message.REQUESTOR_ROLE, true);
    
    return msg;
}
 
Example #20
Source File: DispatchTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
// CXF-2822
public void testInterceptorsConfiguration() throws Exception {
    String cfgFile = "org/apache/cxf/jaxws/dispatch/bus-dispatch.xml";
    Bus bus = new SpringBusFactory().createBus(cfgFile, true);
    ServiceImpl service = new ServiceImpl(bus, getClass().getResource("/wsdl/hello_world.wsdl"),
                                          SERVICE_NAME, null);

    Dispatch<Source> disp = service.createDispatch(PORT_NAME, Source.class, Service.Mode.MESSAGE);
    List<Interceptor<? extends Message>> interceptors = ((DispatchImpl<?>)disp).getClient()
        .getInInterceptors();
    boolean exists = false;
    for (Interceptor<? extends Message> interceptor : interceptors) {
        if (interceptor instanceof LoggingInInterceptor) {
            exists = true;
        }
    }
    assertTrue("The LoggingInInterceptor is not configured to dispatch client", exists);
}
 
Example #21
Source File: WebSocketTransportFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetDestination() throws Exception {
    Bus bus = BusFactory.getDefaultBus();
    EndpointInfo ei = new EndpointInfo();
    ei.setAddress("ws://localhost:8888/bar/foo");
    WebSocketTransportFactory factory = bus.getExtension(WebSocketTransportFactory.class);
    assertNotNull(factory);
    Destination dest = factory.getDestination(ei, bus);
    assertNotNull(dest);
}
 
Example #22
Source File: HostnameVerificationTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testNoSubjectAlternativeNameCNWildcardMatch() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = HostnameVerificationTest.class.getResource("hostname-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    URL url = SOAPService.WSDL_LOCATION;
    SOAPService service = new SOAPService(url, SOAPService.SERVICE);
    assertNotNull("Service is null", service);
    final Greeter port = service.getHttpsPort();
    assertNotNull("Port is null", port);

    updateAddressPort(port, PORT5);

    // Enable Async
    if (async) {
        ((BindingProvider)port).getRequestContext().put("use.async.http.conduit", true);
    }

    assertEquals(port.greetMe("Kitty"), "Hello Kitty");

    ((java.io.Closeable)port).close();
    bus.shutdown(true);
}
 
Example #23
Source File: DomainExpressionBuilderRegistry.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Resource
public final void setBus(Bus b) {
    bus = b;
    if (b != null) {
        b.setExtension(this, DomainExpressionBuilderRegistry.class);
    }
}
 
Example #24
Source File: StaxServer12.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected void run()  {
    Bus busLocal = new SpringBusFactory().createBus(
        "org/apache/cxf/systest/ws/wssec11/server.xml");
    BusFactory.setDefaultBus(busLocal);
    setBus(busLocal);
    super.run();
}
 
Example #25
Source File: IssueUnitTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * Test the Bearer SAML1 case
 */
@org.junit.Test
public void testBearerSaml1() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = IssueUnitTest.class.getResource("cxf-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    // Get a token
    SecurityToken token =
        requestSecurityToken(SAML1_TOKEN_TYPE, BEARER_KEYTYPE, bus, DEFAULT_ADDRESS);
    assertEquals(SAML1_TOKEN_TYPE, token.getTokenType());
    assertNotNull(token.getToken());

    // Process the token
    List<WSSecurityEngineResult> results = processToken(token);
    assertTrue(results != null && results.size() == 1);
    SamlAssertionWrapper assertion =
        (SamlAssertionWrapper)results.get(0).get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
    assertNotNull(assertion);
    assertTrue(assertion.getSaml1() != null && assertion.getSaml2() == null);
    assertTrue(assertion.isSigned());

    List<String> methods = assertion.getConfirmationMethods();
    String confirmMethod = null;
    if (methods != null && !methods.isEmpty()) {
        confirmMethod = methods.get(0);
    }
    assertTrue(confirmMethod != null && confirmMethod.contains("bearer"));

    bus.shutdown(true);
}
 
Example #26
Source File: ServiceListGeneratorServlet.java    From cxf with Apache License 2.0 5 votes vote down vote up
public ServiceListGeneratorServlet(DestinationRegistry destinationRegistry, Bus bus) {
    this.destinationRegistry = destinationRegistry;
    this.bus = bus;
    if (this.bus == null) {
        this.bus = BusFactory.getDefaultBus(false);
    }

    this.title = "CXF - Service list";
}
 
Example #27
Source File: HTTPConduitTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * This test verfies that the "getTarget() call returns the correct
 * EndpointReferenceType for the given endpoint address.
 */
@Test
public void testGetTarget() throws Exception {
    Bus bus = new ExtensionManagerBus();
    EndpointInfo ei = new EndpointInfo();
    ei.setAddress("http://nowhere.com/bar/foo");
    HTTPConduit conduit = new URLConnectionHTTPConduit(bus, ei, null);
    conduit.finalizeConfig();

    EndpointReferenceType target =
        EndpointReferenceUtils.getEndpointReference(
                "http://nowhere.com/bar/foo");

    // Test call
    EndpointReferenceType ref = conduit.getTarget();

    assertNotNull("unexpected null target", ref);
    assertEquals("unexpected target",
                 EndpointReferenceUtils.getAddress(ref),
                 EndpointReferenceUtils.getAddress(target));

    assertEquals("unexpected address",
                 conduit.getAddress(),
                 "http://nowhere.com/bar/foo");
    assertEquals("unexpected on-demand URL",
                 conduit.getURI().getPath(),
                 "/bar/foo");
}
 
Example #28
Source File: LoggingFeature.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public void doInitializeProvider(InterceptorProvider provider, Bus bus) {

    provider.getInInterceptors().add(in);
    provider.getInFaultInterceptors().add(in);

    provider.getOutInterceptors().add(out);
    provider.getOutFaultInterceptors().add(out);
}
 
Example #29
Source File: SAMLRenewUnitTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@org.junit.Test
public void testRenewSAML2TokenFail() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = SAMLRenewUnitTest.class.getResource("cxf-client-unit.xml");

    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);

    String wsdlLocation =
        "https://localhost:" + test.getStsPort() + "/SecurityTokenService/Transport?wsdl";

    // Request the token
    SecurityToken token =
        requestSecurityToken(bus, wsdlLocation, WSS4JConstants.WSS_SAML2_TOKEN_TYPE, 2, false);
    assertNotNull(token);
    // Sleep to expire the token
    Thread.sleep(2100);

    // Renew the token - this will fail as we didn't send a Renewing @OK attribute
    try {
        renewSecurityToken(bus, wsdlLocation, token, false);
        fail("Failure expected on a different AppliesTo address");
    } catch (Exception ex) {
        // expected
    }

    bus.shutdown(true);
}
 
Example #30
Source File: JMSConduit.java    From cxf with Apache License 2.0 5 votes vote down vote up
public JMSConduit(EndpointReferenceType target,
                  JMSConfiguration jmsConfig,
                  Bus b) {
    super(target);
    bus = b;
    this.jmsConfig = jmsConfig;
    conduitId = UUID.randomUUID().toString().replaceAll("-", "");
}