Skip to content

Commit

Permalink
fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scottreisdorf committed Nov 27, 2018
1 parent 653aa3c commit 1d27272
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public class DataSourceController extends AbstractCatalogController {

public static final String BASE = "/v1/catalog/datasource";

public static final String PLUGIN_ID = "/v1/catalog/datasource/plugin-id";

public enum CredentialMode {NONE, EMBED, ATTACH}

static final ExceptionTransformer<ThriftConnectionException> exceptionTransformer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,16 @@ protected void deleteExistingDatasources() {
datasources = getDatasources();
Assert.assertTrue(datasources.length == 0);

DataSource[] jdbcDataSources = getJdbcDataSources();
if(jdbcDataSources != null) {
for (DataSource dataSource : jdbcDataSources) {
deleteDataSource(dataSource.getId());
}
}

jdbcDataSources = getJdbcDataSources();
Assert.assertTrue(jdbcDataSources.length == 0);

}

protected void disableExistingFeeds() {
Expand Down Expand Up @@ -1297,6 +1307,28 @@ protected JdbcDatasource[] getDatasources() {
return response.as(JdbcDatasource[].class);
}

protected DataSource[] getJdbcDataSources() {
LOG.info("Getting datasources");

Response response = given(DataSourceController.PLUGIN_ID)
.when()
.get("?pluginIds=jdbc");

response.then().statusCode(HTTP_OK);

return response.as(DataSource[].class);
}

protected void deleteDataSource(String dataSourceId) {
LOG.info("Delete dataSource {} ",dataSourceId);

Response response = given(DataSourceController.BASE)
.when()
.delete("/" + dataSourceId);

response.then().statusCode(HTTP_NO_CONTENT);
}


protected JdbcDatasource getDatasource(String datasourceId) {
LOG.info("Getting datasource {}", datasourceId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ protected void editFieldPolicies(List<FieldPolicy> policies) {
}

protected void assertEditChanges(ArrayNode diffs) {
Assert.assertTrue(versionPatchContains(diffs, new Diff("replace", "/properties/0/value", getEditedFileName())));
Assert.assertTrue(versionPatchContains(diffs, new Diff("replace", "/properties/3/value", getEditedFileName())));
Assert.assertTrue(versionPatchContains(diffs, new Diff("replace", "/schedule/schedulingPeriod", "20 sec")));
Assert.assertTrue(versionPatchContains(diffs, new Diff("remove", "/description")));
Assert.assertTrue(versionPatchContains(diffs, new Diff("add", "/tags/1")));
Expand Down

0 comments on commit 1d27272

Please sign in to comment.