Skip to content

Commit

Permalink
Merge upstream develop branch
Browse files Browse the repository at this point in the history
  • Loading branch information
cabhishek committed Jul 14, 2016
2 parents d85a0f1 + b4e5801 commit c5bd537
Show file tree
Hide file tree
Showing 125 changed files with 7,729 additions and 1,552 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ addons:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
- python-dev
- python-pip
language: java
jdk:
- oraclejdk8
Expand Down
12 changes: 1 addition & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {

dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE")
classpath("io.spring.gradle:dependency-management-plugin:0.5.6.RELEASE")
classpath("io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE")
classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.3")
classpath("gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.4.11")
}
Expand All @@ -23,16 +23,6 @@ plugins {

ext.githubProjectName = rootProject.name

release {
tagStrategy {
prefixNameWithV = false
}
}

nebulaRelease {
addReleaseBranchPattern(/(release(-|\/))?\d+(\.\d+)?\.(x|\d+)/)
}

allprojects {
apply plugin: 'jacoco'
apply plugin: 'idea'
Expand Down
18 changes: 18 additions & 0 deletions genie-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@ clean {
delete "src/main/python/dist"
}

task installPythonDependencies(type: Exec) {
dependsOn clean
workingDir "src/main/python"
commandLine "sudo", "pip", "install", "-U", "pip", "setuptools", "twine"
}

task installPythonPackage(type: Exec) {
dependsOn installPythonDependencies
workingDir "src/main/python"
commandLine "sudo", "pip", "install", "-U", "-e", "."
}

task testPythonPackage(type: Exec) {
dependsOn installPythonPackage
workingDir "src/main/python"
commandLine "sh", "-c", "nosetests"
}

task buildPythonPackage(type: Exec) {
dependsOn clean
workingDir "src/main/python"
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.netflix.genie.client.config.GenieNetworkConfiguration;
import com.netflix.genie.client.interceptor.ResponseMappingInterceptor;
import com.netflix.genie.client.security.SecurityInterceptor;
import com.netflix.genie.client.exceptions.GenieClientException;
Expand All @@ -27,6 +28,8 @@
import retrofit2.Retrofit;
import retrofit2.converter.jackson.JacksonConverterFactory;

import java.util.concurrent.TimeUnit;

/**
* Base class for the clients for Genie Services.
*
Expand All @@ -45,18 +48,25 @@ public abstract class BaseGenieClient {
*
* @param url The url of the Genie Service.
* @param securityInterceptor An implementation of the Security Interceptor.
* @param genieNetworkConfiguration A configuration object that provides network settings for HTTP calls.
* @throws GenieClientException If there is any problem creating the constructor.
*/
public BaseGenieClient(
final String url,
final SecurityInterceptor securityInterceptor
) throws GenieClientException {
final SecurityInterceptor securityInterceptor,
final GenieNetworkConfiguration genieNetworkConfiguration) throws GenieClientException {

if (StringUtils.isBlank(url)) {
throw new GenieClientException("Service URL cannot be empty or null");
}

final OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.retryOnConnectionFailure(false);

if (genieNetworkConfiguration != null) {
this.addConfigParamsFromConfig(builder, genieNetworkConfiguration);
}

mapper = new ObjectMapper().
configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

Expand All @@ -77,6 +87,24 @@ public BaseGenieClient(
.build();
}

// Private helper method to add network configurations to oktthp builder
private void addConfigParamsFromConfig(
final OkHttpClient.Builder builder,
final GenieNetworkConfiguration genieNetworkConfiguration) {

if (genieNetworkConfiguration.getConnectTimeout() != GenieNetworkConfiguration.DEFAULT_TIMEOUT) {
builder.connectTimeout(genieNetworkConfiguration.getConnectTimeout(), TimeUnit.MILLISECONDS);
}

if (genieNetworkConfiguration.getReadTimeout() != GenieNetworkConfiguration.DEFAULT_TIMEOUT) {
builder.readTimeout(genieNetworkConfiguration.getReadTimeout(), TimeUnit.MILLISECONDS);
}

if (genieNetworkConfiguration.getWriteTimeout() != GenieNetworkConfiguration.DEFAULT_TIMEOUT) {
builder.writeTimeout(genieNetworkConfiguration.getWriteTimeout(), TimeUnit.MILLISECONDS);
}
}

/**
* Helper method to parse the id out of the location string in the Header.
*
Expand Down
Loading

0 comments on commit c5bd537

Please sign in to comment.