Examples of PluginImpl


Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl

     * Does a static mock of {@link PluginImpl}.
     * And specifically the retrieval of Config and the frontendUrl.
     */
    private static void mockPluginConfig() {
        PowerMockito.mockStatic(PluginImpl.class);
        PluginImpl plugin = PowerMockito.mock(PluginImpl.class);
        GerritServer server = mock(GerritServer.class);
        when(plugin.getServer(any(String.class))).thenReturn(server);
        GerritHandler handler = mock(GerritHandler.class);
        when(plugin.getHandler()).thenReturn(handler);
        IGerritHudsonTriggerConfig config = Setup.createConfig();
        config = spy(config);
        doReturn("http://mock.url").when(config).getGerritFrontEndUrlFor(any(String.class), any(String.class));
        when(server.getConfig()).thenReturn(config);
        PowerMockito.when(PluginImpl.getInstance()).thenReturn(plugin);
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl

     */
    @Test
    public void shouldReturnEmptySlaveListWhenGerritServerNotFound() {
        // setup
        PowerMockito.mockStatic(PluginImpl.class);
        PluginImpl pluginMock = mock(PluginImpl.class);
        when(PluginImpl.getInstance()).thenReturn(pluginMock);
        GerritTrigger gerritTrigger = Setup.createDefaultTrigger(null);

        // actual test
        List<GerritSlave> slaves = gerritTrigger.gerritSlavesToWaitFor("unexistingServer");
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl

     * Setup a sever config mock
     * @return the server config mock
     */
    private IGerritHudsonTriggerConfig setupSeverConfigMock() {
        PowerMockito.mockStatic(PluginImpl.class);
        PluginImpl pluginMock = mock(PluginImpl.class);
        when(PluginImpl.getInstance()).thenReturn(pluginMock);
        GerritServer serverMock = mock(GerritServer.class);
        when(pluginMock.getServer(PluginImpl.DEFAULT_SERVER_NAME)).thenReturn(serverMock);
        IGerritHudsonTriggerConfig configMock = mock(IGerritHudsonTriggerConfig.class);
        when(serverMock.getConfig()).thenReturn(configMock);
        return configMock;
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl

     * Tests that the gerrit version is high enough to run the file trigger feature.
     */
    @Test
    public void testHighEnoughVersion() {
        PowerMockito.mockStatic(PluginImpl.class);
        PluginImpl plugin = PowerMockito.mock(PluginImpl.class);
        GerritServer server = mock(GerritServer.class);
        PowerMockito.when(PluginImpl.getInstance()).thenReturn(plugin);
        PowerMockito.when(plugin.getServer(testServer)).thenReturn(server);
        PowerMockito.when(server.getGerritVersion()).thenReturn("2.3.1-450");
        assertTrue(GerritVersionChecker.isCorrectVersion(GerritVersionChecker.Feature.fileTrigger, testServer));
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl

     * Tests that the gerrit version is not high enough to run the file trigger feature.
     */
    @Test
    public void testNotHighEnoughVersion() {
        PowerMockito.mockStatic(PluginImpl.class);
        PluginImpl plugin = PowerMockito.mock(PluginImpl.class);
        GerritServer server = mock(GerritServer.class);
        PowerMockito.when(PluginImpl.getInstance()).thenReturn(plugin);
        PowerMockito.when(plugin.getServer(testServer)).thenReturn(server);
        PowerMockito.when(server.getGerritVersion()).thenReturn("2.2.2.1-150");
        assertFalse(GerritVersionChecker.isCorrectVersion(GerritVersionChecker.Feature.fileTrigger, testServer));
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl

     * Tests that the gerrit version is not high enough to run the file trigger feature.
     */
    @Test
    public void testUnknownVersionEmpty() {
        PowerMockito.mockStatic(PluginImpl.class);
        PluginImpl plugin = PowerMockito.mock(PluginImpl.class);
        GerritServer server = mock(GerritServer.class);
        PowerMockito.when(PluginImpl.getInstance()).thenReturn(plugin);
        PowerMockito.when(plugin.getServer(testServer)).thenReturn(server);
        PowerMockito.when(server.getGerritVersion()).thenReturn("");
        assertTrue(GerritVersionChecker.isCorrectVersion(GerritVersionChecker.Feature.fileTrigger, testServer));
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl

     * Tests that the gerrit version is not high enough to run the file trigger feature.
     */
    @Test
    public void testUnknownVersionNull() {
        PowerMockito.mockStatic(PluginImpl.class);
        PluginImpl plugin = PowerMockito.mock(PluginImpl.class);
        GerritServer server = mock(GerritServer.class);
        PowerMockito.when(PluginImpl.getInstance()).thenReturn(plugin);
        PowerMockito.when(plugin.getServer(testServer)).thenReturn(server);
        PowerMockito.when(server.getGerritVersion()).thenReturn(null);
        assertTrue(GerritVersionChecker.isCorrectVersion(GerritVersionChecker.Feature.fileTrigger , testServer));
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl

     * Tests that the gerrit version is a snapshot and therefore high enough to run the file trigger feature..
     */
    @Test
    public void testSnapshotVersion() {
        PowerMockito.mockStatic(PluginImpl.class);
        PluginImpl plugin = PowerMockito.mock(PluginImpl.class);
        GerritServer server = mock(GerritServer.class);
        PowerMockito.when(PluginImpl.getInstance()).thenReturn(plugin);
        PowerMockito.when(plugin.getServer(testServer)).thenReturn(server);
        String version = "2.2.2.1-340-g47084d4";
        PowerMockito.when(server.getGerritVersion()).thenReturn(version);
        assertTrue(GerritVersionChecker.isCorrectVersion(GerritVersionChecker.Feature.fileTrigger , testServer));
        assertTrue(GerritVersionNumber.getGerritVersionNumber(version).isSnapshot());
    }
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl

    * Adds this trigger as listener to the Gerrit server.
    *
    * @param project the project associated with the trigger.
    */
    private void addThisTriggerAsListener(AbstractProject project) {
        PluginImpl plugin = PluginImpl.getInstance();
        if (plugin != null) {
            GerritHandler handler = plugin.getHandler();
            if (handler != null) {
                handler.addListener(this);
            } else {
                logger.warn("The plugin has no handler instance (BUG)! Project {} will not be triggered!",
                        project.getFullDisplayName());
View Full Code Here

Examples of com.sonyericsson.hudson.plugins.gerrit.trigger.PluginImpl

    /**
     * Removes listener from the server.
     */
    private void removeListener() {
        PluginImpl plugin = PluginImpl.getInstance();
        if (plugin != null) {
            if (PluginImpl.getInstance().getHandler() != null) {
                PluginImpl.getInstance().getHandler().removeListener(this);
            } else {
                logger.error("The Gerrit handler has not been initialized. BUG!");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.