Package com.asakusafw.testdriver.core

Examples of com.asakusafw.testdriver.core.DataModelSource


        profile.put();

        put("testing/output.txt", "Hello, world!");

        DirectFileOutputRetriever testee = new DirectFileOutputRetriever();
        DataModelSource input = testee.createSource(
                new MockTextDefinition(),
                new MockOutputDescription("${vbase}", "${voutput}.txt", format),
                profile.getTextContext("vbase", "base", "voutput", "output"));
        List<String> list = get(input);
        assertThat(list, is(Arrays.asList("Hello, world!")));
View Full Code Here


        put("base/output-1.txt", "Hello1");
        put("base/output-2.txt", "Hello2");
        put("base/output-3.txt", "Hello3");

        DirectFileOutputRetriever testee = new DirectFileOutputRetriever();
        DataModelSource input = testee.createSource(
                new MockTextDefinition(),
                new MockOutputDescription("base", "output-{id}.txt", format),
                profile.getTextContext());
        List<String> list = get(input);
        assertThat(list.size(), is(3));
View Full Code Here

        put("base/output-1.txt", "Hello1");
        put("base/output-2.txt", "Hello2");
        put("base/output-3.txt", "Hello3");

        DirectFileOutputRetriever testee = new DirectFileOutputRetriever();
        DataModelSource input = testee.createSource(
                new MockTextDefinition(),
                new MockOutputDescription("base", "output-*.txt", format),
                profile.getTextContext());
        List<String> list = get(input);
        assertThat(list.size(), is(3));
View Full Code Here

        profile.put();

        put("base/output.txt", "Hello, world!");

        SpiExporterRetriever testee = new SpiExporterRetriever(getClass().getClassLoader());
        DataModelSource input = testee.createSource(
                new MockTextDefinition(),
                new MockOutputDescription("base", "output.txt", format),
                profile.getTextContext());
        List<String> list = get(input);
        assertThat(list, is(Arrays.asList("Hello, world!")));
View Full Code Here

            TestContext context) throws IOException {
        DirectIoTestHelper helper = new DirectIoTestHelper(context, description.getBasePath());
        LOG.info("Retrieving output: {}", description.getClass().getName());
        final V object = definition.toObject(definition.newReflection().build());
        final ModelInput<? super V> input = helper.openInput(definition.getModelClass(), description);
        return new DataModelSource() {
            @Override
            public DataModelReflection next() throws IOException {
                if (input.readTo(object)) {
                    return definition.toReflection(object);
                }
View Full Code Here

    }

    static <T> void verify(DataModelSourceFactory target, DataModelDefinition<T> def, Collection<T> expected) {
        try {
            Set<Object> set = new HashSet<Object>(expected);
            DataModelSource source = target.createSource(def, CONTEXT);
            try {
                while (true) {
                    DataModelReflection next = source.next();
                    if (next == null) {
                        break;
                    }
                    T object = def.toObject(next);
                    assertThat(object.toString(), set.contains(object), is(true));
                    set.remove(object);
                }
                assertThat(set, hasSize(0));
            } finally {
                source.close();
            }
        } catch (IOException e) {
            throw new AssertionError(e);
        }
    }
View Full Code Here

     */
    @Test
    public void open_bynumber() throws Exception {
        ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider();
        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

     */
    @Test
    public void open_byname() throws Exception {
        ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider();
        URI uri = uri("data/workbook.xls", "c");
        DataModelSource source = provider.open(SIMPLE, uri, new TestContext.Empty());
        assertThat(source, not(nullValue()));

        Simple s1 = next(source);
        assertThat(s1.number, is(300));
        assertThat(s1.text, is("ccc"));
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

     */
    @Test
    public void integration() throws Exception {
        ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider();
        URI uri = uri("it/simple.xls", "input");
        DataModelSource source = provider.open(SIMPLE, uri, new TestContext.Empty());
        assertThat(source, not(nullValue()));

        Simple s1 = next(source);
        assertThat(s1.number, is(100));
        assertThat(s1.text, is("aaa"));
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.