public void addMetadataFor(String pluginId, SCMConfigurations configuration, SCMView scmView) { SCMPreference scmPreference = new SCMPreference(configuration, scmView); setPreferenceFor(pluginId, scmPreference); }
@Before public void setUp() throws Exception { messageHandler = new JsonMessageHandler1_0(); scmPropertyConfiguration = new SCMPropertyConfiguration(); scmPropertyConfiguration.add(new SCMProperty("key-one", "value-one")); scmPropertyConfiguration.add(new SCMProperty("key-two", "value-two")); materialData = new HashMap<>(); materialData.put("key-one", "value-one"); }
public boolean hasOption(String pluginId, String key, Option<Boolean> option) { SCMConfigurations configurations = getConfigurationMetadata(pluginId); if (configurations != null) { SCMConfiguration scmConfiguration = configurations.get(key); if (scmConfiguration != null) { return scmConfiguration.hasOption(option); } } return option.getValue(); }
public String displayValue(String pluginId) { if (isEmpty(pluginId) || !hasPreferenceFor(pluginId)) { return null; } SCMView scmView = preferenceFor(pluginId).getScmView(); if (scmView == null) { return null; } return scmView.displayValue(); }
public String template(String pluginId) { if (isEmpty(pluginId) || !hasPreferenceFor(pluginId)) { return null; } SCMView scmView = preferenceFor(pluginId).getScmView(); if (scmView == null) { return null; } return scmView.template(); }
public SCMConfigurations getConfigurationMetadata(String pluginId) { if (isEmpty(pluginId) || !hasPreferenceFor(pluginId)) { return null; } return preferenceFor(pluginId).getScmConfigurations(); }
public SCMView getViewMetadata(String pluginId) { if (isEmpty(pluginId) || !hasPreferenceFor(pluginId)) { return null; } return preferenceFor(pluginId).getScmView(); }
public SCMConfigurations(SCMPropertyConfiguration configuration) { for (Property property : configuration.list()) { configurations.add(new SCMConfiguration(property)); } }
@Override public void pluginLoaded(GoPluginDescriptor pluginDescriptor) { if (scmExtension.canHandlePlugin(pluginDescriptor.id())) { fetchSCMMetaData(pluginDescriptor); } }
@Override public void pluginUnLoaded(GoPluginDescriptor pluginDescriptor) { if (scmExtension.canHandlePlugin(pluginDescriptor.id())) { scmMetadataStore.removeMetadata(pluginDescriptor.id()); } } }
@Test public void shouldBuildSCMConfigurationFromResponseBody() throws Exception { String responseBody = "{" + "\"key-one\":{}," + "\"key-two\":{\"default-value\":\"two\",\"part-of-identity\":true,\"secure\":true,\"required\":true,\"display-name\":\"display-two\",\"display-order\":\"1\"}," + "\"key-three\":{\"default-value\":\"three\",\"part-of-identity\":false,\"secure\":false,\"required\":false,\"display-name\":\"display-three\",\"display-order\":\"2\"}" + "}"; SCMPropertyConfiguration scmConfiguration = messageHandler.responseMessageForSCMConfiguration(responseBody); assertPropertyConfiguration((SCMProperty) scmConfiguration.get("key-one"), "key-one", null, true, true, false, "", 0); assertPropertyConfiguration((SCMProperty) scmConfiguration.get("key-two"), "key-two", "two", true, true, true, "display-two", 1); assertPropertyConfiguration((SCMProperty) scmConfiguration.get("key-three"), "key-three", "three", false, false, false, "display-three", 2); }
private SCMConfiguration scmConfigurationFor(String configKey, SCMConfigurations scmConfigurations) { return scmConfigurations.get(configKey); }
public boolean hasPlugin(String pluginId) { return hasPreferenceFor(pluginId); }
@Test public void shouldBuildResultFromCheckoutResponse() throws Exception { String responseBody = "{\"status\":\"failure\",messages=[\"message-one\",\"message-two\"]}"; Result result = messageHandler.responseMessageForCheckout(responseBody); assertFailureResult(result, asList("message-one", "message-two")); }
public SCMProperty(String key, String value) { super(key, value); updateDefaults(); }
public boolean hasOption(Option<Boolean> option) { return getOption(option) == true; }
public SCMProperty(String key) { super(key); updateDefaults(); }