Search in sources :

Example 1 with DefaultTypeMapping

use of org.apache.cxf.aegis.type.DefaultTypeMapping in project cxf by apache.

the class XFireXmlParamTypeTest 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 org.apache.cxf.aegis.type.TypeCreationOptions());
    tm.setTypeCreator(creator);
}
Also used : DefaultTypeMapping(org.apache.cxf.aegis.type.DefaultTypeMapping) DefaultTypeCreator(org.apache.cxf.aegis.type.DefaultTypeCreator) Before(org.junit.Before)

Example 2 with DefaultTypeMapping

use of org.apache.cxf.aegis.type.DefaultTypeMapping 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);
}
Also used : DefaultTypeMapping(org.apache.cxf.aegis.type.DefaultTypeMapping) DefaultTypeCreator(org.apache.cxf.aegis.type.DefaultTypeCreator) TypeCreationOptions(org.apache.cxf.aegis.type.TypeCreationOptions) Before(org.junit.Before)

Example 3 with DefaultTypeMapping

use of org.apache.cxf.aegis.type.DefaultTypeMapping in project cxf by apache.

the class XMLStreamReaderMappingTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    addNamespace("b", "urn:beanz");
    addNamespace("xsi", Constants.URI_2001_SCHEMA_XSI);
    context = new AegisContext();
    // create a different mapping than the context creates.
    TypeMapping baseMapping = DefaultTypeMapping.createSoap11TypeMapping(true, false, false);
    mapping = new DefaultTypeMapping(Constants.URI_2001_SCHEMA_XSD, baseMapping);
    mapping.register(XMLStreamReader.class, new QName("urn:Bean", "SimpleBean"), new XMLStreamReaderType());
    mapping.setTypeCreator(context.createTypeCreator());
    context.setTypeMapping(mapping);
    context.initialize();
}
Also used : DefaultTypeMapping(org.apache.cxf.aegis.type.DefaultTypeMapping) QName(javax.xml.namespace.QName) AegisContext(org.apache.cxf.aegis.AegisContext) DefaultTypeMapping(org.apache.cxf.aegis.type.DefaultTypeMapping) TypeMapping(org.apache.cxf.aegis.type.TypeMapping) XMLStreamReaderType(org.apache.cxf.aegis.type.xml.XMLStreamReaderType) Before(org.junit.Before)

Example 4 with DefaultTypeMapping

use of org.apache.cxf.aegis.type.DefaultTypeMapping 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.
 *
 * @param mappingNamespaceURI URI to select mappings based on the encoding.
 */
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();
}
Also used : DefaultTypeMapping(org.apache.cxf.aegis.type.DefaultTypeMapping) TypeMapping(org.apache.cxf.aegis.type.TypeMapping) DefaultTypeMapping(org.apache.cxf.aegis.type.DefaultTypeMapping) TypeCreationOptions(org.apache.cxf.aegis.type.TypeCreationOptions)

Example 5 with DefaultTypeMapping

use of org.apache.cxf.aegis.type.DefaultTypeMapping 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));
}
Also used : DefaultTypeMapping(org.apache.cxf.aegis.type.DefaultTypeMapping) AegisType(org.apache.cxf.aegis.type.AegisType) TypeCreationOptions(org.apache.cxf.aegis.type.TypeCreationOptions) MapType(org.apache.cxf.aegis.type.collection.MapType) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Aggregations

DefaultTypeMapping (org.apache.cxf.aegis.type.DefaultTypeMapping)13 TypeCreationOptions (org.apache.cxf.aegis.type.TypeCreationOptions)10 Before (org.junit.Before)8 TypeMapping (org.apache.cxf.aegis.type.TypeMapping)4 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)3 AegisContext (org.apache.cxf.aegis.AegisContext)3 AegisType (org.apache.cxf.aegis.type.AegisType)3 DefaultTypeCreator (org.apache.cxf.aegis.type.DefaultTypeCreator)3 Test (org.junit.Test)3 CollectionType (org.apache.cxf.aegis.type.collection.CollectionType)2 Type (java.lang.reflect.Type)1 HashSet (java.util.HashSet)1 QName (javax.xml.namespace.QName)1 AbstractTypeCreator (org.apache.cxf.aegis.type.AbstractTypeCreator)1 TypeCreator (org.apache.cxf.aegis.type.TypeCreator)1 XMLTypeCreator (org.apache.cxf.aegis.type.XMLTypeCreator)1 MapType (org.apache.cxf.aegis.type.collection.MapType)1 Java5TypeCreator (org.apache.cxf.aegis.type.java5.Java5TypeCreator)1 XMLStreamReaderType (org.apache.cxf.aegis.type.xml.XMLStreamReaderType)1