Skip to content

Commit

Permalink
Merge with mainline code
Browse files Browse the repository at this point in the history
  • Loading branch information
mscata committed May 31, 2012
2 parents 370c1dd + c92c471 commit 9c25cf3
Show file tree
Hide file tree
Showing 39 changed files with 2,508 additions and 258 deletions.
16 changes: 9 additions & 7 deletions .hgignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
^target$
^work$
^bin
^.classpath
^.project
^.settings
^.checkstyle
^target$
^work$
^bin
^.classpath
^.project
^.settings
^.checkstyle
^.DS_Store
^.idea$
75 changes: 60 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<checkstyle.rules.file>checkstyle_rules.xml</checkstyle.rules.file>
<pmd.config.file>pmd_rules.xml</pmd.config.file>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<groovy.version>1.8.6</groovy.version>
</properties>
<developers>
<developer>
Expand All @@ -47,16 +48,59 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0-rc1</version>
<version>1.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>0.6-groovy-1.8</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
<!-- Optional dependencies for using Spock -->
<dependency> <!-- enables mocking of classes (in addition to interfaces) -->
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency> <!-- enables mocking of classes without default constructor (together with
CGLIB) -->
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency> <!-- only necessary if Hamcrest matchers are used -->
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>dashboard-view</artifactId>
<version>2.2</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version><!--$NO-MVN-MAN-VER$-->
<version>2.4</version><!--$NO-MVN-MAN-VER$ -->
<configuration>
<source>1.6</source>
<target>1.6</target>
Expand All @@ -65,15 +109,15 @@
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version><!--$NO-MVN-MAN-VER$-->
<version>1.4</version><!--$NO-MVN-MAN-VER$ -->
<configuration>
<providerSelection>1.7</providerSelection>
<providerSelection>1.8</providerSelection>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.7</artifactId>
<version>1.2</version>
<artifactId>gmaven-runtime-1.8</artifactId>
<version>1.4</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
Expand All @@ -84,7 +128,7 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.7.0</version>
<version>${groovy.version}</version>
</dependency>
</dependencies>
<executions>
Expand All @@ -101,7 +145,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.6</version><!--$NO-MVN-MAN-VER$-->
<version>2.6</version><!--$NO-MVN-MAN-VER$ -->
<configuration>
<configLocation>${checkstyle.rules.file}</configLocation>
<failsOnError>true</failsOnError>
Expand All @@ -120,7 +164,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version><!--$NO-MVN-MAN-VER$-->
<version>2.5</version><!--$NO-MVN-MAN-VER$ -->
<configuration>
<rulesets>
<ruleset>${pmd.config.file}</ruleset>
Expand All @@ -137,7 +181,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.2</version><!--$NO-MVN-MAN-VER$-->
<version>2.3.2</version><!--$NO-MVN-MAN-VER$ -->
<configuration>
<effort>Max</effort>
<threshold>Medium</threshold>
Expand All @@ -154,7 +198,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version><!--$NO-MVN-MAN-VER$-->
<version>2.1</version><!--$NO-MVN-MAN-VER$ -->
<configuration>
<mavenExecutorId>forked-path</mavenExecutorId>
<goals>deploy</goals>
Expand All @@ -163,12 +207,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0</version><!--$NO-MVN-MAN-VER$-->
<version>1.0</version><!--$NO-MVN-MAN-VER$ -->
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
Expand All @@ -189,7 +234,7 @@
</goals>
</pluginExecutionFilter>
<action>
<execute/>
<execute />
</action>
</pluginExecution>
<pluginExecution>
Expand All @@ -203,7 +248,7 @@
</goals>
</pluginExecutionFilter>
<action>
<execute/>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@
import au.com.centrumsystems.hudson.plugin.util.ProjectUtil;

/**
* This view displays the set of jobs that are related based on their upstream\downstream relationships as a pipeline.
* Each build pipeline becomes a row on the view.
* This view displays the set of jobs that are related based on their
* upstream\downstream relationships as a pipeline. Each build pipeline becomes
* a row on the view.
*
* @author Centrum Systems
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
////////////////////////////////////////////////////////////////////////////////
//
// ADOBE SYSTEMS INCORPORATED
// Copyright 2012 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package au.com.centrumsystems.hudson.plugin.buildpipeline.dashboard;

import au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView;
import au.com.centrumsystems.hudson.plugin.buildpipeline.Strings;
import hudson.Extension;
import hudson.model.Descriptor;
import hudson.model.Hudson;
import hudson.plugins.view.dashboard.DashboardPortlet;
import java.util.ArrayList;
import java.util.List;
import org.kohsuke.stapler.DataBoundConstructor;

/**
* This class provides the entry point to use this plugin in the
* dashboard-plugin
*
* @author Ingo Richter ([email protected])
* @since 03/30/2012
*/
public class BuildPipelineDashboard extends DashboardPortlet {
/**
* selectedJob.
*/
private String selectedJob;

/**
* noOfDisplayedBuilds.
*/
private String noOfDisplayedBuilds;

/**
* a brief description of this portlet.
*/
private String description;

/**
* Constructor
* @param name the name of this view
* @param description a brief description of this view
* @param selectedJob the job to start the build-pipeline with
* @param noOfDisplayedBuilds how many builds will be displayed for this
* job
*/
@DataBoundConstructor
public BuildPipelineDashboard(String name, String description, String selectedJob, String noOfDisplayedBuilds) {
super(name);
this.description = description;
this.selectedJob = selectedJob;
this.noOfDisplayedBuilds = noOfDisplayedBuilds;
}

public String getNoOfDisplayedBuilds() {
return noOfDisplayedBuilds;
}

public void setNoOfDisplayedBuilds(final String noOfDisplayedBuilds) {
this.noOfDisplayedBuilds = noOfDisplayedBuilds;
}

public String getSelectedJob() {
return selectedJob;
}

public void setSelectedJob(final String selectedJob) {
this.selectedJob = selectedJob;
}

public String getDescription() {
return description;
}

public void setDescription(final String description) {
this.description = description;
}

public BuildPipelineView getBuildPipelineView() {
return new ReadOnlyBuildPipelineView(getDisplayName(), getDescription(), getSelectedJob(), getNoOfDisplayedBuilds(), false);
}

/**
* Extension point registration.
*/
// TODO: create a class and use this code also in BuildPipelineView
@Extension(optional = true)
public static class BuildPipelineDashboardDescriptor extends Descriptor<DashboardPortlet> {

@Override
public String getDisplayName() {
return Strings.getString("Portlet.BuildPipelineDashboardDescriptor");
}

/**
* Display Job List Item in the Edit View Page
*
* @return ListBoxModel
*/
public hudson.util.ListBoxModel doFillSelectedJobItems() {
final hudson.util.ListBoxModel options = new hudson.util.ListBoxModel();
for (final String jobName : Hudson.getInstance().getJobNames()) {
options.add(jobName);
}
return options;
}

/**
* Display No Of Builds Items in the Edit View Page
*
* @return ListBoxModel
*/
public hudson.util.ListBoxModel doFillNoOfDisplayedBuildsItems() {
final hudson.util.ListBoxModel options = new hudson.util.ListBoxModel();
final List<String> noOfBuilds = new ArrayList<String>();
noOfBuilds.add("1");
noOfBuilds.add("2");
noOfBuilds.add("3");
noOfBuilds.add("5");
noOfBuilds.add("10");
noOfBuilds.add("20");
noOfBuilds.add("50");
noOfBuilds.add("100");
noOfBuilds.add("200");
noOfBuilds.add("500");

for (final String noOfBuild : noOfBuilds) {
options.add(noOfBuild);
}
return options;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
////////////////////////////////////////////////////////////////////////////////
//
// ADOBE SYSTEMS INCORPORATED
// Copyright 2012 Adobe Systems Incorporated
// All Rights Reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
package au.com.centrumsystems.hudson.plugin.buildpipeline.dashboard;

import au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView;
import hudson.model.AbstractProject;
import hudson.security.Permission;

/**
* This class provides a read-only view for the existing build-pipeline view.
* All calls checking permissions return false. The other reason for this class
* is that it's used in a different context and not as a child of the view tab.
*
* @author Ingo Richter ([email protected])
* @since 04/01/2012
*/
public class ReadOnlyBuildPipelineView extends BuildPipelineView {
public ReadOnlyBuildPipelineView(String displayName, String description, String selectedJob, String noOfDisplayedBuilds, boolean triggerOnlyLatestJob) {
super(displayName, displayName, selectedJob, noOfDisplayedBuilds, triggerOnlyLatestJob);
// this is ugly, but there is no other way to set the description of
// the view
super.description = description;
}

@Override
public boolean hasBuildPermission(AbstractProject<?, ?> currentProject) {
// we are not a 'real view' in this case and we don't care in R/O mode
return false;
}

@Override
public boolean hasPermission(Permission p) {
return false;
}

@Override
public AbstractProject<?, ?> getSelectedProject() {
AbstractProject<?, ?> selectedProject = null;
if (getSelectedJob() != null) {
selectedProject = (AbstractProject<?, ?>) jenkins.model.Jenkins.getInstance().getItem(getSelectedJob());
}

return selectedProject;
}
}
Loading

0 comments on commit 9c25cf3

Please sign in to comment.