Package org.apache.tuscany.sca.databinding.impl

Examples of org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl


    private static int prefixCount = 1;

    protected SimpleTypeMapperImpl mapper;

    public JavaBean2XMLTransformer() {
        this.mapper = new SimpleTypeMapperImpl();
    }
View Full Code Here


    public static final QName QNAME_MESSAGE = new QName("message");

    protected SimpleTypeMapperImpl mapper;

    public XML2JavaBeanTransformer() {
        this.mapper = new SimpleTypeMapperImpl();
    }
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
    }

    public void testMap() throws Exception {
        SimpleTypeMapperImpl extension = new SimpleTypeMapperImpl();
        TransformationContext context = EasyMock.createMock(TransformationContext.class);
        Map<String, Object> metaData = new HashMap<String, Object>();
        EasyMock.expect(context.getMetadata()).andReturn(metaData).anyTimes();
        EasyMock.replay(context);

        NamespaceContext namespaceContext = EasyMock.createMock(NamespaceContext.class);
        EasyMock.expect(namespaceContext.getNamespaceURI(EasyMock.eq("f"))).andReturn("http://foo").anyTimes();
        EasyMock.expect(namespaceContext.getPrefix(EasyMock.eq("http://foo"))).andReturn("f").anyTimes();
        EasyMock.replay(namespaceContext);
        context.getMetadata().put(NamespaceContext.class.getName(), namespaceContext);
        for (TypeInfo simpleType : SimpleTypeMapperImpl.XSD_SIMPLE_TYPES.values()) {
            String name = simpleType.getQName().getLocalPart();
            Object value = SAMPLE_VALUES.get(name);
            if (value instanceof String[]) {
                for (String s : (String[])value) {
                    Object obj = extension.toJavaObject(simpleType.getQName(), s, context);
                    String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
                    assertNotNull(str);
                    // assertTrue("[" + name + "] " + s + " " + str,
                    // str.contains((String) s));
                }
            } else if (value instanceof String) {
                Object obj = extension.toJavaObject(simpleType.getQName(), (String)value, context);
                String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
                assertNotNull(str);
                // assertTrue("[" + name + "] " + value + " " + str,
                // str.contains((String) value));
            }
        }
View Full Code Here

    private static int prefixCount = 1;

    protected SimpleTypeMapperImpl mapper;

    public JavaBean2XMLTransformer() {
        this.mapper = new SimpleTypeMapperImpl();
    }
View Full Code Here

    public static final QName QNAME_MESSAGE = new QName("message");

    protected SimpleTypeMapperImpl mapper;

    public XML2JavaBeanTransformer() {
        this.mapper = new SimpleTypeMapperImpl();
    }
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
    }

    public void testMap() throws Exception {
        SimpleTypeMapperImpl extension = new SimpleTypeMapperImpl();
        TransformationContext context = EasyMock.createMock(TransformationContext.class);
        Map<String, Object> metaData = new HashMap<String, Object>();
        EasyMock.expect(context.getMetadata()).andReturn(metaData).anyTimes();
        EasyMock.replay(context);

        NamespaceContext namespaceContext = EasyMock.createMock(NamespaceContext.class);
        EasyMock.expect(namespaceContext.getNamespaceURI(EasyMock.eq("f"))).andReturn("http://foo").anyTimes();
        EasyMock.expect(namespaceContext.getPrefix(EasyMock.eq("http://foo"))).andReturn("f").anyTimes();
        EasyMock.replay(namespaceContext);
        context.getMetadata().put(NamespaceContext.class.getName(), namespaceContext);
        for (TypeInfo simpleType : SimpleTypeMapperImpl.XSD_SIMPLE_TYPES.values()) {
            String name = simpleType.getQName().getLocalPart();
            Object value = SAMPLE_VALUES.get(name);
            if (value instanceof String[]) {
                for (String s : (String[])value) {
                    Object obj = extension.toJavaObject(simpleType.getQName(), s, context);
                    String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
                    assertNotNull(str);
                    // assertTrue("[" + name + "] " + s + " " + str,
                    // str.contains((String) s));
                }
            } else if (value instanceof String) {
                Object obj = extension.toJavaObject(simpleType.getQName(), (String)value, context);
                String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
                assertNotNull(str);
                // assertTrue("[" + name + "] " + value + " " + str,
                // str.contains((String) value));
            }
        }
View Full Code Here

    private static int prefixCount = 1;
   
    protected SimpleTypeMapperImpl mapper;

    public JavaBean2XMLTransformer() {
        this.mapper = new SimpleTypeMapperImpl();
    }
View Full Code Here

    public static final String SET = "set";

    protected SimpleTypeMapperImpl mapper;

    public XML2JavaBeanTransformer() {
        this.mapper = new SimpleTypeMapperImpl();
    }
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
    }

    public void testMap() throws Exception {
        SimpleTypeMapperImpl extension = new SimpleTypeMapperImpl();
        TransformationContext context = EasyMock.createMock(TransformationContext.class);
        Map<String, Object> metaData = new HashMap<String, Object>();
        EasyMock.expect(context.getMetadata()).andReturn(metaData).anyTimes();
        EasyMock.replay(context);

        NamespaceContext namespaceContext = EasyMock.createMock(NamespaceContext.class);
        EasyMock.expect(namespaceContext.getNamespaceURI(EasyMock.eq("f"))).andReturn("http://foo").anyTimes();
        EasyMock.expect(namespaceContext.getPrefix(EasyMock.eq("http://foo"))).andReturn("f").anyTimes();
        EasyMock.replay(namespaceContext);
        context.getMetadata().put(NamespaceContext.class.getName(), namespaceContext);
        for (TypeInfo simpleType : SimpleTypeMapperImpl.XSD_SIMPLE_TYPES.values()) {
            String name = simpleType.getQName().getLocalPart();
            Object value = SAMPLE_VALUES.get(name);
            if (value instanceof String[]) {
                for (String s : (String[])value) {
                    Object obj = extension.toJavaObject(simpleType.getQName(), s, context);
                    String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
                    assertNotNull(str);
                    // assertTrue("[" + name + "] " + s + " " + str,
                    // str.contains((String) s));
                }
            } else if (value instanceof String) {
                Object obj = extension.toJavaObject(simpleType.getQName(), (String)value, context);
                String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
                assertNotNull(str);
                // assertTrue("[" + name + "] " + value + " " + str,
                // str.contains((String) value));
            }
        }
View Full Code Here

    private static int prefixCount = 1;

    protected SimpleTypeMapperImpl mapper;

    public JavaBean2XMLTransformer() {
        this.mapper = new SimpleTypeMapperImpl();
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl

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.