public void testGetElements() throws Exception { Insert insert = example("a.b"); //$NON-NLS-1$ assertNotNull(insert.getColumns()); assertEquals(4, insert.getColumns().size()); // verify that elements are not qualified by group String sInsertSQL = insert.toString(); assertTrue(sInsertSQL.substring(sInsertSQL.indexOf('(')).indexOf( '.') == -1 ); }
public void testGetGroup() throws Exception { assertNotNull(example("a.b").getTable()); //$NON-NLS-1$ }
public void testExpressionsInInsert() throws Exception { Insert insert = example2("a.b"); //$NON-NLS-1$ assertNotNull(insert.getColumns()); assertEquals(1, insert.getColumns().size()); for (Iterator i = insert.getColumns().iterator(); i.hasNext();) { assertTrue(i.next() instanceof ColumnReference); } assertNotNull(insert.getValueSource()); assertEquals(1, ((ExpressionValueSource)insert.getValueSource()).getValues().size()); for (Iterator i = ((ExpressionValueSource)insert.getValueSource()).getValues().iterator(); i.hasNext();) { assertTrue(i.next() instanceof Expression); } }
public static Insert example(String groupName) throws Exception { return TstLanguageBridgeFactory.factory.translate(helpExample(groupName)); } public static Insert example2(String groupName) throws Exception {
public static Insert example2(String groupName) throws Exception { return TstLanguageBridgeFactory.factory.translate(helpExample2(groupName)); } public void testGetGroup() throws Exception {
public static BatchedUpdateCommand helpExample() { List updates = new ArrayList(); updates.add(TestInsertImpl.helpExample("a.b")); //$NON-NLS-1$ updates.add(TestUpdateImpl.helpExample()); updates.add(TestDeleteImpl.helpExample()); return new BatchedUpdateCommand(updates); }
public void testGetValues() throws Exception { Insert insert = example("a.b"); //$NON-NLS-1$ assertNotNull(insert.getValueSource()); assertEquals(4, ((ExpressionValueSource)insert.getValueSource()).getValues().size()); for (Iterator i = ((ExpressionValueSource)insert.getValueSource()).getValues().iterator(); i.hasNext();) { assertTrue(i.next() instanceof Expression); } }