Package com.asakusafw.testdriver.core

Examples of com.asakusafw.testdriver.core.DataModelReflection


        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();
View Full Code Here


        object.setPTextAsString("Hello, world!");
        object.setPBoolean(true);
        object.setPDate(new Date(2011, 5, 2));
        object.setPDatetime(new DateTime(2011, 12, 31, 23, 59, 59));

        DataModelReflection ref = def.toReflection(object);
        assertThat(ref.getValue(p("p_int")), is((Object) 100));
        assertThat(ref.getValue(p("p_long")), is((Object) 200L));
        assertThat(ref.getValue(p("p_byte")), is((Object) (byte) 127));
        assertThat(ref.getValue(p("p_short")), is((Object) (short) 300));
        assertThat(ref.getValue(p("p_float")), is((Object) 1.5f));
        assertThat(ref.getValue(p("p_double")), is((Object) 2.5d));
        assertThat(ref.getValue(p("p_decimal")), is((Object) new BigDecimal("3.141592")));
        assertThat(ref.getValue(p("p_text")), is((Object) "Hello, world!"));
        assertThat(ref.getValue(p("p_boolean")), is((Object) true));
        Calendar date = (Calendar) ref.getValue(p("p_date"));
        assertThat(new SimpleDateFormat("yyyy/MM/dd").format(date.getTime()), is("2011/05/02"));
        Calendar datetime = (Calendar) ref.getValue(p("p_datetime"));
        assertThat(new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(datetime.getTime()), is("2011/12/31 23:59:59"));
    }
View Full Code Here

        object.setPTextAsString("Hello, world!");
        object.setPBoolean(true);
        object.setPDate(new Date(2011, 5, 2));
        object.setPDatetime(new DateTime(2011, 12, 31, 23, 59, 59));

        DataModelReflection ref = def.toReflection(object);
        Variety restored = def.toObject(ref);
        assertThat(restored, not(sameInstance(object)));
        assertThat(restored, equalTo(object));
    }
View Full Code Here

            @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;
                        }
                        T object = definition.toObject(next);
                        transformer.transform(object);
View Full Code Here

    private Set<DataModelReflection> collect(ExcelSheetDataModelSource source) throws IOException {
        Set<DataModelReflection> results = new HashSet<DataModelReflection>();
        try {
            while (true) {
                DataModelReflection next = source.next();
                if (next == null) {
                    break;
                }
                assertThat(next.toString(), results.contains(source), is(false));
                results.add(next);
            }
        } finally {
            source.close();
        }
View Full Code Here

            writer.println("Actual Value");
            writer.println("</th>");

            writer.println("</tr>");

            DataModelReflection expected = difference.getExpected();
            DataModelReflection actual = difference.getActual();
            for (PropertyName property : definition.getProperties()) {
                writer.println("<tr>");

                writer.println("<td class=\"property\">");
                writer.println(toHtml(property));
View Full Code Here

            in.close();
        }
    }

    private Simple next(ExcelSheetDataModelSource source) throws IOException {
        DataModelReflection next = source.next();
        assertThat(next, is(not(nullValue())));
        return SIMPLE.toObject(next);
    }
View Full Code Here

        assertThat(next, is(not(nullValue())));
        return SIMPLE.toObject(next);
    }

    private void end(ExcelSheetDataModelSource source) throws IOException {
        DataModelReflection next = source.next();
        assertThat(String.valueOf(next), next, nullValue());
        source.close();
    }
View Full Code Here

        }
    }

    @Override
    public void write(T model) throws IOException {
        DataModelReflection ref = definition.toReflection(model);
        try {
            driver.insert(ref);
        } catch (SQLException e) {
            throw new IOException(MessageFormat.format(
                    "テーブル{0}に{1}を出力できませんでした",
View Full Code Here

            Builder<?> builder = def.newReflection();
            for (PropertyName name : table.getColumnsToProperties().values()) {
                scan(def, name, builder);
                index++;
            }
            DataModelReflection ref = builder.build();
            return ref;
        }
View Full Code Here

TOP

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

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.