Examples of SimpleTableDef


Examples of org.apache.metamodel.util.SimpleTableDef

        assertEquals("Row[values=[42, Elvis Presley, Elvis Presley, The King]]", dataSet.getRow().toString());
        assertFalse(dataSet.next());
    }

    public void testScenarioWithMap() throws Exception {
        final SimpleTableDef tableDef = new SimpleTableDef("bar", new String[] { "col1", "col2", "col3" },
                new ColumnType[] { ColumnType.VARCHAR, ColumnType.INTEGER, ColumnType.BOOLEAN });
        final List<Map<String, ?>> maps = new ArrayList<Map<String, ?>>();
        maps.add(createMap("2", 1000, true));
        maps.add(createMap("1", 1001, false));
        maps.add(createMap("1", 1002, true));
View Full Code Here

Examples of org.apache.metamodel.util.SimpleTableDef

        final TableDataProvider<?> tableDataProvider = new MapTableDataProvider(tableDef, maps);
        runScenario(tableDataProvider);
    }

    public void testScenarioWithArrays() throws Exception {
        final SimpleTableDef tableDef = new SimpleTableDef("bar", new String[] { "col1", "col2", "col3" },
                new ColumnType[] { ColumnType.VARCHAR, ColumnType.INTEGER, ColumnType.BOOLEAN });
        final List<Object[]> arrays = new ArrayList<Object[]>();
        arrays.add(new Object[] { "2", 1000, true });
        arrays.add(new Object[] { "1", 1001, false });
        arrays.add(new Object[] { "1", 1002, true });
View Full Code Here

Examples of org.apache.metamodel.util.SimpleTableDef

    public void testGetTableDef() throws Exception {
        ObjectTableDataProvider<FoobarBean> tableDataProvider = new ObjectTableDataProvider<FoobarBean>(
                FoobarBean.class);

        SimpleTableDef tableDef = tableDataProvider.getTableDef();
        assertEquals(
                "SimpleTableDef[name=FoobarBean,columnNames=[col1, col2, col3],columnTypes=[VARCHAR, INTEGER, BOOLEAN]]",
                tableDef.toString());
    }
View Full Code Here

Examples of org.apache.metamodel.util.SimpleTableDef

                continue;
            }

            CouchDbConnector connector = couchDbInstance.createConnector(databaseName, false);

            SimpleTableDef tableDef = detectTable(connector);
            tableDefs.add(tableDef);
        }
        return tableDefs.toArray(new SimpleTableDef[tableDefs.size()]);
    }
View Full Code Here

Examples of org.apache.metamodel.util.SimpleTableDef

            columnNames[i] = columnName;
            columnTypes[i] = columnType;
            i++;
        }

        final SimpleTableDef tableDef = new SimpleTableDef(connector.getDatabaseName(), columnNames, columnTypes);
        return tableDef;
    }
View Full Code Here

Examples of org.apache.metamodel.util.SimpleTableDef

            }
            connector = couchDbInstance.createConnector(databaseName, true);

            final String[] columnNames = new String[] { "name", "gender", "age" };
            final ColumnType[] columnTypes = new ColumnType[] { ColumnType.VARCHAR, ColumnType.CHAR, ColumnType.INTEGER };
            predefinedTableDef = new SimpleTableDef(databaseName, columnNames, columnTypes);
        }

    }
View Full Code Here

Examples of org.apache.metamodel.util.SimpleTableDef

            return;
        }

        connector = couchDbInstance.createConnector("test_table_map_and_list", true);

        final CouchDbDataContext dc = new CouchDbDataContext(couchDbInstance, new SimpleTableDef(
                "test_table_map_and_list", new String[] { "id", "foo", "bar" }, new ColumnType[] { ColumnType.INTEGER,
                        ColumnType.MAP, ColumnType.LIST }));
        Table table = null;
        try {
            table = dc.getTableByQualifiedLabel("test_table_map_and_list");
View Full Code Here

Examples of org.apache.metamodel.util.SimpleTableDef

            map.put("gender", 'F');
            connector.create(map);
        }

        // create datacontext using detected schema
        SimpleTableDef tableDef = CouchDbDataContext.detectTable(connector);
        CouchDbDataContext dc = new CouchDbDataContext(couchDbInstance, tableDef);

        // verify schema and execute query
        Schema schema = dc.getMainSchema();
        assertEquals("[" + getDatabaseName() + "]", Arrays.toString(schema.getTableNames()));
View Full Code Here

Examples of org.apache.metamodel.util.SimpleTableDef

            map.put("gender", 'F');
            connector.create(map);
        }

        // create datacontext using detected schema
        SimpleTableDef tableDef = CouchDbDataContext.detectTable(connector);
        CouchDbDataContext dc = new CouchDbDataContext(couchDbInstance, tableDef);

        DataSet ds1 = dc.query().from(getDatabaseName()).select("name").and("age").firstRow(2).execute();
        DataSet ds2 = dc.query().from(getDatabaseName()).select("name").and("age").maxRows(1).execute();
View Full Code Here

Examples of org.apache.metamodel.util.SimpleTableDef

        List<Map<String, ?>> titles = new ArrayList<Map<String, ?>>();
        titles.add(record1);
        titles.add(record2);

        TableDataProvider<?> provider1 = new ObjectTableDataProvider<Person>("persons", Person.class, persons);
        TableDataProvider<?> provider2 = new MapTableDataProvider(new SimpleTableDef("titles", new String[] { "name",
                "title" }), titles);

        DataContext dc = new PojoDataContext(Arrays.<TableDataProvider<?>> asList(provider1, provider2));

        DataSet dataSet = dc.query().from("persons").innerJoin("titles").on("name", "name").selectAll().execute();
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.