Search in sources :

Example 56 with OperationInfo

use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.

the class RequestWrapperTest method testWithAnnotationWithClass.

@Test
public void testWithAnnotationWithClass() throws Exception {
    String pkgName = "org.apache.cxf.tools.fortest.withannotation.doc";
    Class<?> testingClass = Class.forName(pkgName + ".Greeter");
    OperationInfo opInfo = getOperation(testingClass, "sayHi");
    Wrapper wrapper = new RequestWrapper();
    wrapper.setOperationInfo(opInfo);
    assertFalse(wrapper.isWrapperAbsent());
    assertTrue(wrapper.isToDifferentPackage());
    assertFalse(wrapper.isWrapperBeanClassNotExist());
    assertEquals(pkgName, wrapper.getJavaClass().getPackageName());
    assertEquals("SayHi", wrapper.getJavaClass().getName());
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) Test(org.junit.Test)

Example 57 with OperationInfo

use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.

the class RequestWrapperTest method testWithAnnotationNoClass.

@Test
public void testWithAnnotationNoClass() throws Exception {
    String pkgName = "org.apache.cxf.tools.fortest.withannotation.doc";
    Class<?> testingClass = Class.forName(pkgName + ".Stock");
    OperationInfo opInfo = getOperation(testingClass, "getPrice");
    Wrapper wrapper = new RequestWrapper();
    wrapper.setOperationInfo(opInfo);
    assertFalse(wrapper.isWrapperAbsent());
    assertTrue(wrapper.isToDifferentPackage());
    assertFalse(wrapper.isWrapperBeanClassNotExist());
    assertEquals(pkgName + ".jaxws", wrapper.getJavaClass().getPackageName());
    assertEquals("GetPrice", wrapper.getJavaClass().getName());
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) Test(org.junit.Test)

Example 58 with OperationInfo

use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.

the class RequestWrapperTest method testCXF1752.

@Test
public void testCXF1752() throws Exception {
    OperationInfo opInfo = getOperation(AddNumbersPortType.class, "testCXF1752");
    RequestWrapper wrapper = new RequestWrapper();
    wrapper.setOperationInfo(opInfo);
    wrapper.buildWrapperBeanClass();
    List<JavaField> fields = wrapper.getJavaClass().getFields();
    assertEquals(6, fields.size());
    assertEquals("java.util.List<java.lang.Long>", fields.get(0).getClassName());
    assertEquals("byte[]", fields.get(2).getClassName());
    assertEquals("org.apache.cxf.tools.fortest.xmllist.AddNumbersPortType.UserObject[]", fields.get(3).getClassName());
    assertEquals("java.util.List<org.apache.cxf.tools.fortest.xmllist.AddNumbersPortType.UserObject>", fields.get(4).getClassName());
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) JavaField(org.apache.cxf.tools.common.model.JavaField) Test(org.junit.Test)

Example 59 with OperationInfo

use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.

the class RequestWrapperTest method testNoAnnotationNoClass.

@Test
public void testNoAnnotationNoClass() throws Exception {
    String pkgName = "org.apache.cxf.tools.fortest.classnoanno.docwrapped";
    Class<?> testingClass = Class.forName(pkgName + ".Stock");
    OperationInfo opInfo = getOperation(testingClass, "getPrice");
    Wrapper wrapper = new RequestWrapper();
    wrapper.setOperationInfo(opInfo);
    assertTrue(wrapper.isWrapperAbsent());
    assertTrue(wrapper.isToDifferentPackage());
    assertFalse(wrapper.isWrapperBeanClassNotExist());
    assertEquals(pkgName + ".jaxws", wrapper.getJavaClass().getPackageName());
    assertEquals("GetPrice", wrapper.getJavaClass().getName());
    JavaClass jClass = wrapper.buildWrapperBeanClass();
    assertNotNull(jClass);
    List<JavaField> jFields = jClass.getFields();
    assertEquals(1, jFields.size());
    assertEquals("arg0", jFields.get(0).getName());
    assertEquals("java.lang.String", jFields.get(0).getClassName());
    List<JavaMethod> jMethods = jClass.getMethods();
    assertEquals(2, jMethods.size());
    JavaMethod jMethod = jMethods.get(0);
    assertEquals("getArg0", jMethod.getName());
    assertTrue(jMethod.getParameterListWithoutAnnotation().isEmpty());
    jMethod = jMethods.get(1);
    assertEquals("setArg0", jMethod.getName());
    assertEquals(1, jMethod.getParameterListWithoutAnnotation().size());
    assertEquals("java.lang.String newArg0", jMethod.getParameterListWithoutAnnotation().get(0));
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) JavaField(org.apache.cxf.tools.common.model.JavaField) JavaClass(org.apache.cxf.tools.common.model.JavaClass) JavaMethod(org.apache.cxf.tools.common.model.JavaMethod) Test(org.junit.Test)

Example 60 with OperationInfo

use of org.apache.cxf.service.model.OperationInfo in project cxf by apache.

the class RequestWrapperTest method getOperation.

private OperationInfo getOperation(Class<?> clz, String opName) {
    builder.setServiceClass(clz);
    ServiceInfo serviceInfo = builder.createService();
    for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
        if (op.getUnwrappedOperation() != null && op.hasInput() && opName.equals(op.getName().getLocalPart())) {
            return op;
        }
    }
    return null;
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo)

Aggregations

OperationInfo (org.apache.cxf.service.model.OperationInfo)135 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)87 QName (javax.xml.namespace.QName)58 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)44 MessageInfo (org.apache.cxf.service.model.MessageInfo)40 Test (org.junit.Test)38 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)36 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)31 Method (java.lang.reflect.Method)25 Endpoint (org.apache.cxf.endpoint.Endpoint)24 Service (org.apache.cxf.service.Service)22 BindingInfo (org.apache.cxf.service.model.BindingInfo)21 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)19 SoapOperationInfo (org.apache.cxf.binding.soap.model.SoapOperationInfo)17 Exchange (org.apache.cxf.message.Exchange)17 ArrayList (java.util.ArrayList)13 UnwrappedOperationInfo (org.apache.cxf.service.model.UnwrappedOperationInfo)13 BindingMessageInfo (org.apache.cxf.service.model.BindingMessageInfo)12 Fault (org.apache.cxf.interceptor.Fault)10 Message (org.apache.cxf.message.Message)10