Skip to content

Commit

Permalink
Merge pull request #8 from rsandell/optional-build-flow-dep
Browse files Browse the repository at this point in the history
[JENKINS-43497] Make Build Flow Plugin an optional dependency
  • Loading branch information
neuralsandwich committed Apr 21, 2017
2 parents 97514a8 + f3acf16 commit c19f957
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@
target
work
bin
.idea
11 changes: 9 additions & 2 deletions pom.xml
Expand Up @@ -89,16 +89,22 @@
</dependency>
<!-- add dependency for the json rpc -->
<dependency>
<groupId>com.googlecode</groupId>
<groupId>com.github.briandilley.jsonrpc4j</groupId>
<artifactId>jsonrpc4j</artifactId>
<version>0.18</version>
<version>1.5.0</version>
</dependency>
<!-- Apache license Jackson: -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down Expand Up @@ -139,6 +145,7 @@
<groupId>com.cloudbees.plugins</groupId>
<artifactId>build-flow-plugin</artifactId>
<version>0.9</version>
<optional>true</optional>
</dependency>
</dependencies>

Expand Down
Expand Up @@ -7,21 +7,20 @@
import com.sonyericsson.jenkins.plugins.externalresource.dispatcher.PluginImpl;

/**
* Exposes the External Resource Manager to the Build Flow plugin
* Exposes the External Resource Manager to the Build Flow plugin.
* See <a href="https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin">Build+Flow+Plugin</a>
*
* @author Patrik Johansson &lt;patrik.x.johansson@ericsson.com&gt;
*
*/
@Extension
@Extension(optional = true)
public class BuildFlowPluginExtension extends BuildFlowDSLExtension {

public Object createExtension(String extensionName, FlowDelegate dsl){
if(extensionName.equalsIgnoreCase("externalresource-dispatcher")){
return PluginImpl.getInstance().getManager();
}
else{
return null;
@Override
public Object createExtension(String extensionName, FlowDelegate dsl) {
if (extensionName.equalsIgnoreCase("externalresource-dispatcher")) {
return PluginImpl.getInstance().getManager();
} else {
return null;
}
}
}
}
Expand Up @@ -30,15 +30,16 @@
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;

import com.fasterxml.jackson.databind.JsonNode;
import com.googlecode.jsonrpc4j.JsonRpcHttpClient;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
* this is the util class for json rpc.
* you can create different rpc client for use.
* @author Leimeng Zhang
*
* @author Leimeng Zhang
*/
public final class JsonRpcUtil {

Expand All @@ -55,6 +56,7 @@ private JsonRpcUtil() {

/**
* create the Json RPC client using the specified url.
*
* @param url the url of the RPC call.
* @return the {@link JsonRpcHttpClient} to be used.
*/
Expand All @@ -72,7 +74,8 @@ public static JsonRpcHttpClient createJsonRpcClient(String url) {

/**
* create the Json RPC client using the specified url and a customized {@link ObjectMapper}.
* @param url the url of the RPC call.
*
* @param url the url of the RPC call.
* @param customizedObjectMapper the customized {@link ObjectMapper} to support rpc json format.
* @return the {@link JsonRpcHttpClient} to be used.
*/
Expand All @@ -87,6 +90,7 @@ public static JsonRpcHttpClient createJsonRpcClient(String url, ObjectMapper cus
}
return client;
}

/**
* create the customized object mapper, which is used to read/write json
* object. by doing so, the object[] will cast to be one jsonObject if
Expand Down
Expand Up @@ -46,7 +46,7 @@
import java.util.Map;

import net.sf.json.JSONObject;
import org.codehaus.jackson.map.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
Expand Down

0 comments on commit c19f957

Please sign in to comment.