use of org.eclipse.persistence.jaxb.TypeMappingInfo in project eclipselink by eclipse-ee4j.
the class JaxbTypeToSchemaTypeTestCases method testDatahandlerTypes.
public void testDatahandlerTypes() throws Exception {
TypeMappingInfo tmi = new TypeMappingInfo();
tmi.setType(DataHandler.class);
tmi.setElementScope(TypeMappingInfo.ElementScope.Local);
tmi.setXmlTagName(new QName("uri1", "tmi1"));
Annotation[] annotations = getClass().getField("attachmentRefField").getAnnotations();
tmi.setAnnotations(annotations);
TypeMappingInfo tmi2 = new TypeMappingInfo();
tmi2.setElementScope(TypeMappingInfo.ElementScope.Local);
tmi2.setXmlTagName(new QName("uri1", "tmi2"));
tmi2.setType(DataHandler.class);
TypeMappingInfo[] tmis = new TypeMappingInfo[] { tmi, tmi2 };
JAXBContext ctx = (JAXBContext) JAXBContextFactory.createContext(tmis, null, Thread.currentThread().getContextClassLoader());
Map<Type, QName> typeMap = ctx.getTypeToSchemaType();
assertEquals(0, typeMap.size());
Map<TypeMappingInfo, QName> tmiMap = ctx.getTypeMappingInfoToSchemaType();
assertEquals(2, tmiMap.size());
assertNotNull(tmiMap.get(tmi2));
assertEquals(XMLConstants.BASE_64_BINARY_QNAME, tmiMap.get(tmi2));
assertNotNull(tmiMap.get(tmi));
assertEquals(XMLConstants.SWA_REF_QNAME, tmiMap.get(tmi));
}
use of org.eclipse.persistence.jaxb.TypeMappingInfo in project eclipselink by eclipse-ee4j.
the class JaxbTypeToSchemaTypeTestCases method testInnerClass.
public void testInnerClass() throws Exception {
TypeMappingInfo tmi1 = new TypeMappingInfo();
tmi1.setXmlTagName(new QName("test", "theRoot"));
tmi1.setElementScope(ElementScope.Global);
tmi1.setType(MyInnerClass.class);
TypeMappingInfo[] typesToBeBound = new TypeMappingInfo[1];
typesToBeBound[0] = tmi1;
JAXBContext ctx = (JAXBContext) JAXBContextFactory.createContext(typesToBeBound, null, Thread.currentThread().getContextClassLoader());
Map<TypeMappingInfo, QName> types = ctx.getTypeMappingInfoToSchemaType();
assertEquals(1, types.size());
assertNotNull(types.get(tmi1));
}
use of org.eclipse.persistence.jaxb.TypeMappingInfo in project eclipselink by eclipse-ee4j.
the class JaxbTypeToSchemaTypeTestCases method testStringType.
public void testStringType() throws Exception {
TypeMappingInfo tmi = mappingInfo("stringField");
TypeMappingInfo[] tmis = new TypeMappingInfo[] { tmi };
JAXBContext ctx = (JAXBContext) JAXBContextFactory.createContext(tmis, null, Thread.currentThread().getContextClassLoader());
Map<Type, QName> typeMap = ctx.getTypeToSchemaType();
assertEquals(0, typeMap.size());
Map<TypeMappingInfo, QName> tmiMap = ctx.getTypeMappingInfoToSchemaType();
assertEquals(1, tmiMap.size());
assertNotNull(tmiMap.get(tmi));
}
use of org.eclipse.persistence.jaxb.TypeMappingInfo in project eclipselink by eclipse-ee4j.
the class JaxbTypeToSchemaTypeTestCases method testByteArray.
public void testByteArray() throws Exception {
TypeMappingInfo tmi = new TypeMappingInfo();
tmi.setType(byte[].class);
TypeMappingInfo[] tmis = new TypeMappingInfo[] { tmi };
JAXBContext ctx = (JAXBContext) JAXBContextFactory.createContext(tmis, null, Thread.currentThread().getContextClassLoader());
Map<Type, QName> typeMap = ctx.getTypeToSchemaType();
assertEquals(0, typeMap.size());
Map<TypeMappingInfo, QName> tmiMap = ctx.getTypeMappingInfoToSchemaType();
assertEquals(1, tmiMap.size());
assertNotNull(tmiMap.get(tmi));
}
use of org.eclipse.persistence.jaxb.TypeMappingInfo in project eclipselink by eclipse-ee4j.
the class JaxbTypeToSchemaTypeTestCases method testInteger2DArray.
public void testInteger2DArray() throws Exception {
TypeMappingInfo tmi = new TypeMappingInfo();
tmi.setType(Integer[][].class);
TypeMappingInfo[] tmis = new TypeMappingInfo[] { tmi };
JAXBContext ctx = (JAXBContext) JAXBContextFactory.createContext(tmis, null, Thread.currentThread().getContextClassLoader());
Map<Type, QName> typeMap = ctx.getTypeToSchemaType();
assertEquals(0, typeMap.size());
Map<TypeMappingInfo, QName> tmiMap = ctx.getTypeMappingInfoToSchemaType();
assertEquals(1, tmiMap.size());
assertNotNull(tmiMap.get(tmi));
}
Aggregations