Search in sources :

Example 1 with PluginRequestHelper

use of com.thoughtworks.go.plugin.access.PluginRequestHelper in project gocd by gocd.

the class JsonBasedTaskExecutorTest method setup.

@Before
public void setup() {
    context = mock(TaskExecutionContext.class);
    pluginManager = mock(PluginManager.class);
    pluginId = "pluginId";
    response = mock(GoPluginApiResponse.class);
    handler = mock(JsonBasedTaskExtensionHandler.class);
    handlerHashMap.put("1.0", handler);
    final List<String> goSupportedVersions = asList("1.0");
    pluginRequestHelper = new PluginRequestHelper(pluginManager, goSupportedVersions, PLUGGABLE_TASK_EXTENSION);
    when(pluginManager.resolveExtensionVersion(pluginId, PLUGGABLE_TASK_EXTENSION, goSupportedVersions)).thenReturn(extensionVersion);
    when(response.responseCode()).thenReturn(DefaultGoApiResponse.SUCCESS_RESPONSE_CODE);
    when(pluginManager.isPluginOfType(PLUGGABLE_TASK_EXTENSION, pluginId)).thenReturn(true);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) PluginRequestHelper(com.thoughtworks.go.plugin.access.PluginRequestHelper) GoPluginApiResponse(com.thoughtworks.go.plugin.api.response.GoPluginApiResponse) Before(org.junit.Before)

Example 2 with PluginRequestHelper

use of com.thoughtworks.go.plugin.access.PluginRequestHelper in project gocd by gocd.

the class ElasticAgentExtensionV1Test method setUp.

@Before
public void setUp() throws Exception {
    initMocks(this);
    requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
    final List<String> goSupportedVersions = Arrays.asList("1.0", "2.0", "3.0");
    when(descriptor.id()).thenReturn(PLUGIN_ID);
    when(pluginManager.getPluginDescriptorFor(PLUGIN_ID)).thenReturn(descriptor);
    when(pluginManager.isPluginOfType(ELASTIC_AGENT_EXTENSION, PLUGIN_ID)).thenReturn(true);
    when(pluginManager.resolveExtensionVersion(PLUGIN_ID, ELASTIC_AGENT_EXTENSION, goSupportedVersions)).thenReturn("1.0");
    final PluginRequestHelper pluginRequestHelper = new PluginRequestHelper(pluginManager, goSupportedVersions, ELASTIC_AGENT_EXTENSION);
    extensionV1 = new ElasticAgentExtensionV1(pluginRequestHelper);
}
Also used : ElasticAgentExtensionV1(com.thoughtworks.go.plugin.access.elastic.v1.ElasticAgentExtensionV1) GoPluginApiRequest(com.thoughtworks.go.plugin.api.request.GoPluginApiRequest) PluginRequestHelper(com.thoughtworks.go.plugin.access.PluginRequestHelper) Before(org.junit.Before)

Example 3 with PluginRequestHelper

use of com.thoughtworks.go.plugin.access.PluginRequestHelper in project gocd by gocd.

the class ElasticAgentExtensionV2Test method setUp.

@Before
public void setUp() throws Exception {
    initMocks(this);
    requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
    final List<String> goSupportedVersions = Arrays.asList("1.0", "2.0", "3.0");
    when(descriptor.id()).thenReturn(PLUGIN_ID);
    when(pluginManager.getPluginDescriptorFor(PLUGIN_ID)).thenReturn(descriptor);
    when(pluginManager.isPluginOfType(ELASTIC_AGENT_EXTENSION, PLUGIN_ID)).thenReturn(true);
    when(pluginManager.resolveExtensionVersion(PLUGIN_ID, ELASTIC_AGENT_EXTENSION, goSupportedVersions)).thenReturn("2.0");
    final PluginRequestHelper pluginRequestHelper = new PluginRequestHelper(pluginManager, goSupportedVersions, ELASTIC_AGENT_EXTENSION);
    extensionV2 = new ElasticAgentExtensionV2(pluginRequestHelper);
}
Also used : ElasticAgentExtensionV2(com.thoughtworks.go.plugin.access.elastic.v2.ElasticAgentExtensionV2) GoPluginApiRequest(com.thoughtworks.go.plugin.api.request.GoPluginApiRequest) PluginRequestHelper(com.thoughtworks.go.plugin.access.PluginRequestHelper) Before(org.junit.Before)

Example 4 with PluginRequestHelper

use of com.thoughtworks.go.plugin.access.PluginRequestHelper in project gocd by gocd.

the class ElasticAgentExtensionV3Test method setUp.

@Before
public void setUp() throws Exception {
    initMocks(this);
    requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
    final List<String> goSupportedVersions = Arrays.asList("1.0", "2.0", "3.0");
    when(descriptor.id()).thenReturn(PLUGIN_ID);
    when(pluginManager.getPluginDescriptorFor(PLUGIN_ID)).thenReturn(descriptor);
    when(pluginManager.isPluginOfType(ELASTIC_AGENT_EXTENSION, PLUGIN_ID)).thenReturn(true);
    when(pluginManager.resolveExtensionVersion(PLUGIN_ID, ELASTIC_AGENT_EXTENSION, goSupportedVersions)).thenReturn("3.0");
    final PluginRequestHelper pluginRequestHelper = new PluginRequestHelper(pluginManager, goSupportedVersions, ELASTIC_AGENT_EXTENSION);
    extensionV3 = new ElasticAgentExtensionV3(pluginRequestHelper);
}
Also used : GoPluginApiRequest(com.thoughtworks.go.plugin.api.request.GoPluginApiRequest) ElasticAgentExtensionV3(com.thoughtworks.go.plugin.access.elastic.v3.ElasticAgentExtensionV3) PluginRequestHelper(com.thoughtworks.go.plugin.access.PluginRequestHelper) Before(org.junit.Before)

Example 5 with PluginRequestHelper

use of com.thoughtworks.go.plugin.access.PluginRequestHelper in project gocd by gocd.

the class AbstractExtensionTest method setUp.

@Before
public void setUp() throws Exception {
    initMocks(this);
    pluginId = "plugin_id";
    extensionName = "testExtension";
    pluginRequestHelper = new PluginRequestHelper(pluginManager, goSupportedVersions, extensionName);
    extension = new TestExtension(pluginManager, pluginRequestHelper, extensionName);
    when(pluginManager.isPluginOfType(extensionName, pluginId)).thenReturn(true);
}
Also used : PluginRequestHelper(com.thoughtworks.go.plugin.access.PluginRequestHelper) Before(org.junit.Before)

Aggregations

PluginRequestHelper (com.thoughtworks.go.plugin.access.PluginRequestHelper)5 Before (org.junit.Before)5 GoPluginApiRequest (com.thoughtworks.go.plugin.api.request.GoPluginApiRequest)3 ElasticAgentExtensionV1 (com.thoughtworks.go.plugin.access.elastic.v1.ElasticAgentExtensionV1)1 ElasticAgentExtensionV2 (com.thoughtworks.go.plugin.access.elastic.v2.ElasticAgentExtensionV2)1 ElasticAgentExtensionV3 (com.thoughtworks.go.plugin.access.elastic.v3.ElasticAgentExtensionV3)1 GoPluginApiResponse (com.thoughtworks.go.plugin.api.response.GoPluginApiResponse)1 PluginManager (com.thoughtworks.go.plugin.infra.PluginManager)1