use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class ConfigurationTest method testMinOccursDefault1.
@Test
public void testMinOccursDefault1() throws Exception {
config.setDefaultMinOccurs(1);
AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
BeanTypeInfo info = ((BeanType) type).getTypeInfo();
assertEquals(info.getMinOccurs(new QName(info.getDefaultNamespace(), "bogusProperty")), 1);
}
use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class ConfigurationTest method testMinOccursDefault0.
@Test
public void testMinOccursDefault0() throws Exception {
config.setDefaultMinOccurs(0);
AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
BeanTypeInfo info = ((BeanType) type).getTypeInfo();
assertEquals(info.getMinOccurs(new QName(info.getDefaultNamespace(), "bogusProperty")), 0);
}
use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class ConfigurationTest method testExtensibleDefaultFalse.
@Test
public void testExtensibleDefaultFalse() throws Exception {
config.setDefaultExtensibleElements(false);
config.setDefaultExtensibleAttributes(false);
AegisType type = tm.getTypeCreator().createType(AnnotatedBean1.class);
BeanTypeInfo info = ((BeanType) type).getTypeInfo();
assertFalse(info.isExtensibleElements());
assertFalse(info.isExtensibleAttributes());
}
use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class StandaloneReadTest method testCollectionReadNoXsiType.
@Test
public void testCollectionReadNoXsiType() throws Exception {
java.lang.reflect.Type listStringType = ListStringInterface.class.getMethods()[0].getGenericReturnType();
context.setRootClasses(Collections.singleton(listStringType));
context.initialize();
XMLStreamReader streamReader = StaxUtils.createXMLStreamReader(getClass().getResourceAsStream("topLevelList.xml"));
AegisReader<XMLStreamReader> reader = context.createXMLStreamReader();
// until I fix type mapping to use java.lang.reflect.Type instead of
// Class, I need to do the following
QName magicTypeQName = new QName("urn:org.apache.cxf.aegis.types", "ArrayOfString");
AegisType aegisRegisteredType = context.getTypeMapping().getType(magicTypeQName);
Object something = reader.read(streamReader, aegisRegisteredType);
List<String> correctAnswer = Arrays.asList("cat", "dog", "hailstorm");
assertEquals(correctAnswer, something);
}
use of org.apache.cxf.aegis.type.AegisType in project cxf by apache.
the class CollectionTest method testType.
@Test
public void testType() throws Exception {
Method m = CollectionService.class.getMethod("getStrings", new Class[0]);
AegisType type = creator.createType(m, -1);
tm.register(type);
assertTrue(type instanceof CollectionType);
CollectionType colType = (CollectionType) type;
QName componentName = colType.getSchemaType();
assertEquals("ArrayOfString", componentName.getLocalPart());
assertEquals("ArrayOfString", componentName.getLocalPart());
type = colType.getComponentType();
assertNotNull(type);
assertTrue(type.getTypeClass().isAssignableFrom(String.class));
}
Aggregations