use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class TestDateMapping method testWriteCustomTypeSchemaType.
@Test
public void testWriteCustomTypeSchemaType() throws Exception {
context = new AegisContext();
Set<java.lang.reflect.Type> rootClasses = new HashSet<>();
rootClasses.add(BeanWithDate.class);
context.setRootClasses(rootClasses);
context.initialize();
BeanWithDate bean = new BeanWithDate();
java.sql.Date date = new java.sql.Date(0);
bean.setFig(date);
AegisType sbType = context.getTypeMapping().getType(bean.getClass());
// dummy to put schema in.
XmlSchema root = new XmlSchema();
/* will explode if the type object created for the custom mapping isn't fully initialized.
*/
sbType.writeSchema(root);
}
use of org.apache.cxf.aegis.type.AegisType 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.AegisType 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());
}
use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class EnumTypeTest method testTypeAttributeOnEnum.
@Test
public void testTypeAttributeOnEnum() throws Exception {
AegisType type = tm.getTypeCreator().createType(TestEnum.class);
assertEquals("urn:xfire:foo", type.getSchemaType().getNamespaceURI());
assertTrue(type instanceof EnumType);
}
use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class EnumTypeTest method testXFireTypeAttributeOnEnum.
@Test
public void testXFireTypeAttributeOnEnum() throws Exception {
AegisType type = tm.getTypeCreator().createType(XFireTestEnum.class);
assertEquals("urn:xfire:foo", type.getSchemaType().getNamespaceURI());
assertTrue(type instanceof EnumType);
}
Aggregations