Navigation Menu

Skip to content

Commit

Permalink
Changed name of the hyperlink, fixed global config error for JENKINS-…
Browse files Browse the repository at this point in the history
…26484
  • Loading branch information
MadsNielsen committed Feb 4, 2015
1 parent 2ff769e commit f5c510f
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -430,14 +430,14 @@
<dependency>
<groupId>net.praqma</groupId>
<artifactId>cool</artifactId>
<version>0.6.37</version>
<version>0.6.38-SNAPSHOT</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>net.praqma</groupId>
<artifactId>cool</artifactId>
<version>0.6.37</version>
<version>0.6.38-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
Expand Down
Expand Up @@ -33,7 +33,7 @@ public GetRelatedStreams( TaskListener listener, Stream stream, boolean pollingC
this.listener = listener;
this.multisitePolling = multisitePolling;
this.polling = null;
this.hyperLinkName = "FeedFrom";
this.hyperLinkName = "AlternateDeliverTarget";
}

public GetRelatedStreams( TaskListener listener, Stream stream, Polling polling, boolean multisitePolling, String hyperLinkName ) {
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/net/praqma/hudson/scm/CCUCMScm.java
Expand Up @@ -50,6 +50,7 @@
import net.praqma.util.execute.AbnormalProcessTerminationException;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;

import org.apache.commons.lang.exception.ExceptionUtils;
import org.kohsuke.stapler.DataBoundConstructor;
Expand All @@ -64,7 +65,7 @@
*/
public class CCUCMScm extends SCM {

public static final String HLINK_DEFAULT = "FeedFrom";
public static final String HLINK_DEFAULT = "AlternateDeliverTarget";
private static final Logger logger = Logger.getLogger(CCUCMScm.class.getName());

private Boolean multisitePolling;
Expand Down Expand Up @@ -1068,7 +1069,7 @@ public void setMode(PollingMode mode) {
@Extension
public static class CCUCMScmDescriptor extends SCMDescriptor<CCUCMScm> implements hudson.model.ModelObject {

private String hLinkFeedFrom = CCUCMScm.HLINK_DEFAULT;
private String hLinkFeedFrom;
private boolean slavePolling;
private boolean multisitePolling;
private List<String> loadModules;
Expand All @@ -1082,18 +1083,30 @@ public CCUCMScmDescriptor() {
/**
* This method is called, when the user saves the global Hudson
* configuration.
* @param req
* @param json
* @return
* @throws hudson.model.Descriptor.FormException
*/
@Override
public boolean configure(org.kohsuke.stapler.StaplerRequest req, JSONObject json) throws Descriptor.FormException {
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
try {
String s = json.getString("slavePolling");
if (s != null) {
slavePolling = Boolean.parseBoolean(s);
slavePolling = Boolean.parseBoolean(s);
}
s = json.getString("multisitePolling");
if (s != null) {
multisitePolling = Boolean.parseBoolean(s);
}
String hlink = json.getString("hLinkFeedFrom");
if(!StringUtils.isBlank(hlink)) {
hLinkFeedFrom = hlink;
} else {
hLinkFeedFrom = HLINK_DEFAULT;
}


} catch (Exception e) {
e.getMessage();
}
Expand Down
Expand Up @@ -21,14 +21,10 @@ public class PollSiblingMode extends PollingMode implements BaselineCreationEnab
private boolean useHyperLinkForPolling = false;
private boolean createBaseline = false;


@DataBoundConstructor
public PollSiblingMode(String levelToPoll) {
super(levelToPoll);
if(useHyperLinkForPolling) {
polling = new Polling(Polling.PollingType.siblingshlink);
} else {
polling = new Polling(Polling.PollingType.siblings);
}
}

/**
Expand All @@ -44,6 +40,11 @@ public boolean isUseHyperLinkForPolling() {
@DataBoundSetter
public void setUseHyperLinkForPolling(boolean useHyperLinkForPolling) {
this.useHyperLinkForPolling = useHyperLinkForPolling;
if(this.useHyperLinkForPolling) {
polling = new Polling(Polling.PollingType.siblingshlink);
} else {
polling = new Polling(Polling.PollingType.siblings);
}
}

/**
Expand Down
Expand Up @@ -8,7 +8,7 @@
<f:checkbox name="CCUCM.multisitePolling" checked="${descriptor.multisitePolling}" />
</f:entry>
<f:entry title="Deliver target HyperLink specification" field="hLinkFeedFrom">
<f:textbox default="FeedFrom"/>
<f:textbox default="AlternateDeliverTarget"/>
</f:entry>
</f:section>
</j:jelly>
@@ -1,7 +1,7 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<st:include page="config.jelly" class="net.praqma.hudson.scm.pollingmode.PollingMode"></st:include>
<f:entry field="useHyperLinkForPolling" title="Use hyperlink to specify deliver target">
<f:entry field="useHyperLinkForPolling" title="Use hyperlink to specify alternate deliver target">
<f:checkbox/>
</f:entry>
<f:entry field="createBaseline" title="Create baseline">
Expand Down
@@ -1,3 +1,3 @@
<div>
Instead of using the integration streams default deliver target. Use the value specified in the hyperlink. Specified in the global configuration.
Instead of using the integration streams default deliver target. Use the value specified in the hyperlink. The hyperlink type to be used can be configured in the global configuration.
</div>
Expand Up @@ -63,7 +63,8 @@ public void testRecommended() throws Exception {
Baseline baseline = getNewBaseline();

AbstractBuild<?, ?> build = initiateBuild("recommended-" + ccenv.getUniqueName(), true, false, false, false);


//Question: Why do we not validate that the BUILT baseline in promoted??
SystemValidator validator = new SystemValidator(build)
.validateBuild(Result.SUCCESS)
.validateBuildView()
Expand Down

0 comments on commit f5c510f

Please sign in to comment.