Search in sources :

Example 11 with JavaMethod

use of org.apache.cxf.tools.common.model.JavaMethod in project cxf by apache.

the class WebMethodAnnotatorTest method testAddWebResultAnnotation.

@Test
public void testAddWebResultAnnotation() throws Exception {
    JavaMethod method = new JavaMethod();
    method.annotate(new WebResultAnnotator());
    Map<String, JAnnotation> annotations = method.getAnnotationMap();
    assertNotNull(annotations);
    assertEquals(1, annotations.size());
    assertEquals("WebResult", annotations.keySet().iterator().next());
    JAnnotation resultAnnotation = annotations.get("WebResult");
    assertEquals("@WebResult(name = \"return\")", resultAnnotation.toString());
    List<JAnnotationElement> elements = resultAnnotation.getElements();
    assertNotNull(elements);
    assertEquals(1, elements.size());
    assertEquals("name", elements.get(0).getName());
    assertEquals("return", elements.get(0).getValue());
}
Also used : JAnnotation(org.apache.cxf.tools.common.model.JAnnotation) JAnnotationElement(org.apache.cxf.tools.common.model.JAnnotationElement) JavaMethod(org.apache.cxf.tools.common.model.JavaMethod) Test(org.junit.Test)

Example 12 with JavaMethod

use of org.apache.cxf.tools.common.model.JavaMethod in project cxf by apache.

the class WebMethodAnnotatorTest method testAddWebMethodAnnotation.

@Test
public void testAddWebMethodAnnotation() throws Exception {
    JavaMethod method = new JavaMethod();
    method.setName("echoFoo");
    method.setOperationName("echoFoo");
    method.annotate(new WebMethodAnnotator());
    Map<String, JAnnotation> annotations = method.getAnnotationMap();
    assertNotNull(annotations);
    assertEquals(1, annotations.size());
    assertEquals("WebMethod", annotations.keySet().iterator().next());
}
Also used : JAnnotation(org.apache.cxf.tools.common.model.JAnnotation) JavaMethod(org.apache.cxf.tools.common.model.JavaMethod) Test(org.junit.Test)

Example 13 with JavaMethod

use of org.apache.cxf.tools.common.model.JavaMethod in project cxf by apache.

the class WebParamAnnotatorTest method setUp.

@Before
public void setUp() {
    method = new JavaMethod();
    parameter = new JavaParameter();
    parameter.setMethod(method);
}
Also used : JavaMethod(org.apache.cxf.tools.common.model.JavaMethod) JavaParameter(org.apache.cxf.tools.common.model.JavaParameter) Before(org.junit.Before)

Example 14 with JavaMethod

use of org.apache.cxf.tools.common.model.JavaMethod in project cxf by apache.

the class MethodMapperTest method testMap.

@Test
public void testMap() throws Exception {
    JavaMethod method = new MethodMapper().map(getOperation());
    assertNotNull(method);
    assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT, method.getSoapStyle());
    assertEquals("operationTest", method.getName());
    assertEquals("OperationTest", method.getOperationName());
    assertEquals(OperationType.REQUEST_RESPONSE, method.getStyle());
    assertFalse(method.isWrapperStyle());
    assertFalse(method.isOneWay());
}
Also used : JavaMethod(org.apache.cxf.tools.common.model.JavaMethod) Test(org.junit.Test)

Example 15 with JavaMethod

use of org.apache.cxf.tools.common.model.JavaMethod in project cxf by apache.

the class MethodMapperTest method testMapOneWayOperation.

@Test
public void testMapOneWayOperation() throws Exception {
    OperationInfo operation = getOperation();
    MessageInfo inputMessage = operation.createMessage(new QName("urn:test:ns", "testInputMessage"), MessageInfo.Type.INPUT);
    operation.setInput("input", inputMessage);
    JavaMethod method = new MethodMapper().map(operation);
    assertNotNull(method);
    assertTrue(method.isOneWay());
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) QName(javax.xml.namespace.QName) JavaMethod(org.apache.cxf.tools.common.model.JavaMethod) MessageInfo(org.apache.cxf.service.model.MessageInfo) Test(org.junit.Test)

Aggregations

JavaMethod (org.apache.cxf.tools.common.model.JavaMethod)28 JAnnotation (org.apache.cxf.tools.common.model.JAnnotation)14 JAnnotationElement (org.apache.cxf.tools.common.model.JAnnotationElement)11 JavaParameter (org.apache.cxf.tools.common.model.JavaParameter)9 Test (org.junit.Test)9 JavaInterface (org.apache.cxf.tools.common.model.JavaInterface)7 OperationInfo (org.apache.cxf.service.model.OperationInfo)6 JavaException (org.apache.cxf.tools.common.model.JavaException)5 JavaReturn (org.apache.cxf.tools.common.model.JavaReturn)4 ArrayList (java.util.ArrayList)3 ToolContext (org.apache.cxf.tools.common.ToolContext)3 GenericArrayType (java.lang.reflect.GenericArrayType)2 Method (java.lang.reflect.Method)2 ParameterizedType (java.lang.reflect.ParameterizedType)2 Type (java.lang.reflect.Type)2 URISyntaxException (java.net.URISyntaxException)2 SOAPBinding (javax.jws.soap.SOAPBinding)2 QName (javax.xml.namespace.QName)2 FaultInfo (org.apache.cxf.service.model.FaultInfo)2 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)2