protected void assertVariable(SystemVariables.Scope scope, String name, String expectedValue) { String actualValue = parser.systemVariables().getVariable(name, scope); if (expectedValue == null) { assertThat(actualValue).isNull(); } else { assertThat(actualValue).isEqualToIgnoringCase(expectedValue); } }
protected void assertVariable(String name, String expectedValue) { String actualValue = parser.systemVariables().getVariable(name); if (expectedValue == null) { assertThat(actualValue).isNull(); } else { assertThat(actualValue).isEqualToIgnoringCase(expectedValue); } }
protected void assertFieldSchema(Document doc, String fieldName, Schema.Type type, boolean optional) { assertThat(doc.getString("field")).isEqualTo(fieldName); assertThat(doc.getString("type")).isEqualToIgnoringCase(type.name()); assertThat(doc.getBoolean("optional")).isEqualTo(optional); }
@Test @FixFor("DBZ-1028") public void shouldParseCommentWithEngineName() { final String ddl = "CREATE TABLE t1 (" + "`id` int(11) NOT NULL AUTO_INCREMENT, " + "`field_1` int(11) NOT NULL, " + "`field_2` int(11) NOT NULL, " + "`field_3` int(11) NOT NULL, " + "`field_4` int(11) NOT NULL, " + "`field_5` tinytext COLLATE utf8_unicode_ci NOT NULL, " + "`field_6` tinytext COLLATE utf8_unicode_ci NOT NULL, " + "`field_7` tinytext COLLATE utf8_unicode_ci NOT NULL COMMENT 'CSV'," + "primary key(id));"; parser.parse(ddl, tables); assertThat(tables.size()).isEqualTo(1); Column columnWithComment = tables.forTable(null, null, "t1").columnWithName("field_7"); assertThat(columnWithComment.typeName()).isEqualToIgnoringCase("tinytext"); }
assertThat(keySchema.getString("type")).isEqualToIgnoringCase(Schema.Type.STRUCT.name()); assertThat(keySchema.getBoolean("optional")).isEqualTo(false); Array keySchemaFields = keySchema.getArray("fields"); assertThat(valueSchema.getString("type")).isEqualToIgnoringCase(Schema.Type.STRUCT.name()); assertThat(valueSchema.getBoolean("optional")).isEqualTo(false); Array valueSchemaFields = valueSchema.getArray("fields");
protected void assertVariable(SystemVariables.Scope scope, String name, String expectedValue) { String actualValue = parser.systemVariables().getVariable(name, scope); if (expectedValue == null) { assertThat(actualValue).isNull(); } else { assertThat(actualValue).isEqualToIgnoringCase(expectedValue); } }
protected void assertVariable(String name, String expectedValue) { String actualValue = parser.systemVariables().getVariable(name); if (expectedValue == null) { assertThat(actualValue).isNull(); } else { assertThat(actualValue).isEqualToIgnoringCase(expectedValue); } }
@Test public void testGetBoardMemberActivityComments() { List<CardWithActions> commentActivity = trello.getBoardMemberActivity(BOARD_ID, "5187a69eabd0b7305100beaa", "commentCard"); assertThat(commentActivity).isNotNull(); assertThat(commentActivity).hasSize(1); assertThat(commentActivity.get(0).getActions()).isNotNull(); assertThat(commentActivity.get(0).getActions()).hasSize(1); assertThat(commentActivity.get(0).getActions().get(0)).isNotNull(); assertThat(commentActivity.get(0).getActions().get(0).getData()).isNotNull(); assertThat(commentActivity.get(0).getActions().get(0).getData().getText()).isNotNull(); assertThat(commentActivity.get(0).getActions().get(0).getData().getText()) .isEqualToIgnoringCase("a comment"); } }
protected void assertFieldSchema(Document doc, String fieldName, Schema.Type type, boolean optional) { assertThat(doc.getString("field")).isEqualTo(fieldName); assertThat(doc.getString("type")).isEqualToIgnoringCase(type.name()); assertThat(doc.getBoolean("optional")).isEqualTo(optional); }
@Test public void testSimpleSelectDerby() throws Exception { setupDerby(); final QueryVO q = new QueryVO("name", "select ent from TableA ent"); JPATransformer.transform(q); assertThat(q.getError()).isNull(); assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1); assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1); assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0"); }
@Test public void testWithParamDerby() throws Exception { setupDerby(); final QueryVO q = new QueryVO("name", "select ent from TableA ent where ent.id = :id"); JPATransformer.transform(q); assertThat(q.getError()).isNull(); assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1); assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1); assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0 where (t0.ID = ?)"); }
@Test public void testSimpleSelectHSQL() throws Exception { setupHSQL(); final QueryVO q = new QueryVO("name", "select ent from TableA ent"); JPATransformer.transform(q); assertThat(q.getError()).isNull(); assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1); assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1); assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0"); }
@Test public void testWithParamHSQL() throws Exception { setupHSQL(); final QueryVO q = new QueryVO("name", "select ent from TableA ent where ent.id = :id"); JPATransformer.transform(q); assertThat(q.getError()).isNull(); assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1); assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1); assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0 where (t0.ID = ?)"); }
@Test public void testSimpleSelectH2() throws Exception { setupH2(); if (VersionSupport.isNotSupported(CoreFactory.getProperties())) { return; } final QueryVO q = new QueryVO("name", "select ent from TableA ent"); JPATransformer.transform(q); assertThat(q.getError()).isNull(); assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1); assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1); assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0"); }
@Test public void testWithParamH2() throws Exception { setupH2(); if (VersionSupport.isNotSupported(CoreFactory.getProperties())) { return; } final QueryVO q = new QueryVO("name", "select ent from TableA ent where ent.id = :id"); JPATransformer.transform(q); assertThat(q.getError()).isNull(); assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1); assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1); assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0 where (t0.ID = ?)"); }
@Test @FixFor("DBZ-1028") public void shouldParseCommentWithEngineName() { final String ddl = "CREATE TABLE t1 (" + "`id` int(11) NOT NULL AUTO_INCREMENT, " + "`field_1` int(11) NOT NULL, " + "`field_2` int(11) NOT NULL, " + "`field_3` int(11) NOT NULL, " + "`field_4` int(11) NOT NULL, " + "`field_5` tinytext COLLATE utf8_unicode_ci NOT NULL, " + "`field_6` tinytext COLLATE utf8_unicode_ci NOT NULL, " + "`field_7` tinytext COLLATE utf8_unicode_ci NOT NULL COMMENT 'CSV'," + "primary key(id));"; parser.parse(ddl, tables); assertThat(tables.size()).isEqualTo(1); Column columnWithComment = tables.forTable(null, null, "t1").columnWithName("field_7"); assertThat(columnWithComment.typeName()).isEqualToIgnoringCase("tinytext"); }
assertThat(keySchema.getString("type")).isEqualToIgnoringCase(Schema.Type.STRUCT.name()); assertThat(keySchema.getBoolean("optional")).isEqualTo(false); Array keySchemaFields = keySchema.getArray("fields"); assertThat(valueSchema.getString("type")).isEqualToIgnoringCase(Schema.Type.STRUCT.name()); assertThat(valueSchema.getBoolean("optional")).isEqualTo(false); Array valueSchemaFields = valueSchema.getArray("fields");