Examples of DataModelSource


Examples of com.asakusafw.testdriver.core.DataModelSource

     */
    @Test
    public void invalid_file() throws Exception {
        ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider();
        URI uri = uri("data/simple.json", ":1");
        DataModelSource source = provider.open(SIMPLE, uri, new TestContext.Empty());
        assertThat(source, is(nullValue()));
    }
View Full Code Here

Examples of com.asakusafw.testdriver.core.DataModelSource

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

        // the first sheet
        Simple s1 = next(source);
        assertThat(s1.number, is(100));
View Full Code Here

Examples of com.asakusafw.testdriver.core.DataModelSource

     */
    @Test
    public void invalid_fragment() throws Exception {
        ExcelSheetSourceProvider provider = new ExcelSheetSourceProvider();
        URI uri = uri("data/workbook.xls", ":");
        DataModelSource source = provider.open(SIMPLE, uri, new TestContext.Empty());
        assertThat(source, is(nullValue()));
    }
View Full Code Here

Examples of com.asakusafw.testdriver.core.DataModelSource

        TemporaryOutputRetriever retriever = new TemporaryOutputRetriever(factory);

        putText("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

Examples of com.asakusafw.testdriver.core.DataModelSource

    protected final DataModelSourceFilter toDataModelSourceFilter(final ModelTransformer<? super T> transformer) {
        final DataModelDefinition<T> definition = getDataModelDefinition();
        return new DataModelSourceFilter() {
            @Override
            public DataModelSource apply(final DataModelSource source) {
                return new DataModelSource() {
                    @Override
                    public DataModelReflection next() throws IOException {
                        DataModelReflection next = source.next();
                        if (next == null) {
                            return null;
View Full Code Here

Examples of com.asakusafw.testdriver.core.DataModelSource

                    VerifyContext context) throws IOException {
                final Verifier delegate = verifierFactory.createVerifier(definition, context);
                return new Verifier() {
                    @Override
                    public List<Difference> verify(DataModelSource results) throws IOException {
                        DataModelSource filtered = sourceFilter.apply(results);
                        return delegate.verify(filtered);
                    }
                    @Override
                    public void close() throws IOException {
                        delegate.close();
View Full Code Here

Examples of com.asakusafw.testdriver.core.DataModelSource

        InputStream input = url.openStream();
        boolean established = false;
        try {
            InputStream bin = new BufferedInputStream(input);
            Reader reader = new InputStreamReader(bin, ENCONDING);
            DataModelSource dms = new JsonDataModelSource(source, definition, reader);
            established = true;
            return dms;
        } finally {
            if (established == false) {
                input.close();
View Full Code Here

Examples of com.asakusafw.testdriver.core.DataModelSource

        LOG.info("エクスポート結果を取得します: テーブル{}", info.getTableName());
        LOG.debug("Opening results: {}", info);
        Connection conn = conf.open();
        boolean green = false;
        try {
            DataModelSource source = new TableSource<V>(info, conn);
            green = true;
            return source;
        } finally {
            if (green == false) {
                try {
View Full Code Here

Examples of com.asakusafw.testdriver.core.DataModelSource

    public void filter() {
        MockFlowDriverOutput mock = new MockFlowDriverOutput(getClass(), tool_rule("Hello3"));
        DataModelSourceFilter filter = new DataModelSourceFilter() {
            @Override
            public DataModelSource apply(final DataModelSource source) {
                return new DataModelSource() {
                    @Override
                    public DataModelReflection next() throws IOException {
                        DataModelReflection next = source.next();
                        if (next == null || DEFINITION.toObject(next).toString().equals("Hello2")) {
                            return next;
View Full Code Here

Examples of com.asakusafw.testdriver.core.DataModelSource

    private List<Difference> test(VerifierFactory factory, String... pattern) {
        try {
            Verifier v = factory.createVerifier(DEFINITION, new VerifyContext(CONTEXT));
            try {
                DataModelSource a = source(pattern);
                try {
                    return v.verify(a);
                } finally {
                    a.close();
                }
            } finally {
                v.close();
            }
        } catch (IOException e) {
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.