You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ka...@apache.org on 2014/07/11 19:13:16 UTC
[2/7] git commit: [HELIX-430] Fix test failures caused by restlet 2.2
[HELIX-430] Fix test failures caused by restlet 2.2
Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/e914edb6
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/e914edb6
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/e914edb6
Branch: refs/heads/master
Commit: e914edb6b1796b82234a2555048654f3ae573369
Parents: 208f1fa
Author: Kanak Biscuitwala <ka...@apache.org>
Authored: Tue May 20 16:26:09 2014 -0700
Committer: Kanak Biscuitwala <ka...@apache.org>
Committed: Thu Jul 10 10:51:32 2014 -0700
----------------------------------------------------------------------
...x-admin-webapp-0.7.1-incubating-SNAPSHOT.ivy | 4 +-
.../webapp/TestHelixAdminScenariosRest.java | 72 ++++++++++++--------
.../helix-core-0.7.1-incubating-SNAPSHOT.ivy | 6 +-
helix-core/pom.xml | 4 +-
pom.xml | 2 +-
5 files changed, 48 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/helix/blob/e914edb6/helix-admin-webapp/helix-admin-webapp-0.7.1-incubating-SNAPSHOT.ivy
----------------------------------------------------------------------
diff --git a/helix-admin-webapp/helix-admin-webapp-0.7.1-incubating-SNAPSHOT.ivy b/helix-admin-webapp/helix-admin-webapp-0.7.1-incubating-SNAPSHOT.ivy
index 0478f34..35c6158 100644
--- a/helix-admin-webapp/helix-admin-webapp-0.7.1-incubating-SNAPSHOT.ivy
+++ b/helix-admin-webapp/helix-admin-webapp-0.7.1-incubating-SNAPSHOT.ivy
@@ -38,8 +38,8 @@ under the License.
</publications>
<dependencies>
<dependency org="org.apache.helix" name="helix-core" rev="0.7.1-incubating-SNAPSHOT" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
- <dependency org="org.restlet" name="org.restlet" rev="1.1.10" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
- <dependency org="com.noelios.restlet" name="com.noelios.restlet" rev="1.1.10" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
+ <dependency org="org.apache.helix" name="helix-core" rev="0.6.4-SNAPSHOT" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
+ <dependency org="org.restlet.jse" name="org.restlet" rev="2.2.1" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="org.codehaus.jackson" name="jackson-core-asl" rev="1.8.5" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.8.5" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="commons-cli" name="commons-cli" rev="1.2" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
http://git-wip-us.apache.org/repos/asf/helix/blob/e914edb6/helix-admin-webapp/src/test/java/org/apache/helix/webapp/TestHelixAdminScenariosRest.java
----------------------------------------------------------------------
diff --git a/helix-admin-webapp/src/test/java/org/apache/helix/webapp/TestHelixAdminScenariosRest.java b/helix-admin-webapp/src/test/java/org/apache/helix/webapp/TestHelixAdminScenariosRest.java
index 7f44174..8082f04 100644
--- a/helix-admin-webapp/src/test/java/org/apache/helix/webapp/TestHelixAdminScenariosRest.java
+++ b/helix-admin-webapp/src/test/java/org/apache/helix/webapp/TestHelixAdminScenariosRest.java
@@ -44,7 +44,6 @@ import org.apache.helix.tools.ClusterSetup;
import org.apache.helix.tools.ClusterStateVerifier;
import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
import org.apache.helix.tools.ClusterStateVerifier.MasterNbInExtViewVerifier;
-import org.apache.helix.webapp.RestAdminApplication;
import org.apache.helix.webapp.resources.ClusterRepresentationUtil;
import org.apache.helix.webapp.resources.InstancesResource.ListInstancesWrapper;
import org.apache.helix.webapp.resources.JsonParameters;
@@ -68,6 +67,8 @@ import org.testng.annotations.Test;
* Simulate all the admin tasks needed by using command line tool
*/
public class TestHelixAdminScenariosRest extends AdminTestBase {
+ private static final int MAX_RETRIES = 5;
+
RestAdminApplication _adminApp;
Component _component;
String _tag1 = "tag1123";
@@ -94,42 +95,53 @@ public class TestHelixAdminScenariosRest extends AdminTestBase {
static String assertSuccessPostOperation(String url, Map<String, String> jsonParameters,
boolean hasException) throws IOException {
- Reference resourceRef = new Reference(url);
-
- Request request = new Request(Method.POST, resourceRef);
- request.setEntity(
- JsonParameters.JSON_PARAMETERS + "="
- + ClusterRepresentationUtil.ObjectToJson(jsonParameters), MediaType.APPLICATION_ALL);
- Response response = _gClient.handle(request);
- Representation result = response.getEntity();
- StringWriter sw = new StringWriter();
- result.write(sw);
-
- Assert.assertTrue(response.getStatus().getCode() == Status.SUCCESS_OK.getCode());
- Assert.assertTrue(hasException == sw.toString().toLowerCase().contains("exception"));
- return sw.toString();
+ return assertSuccessPostOperation(url, jsonParameters, null, hasException);
}
static String assertSuccessPostOperation(String url, Map<String, String> jsonParameters,
Map<String, String> extraForm, boolean hasException) throws IOException {
Reference resourceRef = new Reference(url);
- Request request = new Request(Method.POST, resourceRef);
- String entity =
- JsonParameters.JSON_PARAMETERS + "="
- + ClusterRepresentationUtil.ObjectToJson(jsonParameters);
- for (String key : extraForm.keySet()) {
- entity = entity + "&" + (key + "=" + extraForm.get(key));
- }
- request.setEntity(entity, MediaType.APPLICATION_ALL);
- Response response = _gClient.handle(request);
- Representation result = response.getEntity();
- StringWriter sw = new StringWriter();
- result.write(sw);
+ int numRetries = 0;
+ while (numRetries <= MAX_RETRIES) {
+ Request request = new Request(Method.POST, resourceRef);
+
+ if (extraForm != null) {
+ String entity =
+ JsonParameters.JSON_PARAMETERS + "="
+ + ClusterRepresentationUtil.ObjectToJson(jsonParameters);
+ for (String key : extraForm.keySet()) {
+ entity = entity + "&" + (key + "=" + extraForm.get(key));
+ }
+ request.setEntity(entity, MediaType.APPLICATION_ALL);
+ } else {
+ request
+ .setEntity(
+ JsonParameters.JSON_PARAMETERS + "="
+ + ClusterRepresentationUtil.ObjectToJson(jsonParameters),
+ MediaType.APPLICATION_ALL);
+ }
- Assert.assertTrue(response.getStatus().getCode() == Status.SUCCESS_OK.getCode());
- Assert.assertTrue(hasException == sw.toString().toLowerCase().contains("exception"));
- return sw.toString();
+ Response response = _gClient.handle(request);
+ Representation result = response.getEntity();
+ StringWriter sw = new StringWriter();
+
+ if (result != null) {
+ result.write(sw);
+ }
+
+ int code = response.getStatus().getCode();
+ boolean successCode =
+ code == Status.SUCCESS_NO_CONTENT.getCode() || code == Status.SUCCESS_OK.getCode();
+ if (successCode || numRetries == MAX_RETRIES) {
+ Assert.assertTrue(successCode);
+ Assert.assertTrue(hasException == sw.toString().toLowerCase().contains("exception"));
+ return sw.toString();
+ }
+ numRetries++;
+ }
+ Assert.fail("Request failed after all retries");
+ return null;
}
void deleteUrl(String url, boolean hasException) throws IOException {
http://git-wip-us.apache.org/repos/asf/helix/blob/e914edb6/helix-core/helix-core-0.7.1-incubating-SNAPSHOT.ivy
----------------------------------------------------------------------
diff --git a/helix-core/helix-core-0.7.1-incubating-SNAPSHOT.ivy b/helix-core/helix-core-0.7.1-incubating-SNAPSHOT.ivy
index 137fc06..eb37bed 100644
--- a/helix-core/helix-core-0.7.1-incubating-SNAPSHOT.ivy
+++ b/helix-core/helix-core-0.7.1-incubating-SNAPSHOT.ivy
@@ -54,11 +54,7 @@ under the License.
<dependency org="commons-cli" name="commons-cli" rev="1.2" conf="compile->compile(default);runtime->runtime(default);default->default"/>
<dependency org="commons-math" name="commons-math" rev="2.1" conf="compile->compile(default);runtime->runtime(default);default->default"/>
<dependency org="com.github.sgroschupf" name="zkclient" rev="0.1" conf="compile->compile(default);runtime->runtime(default);default->default"/>
- <dependency org="org.apache.camel" name="camel-josql" rev="2.5.0" conf="compile->compile(default);runtime->runtime(default);default->default"/>
- <dependency org="org.apache.camel" name="camel-core" rev="2.5.0" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
- <dependency org="net.sf.josql" name="gentlyweb-utils" rev="1.5" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
- <dependency org="net.sf.josql" name="josql" rev="1.5" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
- <dependency org="org.fusesource.commonman" name="commons-management" rev="1.0" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
+ <dependency org="org.restlet.jse" name="org.restlet" rev="2.2.1" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="commons-logging" name="commons-logging-api" rev="1.1" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="org.restlet" name="org.restlet" rev="1.1.10" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
<dependency org="com.noelios.restlet" name="com.noelios.restlet" rev="1.1.10" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
http://git-wip-us.apache.org/repos/asf/helix/blob/e914edb6/helix-core/pom.xml
----------------------------------------------------------------------
diff --git a/helix-core/pom.xml b/helix-core/pom.xml
index a8414f4..b8e7a9a 100644
--- a/helix-core/pom.xml
+++ b/helix-core/pom.xml
@@ -45,7 +45,7 @@ under the License.
org.apache.zookeeper.txn*;resolution:=optional,
org.apache.zookeeper*;version="[3.3,4)",
org.codehaus.jackson*;version="[1.8,2)",
- org.restlet;version="[2.2.0,3]",
+ org.restlet;version="[2.2.1,3]",
*
</osgi.import>
<osgi.ignore>
@@ -133,7 +133,7 @@ under the License.
<dependency>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet</artifactId>
- <version>2.2.0</version>
+ <version>2.2.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
http://git-wip-us.apache.org/repos/asf/helix/blob/e914edb6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index acb8589..8b45e0a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -335,7 +335,7 @@ under the License.
<dependency>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet</artifactId>
- <version>2.2.0</version>
+ <version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.helix</groupId>