use of io.syndesis.common.model.filter.FilterOptions in project syndesis by syndesisio.
the class FilterITCase method shouldGetGlobalFilterOptions.
@Test
public void shouldGetGlobalFilterOptions() {
ResponseEntity<FilterOptions> response = get("/api/v1/integrations/filters/options", FilterOptions.class, tokenRule.validToken(), HttpStatus.OK);
FilterOptions filterOptions = response.getBody();
Assert.assertNotNull(filterOptions);
}
use of io.syndesis.common.model.filter.FilterOptions in project syndesis by syndesisio.
the class IntegrationHandlerTest method filterOptionsNoOutputShape.
@Test
public void filterOptionsNoOutputShape() {
DataShape dataShape = dataShape(DataShapeKinds.NONE);
FilterOptions options = handler.getFilterOptions(dataShape);
assertThat(options.getPaths()).isEmpty();
}
use of io.syndesis.common.model.filter.FilterOptions in project syndesis by syndesisio.
the class ConnectorHandler method getFilterOptions.
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path(value = "/{connectorId}/actions/{actionId}/filters/options")
public FilterOptions getFilterOptions(@PathParam("connectorId") @ApiParam(required = true) final String connectorId, @PathParam("actionId") @ApiParam(required = true) final String actionId) {
final FilterOptions.Builder builder = new FilterOptions.Builder().addOp(Op.DEFAULT_OPTS);
final Connector connector = getDataManager().fetch(Connector.class, connectorId);
if (connector == null) {
return builder.build();
}
connector.findActionById(actionId).filter(ConnectorAction.class::isInstance).map(ConnectorAction.class::cast).ifPresent(action -> {
action.getOutputDataShape().ifPresent(dataShape -> {
final List<String> paths = inspectors.getPaths(dataShape.getKind().toString(), dataShape.getType(), dataShape.getSpecification(), dataShape.getExemplar());
builder.addAllPaths(paths);
});
});
return builder.build();
}
use of io.syndesis.common.model.filter.FilterOptions in project syndesis by syndesisio.
the class IntegrationHandlerTest method filterOptionsSimple.
@Test
public void filterOptionsSimple() {
when(inspectors.getPaths(DataShapeKinds.JAVA.toString(), "twitter4j.Status", null, Optional.empty())).thenReturn(Arrays.asList("paramA", "paramB"));
DataShape dataShape = dataShape(DataShapeKinds.JAVA, "twitter4j.Status");
FilterOptions options = handler.getFilterOptions(dataShape);
assertThat(options.getPaths()).hasSize(2).contains("paramA", "paramB");
}
Aggregations