Package org.apache.tuscany.spi.model

Examples of org.apache.tuscany.spi.model.DataType


        Assert.assertTrue(result instanceof Object);

    }

    private TransformationContext createTransformationContext() {
        DataType dataType = new DataType<Class>(Object.class, null);
        dataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);

        TransformationContext tContext = createMock(TransformationContext.class);
        expect(tContext.getTargetDataType()).andReturn(dataType).anyTimes();

        expect(tContext.getSourceDataType()).andReturn(dataType).anyTimes();
View Full Code Here


        // XmlObject to XMLStreamReader
        XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
        XMLStreamReader reader = t1.transform(object, null);

        DataType targetDataType = new DataType<Class>(Object.class, null);
        targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);

        TransformationContext tContext = createMock(TransformationContext.class);
        expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
        replay(tContext);

        // XMLStreamReader to JAXB
        XMLStreamReader2JAXB t2 = new XMLStreamReader2JAXB();
        Object object2 = t2.transform(reader, tContext);

        DataType sourceDataType = new DataType<Class>(Object.class, null);
        sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);

        TransformationContext tContext1 = createMock(TransformationContext.class);
        expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
        replay(tContext1);
View Full Code Here

    private Client client;
    private String contextPath = "com.example.ipo.jaxb";

    @SuppressWarnings("unchecked")
    public void testDataBindingBootstrap() throws Exception {
        DataType targetDataType = new DataType<Class>(Object.class, null);
        targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
        TransformationContext tContext = createMock(TransformationContext.class);
        expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
        replay(tContext);

        String2DataObject t1 = new String2DataObject();
View Full Code Here

     * @param context
     * @param element
     */
    private void adjustElementName(TransformationContext context, OMElement element) {
        if (context != null) {
            DataType dataType = context.getTargetDataType();
            Object targetQName = dataType == null ? null : dataType.getLogical();
            if (!(targetQName instanceof QName)) {
                return;
            }
            if (!element.getQName().equals(targetQName)) {
                // TODO: Throw expection or switch to the new Element
View Full Code Here

     * @param context
     * @param element
     */
    private void adjustElementName(TransformationContext context, OMElement element) {
        if (context != null) {
            DataType dataType = context.getTargetDataType();
            Object targetQName = dataType == null ? null : dataType.getLogical();
            if (!(targetQName instanceof QName)) {
                return;
            }
            if (!element.getQName().equals(targetQName)) {
                // TODO: Throw expection or switch to the new Element
View Full Code Here

    }

    public void testTransform() throws Exception {
        Reader2JAXB t0 = new Reader2JAXB();

        DataType targetDataType = new DataType<Class>(Object.class, null);
        targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);

        TransformationContext tContext = createMock(TransformationContext.class);
        expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
        replay(tContext);

        Object object1 = t0.transform(new StringReader(IPO_XML), tContext);

        DataType sourceDataType = new DataType<Class>(Object.class, null);
        sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);

        TransformationContext tContext1 = createMock(TransformationContext.class);
        expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
        replay(tContext1);
View Full Code Here

        String name = reader.getAttributeValue(null, "name");
        LoaderUtil.skipToEndElement(reader);
        if (name == null) {
            throw new InvalidValueException("The 'name' attrbiute is required");
        }
        DataType dataType = new DataType<Class>(name, Object.class, Object.class);
        return dataType;
    }
View Full Code Here

    @Init(eager = true)
    public void init() {
    }

    public DataType introspectType(Class<?> javaType) {
        DataType dataType = null;
        for (DataBinding binding : bindings.values()) {
            dataType = binding.introspect(javaType);
            if (dataType != null) {
                return dataType;
            }
View Full Code Here

        }
        return null;
    }

    public DataType introspectType(Object value) {
        DataType dataType = null;
        for (DataBinding binding : bindings.values()) {
            dataType = binding.introspect(value);
            if (dataType != null) {
                return dataType;
            }
View Full Code Here

     *      TransformationContext)
     */
    public Object create(ElementInfo element, TransformationContext context) {
        TypeHelper typeHelper = TypeHelper.INSTANCE;
        if (context != null) {
            DataType targetType = context.getTargetDataType();
            if (targetType != null) {
                typeHelper = (TypeHelper) targetType.getMetadata(TypeHelper.class.getName());
                if (typeHelper == null) {
                    typeHelper = TypeHelper.INSTANCE;
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.spi.model.DataType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.