use of org.apache.cxf.aegis.type.TypeCreationOptions in project cxf by apache.
the class MapTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
tm = new DefaultTypeMapping();
creator = new Java5TypeCreator();
creator.setConfiguration(new TypeCreationOptions());
tm.setTypeCreator(creator);
}
use of org.apache.cxf.aegis.type.TypeCreationOptions in project cxf by apache.
the class MapTest method testMapDTO.
@Test
public void testMapDTO() {
tm = new DefaultTypeMapping();
creator = new Java5TypeCreator();
creator.setConfiguration(new TypeCreationOptions());
tm.setTypeCreator(creator);
AegisType dto = creator.createType(MapDTO.class);
Set<AegisType> deps = dto.getDependencies();
AegisType type = deps.iterator().next();
assertTrue(type instanceof MapType);
MapType mapType = (MapType) type;
deps = dto.getDependencies();
assertEquals(1, deps.size());
type = mapType.getKeyType();
assertNotNull(type);
assertTrue(type.getTypeClass().isAssignableFrom(String.class));
type = mapType.getValueType();
assertNotNull(type);
assertTrue(type.getTypeClass().isAssignableFrom(Integer.class));
}
use of org.apache.cxf.aegis.type.TypeCreationOptions in project cxf by apache.
the class DuplicateArrayTest method testServiceStart.
@Test
public void testServiceStart() throws Exception {
AegisDatabinding binder = new AegisDatabinding();
JaxWsServerFactoryBean serviceFactory = new JaxWsServerFactoryBean();
serviceFactory.getServiceFactory().setDataBinding(binder);
TypeCreationOptions configuration = binder.getAegisContext().getTypeCreationOptions();
configuration.setDefaultMinOccurs(1);
configuration.setDefaultNillable(false);
binder.getAegisContext().setWriteXsiTypes(true);
serviceFactory.setAddress("local://DuplicateArrayService");
serviceFactory.setServiceBean(new DuplicateArrayServiceBean());
serviceFactory.setServiceClass(DuplicateArrayService.class);
Document doc = this.getWSDLDocument(serviceFactory.create());
this.assertValid("//wsdl:definitions/wsdl:types" + "/xsd:schema[@targetNamespace='http://cxf.apache.org/arrays']" + "/xsd:complexType[@name='ArrayOfAnyType']", doc.getDocumentElement());
}
use of org.apache.cxf.aegis.type.TypeCreationOptions in project cxf by apache.
the class ConfigurationTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
AegisContext context = new AegisContext();
config = new TypeCreationOptions();
context.setTypeCreationOptions(config);
context.initialize();
XMLTypeCreator creator = new XMLTypeCreator();
creator.setConfiguration(config);
Java5TypeCreator next = new Java5TypeCreator();
next.setConfiguration(config);
creator.setNextCreator(next);
tm = (DefaultTypeMapping) context.getTypeMapping();
tm.setTypeCreator(creator);
}
use of org.apache.cxf.aegis.type.TypeCreationOptions in project cxf by apache.
the class AnnotatedTypeTest method testType.
@Test
public void testType() {
AnnotatedTypeInfo info = new AnnotatedTypeInfo(tm, AnnotatedBean1.class, "urn:foo", new TypeCreationOptions());
Iterator<QName> elements = info.getElements().iterator();
assertTrue(elements.hasNext());
QName element = elements.next();
assertTrue(elements.hasNext());
AegisType custom = info.getType(element);
if ("bogusProperty".equals(element.getLocalPart())) {
assertTrue(custom instanceof StringType);
} else if ("elementProperty".equals(element.getLocalPart())) {
assertTrue(custom instanceof CustomStringType);
} else {
fail("Unexpected element name: " + element.getLocalPart());
}
element = elements.next();
assertFalse(elements.hasNext());
custom = info.getType(element);
if ("bogusProperty".equals(element.getLocalPart())) {
assertTrue(custom instanceof StringType);
} else if ("elementProperty".equals(element.getLocalPart())) {
assertTrue(custom instanceof CustomStringType);
} else {
fail("Unexpected element name: " + element.getLocalPart());
}
Iterator<QName> atts = info.getAttributes().iterator();
assertTrue(atts.hasNext());
atts.next();
assertFalse(atts.hasNext());
assertTrue(info.isExtensibleElements());
assertTrue(info.isExtensibleAttributes());
}
Aggregations