Search in sources :

Example 1 with HelloPort

use of com.sun.xml.ws.test.HelloPort in project metro-jax-ws by eclipse-ee4j.

the class JAXBRIBasicTest method testHelloEchoNoMode.

public void testHelloEchoNoMode() throws Exception {
    Class endpointClass = HelloImpl.class;
    Class proxySEIClass = HelloPort.class;
    DatabindingConfig srvConfig = new DatabindingConfig();
    srvConfig.setEndpointClass(endpointClass);
    srvConfig.setMetadataReader(new DummyAnnotations());
    WebServiceFeature[] f = {};
    srvConfig.setFeatures(f);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setMetadataReader(new DummyAnnotations());
    cliConfig.setContractClass(proxySEIClass);
    cliConfig.setFeatures(f);
    HelloPort hp = createProxy(HelloPort.class, srvConfig, cliConfig, false);
    String req = "testInVM " + databindingMode().getMode();
    String res = hp.echoS(req);
    assertEquals(req, res);
    String wrapperName = srvConfig.properties().get(BindingContext.class.getName()).getClass().getName();
    assertTrue("Wrapper: " + wrapperName, wrapperName != null && wrapperName.endsWith("JAXBRIContextWrapper"));
}
Also used : DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) DummyAnnotations(com.sun.xml.ws.base.DummyAnnotations) HelloImpl(com.sun.xml.ws.test.HelloImpl) HelloPort(com.sun.xml.ws.test.HelloPort) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) BindingContext(com.sun.xml.ws.spi.db.BindingContext)

Example 2 with HelloPort

use of com.sun.xml.ws.test.HelloPort in project metro-jax-ws by eclipse-ee4j.

the class JAXBRIBasicTest method testHelloEchoInvalidDB.

public void testHelloEchoInvalidDB() throws Exception {
    Class endpointClass = HelloImpl.class;
    Class proxySEIClass = HelloPort.class;
    DatabindingConfig srvConfig = new DatabindingConfig();
    srvConfig.setEndpointClass(endpointClass);
    srvConfig.setMetadataReader(new DummyAnnotations());
    WebServiceFeature[] f = { new DatabindingModeFeature("invalid.db") };
    srvConfig.setFeatures(f);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setMetadataReader(new DummyAnnotations());
    cliConfig.setContractClass(proxySEIClass);
    cliConfig.setFeatures(f);
    try {
        HelloPort hp = createProxy(HelloPort.class, srvConfig, cliConfig, false);
        fail("Expected DatabindingException not thrown");
    } catch (DatabindingException e) {
    // expected exception.
    }
}
Also used : DatabindingException(com.sun.xml.ws.spi.db.DatabindingException) DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) DummyAnnotations(com.sun.xml.ws.base.DummyAnnotations) HelloImpl(com.sun.xml.ws.test.HelloImpl) HelloPort(com.sun.xml.ws.test.HelloPort) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature)

Example 3 with HelloPort

use of com.sun.xml.ws.test.HelloPort in project metro-jax-ws by eclipse-ee4j.

the class BasicDatabindingTestBase method _testHelloEcho.

protected String _testHelloEcho() throws Exception {
    Class<?> endpointClass = HelloImpl.class;
    Class<?> proxySEIClass = HelloPort.class;
    DatabindingConfig srvConfig = new DatabindingConfig();
    srvConfig.setEndpointClass(endpointClass);
    srvConfig.setMetadataReader(new DummyAnnotations());
    DatabindingModeFeature dbm = databindingMode();
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setMetadataReader(new DummyAnnotations());
    cliConfig.setContractClass(proxySEIClass);
    // Honor system property if present, otherwise set feature.
    WebServiceFeature[] f = null;
    String dbProperty = System.getProperty(BindingContextFactory.JAXB_CONTEXT_FACTORY_PROPERTY);
    if (dbProperty == null)
        f = new WebServiceFeature[] { dbm };
    else
        f = new WebServiceFeature[0];
    srvConfig.setFeatures(f);
    cliConfig.setFeatures(f);
    HelloPort hp = createProxy(HelloPort.class, srvConfig, cliConfig, false);
    String req = "testInVM " + dbm.getMode();
    String res = hp.echoS(req);
    assertEquals(req, res);
    return srvConfig.properties().get(BindingContext.class.getName()).getClass().getName();
}
Also used : DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) DummyAnnotations(com.sun.xml.ws.base.DummyAnnotations) HelloImpl(com.sun.xml.ws.test.HelloImpl) HelloPort(com.sun.xml.ws.test.HelloPort) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) BindingContext(com.sun.xml.ws.spi.db.BindingContext)

Aggregations

DatabindingConfig (com.sun.xml.ws.api.databinding.DatabindingConfig)3 DummyAnnotations (com.sun.xml.ws.base.DummyAnnotations)3 HelloImpl (com.sun.xml.ws.test.HelloImpl)3 HelloPort (com.sun.xml.ws.test.HelloPort)3 WebServiceFeature (jakarta.xml.ws.WebServiceFeature)3 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)2 BindingContext (com.sun.xml.ws.spi.db.BindingContext)2 DatabindingException (com.sun.xml.ws.spi.db.DatabindingException)1