Package com.asakusafw.dmdl.thundergate.model

Examples of com.asakusafw.dmdl.thundergate.model.TableModelDescription


    /**
     * 単一のプロパティに関するテスト。
     */
    @Test
    public void simple() {
        TableModelDescription desc = new TableModelBuilder("Example")
            .add(null, "value", PropertyTypeKind.INT)
            .toDescription();

        assertThat(desc.getReference().getSimpleName(), is("Example"));

        List<ModelProperty> properties = desc.getProperties();
        assertThat(properties.size(), is(1));

        ModelProperty value = properties.get(0);
        assertThat(value.getName(), is("value"));
        assertThat(value.getType().getKind(), is(PropertyTypeKind.INT));
        assertThat(value.getJoined(), is(nullValue()));

        Source valueSrc = value.getFrom();
        assertThat(valueSrc.getAggregator(), is(Aggregator.IDENT));
        assertThat(valueSrc.getDeclaring(), is(desc.getReference()));
        assertThat(valueSrc.getName(), is("value"));
        assertThat(valueSrc.getType().getKind(), is(PropertyTypeKind.INT));
        assertThat(valueSrc.getAttributes().size(), is(0));
    }
View Full Code Here


    public void multi() {
        TableModelBuilder target = new TableModelBuilder("Example");
        target.add(null, "a", PropertyTypeKind.INT);
        target.add(null, "b", new StringType(255));
        target.add(null, "c", PropertyTypeKind.DATETIME);
        TableModelDescription desc = target.toDescription();

        assertThat(desc.getReference().getSimpleName(), is("Example"));

        List<ModelProperty> properties = desc.getProperties();
        assertThat(properties.size(), is(3));

        ModelProperty a = properties.get(0);
        assertThat(a.getName(), is("a"));
        assertThat(a.getType().getKind(), is(PropertyTypeKind.INT));
View Full Code Here

    @Test
    public void attributes() {
        TableModelBuilder target = new TableModelBuilder("Attribute");
        target.add(null, "id", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY);
        target.add(null, "str", new StringType(255), Attribute.UNIQUE, Attribute.NOT_NULL);
        TableModelDescription desc = target.toDescription();

        assertThat(desc.getReference().getSimpleName(), is("Attribute"));

        List<ModelProperty> properties = desc.getProperties();
        assertThat(properties.size(), is(2));

        ModelProperty a = properties.get(0);
        assertThat(a.getName(), is("id"));
        assertThat(a.getType().getKind(), is(PropertyTypeKind.LONG));
View Full Code Here

    /**
     * 単純なテスト。
     */
    @Test
    public void simple() {
        TableModelDescription a = new TableModelBuilder("A")
            .add(null, "id", PropertyTypeKind.LONG)
            .add(null, "hoge", new StringType(255))
            .toDescription();
        TableModelDescription b = new TableModelBuilder("B")
            .add(null, "id", PropertyTypeKind.LONG)
            .add(null, "foo", new StringType(255))
            .toDescription();

        JoinedModelBuilder target = new JoinedModelBuilder(
View Full Code Here

     * simple table.
     * @throws Exception if test was failed
     */
    @Test
    public void table() throws Exception {
        TableModelDescription table = new TableModelBuilder("SIMPLE")
            .add("comment", "VALUE", new StringType(255))
            .toDescription();

        ThunderGateModelEmitter emitter = new ThunderGateModelEmitter(config());
        emitter.emit(table);
View Full Code Here

     * simple join.
     * @throws Exception if test was failed
     */
    @Test
    public void join() throws Exception {
        TableModelDescription left = new TableModelBuilder("LEFT")
            .add(null, "SID", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "RIGHT_ID", PropertyTypeKind.LONG)
            .add(null, "VALUE", new StringType(255))
            .toDescription();
        TableModelDescription right = new TableModelBuilder("RIGHT")
            .add(null, "SID", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "VALUE", new StringType(255))
            .toDescription();
        JoinedModelDescription join = new JoinedModelBuilder("SIMPLE", left, "l", right, "r")
            .on("l.RIGHT_ID", "r.SID")
View Full Code Here

     * simple summarize.
     * @throws Exception if test was failed
     */
    @Test
    public void summarize() throws Exception {
        TableModelDescription target = new TableModelBuilder("TARGET")
            .add(null, "SID", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "VALUE_A", PropertyTypeKind.INT)
            .add(null, "VALUE_B", PropertyTypeKind.LONG)
            .add(null, "VALUE_C", PropertyTypeKind.DATE)
            .toDescription();
View Full Code Here

     * table cache.
     * @throws Exception if test was failed
     */
    @Test
    public void table_cached() throws Exception {
        TableModelDescription table = new TableModelBuilder("SIMPLE")
            .add("", "SID", new BasicType(PropertyTypeKind.LONG))
            .add("", "TIMESTAMP", new BasicType(PropertyTypeKind.DATETIME))
            .toDescription();

        Configuration config = config();
View Full Code Here

     * table cache.
     * @throws Exception if test was failed
     */
    @Test
    public void table_cached_with_delete() throws Exception {
        TableModelDescription table = new TableModelBuilder("SIMPLE")
            .add("", "SID", new BasicType(PropertyTypeKind.LONG))
            .add("", "TIMESTAMP", new BasicType(PropertyTypeKind.DATETIME))
            .add("", "DELETE", new BasicType(PropertyTypeKind.BOOLEAN))
            .toDescription();

View Full Code Here

     * table cache without SID.
     * @throws Exception if test was failed
     */
    @Test
    public void table_cached_no_sid() throws Exception {
        TableModelDescription table = new TableModelBuilder("SIMPLE")
            .add("", "TIMESTAMP", new BasicType(PropertyTypeKind.DATETIME))
            .add("", "DELETE", new BasicType(PropertyTypeKind.BOOLEAN))
            .toDescription();

        Configuration config = config();
View Full Code Here

TOP

Related Classes of com.asakusafw.dmdl.thundergate.model.TableModelDescription

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.