Search in sources :

Example 1 with AnotherPolicyType

use of org.apache.cxf.abc.test.AnotherPolicyType in project cxf by apache.

the class JAXBExtensionHelperTest method checkTestExt.

private void checkTestExt() throws Exception {
    Service s = wsdlDefinition.getService(new QName("http://cxf.apache.org/test/hello_world", "HelloWorldService"));
    Port p = s.getPort("HelloWorldPort");
    List<?> extPortList = p.getExtensibilityElements();
    TestPolicyType tp = null;
    AnotherPolicyType ap = null;
    for (Object ext : extPortList) {
        if (ext instanceof TestPolicyType) {
            tp = (TestPolicyType) ext;
        } else if (ext instanceof AnotherPolicyType) {
            ap = (AnotherPolicyType) ext;
        } else if (ext instanceof UnknownExtensibilityElement) {
            UnknownExtensibilityElement e = (UnknownExtensibilityElement) ext;
            System.out.println(e.getElementType());
        }
    }
    assertNotNull("Could not find extension element TestPolicyType", tp);
    assertNotNull("Could not find extension element AnotherPolicyType", ap);
    assertEquals("Unexpected value for TestPolicyType intAttr", 30, tp.getIntAttr());
    assertEquals("Unexpected value for TestPolicyType stringAttr", "hello", tp.getStringAttr());
    assertTrue("Unexpected value for AnotherPolicyType floatAttr", Math.abs(0.1F - ap.getFloatAttr()) < 0.5E-5);
}
Also used : QName(javax.xml.namespace.QName) Port(javax.wsdl.Port) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) AnotherPolicyType(org.apache.cxf.abc.test.AnotherPolicyType) Service(javax.wsdl.Service) TestPolicyType(org.apache.cxf.abc.test.TestPolicyType)

Aggregations

Port (javax.wsdl.Port)1 Service (javax.wsdl.Service)1 UnknownExtensibilityElement (javax.wsdl.extensions.UnknownExtensibilityElement)1 QName (javax.xml.namespace.QName)1 AnotherPolicyType (org.apache.cxf.abc.test.AnotherPolicyType)1 TestPolicyType (org.apache.cxf.abc.test.TestPolicyType)1