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());
}
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());
}
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());
}
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));
}
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;
}
Aggregations