Package com.asakusafw.testdriver.core

Examples of com.asakusafw.testdriver.core.DataModelSourceProvider.open()


    @Test
    public void open_importer() throws Exception {
        DataModelSourceProvider provider = new SpiDataModelSourceProvider(getClass().getClassLoader());
        URI uri = new URI("windgate:" + MockImporter.class.getName());
        ValueDefinition<String> definition = ValueDefinition.of(String.class);
        DataModelSource source = provider.open(definition, uri, EMPTY);
        try {
            DataModelReflection r1 = source.next();
            assertThat(r1, is(notNullValue()));
            assertThat(definition.toObject(r1), is("Hello1, world!"));
View Full Code Here


    @Test
    public void open_exporter() throws Exception {
        DataModelSourceProvider provider = new SpiDataModelSourceProvider(getClass().getClassLoader());
        URI uri = new URI("windgate:" + MockExporter.class.getName());
        ValueDefinition<String> definition = ValueDefinition.of(String.class);
        DataModelSource source = provider.open(definition, uri, EMPTY);
        try {
            DataModelReflection r1 = source.next();
            assertThat(r1, is(notNullValue()));
            assertThat(definition.toObject(r1), is("Hello1, world!"));
View Full Code Here

    @Test
    public void invalid_scheme() throws Exception {
        DataModelSourceProvider provider = new WindGateSourceProvider();
        URI uri = new URI("INVALIDwindgate:" + MockExporter.class.getName());
        ValueDefinition<String> definition = ValueDefinition.of(String.class);
        DataModelSource source = provider.open(definition, uri, EMPTY);
        assertThat(source, is(nullValue()));
    }

    /**
     * Attempts to open URI with missing class.
View Full Code Here

    @Test(expected = IOException.class)
    public void unknown_class() throws Exception {
        DataModelSourceProvider provider = new WindGateSourceProvider();
        URI uri = new URI("windgate:__INVALID__");
        ValueDefinition<String> definition = ValueDefinition.of(String.class);
        provider.open(definition, uri, EMPTY);
    }

    /**
     * Attempts to open URI with unexpected class.
     * @throws Exception if occur
View Full Code Here

    @Test(expected = IOException.class)
    public void unexpected_class() throws Exception {
        DataModelSourceProvider provider = new WindGateSourceProvider();
        URI uri = new URI("windgate:" + String.class.getName());
        ValueDefinition<String> definition = ValueDefinition.of(String.class);
        provider.open(definition, uri, EMPTY);
    }

    /**
     * Importer description for testing.
     */
 
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void spi() throws Exception {
        DataModelSourceProvider provider = new SpiDataModelSourceProvider(JsonSourceProvider.class.getClassLoader());
        DataModelSource source = provider.open(SIMPLE, uri("simple.json"), new TestContext.Empty());
        assertThat(source, not(nullValue()));
        try {
            Simple s1 = SIMPLE.toObject(source.next());
            assertThat(s1.number, is(100));
            assertThat(source.next(), is(nullValue()));
View Full Code Here

     */
    @Test
    public void spi() throws Exception {
        DataModelSourceProvider provider = new SpiDataModelSourceProvider(ExcelSheetSourceProvider.class.getClassLoader());
        URI uri = uri("data/workbook.xls", ":1");
        DataModelSource source = provider.open(SIMPLE, uri, new TestContext.Empty());
        assertThat(source, not(nullValue()));

        Simple s1 = next(source);
        assertThat(s1.number, is(200));
        assertThat(s1.text, is("bbb"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.