Package com.sonyericsson.hudson.plugins.gerrit.trigger

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


        PatchsetCreated event = preparePatchsetCreatedObjForMockTest(change,
                new PatchSet(patch), GerritEventType.PATCHSET_CREATED);
        //mock the returned url
        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);

        //prepare GerritTrigger object with the readableMessage setting is on.
        GerritTrigger triggerWithReadableMessageOn = Setup.createDefaultTrigger(null);
        when(project.getTrigger(GerritTrigger.class)).thenReturn(triggerWithReadableMessageOn);
View Full Code Here


                new PatchSet(patch), GerritEventType.PATCHSET_CREATED);

        //mock the returned url
        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);

        //prepare GerritTrigger object with the escapeQuotes setting is off.
        GerritTrigger triggerWithReadableMessageOff = Setup.createDefaultTrigger(null);
        when(project.getTrigger(GerritTrigger.class)).thenReturn(triggerWithReadableMessageOff);
View Full Code Here

     * 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

     */
    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

    public void testPopulateDropDown() throws Exception {
        @SuppressWarnings("unused")
        List<GerritServer> servers = PluginImpl.getInstance().getServers();

        //create a server for testing
        GerritServer server = new GerritServer(PluginImpl.DEFAULT_SERVER_NAME);
        servers.add(server);
        server.start();

        FreeStyleProject project = DuplicatesUtil.createGerritTriggeredJobForCommentAdded(j, "myGerritProject");
        WebClient wc = j.createWebClient();
        HtmlPage page = wc.goTo("/job/myGerritProject/configure");
        List<HtmlElement> elements = page.getDocumentElement().getElementsByAttribute("td", "class", "setting-name");
View Full Code Here

    public void testPopulateDropDownFromTwoServers() throws Exception {
        @SuppressWarnings("unused")
        List<GerritServer> servers = PluginImpl.getInstance().getServers();

        //create a server with default Verdict Categories
        GerritServer server1 = new GerritServer("testServer1");
        servers.add(server1);
        server1.start();

        GerritServer server2 = new GerritServer("testServer2");
        servers.add(server2);
        server2.start();
        server2.getConfig().getCategories().add(new VerdictCategory("Code-Review", "Code Review For Gerrit 2.6+"));
        server2.getConfig().getCategories().add(new VerdictCategory("Verified", "Verified For Gerrit 2.6+"));

        FreeStyleProject project = DuplicatesUtil.createGerritTriggeredJobForCommentAdded(j, "myGerritProject",
                GerritServer.ANY_SERVER);
        WebClient wc = j.createWebClient();
        HtmlPage page = wc.goTo("/job/myGerritProject/configure");
View Full Code Here

     */
    @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

     */
    @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

     */
    @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

     */
    @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

TOP

Related Classes of com.sonyericsson.hudson.plugins.gerrit.trigger.GerritServer

Copyright © 2018 www.massapicom. 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.