@Test public void shouldFilterOutNonOAuthConnectors() { final Connector connector1 = new Connector.Builder().build(); final Connector connector2 = new Connector.Builder() .putProperty("clientId", new ConfigurationProperty.Builder().addTag(Credentials.CLIENT_ID_TAG).build()) .putConfiguredProperty("clientId", "my-client-id").build(); final Connector connector3 = new Connector.Builder() .putProperty("clientId", new ConfigurationProperty.Builder().addTag(Credentials.CLIENT_ID_TAG).build()).build(); final ListResult<Connector> result = ListResult.of(connector1, connector2, connector3); assertThat(OAuthConnectorFilter.INSTANCE.apply(result)).containsOnly(connector2, connector3); }
@Override public ListResult<Connector> apply(final ListResult<Connector> result) { final List<Connector> oauthConnectors = result.getItems().stream() .filter(c -> c.propertyEntryTaggedWith(Credentials.CLIENT_ID_TAG).isPresent()).collect(Collectors.toList()); return ListResult.of(oauthConnectors); }
OAuthConnectorFilter implements Function<ListResult<Connector>, ListResult<Connector>> { @Override public ListResult<Connector> apply(final ListResult<Connector> result) { final List<Connector> oauthConnectors = result.getItems().stream() .filter(c -> c.propertyEntryTaggedWith(Credentials.CLIENT_ID_TAG).isPresent()).collect(Collectors.toList()); return ListResult.of(oauthConnectors); } }
OAuthConnectorFilter implements Function<ListResult<Connector>, ListResult<Connector>> { @Override public ListResult<Connector> apply(final ListResult<Connector> result) { final List<Connector> oauthConnectors = result.getItems().stream() .filter(c -> c.propertyEntryTaggedWith(Credentials.CLIENT_ID_TAG).isPresent()).collect(Collectors.toList()); return ListResult.of(oauthConnectors); } private  OAuthConnectorFilter(); }
OAuthConnectorFilter implements Function<ListResult<Connector>, ListResult<Connector>> { @Override public ListResult<Connector> apply(final ListResult<Connector> result) { final List<Connector> oauthConnectors = result.getItems().stream() .filter(c -> c.propertyEntryTaggedWith(Credentials.CLIENT_ID_TAG).isPresent()).collect(Collectors.toList()); return ListResult.of(oauthConnectors); } private  OAuthConnectorFilter(); @Override ListResult<Connector> apply(final ListResult<Connector> result); }
OAuthConnectorFilter implements Function<ListResult<Connector>, ListResult<Connector>> { @Override public ListResult<Connector> apply(final ListResult<Connector> result) { final List<Connector> oauthConnectors = result.getItems().stream() .filter(c -> c.propertyEntryTaggedWith(Credentials.CLIENT_ID_TAG).isPresent()).collect(Collectors.toList()); return ListResult.of(oauthConnectors); } private  OAuthConnectorFilter(); @Override ListResult<Connector> apply(final ListResult<Connector> result); static final Function<ListResult<Connector>, ListResult<Connector>> INSTANCE; }