}
public void testPathOps() {
// Test equals operator with case insensitive names
QualifiedDBIdentifier p1 = QualifiedDBIdentifier.newPath(DBIdentifier.newTable("MyTable"),
DBIdentifier.newColumn("mycol"));
QualifiedDBIdentifier p2 = QualifiedDBIdentifier.newPath(DBIdentifier.newTable("MYTABLE"),
DBIdentifier.newColumn("MYCOL"));
assertTrue(QualifiedDBIdentifier.equal(p1, p1));
// Test equals operator with delimited, case sensitive names
QualifiedDBIdentifier p3 = QualifiedDBIdentifier.newPath(DBIdentifier.newTable("\"MyTable\""),
DBIdentifier.newColumn("\"mycol\""));
QualifiedDBIdentifier p4 = QualifiedDBIdentifier.newPath(DBIdentifier.newTable("MYTABLE"),
DBIdentifier.newColumn("MYCOL"));
QualifiedDBIdentifier p5 = QualifiedDBIdentifier.newPath(DBIdentifier.newTable("\"MyTable\""),
DBIdentifier.newColumn("\"mycol\""));
assertFalse(QualifiedDBIdentifier.equal(p3, p4));
assertTrue(QualifiedDBIdentifier.equal(p3, p5));
// Test setPath method
QualifiedDBIdentifier p6 = QualifiedDBIdentifier.newPath(DBIdentifier.newTable("MyTable"),
DBIdentifier.newColumn("mycol"));
DBIdentifier n1 = DBIdentifier.newSchema("Schema_1");
DBIdentifier n2 = DBIdentifier.newTable("Table_1");
DBIdentifier n3 = DBIdentifier.newColumn("Column_1");
p6.setPath(n1);
assertEquals("Schema_1", n1.getName());
assertEquals(n1.getType(), DBIdentifierType.SCHEMA);
p6.setPath(n2);
assertEquals("Table_1", n2.getName());
assertEquals(n2.getType(), DBIdentifierType.TABLE);
p6.setPath(n3);
assertEquals("Column_1", n3.getName());
assertEquals(n3.getType(), DBIdentifierType.COLUMN);
// Test isDelimited method
QualifiedDBIdentifier p7 = QualifiedDBIdentifier.newPath(DBIdentifier.newTable("MyTable"),
DBIdentifier.newColumn("mycol"));
assertFalse(p7.isDelimited());
// All identifiers not delimited
QualifiedDBIdentifier p8 = QualifiedDBIdentifier.newPath(DBIdentifier.newTable("My Table"),
DBIdentifier.newColumn("mycol"));
assertFalse(p8.isDelimited());
// All identifiers delimited by default
QualifiedDBIdentifier p9 = QualifiedDBIdentifier.newPath(DBIdentifier.newTable("My Table"),
DBIdentifier.newColumn("my col"));
assertTrue(p9.isDelimited());
// All identifiers specifically delimited
QualifiedDBIdentifier p10 = QualifiedDBIdentifier.newPath(DBIdentifier.newTable("\"MyTable\""),
DBIdentifier.newColumn("\"my col\""));
assertTrue(p10.isDelimited());
// All identifiers specifically delimited sch + tbl + col
QualifiedDBIdentifier p11 = QualifiedDBIdentifier.newPath(DBIdentifier.newSchema("\"MySchema\""),
DBIdentifier.newTable("\"my tbl\""));
assertTrue(p11.isDelimited());
// Table identifier not delimited
QualifiedDBIdentifier p12 = QualifiedDBIdentifier.newPath(DBIdentifier.newSchema("\"MySchema\""),
DBIdentifier.newTable("mytbl"),
DBIdentifier.newColumn("\"my col\""));
assertFalse(p12.isDelimited());
}