"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);
}