Java Code Examples for com.thoughtworks.go.plugin.api.GoApplicationAccessor

The following examples show how to use com.thoughtworks.go.plugin.api.GoApplicationAccessor. These examples are extracted from open source projects. 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 Project: gocd   Source File: DummyClassProvidingAnonymousClass.java    License: Apache License 2.0 6 votes vote down vote up
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 Project: gocd   Source File: DummyClassProvidingAnonymousClass.java    License: Apache License 2.0 6 votes vote down vote up
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 3
public static ConsoleLogger getLogger(GoApplicationAccessor accessor) {
    if (consoleLogger == null) {
        synchronized (ConsoleLogger.class) {
            if (consoleLogger == null) {
                consoleLogger = new ConsoleLogger(accessor);
            }
        }
    }

    return consoleLogger;
}
 
Example 4
@BeforeClass
public static void setUp() {
    accessor = mock(GoApplicationAccessor.class);
    argumentCaptor = ArgumentCaptor.forClass(GoApiRequest.class);

    consoleLogger = ConsoleLogger.getLogger(accessor);

    when(accessor.submit(argumentCaptor.capture())).thenReturn(DefaultGoApiResponse.success(null));
}
 
Example 5
@Test
public void shouldNotThrowAnExceptionIfConsoleLogAppenderCallFails() {
    final JobIdentifier jobIdentifier = new JobIdentifier("p1", 1L, "l1", "s1", "1", "j1", 1L);

    GoApplicationAccessor accessor = mock(GoApplicationAccessor.class);
    when(accessor.submit(any())).thenReturn(DefaultGoApiResponse.badRequest("Something went wrong"));

    final PluginRequest pluginRequest = new PluginRequest(accessor);
    pluginRequest.appendToConsoleLog(jobIdentifier, "text1");
}
 
Example 6
@Before
public void setUp() {
    plugin = new YamlConfigPlugin();
    goAccessor = mock(GoApplicationAccessor.class);
    plugin.initializeGoApplicationAccessor(goAccessor);
    GoApiResponse settingsResponse = DefaultGoApiResponse.success("{}");
    when(goAccessor.submit(any(GoApiRequest.class))).thenReturn(settingsResponse);
    parser = new JsonParser();
}
 
Example 7
@Test
public void shouldNotThrowAnExceptionIfConsoleLogAppenderCallFails() {
    final JobIdentifier jobIdentifier = new JobIdentifier("p1", 1L, "l1", "s1", "1", "j1", 1L);

    GoApplicationAccessor accessor = mock(GoApplicationAccessor.class);
    when(accessor.submit(any())).thenReturn(DefaultGoApiResponse.badRequest("Something went wrong"));

    final PluginRequest pluginRequest = new PluginRequest(accessor);
    pluginRequest.appendToConsoleLog(jobIdentifier, "text1");
}
 
Example 8
Source Project: gocd   Source File: DescriptorValidatorPlugin.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    if (loadCalled == 0) {
        throw new RuntimeException("Load callback has not been called for this plugin");
    }
    System.setProperty("testplugin.descriptorValidator.setPluginDescriptor.invoked", "PluginLoad: " + loadCalled + ", InitAccessor");
}
 
Example 9
private ConsoleLogger(GoApplicationAccessor accessor) {
    this.accessor = accessor;
}
 
Example 10
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor accessor) {
    consoleLogger = ConsoleLogger.getLogger(accessor);
}
 
Example 11
Source Project: kubernetes-elastic-agents   Source File: PluginRequest.java    License: Apache License 2.0 4 votes vote down vote up
public PluginRequest(GoApplicationAccessor accessor) {
    this.accessor = accessor;
}
 
Example 12
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor accessor) {
    pluginRequest = new PluginRequest(accessor);
    clusterSpecificAgentInstances = new HashMap<>();
}
 
Example 13
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor accessor) {
    this.accessor = accessor;
}
 
Example 14
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor accessor) {
    this.accessor = accessor;
}
 
Example 15
Source Project: gocd-yaml-config-plugin   Source File: YamlConfigPlugin.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    this.goApplicationAccessor = goApplicationAccessor;
}
 
Example 16
public PluginRequest(GoApplicationAccessor accessor) {
    this.accessor = accessor;
}
 
Example 17
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor accessor) {
    pluginRequest = new PluginRequest(accessor);
    clusterSpecificAgentInstances = new HashMap<>();
}
 
Example 18
Source Project: gocd   Source File: TestGoPluginTom.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example 19
public PluginRequest(GoApplicationAccessor accessor) {
    this.accessor = accessor;
}
 
Example 20
Source Project: docker-elastic-agents-plugin   Source File: DockerPlugin.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor accessor) {
    pluginRequest = new PluginRequest(accessor);
    clusterSpecificAgentInstances = new HashMap<>();
}
 
Example 21
Source Project: gocd-oauth-login   Source File: OAuthLoginPlugin.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    this.goApplicationAccessor = goApplicationAccessor;
}
 
Example 22
Source Project: gocd-plugins   Source File: NessusScanTask.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    // not required in most plugins
}
 
Example 23
Source Project: gocd-plugins   Source File: SonarScanTask.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    // not required in most plugins
}
 
Example 24
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    this.goApplicationAccessor = goApplicationAccessor;
}
 
Example 25
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    this.goApplicationAccessor = goApplicationAccessor;
}
 
Example 26
Source Project: script-executor-task   Source File: GoPluginImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    // ignore
}
 
Example 27
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example 28
Source Project: go-plugins   Source File: DummyArtifactPlugin.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example 29
Source Project: go-plugins   Source File: SampleAuthenticationPluginImpl.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    this.goApplicationAccessor = goApplicationAccessor;
}
 
Example 30
Source Project: gocd   Source File: DescriptorPlugin.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}