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

The following examples show how to use com.thoughtworks.go.plugin.api.GoApplicationAccessor. 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 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 File: DummyClassProvidingAnonymousClass.java    From gocd with 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
Source File: ConsoleLogger.java    From docker-registry-artifact-plugin with Apache License 2.0 5 votes vote down vote up
public static ConsoleLogger getLogger(GoApplicationAccessor accessor) {
    if (consoleLogger == null) {
        synchronized (ConsoleLogger.class) {
            if (consoleLogger == null) {
                consoleLogger = new ConsoleLogger(accessor);
            }
        }
    }

    return consoleLogger;
}
 
Example #4
Source File: ConsoleLoggerTest.java    From docker-registry-artifact-plugin with Apache License 2.0 5 votes vote down vote up
@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
Source File: DescriptorValidatorPlugin.java    From gocd with 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 #6
Source File: PluginRequestTest.java    From docker-elastic-agents-plugin with Apache License 2.0 5 votes vote down vote up
@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 #7
Source File: PluginRequestTest.java    From kubernetes-elastic-agents with Apache License 2.0 5 votes vote down vote up
@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 File: YamlConfigPluginIntegrationTest.java    From gocd-yaml-config-plugin with Apache License 2.0 5 votes vote down vote up
@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 #9
Source File: GoExtensionWithLoadUnloadAnnotation.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #10
Source File: TaskExtensionImplementation.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    System.setProperty("valid-plugin-with-multiple-extensions.task_extension.initialize_accessor.count", String.valueOf(++numberOfCallsToInitialize));
    System.setProperty("valid-plugin-with-multiple-extensions.task_extension.initialize_accessor.value", String.valueOf(System.currentTimeMillis()));
}
 
Example #11
Source File: PublicGoExtensionClassWhichWillLoadSuccessfullyButThrowWhenAskedForPluginIdentifier.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #12
Source File: DefaultGoPluginActivatorTest.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #13
Source File: DefaultGoPluginActivatorTest.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #14
Source File: DefaultGoPluginActivatorIntegrationTest.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    throw new UnsupportedOperationException();
}
 
Example #15
Source File: DummyTestPlugin.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    throw new UnsupportedOperationException();
}
 
Example #16
Source File: ClassWhichUsesSomeClassesInOrgXMLSaxPackage.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    throw new UnsupportedOperationException();
}
 
Example #17
Source File: ClassWhichUsesSomeClassesInOrgW3CDomPackage.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    throw new UnsupportedOperationException();
}
 
Example #18
Source File: DummyTestPluginWithNonPublicDefaultConstructor.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
    throw new UnsupportedOperationException();
}
 
Example #19
Source File: PublicGoExtensionClassWhichWillLoadSuccessfullyAndProvideAValidIdentifier.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #20
Source File: NonExtensionWithLoadUnloadAnnotation.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #21
Source File: PublicGoExtensionClassWhichLogsInAStaticBlock.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #22
Source File: GoExtensionWithUnloadAnnotationMethodThrowingException.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #23
Source File: GoExtensionWithPublicLoadUnloadAnnotationWithArguments.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #24
Source File: GoExtensionWithMultipleLoadUnloadAnnotation.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #25
Source File: GoExtensionWithStaticLoadAnnotationMethod.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #26
Source File: GoExtensionWithInheritedPublicLoadUnloadAnnotationMethod.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #27
Source File: GoExtensionWithNonPublicLoadUnloadAnnotation.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #28
Source File: PublicGoExtensionClassWhichWillAlsoLoadSuccessfully.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #29
Source File: GoExtensionWithLoadAnnotationMethodThrowingException.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}
 
Example #30
Source File: DumbPluginThatRespondsWithClassloaderName.java    From gocd with Apache License 2.0 4 votes vote down vote up
@Override
public void initializeGoApplicationAccessor(GoApplicationAccessor goApplicationAccessor) {
}