com.thoughtworks.go.plugin.api.GoPluginIdentifier Java Examples
The following examples show how to use
com.thoughtworks.go.plugin.api.GoPluginIdentifier.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DummyClassProvidingAnonymousClass.java From gocd with Apache License 2.0 | 6 votes |
public static GoPlugin getAnonymousClass() { return new GoPlugin() { @Override public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) { } @Override public GoPluginApiResponse handle(GoPluginApiRequest requestMessage) throws UnhandledRequestTypeException { return null; } @Override public GoPluginIdentifier pluginIdentifier() { return null; } }; }
Example #2
Source File: DefaultPluginManagerTest.java From gocd with Apache License 2.0 | 6 votes |
@Test void shouldSayPluginIsOfGivenExtensionTypeWhenReferenceIsFound() { String pluginId = "plugin-id"; String extensionType = "sample-extension"; GoPluginIdentifier pluginIdentifier = new GoPluginIdentifier(extensionType, asList("1.0")); final GoPlugin goPlugin = mock(GoPlugin.class); final GoPluginDescriptor descriptor = mock(GoPluginDescriptor.class); when(goPluginOSGiFramework.hasReferenceFor(GoPlugin.class, pluginId, extensionType)).thenReturn(true); doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocationOnMock) { ActionWithReturn<GoPlugin, GoPluginApiResponse> action = (ActionWithReturn<GoPlugin, GoPluginApiResponse>) invocationOnMock.getArguments()[2]; return action.execute(goPlugin, descriptor); } }).when(goPluginOSGiFramework).doOn(eq(GoPlugin.class), eq(pluginId), eq(extensionType), any(ActionWithReturn.class)); when(goPlugin.pluginIdentifier()).thenReturn(pluginIdentifier); DefaultPluginManager pluginManager = new DefaultPluginManager(monitor, registry, goPluginOSGiFramework, jarChangeListener, pluginRequestProcessorRegistry, systemEnvironment, pluginLoader); assertThat(pluginManager.isPluginOfType(extensionType, pluginId)).isTrue(); }
Example #3
Source File: DummyClassProvidingAnonymousClass.java From gocd with Apache License 2.0 | 6 votes |
public static GoPlugin getAnonymousClass() { return new GoPlugin() { @Override public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) { } @Override public GoPluginApiResponse handle(GoPluginApiRequest requestMessage) throws UnhandledRequestTypeException { return null; } @Override public GoPluginIdentifier pluginIdentifier() { return null; } }; }
Example #4
Source File: ServerInfoRequestProcessorTest.java From gocd with Apache License 2.0 | 5 votes |
@Test public void shouldReturnAServerIdInJSONForm() { DefaultGoApiRequest request = new DefaultGoApiRequest(GET_SERVER_INFO, "1.0", new GoPluginIdentifier("extension1", Arrays.asList("1.0"))); GoApiResponse response = processor.process(pluginDescriptor, request); assertThat(response.responseCode(), is(200)); assertThat(response.responseBody(), is(format("{\"server_id\":\"%s\",\"site_url\":\"%s\",\"secure_site_url\":\"%s\"}", serverConfig.getServerId(), serverConfig.getSiteUrl().getUrl(), serverConfig.getSecureSiteUrl().getUrl()))); }
Example #5
Source File: SampleAuthenticationPluginImpl.java From go-plugins with Apache License 2.0 | 5 votes |
private GoApiRequest createGoApiRequest(final String api, final String responseBody) { return new GoApiRequest() { @Override public String api() { return api; } @Override public String apiVersion() { return "1.0"; } @Override public GoPluginIdentifier pluginIdentifier() { return getGoPluginIdentifier(); } @Override public Map<String, String> requestParameters() { return null; } @Override public Map<String, String> requestHeaders() { return null; } @Override public String requestBody() { return responseBody; } }; }
Example #6
Source File: PluginSettingsRequestProcessorTest.java From gocd with Apache License 2.0 | 5 votes |
@Test public void shouldNotGetPluginSettingsForPluginThatDoesNotExistInDB() { String PLUGIN_ID = "plugin-foo-id"; String requestBody = "expected-request"; when(pluginDescriptor.id()).thenReturn(PLUGIN_ID); when(pluginSqlMapDao.findPlugin(PLUGIN_ID)).thenReturn(new NullPlugin()); DefaultGoApiRequest apiRequest = new DefaultGoApiRequest(PluginSettingsRequestProcessor.GET_PLUGIN_SETTINGS, "1.0", new GoPluginIdentifier("extension1", Collections.singletonList("1.0"))); apiRequest.setRequestBody(requestBody); GoApiResponse response = processor.process(pluginDescriptor, apiRequest); assertThat(response.responseCode(), is(200)); assertThat(response.responseBody(), is(nullValue())); }
Example #7
Source File: BuildStatusNotifierPlugin.java From gocd-build-status-notifier with Apache License 2.0 | 5 votes |
private GoApiRequest createGoApiRequest(final String api, final String responseBody) { return new GoApiRequest() { @Override public String api() { return api; } @Override public String apiVersion() { return "1.0"; } @Override public GoPluginIdentifier pluginIdentifier() { return getGoPluginIdentifier(); } @Override public Map<String, String> requestParameters() { return null; } @Override public Map<String, String> requestHeaders() { return null; } @Override public String requestBody() { return responseBody; } }; }
Example #8
Source File: ServerInfoRequestProcessorTest.java From gocd with Apache License 2.0 | 5 votes |
@Test public void shouldReturnSuccessForServerInfoV2() { DefaultGoApiRequest request = new DefaultGoApiRequest(GET_SERVER_INFO, "2.0", new GoPluginIdentifier("extension1", Arrays.asList("1.0"))); GoApiResponse response = processor.process(pluginDescriptor, request); assertThat(response.responseCode(), is(200)); }
Example #9
Source File: DefaultPluginManagerTest.java From gocd with Apache License 2.0 | 5 votes |
@Test void shouldResolveToCorrectExtensionVersion() { String pluginId = "plugin-id"; String extensionType = "sample-extension"; GoPlugin goPlugin = mock(GoPlugin.class); GoPlugginOSGiFrameworkStub osGiFrameworkStub = new GoPlugginOSGiFrameworkStub(goPlugin); osGiFrameworkStub.addHasReferenceFor(GoPlugin.class, pluginId, extensionType, true); when(goPlugin.pluginIdentifier()).thenReturn(new GoPluginIdentifier(extensionType, asList("1.0", "2.0"))); DefaultPluginManager pluginManager = new DefaultPluginManager(monitor, registry, osGiFrameworkStub, jarChangeListener, pluginRequestProcessorRegistry, systemEnvironment, pluginLoader); assertThat(pluginManager.resolveExtensionVersion(pluginId, extensionType, asList("1.0", "2.0", "3.0"))).isEqualTo("2.0"); }
Example #10
Source File: PluginSettingsRequestProcessorTest.java From gocd with Apache License 2.0 | 5 votes |
@Test public void shouldGetPluginSettingsForPluginThatExistsInDB() { String PLUGIN_ID = "plugin-foo-id"; when(pluginDescriptor.id()).thenReturn(PLUGIN_ID); when(pluginSqlMapDao.findPlugin(PLUGIN_ID)).thenReturn(new Plugin(PLUGIN_ID, "{\"k1\": \"v1\",\"k2\": \"v2\"}")); DefaultGoApiRequest apiRequest = new DefaultGoApiRequest(PluginSettingsRequestProcessor.GET_PLUGIN_SETTINGS, "1.0", new GoPluginIdentifier("extension1", Collections.singletonList("1.0"))); apiRequest.setRequestBody("expected-request"); GoApiResponse response = processor.process(pluginDescriptor, apiRequest); assertThat(response.responseCode(), is(200)); assertThat(response.responseBody(), is("{\"k1\":\"v1\",\"k2\":\"v2\"}")); }
Example #11
Source File: EmailNotificationPluginImpl.java From email-notifier with Apache License 2.0 | 5 votes |
private GoApiRequest createGoApiRequest(final String api, final String responseBody) { return new GoApiRequest() { @Override public String api() { return api; } @Override public String apiVersion() { return "1.0"; } @Override public GoPluginIdentifier pluginIdentifier() { return getGoPluginIdentifier(); } @Override public Map<String, String> requestParameters() { return null; } @Override public Map<String, String> requestHeaders() { return null; } @Override public String requestBody() { return responseBody; } }; }
Example #12
Source File: TaskExtensionImplementation.java From gocd with Apache License 2.0 | 5 votes |
@Override public GoPluginIdentifier pluginIdentifier() { System.setProperty("valid-plugin-with-multiple-extensions.task_extension.plugin_identifier.count", String.valueOf(++numberOfCallsToPluginIdentifier)); System.setProperty("valid-plugin-with-multiple-extensions.task_extension.plugin_identifier.value", String.valueOf(System.currentTimeMillis())); return new GoPluginIdentifier("task", Collections.singletonList("1.0")); }
Example #13
Source File: AnalyticsExtensionImplementation.java From gocd with Apache License 2.0 | 5 votes |
@Override public GoPluginIdentifier pluginIdentifier() { System.setProperty("valid-plugin-with-multiple-extensions.analytics_extension.plugin_identifier.count", String.valueOf(++numberOfCallsToPluginIdentifier)); System.setProperty("valid-plugin-with-multiple-extensions.analytics_extension.plugin_identifier.value", String.valueOf(System.currentTimeMillis())); return new GoPluginIdentifier("analytics", Collections.singletonList("1.0")); }
Example #14
Source File: LogNotificationPluginImpl.java From go-plugins with Apache License 2.0 | 5 votes |
GoApiRequest getGoApiRequest(final String api, final String requestBody) { return new GoApiRequest() { @Override public String api() { return api; } @Override public String apiVersion() { return "1.0"; } @Override public GoPluginIdentifier pluginIdentifier() { return getGoPluginIdentifier(); } @Override public Map<String, String> requestParameters() { return null; } @Override public Map<String, String> requestHeaders() { return null; } @Override public String requestBody() { return requestBody; } }; }
Example #15
Source File: ServerInfoRequestProcessorTest.java From gocd with Apache License 2.0 | 5 votes |
@Test public void shouldReturnAErrorResponseIfExtensionDoesNotSupportServerInfo() { DefaultGoApiRequest request = new DefaultGoApiRequest(GET_SERVER_INFO, "bad-version", new GoPluginIdentifier("foo", Arrays.asList("1.0"))); GoApiResponse response = processor.process(pluginDescriptor, request); assertThat(response.responseCode(), is(400)); }
Example #16
Source File: DescriptorPlugin.java From gocd with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("notification", Collections.singletonList("2.0")); }
Example #17
Source File: GoExtensionWithNonPublicLoadUnloadAnnotation.java From gocd with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("some-extension-type", Collections.singletonList("1.0")); }
Example #18
Source File: DefaultGoPluginActivatorIntegrationTest.java From gocd with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { throw new UnsupportedOperationException(); }
Example #19
Source File: ClassThatExtendsTestExtensionPoint.java From gocd with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("some-extension-type", Collections.singletonList("1.0")); }
Example #20
Source File: DefaultGoPluginActivatorIntegrationTest.java From gocd with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { throw new UnsupportedOperationException(); }
Example #21
Source File: DumbPluginThatRespondsWithClassloaderName.java From gocd with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("notification", Collections.singletonList("2.0")); }
Example #22
Source File: ValidStaticClassPlugin.java From go-plugins with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("task", asList("1.0")); }
Example #23
Source File: DoNothingPlugin.java From go-plugins with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("task", asList("1.0")); }
Example #24
Source File: Plugin2.java From go-plugins with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("task", asList("1.0")); }
Example #25
Source File: Plugin1.java From go-plugins with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("task", asList("1.0")); }
Example #26
Source File: GitPluginImpl.java From go-plugins with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier(EXTENSION_NAME, goSupportedVersions); }
Example #27
Source File: ClassWhichUsesSomeClassInJavaxPackage.java From gocd with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("some-extension-type", Collections.singletonList("1.0")); }
Example #28
Source File: PluginWithInvalidId.java From go-plugins with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("PluginWithInvalidId", asList("1.0")); }
Example #29
Source File: PluginWithMultipleLoadMethods.java From go-plugins with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("PluginWithMultipleLoadMethods", asList("1.0")); }
Example #30
Source File: TestPluginOuterClass.java From gocd with Apache License 2.0 | 4 votes |
@Override public GoPluginIdentifier pluginIdentifier() { return new GoPluginIdentifier("some-extension-type4", Collections.singletonList("1.0")); }