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

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


     * @return the URL. Empty String if no server found.
     */
    private String getUrlFromEvent() {
        if (tEvent.getProvider() != null) {
            String serverName = tEvent.getProvider().getName();
            GerritServer server = PluginImpl.getInstance().getServer(serverName);
            if (server != null) {
            IGerritHudsonTriggerConfig config = server.getConfig();
                if (config != null) {
                    return config.getGerritFrontEndUrlFor(tEvent);
                } else {
                    logger.error("Could not get the server config for server {}", server.getName());
                }
            } else {
            logger.error("Could not get the server {}", serverName);
            }
        } else {
View Full Code Here


                //Do an average just for giggles
                return calculateAverageDynamicConfigRefreshInterval();
            }
        } else {
            //get the actual if it exists.
            GerritServer server = PluginImpl.getInstance().getServer(timerTask.getGerritTrigger().getServerName());
            if (server != null) {
                return server.getConfig().getDynamicConfigRefreshInterval();
            } else {
                //Do an average just for giggles
                return calculateAverageDynamicConfigRefreshInterval();
            }
        }
View Full Code Here

                // We do not know which server is selected, so we cannot tell the
                // currently active default value.  It might be the global default,
                // but also a different value.
                return new Option(Messages.NotificationLevel_DefaultValue(), "");
            } else if (serverName != null) {
                GerritServer server = PluginImpl.getInstance().getServer(serverName);
                if (server != null) {
                    Notify level = server.getConfig().getNotificationLevel();
                    if (level != null) {
                        String levelText = levelTextsById.get(level);
                        if (levelText == null) { // new/unknown value
                            levelText = level.toString();
                        }
View Full Code Here

     * @throws IOException          if so
     * @throws InterruptedException if so.
     */
    public void testIt() throws IOException, InterruptedException {
        jenkins.setCrumbIssuer(null);
        GerritServer server1 = new GerritServer(PluginImpl.DEFAULT_SERVER_NAME);
        PluginImpl.getInstance().addServer(server1);
        Config config = (Config)server1.getConfig();
        config.setGerritFrontEndURL(this.getURL().toString() + "gerrit/");
        config.setUseRestApi(true);
        config.setGerritHttpUserName("user");
        config.setGerritHttpPassword("passwd");
        config.setRestCodeReview(true);
        config.setRestVerified(true);

        server1.start();

        PatchsetCreated event = Setup.createPatchsetCreated(server1.getName());

        FreeStyleProject project = createFreeStyleProject();
        GerritTrigger trigger = Setup.createDefaultTrigger(project);
        trigger.setGerritProjects(Collections.singletonList(
                new GerritProject(CompareType.PLAIN, event.getChange().getProject(),
View Full Code Here

     * @throws Exception if so.
     */
    @LocalData
    public void testGetGetUrlNameNotPermitted() throws Exception {
        //add a server so that the manual trigger action URL can be accessed by users with proper access rights.
        PluginImpl.getInstance().addServer(new GerritServer("testServer"));
        ManualTriggerAction action = getManualTriggerAction();
        WebClient wc = new WebClient();
        HtmlPage page = wc.goTo("/");
        try {
            HtmlAnchor a = page.getAnchorByHref(action.getUrlName());
View Full Code Here

     * @throws Exception if so.
     */
    @LocalData
    public void testGetUrlName() throws Exception {
        //add a server so that the manual trigger action URL can be accessed by users with proper access rights.
        PluginImpl.getInstance().addServer(new GerritServer("testServer"));
        ManualTriggerAction action = getManualTriggerAction();
        WebClient wc = new WebClient().login("admin", "admin");
        HtmlPage page = wc.goTo("/");
        try {
            HtmlAnchor a = page.getAnchorByHref(action.getUrlName());
View Full Code Here

     * @throws Exception if so.
     */
    @LocalData
    public void testGetUrlNamePrivileged() throws Exception {
        //add a server so that the manual trigger action URL can be accessed by users with proper access rights.
        PluginImpl.getInstance().addServer(new GerritServer("testServer"));
        ManualTriggerAction action = getManualTriggerAction();
        WebClient wc = new WebClient().login("bobby", "bobby");
        HtmlPage page = wc.goTo("/");
        try {
            HtmlAnchor a = page.getAnchorByHref(action.getUrlName());
View Full Code Here

     * @throws Exception if so.
     */
    @LocalData
    public void testDoGerritSearch() throws Exception {
        //add a server so that the manual trigger action URL can be accessed by users with proper access rights.
        PluginImpl.getInstance().addServer(new GerritServer("testServer"));
        ManualTriggerAction action = getManualTriggerAction();
        WebClient wc = new WebClient().login("bobby", "bobby");
        try {
            HtmlPage page = wc.goTo(action.getUrlName());
            HtmlForm form = page.getFormByName("theSearch");
View Full Code Here

     * @throws Exception if so.
     */
    @LocalData
    public void testDoGerritSearchNotPermitted() throws Exception {
        //add a server so that the manual trigger action URL can be accessed by users with proper access rights.
        PluginImpl.getInstance().addServer(new GerritServer("testServer"));
        ManualTriggerAction action = getManualTriggerAction();
        WebClient wc = new WebClient();
        try {
            HtmlPage page = wc.goTo(action.getUrlName());
            HtmlForm form = page.getFormByName("theSearch");
View Full Code Here

     *
     * @param serverName the name of the server.
     * @return the server-config.
     */
    public IGerritHudsonTriggerConfig getConfig(String serverName) {
        GerritServer server = PluginImpl.getInstance().getServer(serverName);
        if (server != null) {
            return server.getConfig();
        } else {
            logger.error("Could not find the Gerrit Server: {}", serverName);
        }
        return null;
    }
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.