Search in sources :

Example 1 with SOAPAddressRewriteMetadata

use of org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata in project jbossws-cxf by jbossws.

the class BusHolderLifeCycleTestCase method shutdownTestWithNoShutdown.

private static void shutdownTestWithNoShutdown(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);
    assertEquals("preShutdown method on listener shouldn't be called before holder is closed: number of actual calls: " + listener.getCount(), 0, listener.getCount());
    holder.close();
}
Also used : Bus(org.apache.cxf.Bus) DefaultDeploymentModelFactory(org.jboss.ws.common.deployment.DefaultDeploymentModelFactory) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata) Deployment(org.jboss.wsf.spi.deployment.Deployment) BusLifeCycleManager(org.apache.cxf.buslifecycle.BusLifeCycleManager)

Example 2 with SOAPAddressRewriteMetadata

use of org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata in project jbossws-cxf by jbossws.

the class BusHolderLifeCycleTestCase method shutdownTestWithInnerShutdown.

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());
}
Also used : Bus(org.apache.cxf.Bus) DefaultDeploymentModelFactory(org.jboss.ws.common.deployment.DefaultDeploymentModelFactory) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata) Deployment(org.jboss.wsf.spi.deployment.Deployment) BusLifeCycleManager(org.apache.cxf.buslifecycle.BusLifeCycleManager)

Example 3 with SOAPAddressRewriteMetadata

use of org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata in project jbossws-cxf by jbossws.

the class BusHolderLifeCycleTestCase method simpleShutdownTest.

private static void simpleShutdownTest(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);
    holder.close();
    assertEquals("preShutdown method on listener should be called exactly once; number of actual calls: " + listener.getCount(), 1, listener.getCount());
}
Also used : Bus(org.apache.cxf.Bus) DefaultDeploymentModelFactory(org.jboss.ws.common.deployment.DefaultDeploymentModelFactory) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata) Deployment(org.jboss.wsf.spi.deployment.Deployment) BusLifeCycleManager(org.apache.cxf.buslifecycle.BusLifeCycleManager)

Example 4 with SOAPAddressRewriteMetadata

use of org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata in project jbossws-cxf by jbossws.

the class BusHolderTest method setupPropertyAndGetAlternativeSelector.

private static String setupPropertyAndGetAlternativeSelector(String alternative) {
    JBossWebservicesMetaData wsmd = null;
    if (alternative != null) {
        Map<String, String> props = new HashMap<String, String>();
        props.put(Constants.CXF_POLICY_ALTERNATIVE_SELECTOR_PROP, alternative);
        wsmd = new JBossWebservicesMetaData(null, null, null, null, props, null, null);
    }
    BusHolder holder = new BusHolder(new DDBeans());
    try {
        Deployment dep = new DefaultDeploymentModelFactory().newDeployment("testDeployment", null, null);
        dep.addAttachment(SOAPAddressRewriteMetadata.class, new SOAPAddressRewriteMetadata(getTestServerConfig(), null));
        holder.configure(null, null, wsmd, dep);
        return holder.getBus().getExtension(PolicyEngine.class).getAlternativeSelector().getClass().getName();
    } finally {
        holder.close();
    }
}
Also used : DDBeans(org.jboss.wsf.stack.cxf.metadata.services.DDBeans) DefaultDeploymentModelFactory(org.jboss.ws.common.deployment.DefaultDeploymentModelFactory) HashMap(java.util.HashMap) JBossWebservicesMetaData(org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata) Deployment(org.jboss.wsf.spi.deployment.Deployment) PolicyEngine(org.apache.cxf.ws.policy.PolicyEngine)

Example 5 with SOAPAddressRewriteMetadata

use of org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata in project jbossws-cxf by jbossws.

the class EndpointImpl method updateSoapAddress.

/**
 * For both code-first and wsdl-first scenarios, reset the endpoint address
 * so that it is written to the generated wsdl file.
 */
private void updateSoapAddress() {
    final SOAPAddressRewriteMetadata metadata = getSOAPAddressRewriteMetadata();
    if (metadata.isModifySOAPAddress()) {
        // - code-first handling
        List<ServiceInfo> sevInfos = getServer().getEndpoint().getService().getServiceInfos();
        for (ServiceInfo si : sevInfos) {
            Collection<EndpointInfo> epInfos = si.getEndpoints();
            for (EndpointInfo ei : epInfos) {
                String publishedEndpointUrl = (String) ei.getProperty(WSDLGetUtils.PUBLISHED_ENDPOINT_URL);
                if (publishedEndpointUrl != null) {
                    ei.setAddress(publishedEndpointUrl);
                } else {
                    // - wsdl-first handling
                    if (ei.getAddress().contains(ServerConfig.UNDEFINED_HOSTNAME)) {
                        String epurl = SoapAddressRewriteHelper.getRewrittenPublishedEndpointUrl(ei.getAddress(), metadata);
                        ei.setAddress(epurl);
                    }
                }
            }
        }
    }
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata)

Aggregations

SOAPAddressRewriteMetadata (org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata)8 Deployment (org.jboss.wsf.spi.deployment.Deployment)5 DefaultDeploymentModelFactory (org.jboss.ws.common.deployment.DefaultDeploymentModelFactory)4 Bus (org.apache.cxf.Bus)3 BusLifeCycleManager (org.apache.cxf.buslifecycle.BusLifeCycleManager)3 HashMap (java.util.HashMap)2 DDBeans (org.jboss.wsf.stack.cxf.metadata.services.DDBeans)2 URL (java.net.URL)1 QName (javax.xml.namespace.QName)1 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)1 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)1 PolicyEngine (org.apache.cxf.ws.policy.PolicyEngine)1 SOAPAddressWSDLParser (org.jboss.ws.common.deployment.SOAPAddressWSDLParser)1 Endpoint (org.jboss.wsf.spi.deployment.Endpoint)1 HttpEndpoint (org.jboss.wsf.spi.deployment.HttpEndpoint)1 JBossWebservicesMetaData (org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData)1 JBossWSInvoker (org.jboss.wsf.stack.cxf.JBossWSInvoker)1 EndpointAssociationInterceptor (org.jboss.wsf.stack.cxf.interceptor.EndpointAssociationInterceptor)1 GracefulShutdownInterceptor (org.jboss.wsf.stack.cxf.interceptor.GracefulShutdownInterceptor)1 HandlerAuthInterceptor (org.jboss.wsf.stack.cxf.interceptor.HandlerAuthInterceptor)1