You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by dl...@apache.org on 2016/06/03 18:03:02 UTC
[10/11] incubator-quarks git commit: Implemented review comments
Implemented review comments
Project: http://git-wip-us.apache.org/repos/asf/incubator-quarks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quarks/commit/9212be33
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quarks/tree/9212be33
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quarks/diff/9212be33
Branch: refs/heads/master
Commit: 9212be33bb97a70e2ba6d16bd91c97d0a58685da
Parents: f96c8e0
Author: Saurabh Jinturkar <sa...@sjsu.edu>
Authored: Tue May 31 01:39:01 2016 -0700
Committer: Saurabh Jinturkar <sa...@sjsu.edu>
Committed: Tue May 31 01:39:01 2016 -0700
----------------------------------------------------------------------
.../java/quarks/connectors/http/HttpStreams.java | 9 ++++-----
.../quarks/test/connectors/http/HttpTest.java | 18 ++++++++----------
2 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/9212be33/connectors/http/src/main/java/quarks/connectors/http/HttpStreams.java
----------------------------------------------------------------------
diff --git a/connectors/http/src/main/java/quarks/connectors/http/HttpStreams.java b/connectors/http/src/main/java/quarks/connectors/http/HttpStreams.java
index 954b1b3..fff7f46 100644
--- a/connectors/http/src/main/java/quarks/connectors/http/HttpStreams.java
+++ b/connectors/http/src/main/java/quarks/connectors/http/HttpStreams.java
@@ -157,7 +157,7 @@ public class HttpStreams {
*
* TStream<JsonObject> stream = topology.collection(Arrays.asList(body));
* TStream<JsonObject> rc = HttpStreams.postJson(stream,
- * HttpClients::noAuthentication, t -> url, t -> body);
+ * HttpClients::noAuthentication, t -> url, t -> t);
* }
* </pre>
*
@@ -167,7 +167,7 @@ public class HttpStreams {
* @param stream - JsonObject TStream.
* @param clientCreator - CloseableHttpClient supplier preferably created using {@link HttpClients}
* @param uri - URI function which returns URI string
- * @param body - Function that returns HttpEntity which will be set as a body for the request.
+ * @param body - Function that returns JsonObject which will be set as a body for the request.
* @return TStream of JsonObject which contains responses of POST requests
*
* @see HttpStreams#requestsWithBody(TStream, Supplier, Function, Function, Function, BiFunction)
@@ -205,7 +205,7 @@ public class HttpStreams {
*
* TStream<JsonObject> stream = topology.collection(Arrays.asList(body));
* TStream<JsonObject> rc = HttpStreams.putJson(stream,
- * HttpClients::noAuthentication, t -> url, t -> body);
+ * HttpClients::noAuthentication, t -> url, t -> t);
* }
* </pre>
*
@@ -215,7 +215,7 @@ public class HttpStreams {
* @param stream - JsonObject TStream.
* @param clientCreator - CloseableHttpClient supplier preferably created using {@link HttpClients}
* @param uri - URI function which returns URI string
- * @param body - Function that returns HttpEntity which will be set as a body for the request.
+ * @param body - Function that returns JsonObject which will be set as a body for the request.
* @return TStream of JsonObject which contains responses of PUT requests
*
* @see HttpStreams#requestsWithBody(TStream, Supplier, Function, Function, Function, BiFunction)
@@ -224,7 +224,6 @@ public class HttpStreams {
Supplier<CloseableHttpClient> clientCreator,
Function<JsonObject, String> uri,
UnaryOperator<JsonObject> body) {
-
return HttpStreams.<JsonObject, JsonObject> requestsWithBody(stream,
clientCreator, t -> HttpPut.METHOD_NAME, uri,
t -> new ByteArrayEntity(body.apply(t).toString().getBytes()),
http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/9212be33/connectors/http/src/test/java/quarks/test/connectors/http/HttpTest.java
----------------------------------------------------------------------
diff --git a/connectors/http/src/test/java/quarks/test/connectors/http/HttpTest.java b/connectors/http/src/test/java/quarks/test/connectors/http/HttpTest.java
index 47214d5..d72773f 100644
--- a/connectors/http/src/test/java/quarks/test/connectors/http/HttpTest.java
+++ b/connectors/http/src/test/java/quarks/test/connectors/http/HttpTest.java
@@ -270,8 +270,8 @@ public class HttpTest {
final String url = "http://httpbin.org/delete?";
JsonObject request = new JsonObject();
- request.addProperty("a", "abc");
- request.addProperty("b", "42");
+ request.addProperty("a", getProp1());
+ request.addProperty("b", getProp2());
TStream<JsonObject> stream = topology.collection(Arrays.asList(request));
TStream<JsonObject> rc = HttpStreams.deleteJson(
@@ -314,14 +314,13 @@ public class HttpTest {
final String url = "http://httpbin.org/post";
JsonObject body = new JsonObject();
- body.addProperty("foo", "abc");
- body.addProperty("bar", 42);
+ body.addProperty("foo", getProp1());
+ body.addProperty("bar", getProp2());
TStream<JsonObject> stream = topology.collection(Arrays.asList(body));
TStream<JsonObject> rc = HttpStreams.postJson(
stream, HttpClients::noAuthentication, t -> url,
- t -> body);
-
+ t -> t);
TStream<Boolean> resStream = rc.map(j -> {
assertTrue(j.has("request"));
assertTrue(j.has("response"));
@@ -352,14 +351,13 @@ public class HttpTest {
final String url = "http://httpbin.org/put";
JsonObject body = new JsonObject();
- body.addProperty("foo", "abc");
- body.addProperty("bar", 42);
+ body.addProperty("foo", getProp1());
+ body.addProperty("bar", getProp2());
TStream<JsonObject> stream = topology.collection(Arrays.asList(body));
TStream<JsonObject> rc = HttpStreams.putJson(
stream, HttpClients::noAuthentication, t -> url,
- t -> body);
-
+ t -> t);
TStream<Boolean> resStream = rc.map(j -> {
assertTrue(j.has("request"));
assertTrue(j.has("response"));