use of org.apache.cxf.aegis.type.TypeCreationOptions in project cxf by apache.
the class XFireTypeTest method testType.
@Test
public void testType() {
AnnotatedTypeInfo info = new AnnotatedTypeInfo(tm, XFireBean1.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());
}
use of org.apache.cxf.aegis.type.TypeCreationOptions in project cxf by apache.
the class XFireTypeTest method testGetSetRequired.
@Test
public void testGetSetRequired() throws Exception {
BeanType type = new BeanType(new AnnotatedTypeInfo(tm, BadBean.class, "urn:foo", new TypeCreationOptions()));
type.setSchemaType(new QName("urn:foo", "BadBean"));
assertEquals(0, type.getTypeInfo().getElements().size());
}
use of org.apache.cxf.aegis.type.TypeCreationOptions in project cxf by apache.
the class XmlParamTypeTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
tm = new DefaultTypeMapping(null, DefaultTypeMapping.createDefaultTypeMapping(false, false));
creator = new Java5TypeCreator();
creator.setNextCreator(new DefaultTypeCreator());
creator.setConfiguration(new TypeCreationOptions());
tm.setTypeCreator(creator);
}
use of org.apache.cxf.aegis.type.TypeCreationOptions in project cxf by apache.
the class AegisContext method initialize.
/**
* Initialize the context. The encodingStyleURI allows .aegis.xml files to have multiple mappings for,
* say, SOAP 1.1 versus SOAP 1.2. Passing null uses a default URI.
*/
public void initialize() {
// allow spring config of an alternative mapping.
if (configuration == null) {
configuration = new TypeCreationOptions();
}
if (typeMapping == null) {
boolean defaultNillable = configuration.isDefaultNillable();
TypeMapping baseTM = DefaultTypeMapping.createDefaultTypeMapping(defaultNillable, mtomUseXmime, enableJDOMMappings);
if (mappingNamespaceURI == null) {
mappingNamespaceURI = DefaultTypeMapping.DEFAULT_MAPPING_URI;
}
DefaultTypeMapping defaultTypeMapping = new DefaultTypeMapping(mappingNamespaceURI, baseTM);
defaultTypeMapping.setTypeCreator(createTypeCreator());
typeMapping = defaultTypeMapping;
}
processRootTypes();
}
use of org.apache.cxf.aegis.type.TypeCreationOptions in project cxf by apache.
the class NoNamespaceAegisElementProvider method getAegisContext.
@Override
protected AegisContext getAegisContext(Class<?> plainClass, Type genericType) {
AegisContext context = new AegisContext();
context.setWriteXsiTypes(writeXsiType);
context.setReadXsiTypes(readXsiType);
TypeCreationOptions tco = new TypeCreationOptions();
tco.setQualifyElements(false);
Set<java.lang.reflect.Type> rootClasses = new HashSet<>();
rootClasses.add(genericType);
context.setTypeCreationOptions(tco);
context.setRootClasses(rootClasses);
TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false, false);
DefaultTypeMapping mapping = new DefaultTypeMapping(Constants.URI_2001_SCHEMA_XSD, baseMapping);
TypeCreator stockTypeCreator = createTypeCreator(tco);
mapping.setTypeCreator(stockTypeCreator);
context.setTypeMapping(mapping);
context.initialize();
return context;
}
Aggregations