@Test public void shouldCreateSecurityConfigurationFromReverbSwagger() throws IOException { final String specification = resource("/swagger/reverb.swagger.yaml"); final ConnectorSettings connectorSettings = new ConnectorSettings.Builder()// .name("Reverb API")// .description("Invokes Reverb API")// .icon("fa-music")// .putConfiguredProperty("specification", specification)// .build(); final Connector generated = generator.generate(SWAGGER_TEMPLATE, connectorSettings); assertThat(generated.getProperties().keySet()).contains("accessToken", "authorizationEndpoint", "tokenEndpoint", "clientId", "clientSecret"); assertThat(generated.getProperties().get("authenticationType").getEnum()) .containsExactly(new ConfigurationProperty.PropertyValue.Builder().value("oauth2").label("OAuth 2.0").build()); }
@Test public void shouldCreateSecurityConfigurationFromReverbSwagger() throws IOException { final String specification = resource("/swagger/reverb.swagger.yaml"); final ConnectorSettings connectorSettings = new ConnectorSettings.Builder()// .name("Reverb API")// .description("Invokes Reverb API")// .icon("fa-music")// .putConfiguredProperty("specification", specification)// .build(); final Connector generated = generator.generate(SWAGGER_TEMPLATE, connectorSettings); assertThat(generated.getProperties().keySet()).contains("accessToken", "authorizationEndpoint", "tokenEndpoint", "clientId", "clientSecret"); assertThat(generated.getProperties().get("authenticationType").getEnum()) .containsExactly(new ConfigurationProperty.PropertyValue.Builder().value("oauth2").label("OAuth 2.0").build()); }
@Test public void shouldSerializeMultipleValue() throws JSONException { final ConfigurationProperty.PropertyValue val1 = new ConfigurationProperty.PropertyValue.Builder().label("label").value("value") .build(); final Map<String, String> val2 = Collections.singletonMap("key", "value"); assertEquals("{\"label\": \"label\", \"value\": \"value\", \"key\": \"value\"}", serialize(create(val1, val2)), true); }
/** * Creates an immutable copy of a {@link ConfigurationProperty.PropertyValue} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable PropertyValue instance */ public static ConfigurationProperty.PropertyValue copyOf(ConfigurationProperty.PropertyValue instance) { if (instance instanceof ImmutablePropertyValue) { return (ImmutablePropertyValue) instance; } return new ConfigurationProperty.PropertyValue.Builder() .createFrom(instance) .build(); }
static PropertyValue createPropertyValue(final String value) { return new PropertyValue.Builder().label(value).value(value).build(); }
static PropertyValue createPropertyValue(final String value) { return new PropertyValue.Builder().label(value).value(value).build(); }
public static PropertyValue from(final ActionPropertySuggestion suggestion) { return new Builder().label(suggestion.displayValue()).value(suggestion.value()).build(); }
SupportedAuthenticationTypes(final String label) { this.label = label; propertyValue = new ConfigurationProperty.PropertyValue.Builder().value(name()).label(label).build(); }
SupportedAuthenticationTypes(final String label) { this.label = label; propertyValue = new ConfigurationProperty.PropertyValue.Builder().value(name()).label(label).build(); }
public static PropertyValue of(final String value, final String label) { return new Builder().label(label).value(value).build(); } }
@Test public void shouldSerializeSimpleValue() throws JSONException { final ConfigurationProperty.PropertyValue val = new ConfigurationProperty.PropertyValue.Builder().label("label").value("value") .build(); assertEquals("{\"label\": \"label\", \"value\": \"value\"}", serialize(create(val)), true); }