Search in sources :

Example 1 with ProcessControl

use of com.sun.xml.ws.sdo.sample.service.types.ProcessControl in project metro-jax-ws by eclipse-ee4j.

the class SDOHRAppServiceTest method testSDO_HRAppServiceNoWrapper.

// Bug 14071356
public void testSDO_HRAppServiceNoWrapper() throws Exception {
    Set<SchemaInfo> schemas = SDOUtils.getSchemas(getResource("wsdl/HRAppService.wsdl").getFile());
    DatabindingConfig srvConfig = new DatabindingConfig();
    Class<HRAppServiceNoWrapper> sei = HRAppServiceNoWrapper.class;
    Class<HRAppServiceImpl> seb = HRAppServiceImpl.class;
    SDOConfig cSdo = sdoConfig(schemas, false);
    SDOConfig sSdo = sdoConfig(schemas, true);
    srvConfig.setContractClass(sei);
    srvConfig.setEndpointClass(seb);
    DatabindingModeFeature dbm = new DatabindingModeFeature("eclipselink.sdo");
    WebServiceFeature[] features = { dbm };
    srvConfig.setFeatures(features);
    srvConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_INFO, schemas);
    // srvConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_FILE, f);
    srvConfig.properties().put(SDOContextWrapper.SDO_HELPER_CONTEXT_RESOLVER, sSdo.resolver);
    srvConfig.properties().put("com.sun.xml.ws.api.model.SuppressDocLitWrapperGeneration", true);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setContractClass(sei);
    cliConfig.setFeatures(features);
    cliConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_INFO, schemas);
    // cliConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_FILE, f);
    cliConfig.properties().put(SDOContextWrapper.SDO_HELPER_CONTEXT_RESOLVER, cSdo.resolver);
    cliConfig.properties().put("com.sun.xml.ws.api.model.SuppressDocLitWrapperGeneration", true);
    HRAppServiceNoWrapper proxy = createProxy(sei, srvConfig, cliConfig, debug);
    java.math.BigDecimal totalComp = proxy.getTotalComp(new BigInteger("222"));
    assertEquals("222", totalComp.toString());
    totalComp = proxy.getTotalComp(new BigInteger("333"));
    assertEquals("333", totalComp.toString());
    doTestGetDeptno("1", proxy);
    doTestGetDeptno("2", proxy);
    doTestGetDeptno("2000", proxy);
    List<Emp> emps = proxy.getManagerAndPeers(new BigInteger("100"));
    assertEquals(3, emps.size());
    for (int i = 0; i < emps.size(); i++) {
        assertEquals("name" + i, emps.get(i).getEname());
        assertEquals("job" + i, emps.get(i).getJob());
    }
    HelperContext context = cSdo.context;
    {
        Emp emp = (Emp) context.getDataFactory().create(Emp.class);
        ProcessControl processControl = (ProcessControl) context.getDataFactory().create(ProcessControl.class);
        processControl.setReturnMode("Full");
        emp.setEname("name0");
        List<Emp> empIn = new Vector<Emp>();
        empIn.add(emp);
        emp = (Emp) context.getDataFactory().create(Emp.class);
        emp.setEname("name1");
        empIn.add(emp);
        List<Emp> ret = proxy.processEmps("myoperation", empIn, processControl);
        for (int i = 0; i < ret.size(); i++) {
            assertEquals(ret.get(i).getEname(), empIn.get(i).getEname());
            assertEquals("myoperation", ret.get(i).getJob());
        }
    }
    {
        Emp emp = createEmployee(200, "1", "name", "1000", "fry cook", context);
        Emp ret = proxy.createEmp(emp);
        assertEquals(ret.getEname(), emp.getEname());
        assertEquals(ret.getEmpno(), emp.getEmpno());
        assertEquals(ret.getDeptno(), emp.getDeptno());
        assertEquals(ret.getJob(), emp.getJob());
        doTestGetDeptno("1", proxy);
        doTestGetDeptno("2", proxy);
        doTestGetDeptno("2000", proxy);
    }
}
Also used : ProcessControl(com.sun.xml.ws.sdo.sample.service.types.ProcessControl) HelperContext(commonj.sdo.helper.HelperContext) SDOHelperContext(org.eclipse.persistence.sdo.helper.SDOHelperContext) Emp(com.sun.xml.ws.sdo.sample.service.types.Emp) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) WSEndpoint(com.sun.xml.ws.api.server.WSEndpoint) DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) BigDecimal(java.math.BigDecimal) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) BigInteger(java.math.BigInteger) List(java.util.List) SchemaInfo(com.sun.xml.ws.db.sdo.SchemaInfo)

Example 2 with ProcessControl

use of com.sun.xml.ws.sdo.sample.service.types.ProcessControl in project metro-jax-ws by eclipse-ee4j.

the class SDOHRAppServiceTest method doTest.

public void doTest(HRAppService proxy, HelperContext chc) throws Exception {
    java.math.BigDecimal totalComp = proxy.getTotalComp(new BigInteger("222"));
    assertEquals("222", totalComp.toString());
    totalComp = proxy.getTotalComp(new BigInteger("333"));
    assertEquals("333", totalComp.toString());
    doTestGetDeptno("1", proxy);
    doTestGetDeptno("2", proxy);
    doTestGetDeptno("2000", proxy);
    List<Emp> emps = proxy.getManagerAndPeers(new BigInteger("100"));
    assertEquals(3, emps.size());
    for (int i = 0; i < emps.size(); i++) {
        assertEquals("name" + i, emps.get(i).getEname());
        assertEquals("job" + i, emps.get(i).getJob());
    }
    HelperContext context = chc;
    {
        Emp emp = (Emp) context.getDataFactory().create(Emp.class);
        ProcessControl processControl = (ProcessControl) context.getDataFactory().create(ProcessControl.class);
        processControl.setReturnMode("Full");
        emp.setEname("name0");
        List<Emp> empIn = new Vector<Emp>();
        empIn.add(emp);
        emp = (Emp) context.getDataFactory().create(Emp.class);
        emp.setEname("name1");
        empIn.add(emp);
        List<Emp> ret = proxy.processEmps("myoperation", empIn, processControl);
        for (int i = 0; i < ret.size(); i++) {
            assertEquals(ret.get(i).getEname(), empIn.get(i).getEname());
            assertEquals("myoperation", ret.get(i).getJob());
        }
    }
    {
        Emp emp = createEmployee(200, "1", "name", "1000", "fry cook", context);
        Emp ret = proxy.createEmp(emp);
        assertEquals(ret.getEname(), emp.getEname());
        assertEquals(ret.getEmpno(), emp.getEmpno());
        assertEquals(ret.getDeptno(), emp.getDeptno());
        assertEquals(ret.getJob(), emp.getJob());
        doTestGetDeptno("1", proxy);
        doTestGetDeptno("2", proxy);
        doTestGetDeptno("2000", proxy);
    }
}
Also used : ProcessControl(com.sun.xml.ws.sdo.sample.service.types.ProcessControl) BigDecimal(java.math.BigDecimal) HelperContext(commonj.sdo.helper.HelperContext) SDOHelperContext(org.eclipse.persistence.sdo.helper.SDOHelperContext) BigInteger(java.math.BigInteger) Emp(com.sun.xml.ws.sdo.sample.service.types.Emp) List(java.util.List) WSEndpoint(com.sun.xml.ws.api.server.WSEndpoint)

Aggregations

WSEndpoint (com.sun.xml.ws.api.server.WSEndpoint)2 Emp (com.sun.xml.ws.sdo.sample.service.types.Emp)2 ProcessControl (com.sun.xml.ws.sdo.sample.service.types.ProcessControl)2 HelperContext (commonj.sdo.helper.HelperContext)2 BigDecimal (java.math.BigDecimal)2 BigInteger (java.math.BigInteger)2 List (java.util.List)2 SDOHelperContext (org.eclipse.persistence.sdo.helper.SDOHelperContext)2 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)1 DatabindingConfig (com.sun.xml.ws.api.databinding.DatabindingConfig)1 SchemaInfo (com.sun.xml.ws.db.sdo.SchemaInfo)1 WebServiceFeature (jakarta.xml.ws.WebServiceFeature)1