Skip to content
Permalink
Browse files

Add MaxCC parameter [JENKINS-29214].

  • Loading branch information
candiduslynx committed Jul 17, 2015
1 parent c97fa5c commit 712a2ecce524ae7339dd613b9889fa0f2fa230ff
@@ -55,6 +55,11 @@
*/
private String job;

/**
* MaxCC to decide that job ended OK.
*/
private String MaxCC;

/**
* Constructor. Invoked when 'Apply' or 'Save' button is pressed on the project configuration page.
*
@@ -68,7 +73,16 @@
* @param job JCL of the job to be submitted.
*/
@DataBoundConstructor
public zOSJobSubmitter (String server, int port, String userID, String password, boolean wait, int waitTime, boolean deleteJobFromSpool, String job)
public zOSJobSubmitter (
String server,
int port,
String userID,
String password,
boolean wait,
int waitTime,
boolean deleteJobFromSpool,
String job,
String MaxCC)
{
// Copy values
this.server = server.replaceAll("\\s","");
@@ -79,6 +93,14 @@ public zOSJobSubmitter (String server, int port, String userID, String password,
this.waitTime = waitTime;
this.deleteJobFromSpool = deleteJobFromSpool;
this.job = job;
if (MaxCC == null || MaxCC.isEmpty()) {
this.MaxCC = "0000";
} else {
this.MaxCC = MaxCC;
if (this.MaxCC.length() < 4) {
this.MaxCC = "000".substring(0,4-this.MaxCC.length()) + this.MaxCC;
}
}
}

/**
@@ -114,9 +136,11 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis
if(printableCC != null)
printableCC = printableCC.replaceAll("\\s+","");

// Print the info about the job
listener.getLogger().println("Job [" + zFTPConnector.getJobID() + "] processing finished.");

// If wait was requested try to save the job log.
if(this.wait)
{
if(this.wait) {
// Save the log.
try
{
@@ -139,14 +163,12 @@ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener lis
{
i.printStackTrace();
}
}
else
{
} else {
printableCC = "0000"; //set RC = 0
}

// Return whether the job succeeded or not.
return result && "0000".equals(printableCC);
return result && (this.MaxCC.compareTo(printableCC) >= 0);
}

/**
@@ -219,13 +241,20 @@ public int getWaitTime()
/**
* Get Job.
*
* @return <b><code>job</code></b>
* @return <b><code>Job</code></b>
*/
public String getJob()
{
return this.job;
}

/**
* @return <b><code>MaxCC of the job to be considered OK</code></b>
*/
public String getMaxCC() {
return this.MaxCC;
}

/**
* Get descriptor for this class.
*
@@ -333,14 +362,21 @@ public FormValidation doCheckInput(@QueryParameter String value)
* @throws ServletException
*/
public FormValidation doCheckWaitTime(@QueryParameter String value)
throws IOException, ServletException {
throws IOException, ServletException {
if (!value.matches("\\d*"))
return FormValidation.error("Value must be numeric");
if(Integer.parseInt(value) < 0)
return FormValidation.error("Value must not be negative");
return FormValidation.ok();
}

public FormValidation doCheckMaxCC(@QueryParameter String value)
throws IOException, ServletException {
if (!value.matches("(\\d{1,4})|(\\s*)"))
return FormValidation.error("Value must be 4 decimal digits or empty");
return FormValidation.ok();

}
/**
* If this build step can be used with the project.
*
@@ -24,6 +24,9 @@
<f:entry field="deleteJobFromSpool" title="Delete job log from Spool?">
<f:checkbox default="false" value="${it.getDeleteJobFromSpool()}"/>
</f:entry>
<f:entry field="MaxCC" title="MaxCC" description='Default or empty = "0000"'>
<f:textbox value="${it.getMaxCC()}" default=""/>
</f:entry>
</f:optionalBlock>
</table>
</f:block>

0 comments on commit 712a2ec

Please sign in to comment.
You can’t perform that action at this time.