Package org.jitterbit.integration.database.info

Examples of org.jitterbit.integration.database.info.DatabaseTable


    @Test
    public void testEquality() {
        String name = "orders";
        String schema = "public";
        DatabaseTable table_1 = new DatabaseTable(name, schema);
        DatabaseTable table_2 = new DatabaseTable(name, schema);
        DatabaseTable table_3 = new DatabaseTable("order details", schema);
        assertEquals(table_1, table_2);
        assertEquals(table_1.hashCode(), table_2.hashCode());
        assertFalse(table_1.equals(table_3));
        table_1.addColumn(new DatabaseColumn(table_1, "orderid", "serial", 0, null, false, false));
        assertEquals(table_1, table_2);
View Full Code Here


        assertEquals(table_1, table_2);
    }
   
    @Test
    public void testColumns() {
        DatabaseTable table = new DatabaseTable("order details", null);
        DatabaseColumn id = new DatabaseColumn(table, "id", "serial", 0, null, false, true);
        DatabaseColumn orderId = new DatabaseColumn(table, "orderId", "int", 0, null, false, true);
        DatabaseColumn date = new DatabaseColumn(table, "date", "date", 0, null, false, false);
        table.addColumn(id);
        table.addColumn(orderId);
        table.addColumn(date);
        assertEquals(Sets.newHashSet(table.getAllColumns()), Sets.newHashSet(id, orderId, date));
        assertEquals(Sets.newHashSet(table.getPrimaryKeys()), Sets.newHashSet(id, orderId));
    }
View Full Code Here

*/
public class UpdateValuesStringConverterJUnitTest {

    @Test
    public void run() {
        DatabaseTable table = new DatabaseTable("Orders", "");
        DatabaseColumn[] columns = {
            new DatabaseColumn(table, "OrderID", "int", 0, null, false, false),
            new DatabaseColumn(table, "OrderDate", "date", 0, null, false, false),
            new DatabaseColumn(table, "CustomerID", "int", 0, null, false, false),
            new DatabaseColumn(table, "Status", "String", 0, null, false, false),
        };
        for (DatabaseColumn c : columns) {
            table.addColumn(c);
        }
        String[] newValues = new String[] { "2007-07-05", "In process" };
        DatabaseColumn[] updatedColumns = new DatabaseColumn[] { columns[1], columns[3] };
        String s = UpdateValuesStringConverter.toString(updatedColumns, newValues);
        test(table, newValues, updatedColumns, s);
View Full Code Here

    public static void main(String[] args) throws Exception {
        ConnectionParams params = createParams();
        SourceId sourceGuid = new SourceId("475118e7-1b59-4371-bc09-598c19b12385");
        ConnectionFactory connectionFactory = new DefaultConnectionFactory(params, sourceGuid, null);
        DatabaseColumnRetriever r = new DatabaseColumnRetriever(connectionFactory);
        DatabaseObject table = new DatabaseTable("OrderDetail", "public");
        r.populateColumns(new DatabaseObject[] { table });
        for (DatabaseColumn col : table.getAllColumns()) {
            System.out.println(col);
        }
    }
View Full Code Here

        String name = wsObj.getObjectName();
        DatabaseObjectType type = DatabaseObjectType.valueOf(wsObj.getObjectType());
        DatabaseObject table;
        switch (type) {
        case TABLE:
            table = new DatabaseTable(name, schema);
            break;
        case VIEW:
            table = new DatabaseView(name, schema);
            break;
        case MANUAL_SQL:
View Full Code Here

    private DatabaseObject createTableObject(ResultSet rs) throws SQLException {
        String schema = rs.getString(2);
        String name = rs.getString(3);
        String type = rs.getString(4);
        if (TABLE.equals(type)) {
            return new DatabaseTable(name, schema);
        } else if (VIEW.equals(type)) {
            return new DatabaseView(name, schema);
        }
        // XXX: I'd like to throw a RuntimeException here, but that would change the behavior
        // of the code and I don't want to do that so close to release.
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.database.info.DatabaseTable

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.