Package com.asakusafw.testdriver.core

Examples of com.asakusafw.testdriver.core.DataModelSource


        simple.number = 100;
        simple.text = "Hello, world!";
        insert(simple, SIMPLE, "SIMPLE");

        TableSourceProvider provider = new TableSourceProvider();
        DataModelSource source = provider.open(SIMPLE, new URI("bulkloader:provider:SIMPLE"), new TestContext.Empty());

        try {
            assertThat(next(source), is(simple));
            assertThat(next(source), is(nullValue()));
        } finally {
            source.close();
        }
    }
View Full Code Here


        s2.number = 200;
        s2.text = "Hello, world!!!!";
        insert(s2, SIMPLE, "SIMPLE");

        TableSourceProvider provider = new TableSourceProvider();
        DataModelSource source = provider.open(SIMPLE, new URI("bulkloader:provider:SIMPLE"), new TestContext.Empty());

        try {
            assertThat(next(source), is(s1));
            assertThat(next(source), is(s2));
            assertThat(next(source), is(nullValue()));
        } finally {
            source.close();
        }
    }
View Full Code Here

    @Test
    public void zero() throws Exception {
        context.put("provider", "provider");

        TableSourceProvider provider = new TableSourceProvider();
        DataModelSource source = provider.open(SIMPLE, new URI("bulkloader:provider:SIMPLE"), new TestContext.Empty());
        try {
            assertThat(next(source), is(nullValue()));
        } finally {
            source.close();
        }
    }
View Full Code Here

    @Test
    public void invalid_scheme() throws Exception {
        context.put("provider", "provider");

        TableSourceProvider provider = new TableSourceProvider();
        DataModelSource source = provider.open(SIMPLE, new URI("hoge:provider:SIMPLE"), new TestContext.Empty());
        assertThat(source, is(nullValue()));
    }
View Full Code Here

        object.text = "Hello, world!";
        insert(object, SIMPLE, "SIMPLE");

        context.put("exporter", "exporter");
        BulkLoadExporterRetriever exporter = new BulkLoadExporterRetriever();
        DataModelSource source = exporter.createSource(SIMPLE, NORMAL);
        try {
            List<Simple> results = drain(SIMPLE, source);
            assertThat(results, is(Arrays.asList(object)));
        } finally {
            source.close();
        }
    }
View Full Code Here

        object.text = "Hello, world!";
        insert(object, DUP_CHECK, "DUP_CHECK");

        context.put("exporter", "exporter");
        BulkLoadExporterRetriever exporter = new BulkLoadExporterRetriever();
        DataModelSource source = exporter.createSource(DUP_CHECK, NORMAL);
        try {
            List<DupCheck> results = drain(DUP_CHECK, source);
            assertThat(results, is(Arrays.asList(object)));
        } finally {
            source.close();
        }
    }
View Full Code Here

     */
    @Test(expected = IOException.class)
    public void source_invalid() throws Exception {
        context.put("exporter", "exporter");
        BulkLoadExporterRetriever exporter = new BulkLoadExporterRetriever();
        DataModelSource source = exporter.createSource(
                new SimpleDataModelDefinition<Invalid>(Invalid.class), NORMAL);
        source.close();
    }
View Full Code Here

     */
    @Test(expected = IOException.class)
    public void source_missing() throws Exception {
        context.put("exporter", "exporter");
        BulkLoadExporterRetriever exporter = new BulkLoadExporterRetriever();
        DataModelSource source = exporter.createSource(SIMPLE, MISSING);
        source.close();
    }
View Full Code Here

        FileExporterRetriever retriever = new FileExporterRetriever(factory);

        putTextRaw("target/testing/hello", "Hello, world!\nThis is a test.\n".getBytes("UTF-8"));

        MockTextDefinition definition = new MockTextDefinition();
        DataModelSource result = retriever.createSource(definition, exporter, EMPTY);
        try {
            DataModelReflection ref;
            ref = result.next();
            assertThat(ref, is(not(nullValue())));
            assertThat(definition.toObject(ref), is(new Text("Hello, world!")));

            ref = result.next();
            assertThat(ref, is(not(nullValue())));
            assertThat(definition.toObject(ref), is(new Text("This is a test.")));

            ref = result.next();
            assertThat(ref, is(nullValue()));
        } finally {
            result.close();
        }
    }
View Full Code Here

        FileExporterRetriever retriever = new FileExporterRetriever(factory);

        putTextSequenceFile("target/testing/hello", "Hello, world!", "This is a test.");

        MockTextDefinition definition = new MockTextDefinition();
        DataModelSource result = retriever.createSource(definition, exporter, EMPTY);
        try {
            DataModelReflection ref;
            ref = result.next();
            assertThat(ref, is(not(nullValue())));
            assertThat(definition.toObject(ref), is(new Text("Hello, world!")));

            ref = result.next();
            assertThat(ref, is(not(nullValue())));
            assertThat(definition.toObject(ref), is(new Text("This is a test.")));

            ref = result.next();
            assertThat(ref, is(nullValue()));
        } finally {
            result.close();
        }
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.testdriver.core.DataModelSource

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.