This repository has been archived by the owner on Sep 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,094 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
language: java | ||
jdk: | ||
- oraclejdk8 | ||
- oraclejdk7 | ||
- openjdk7 | ||
after_success: | ||
- mvn clean -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID cobertura:cobertura coveralls:report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
gdk-core/src/main/java/com/github/libgraviton/gdk/api/NoopRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.github.libgraviton.gdk.api; | ||
|
||
import com.github.libgraviton.gdk.exception.CommunicationException; | ||
import com.github.libgraviton.gdk.exception.UnsuccessfulRequestException; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.net.MalformedURLException; | ||
|
||
public class NoopRequest extends Request { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(NoopRequest.class); | ||
|
||
protected String reason; | ||
|
||
protected NoopRequest(Builder builder) throws MalformedURLException { | ||
super(builder); | ||
this.reason = builder.reason; | ||
} | ||
|
||
public String getReason() { | ||
return reason; | ||
} | ||
|
||
public static class Builder extends Request.Builder { | ||
|
||
private String reason; | ||
|
||
public Builder(String reason) { | ||
this.reason = reason; | ||
} | ||
|
||
public NoopRequest build() throws MalformedURLException { | ||
return new NoopRequest(this); | ||
} | ||
|
||
public NoopResponse execute() throws CommunicationException { | ||
NoopRequest request; | ||
try { | ||
request = build(); | ||
} catch (MalformedURLException e) { | ||
throw new UnsuccessfulRequestException(String.format("'%s' to '%s' failed due to malformed url.", method, url), | ||
e); | ||
} | ||
LOG.info(request.getMethod() + " request to '" + request.getUrl() + "' not executed due to '" + request.getReason() + "'."); | ||
return new NoopResponse(request); | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
gdk-core/src/main/java/com/github/libgraviton/gdk/api/NoopResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.github.libgraviton.gdk.api; | ||
|
||
import com.github.libgraviton.gdk.api.header.HeaderBag; | ||
|
||
/** | ||
* Graviton response wrapper with additional functionality and simplified interface. | ||
* | ||
* @author List of contributors {@literal <https://github.com/libgraviton/gdk-java/graphs/contributors>} | ||
* @see <a href="http://swisscom.ch">http://swisscom.ch</a> | ||
* @version $Id: $Id | ||
*/ | ||
public class NoopResponse extends Response { | ||
|
||
public NoopResponse(NoopRequest request) { | ||
this.request = request; | ||
this.code = -1; | ||
this.isSuccessful = true; | ||
this.message = "This is not the response you are looking for"; | ||
this.body = null; | ||
this.headers = new HeaderBag.Builder().build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.