Package com.asakusafw.modelgen.model

Examples of com.asakusafw.modelgen.model.TableModelDescription


     * 名前空間付きのモデル。
     * @throws Throwable 例外が発生した場合
     */
    @Test
    public void namespace() throws Throwable {
        TableModelDescription model = new TableModelBuilder("Hello")
            .namespace("testing", "table")
            .add(null, "id", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "value", new StringType(255))
            .toDescription();

View Full Code Here


     * 単純なモデルのテスト。
     * @throws Throwable 例外が発生した場合
     */
    @Test
    public void simple() throws Throwable {
        TableModelDescription model = new TableModelBuilder("Model")
            .add(null, "id", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .toDescription();

        new Table().emit(model);
        new TsvIn().emit(model);
View Full Code Here

     * 単純なモデルのテスト。
     * @throws Throwable 例外が発生した場合
     */
    @Test
    public void complex() throws Throwable {
        TableModelDescription model = new TableModelBuilder("Model")
            .add(null, "id", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "value", new StringType(255))
            .add(null, "date", PropertyTypeKind.DATE)
            .add(null, "price", PropertyTypeKind.INT)
            .add(null, "flag", PropertyTypeKind.BOOLEAN)
View Full Code Here

     * 単純なテーブル
     * @throws Throwable 例外が発生した場合
     */
    @Test
    public void simple() throws Throwable {
        TableModelDescription a = new TableModelBuilder("A")
            .add(null, "id", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "word", new StringType(255))
            .toDescription();

        SummarizedModelDescription model = new SummarizedModelBuilder("S", a, "a")
View Full Code Here

     * 集約関数の一覧。
     * @throws Throwable 例外が発生した場合
     */
    @Test
    public void aggregators() throws Throwable {
        TableModelDescription a = new TableModelBuilder("A")
            .add(null, "id", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "value", PropertyTypeKind.INT)
            .toDescription();

        SummarizedModelDescription model = new SummarizedModelBuilder("S", a, "a")
View Full Code Here

     * 単純なテーブル
     * @throws Throwable 例外が発生した場合
     */
    @Test
    public void booleanGetter() throws Throwable {
        TableModelDescription model = new TableModelBuilder("Hello")
            .add(null, "id", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "frag", PropertyTypeKind.BOOLEAN)
            .toDescription();

        new Table().emit(model);
View Full Code Here

     * 推奨されない名前。
     * @throws Throwable 例外が発生した場合
     */
    @Test
    public void bad_name() throws Throwable {
        TableModelDescription a = new TableModelBuilder("A__a")
            .add(null, "id__a", PropertyTypeKind.LONG, Attribute.PRIMARY_KEY)
            .add(null, "word__a", new StringType(255))
            .toDescription();

        SummarizedModelDescription model = new SummarizedModelBuilder("_S__a", a, "a")
View Full Code Here

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

        assertThat(desc.getReference().isDefaultNameSpace(), is(true));
        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

TOP

Related Classes of com.asakusafw.modelgen.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.