Tabnine Logo
Response.getStatus
Code IndexAdd Tabnine to your IDE (free)

How to use
getStatus
method
in
org.restlet.Response

Best Java code snippets using org.restlet.Response.getStatus (Showing top 20 results out of 315)

origin: uber/chaperone

@Test
public void testPost() {
 // Create topic
 Request request = ControllerRequestURLBuilder.baseUrl(REQUEST_URL)
   .getTopicCreationRequestUrl("testTopic1", 16);
 Response response = HTTP_CLIENT.handle(request);
 Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
 Assert.assertEquals(response.getEntityAsText(),
   "Successfully add new topic: {topic: testTopic1, partition: 16}");
 Assert.assertTrue(ZK_CLIENT.exists("/" + HELIX_CLUSTER_NAME + "/CONFIGS/RESOURCE/testTopic1"));
 // Create existed topic
 request = ControllerRequestURLBuilder.baseUrl(REQUEST_URL)
   .getTopicCreationRequestUrl("testTopic1", 16);
 response = HTTP_CLIENT.handle(request);
 Assert.assertEquals(response.getStatus(), Status.CLIENT_ERROR_NOT_FOUND);
 Assert.assertEquals(response.getEntityAsText(),
   "Failed to add new topic: testTopic1, it is already existed!");
 // Delete topic
 request =
   ControllerRequestURLBuilder.baseUrl(REQUEST_URL).getTopicDeleteRequestUrl("testTopic1");
 response = HTTP_CLIENT.handle(request);
 Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
 Assert.assertEquals(response.getEntityAsText(),
   "Successfully finished delete topic: testTopic1");
}
origin: uber/chaperone

  .getTopicCreationRequestUrl("testTopic3", 8);
Response response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
Assert.assertEquals(response.getEntityAsText(),
  "Successfully add new topic: {topic: testTopic3, partition: 8}");
  .getTopicExternalViewRequestUrl("testTopic3");
response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
Assert.assertEquals(response.getEntityAsText(),
  "Successfully finished delete topic: testTopic3");
  ControllerRequestURLBuilder.baseUrl(REQUEST_URL).getTopicDeleteRequestUrl("testTopic4");
response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.CLIENT_ERROR_NOT_FOUND);
Assert.assertEquals(response.getEntityAsText(),
  "Failed to delete not existed topic: testTopic4");
  .getTopicExternalViewRequestUrl("testTopic3");
response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.CLIENT_ERROR_NOT_FOUND);
origin: uber/chaperone

  .getTopicCreationRequestUrl("testTopic2", 8);
Response response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
Assert.assertEquals(response.getEntityAsText(),
  "Successfully add new topic: {topic: testTopic2, partition: 8}");
  .getTopicExpansionRequestUrl("testTopic2", 16);
response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
Assert.assertEquals(response.getEntityAsText(),
  "Successfully expand topic: {topic: testTopic2, partition: 16}");
  .getTopicExpansionRequestUrl("testTopic22", 16);
response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.CLIENT_ERROR_NOT_FOUND);
Assert.assertEquals(response.getEntityAsText(),
  "Failed to expand topic, topic: testTopic22 is not existed!");
  ControllerRequestURLBuilder.baseUrl(REQUEST_URL).getTopicDeleteRequestUrl("testTopic2");
response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
Assert.assertEquals(response.getEntityAsText(),
  "Successfully finished delete topic: testTopic2");
origin: uber/chaperone

  .getTopicExternalViewRequestUrl("");
Response response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
Assert.assertEquals(response.getEntityAsText(), "No topic is added in MirrorMaker Controller!");
System.out.println(response.getEntityAsText());
  .getTopicCreationRequestUrl("testTopic0", 8);
response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
Assert.assertEquals(response.getEntityAsText(),
  "Successfully add new topic: {topic: testTopic0, partition: 8}");
  .getTopicExternalViewRequestUrl("");
response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
Assert.assertEquals(response.getEntityAsText(), "Current serving topics: [testTopic0]");
System.out.println(response.getEntityAsText());
  .getTopicExternalViewRequestUrl("testTopic0");
response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
JSONObject jsonObject = JSON.parseObject(response.getEntityAsText());
System.out.println(jsonObject);
  ControllerRequestURLBuilder.baseUrl(REQUEST_URL).getTopicDeleteRequestUrl("testTopic0");
response = HTTP_CLIENT.handle(request);
Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
Assert.assertEquals(response.getEntityAsText(),
  "Successfully finished delete topic: testTopic0");
origin: org.restlet.osgi/org.restlet

/**
 * Indicates if the response is provisional or final. It relies on the {@link Status#isInformational()} method.
 * 
 * @return True if the response is provisional.
 */
public boolean isProvisional() {
  return getStatus().isInformational();
}
origin: org.restlet.osgi/org.restlet

/**
 * Returns the status.
 * 
 * @return The status.
 */
@Override
public Status getStatus() {
  return getWrappedResponse().getStatus();
}
origin: org.restlet.osgi/org.restlet

/**
 * Indicates if the response is final or provisional. It relies on the {@link Status#isInformational()} method.
 * 
 * @return True if the response is final.
 */
public boolean isFinal() {
  return !getStatus().isInformational();
}
origin: org.restlet.osgi/org.restlet

/**
 * Returns the status.
 * 
 * @return The status.
 * @see Response#getStatus()
 */
public Status getStatus() {
  return getResponse() == null ? null : getResponse().getStatus();
}
origin: org.restlet.jse/org.restlet.example

@Test(threadPoolSize = 10, invocationCount = 100, timeOut = 5000)
public void makeCall() {
  Request request = new Request(Method.GET, "http://localhost:8111/");
  Response response = component.handle(request);
  Assert.assertTrue(response.getStatus().isSuccess());
  Assert.assertEquals("Welcome to the RESTful Mail Server application !",
      response.getEntityAsText());
}
origin: org.restlet.osgi/org.restlet.ext.oauth

@Override
public Representation handleInbound(Response response) {
  Representation result = null;
  // Verify that the request was synchronous
  if (response.getRequest().isSynchronous()) {
    if (response.getStatus().isError()) {
      doError(response.getStatus());
      // DO NOT DISPOSE THE RESPONSE.
    }/* else { */
    result = (response == null) ? null : response.getEntity();
    /* } */
  }
  return result;
}
origin: org.restlet.osgi/org.restlet

  /**
   * Displays a synthesis of the response like an HTTP status line.
   * 
   * @return A synthesis of the response like an HTTP status line.
   */
  public String toString() {
    return ((getRequest() == null) ? "?" : getRequest().getProtocol())
        + " - " + getStatus();
  }
}
origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Deletes a resource.
 * 
 * @param uri
 *            The resource URI.
 * @return The result status.
 */
public Status deleteResource(String uri) {
  return getClientDispatcher().handle(new Request(Method.DELETE, uri))
      .getStatus();
}
origin: org.restlet.android/org.restlet.ext.atom

/**
 * Deletes a resource.
 * 
 * @param uri
 *            The resource URI.
 * @return The result status.
 */
public Status deleteResource(String uri) {
  return getClientDispatcher().handle(new Request(Method.DELETE, uri))
      .getStatus();
}
origin: org.restlet.jee/org.restlet.ext.atom

/**
 * Updates a resource representation.
 * 
 * @param uri
 *            The resource URI.
 * @return The resource representation.
 */
public Status updateResource(String uri,
    Representation updatedRepresentation) {
  return getClientDispatcher().handle(
      new Request(Method.PUT, uri, updatedRepresentation))
      .getStatus();
}
origin: org.restlet.android/org.restlet.ext.atom

/**
 * Updates a resource representation.
 * 
 * @param uri
 *            The resource URI.
 * @return The resource representation.
 */
public Status updateResource(String uri,
    Representation updatedRepresentation) {
  return getClientDispatcher().handle(
      new Request(Method.PUT, uri, updatedRepresentation))
      .getStatus();
}
origin: uber/uReplicator

 @Test
 public void testHealthCheck() {
  Request request = ManagerRequestURLBuilder.baseUrl(REQUEST_URL).getHealthCheck();
  Response response = HTTP_CLIENT.handle(request);
  String responseString = response.getEntityAsText();
  Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
  Assert.assertEquals(responseString, "OK\n");
 }
}
origin: org.umlg/runtime-restlet

@Override
protected void afterHandle(Request request, Response response) {
  if (response.getStatus() != Status.REDIRECTION_NOT_MODIFIED) {
    if (UMLG.get().isTransactionActive()) {
      logger.log(Level.SEVERE, "Transaction is still active! Request = " + request.toString());
    }
    UMLG.get().rollback();
    UMLG.get().afterThreadContext();
  }
}
origin: uber/uReplicator

@Test
public void testGetControllerRebalance() {
 Request request = ManagerRequestURLBuilder.baseUrl(REQUEST_URL).getControllerRebalanceStatus();
 Response response = HTTP_CLIENT.handle(request);
 String responseString = response.getEntityAsText();
 Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
 Assert.assertEquals(responseString, "{}");
}
origin: uber/uReplicator

@Test
public void testPostRebalance() {
 Request request = ManagerRequestURLBuilder.baseUrl(REQUEST_URL).postInstanceRebalance(true);
 Response response = HTTP_CLIENT.handle(request);
 String responseString = response.getEntityAsText();
 Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
 Assert.assertEquals(responseString, "{\"status\":200}");
 request = ManagerRequestURLBuilder.baseUrl(REQUEST_URL).postInstanceRebalance(false);
 response = HTTP_CLIENT.handle(request);
 responseString = response.getEntityAsText();
 Assert.assertEquals(response.getStatus(), Status.CLIENT_ERROR_BAD_REQUEST);
 Assert.assertEquals(responseString, "{\"message\":\"invalid operation\",\"status\":400}");
}
origin: uber/uReplicator

@Test
public void testPostControllerRebalance() {
 Request request = ManagerRequestURLBuilder.baseUrl(REQUEST_URL).postSetControllerRebalance(true);
 Response response = HTTP_CLIENT.handle(request);
 String responseString = response.getEntityAsText();
 Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
 Assert.assertEquals(responseString, "{\"execution\":{},\"managerAutoscaling\":true,\"status\":{}}");
 request = ManagerRequestURLBuilder.baseUrl(REQUEST_URL).postSetControllerRebalance("sjc1a", "sjc1-agg1", true);
 response = HTTP_CLIENT.handle(request);
 responseString = response.getEntityAsText();
 Assert.assertEquals(response.getStatus(), Status.SUCCESS_OK);
 Assert.assertEquals(responseString, "{\"execution\":{},\"managerAutoscaling\":true,\"status\":{}}");
}
@Test
org.restletResponsegetStatus

Javadoc

Returns the status.

Popular methods of Response

  • setStatus
    Sets the status.
  • setEntity
  • getEntity
  • getAttributes
  • getEntityAsText
  • isEntityAvailable
  • getHeaders
  • redirectSeeOther
    Redirects the client to a different URI that SHOULD be retrieved using a GET method on that resource
  • getCookieSettings
    Returns the modifiable series of cookie settings provided by the server. Creates a new instance if n
  • getCurrent
    Returns the response associated to the current thread. Warning: this method should only be used unde
  • getRequest
    Returns the associated request
  • getAllowedMethods
    Returns the modifiable set of methods allowed on the requested resource. This property only has to b
  • getRequest,
  • getAllowedMethods,
  • getLocationRef,
  • setLocationRef,
  • <init>,
  • getCacheDirectives,
  • getServerInfo,
  • commit,
  • getChallengeRequests

Popular in Java

  • Start an intent from android
  • setRequestProperty (URLConnection)
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Permission (java.security)
    Legacy security code; do not use.
  • ImageIO (javax.imageio)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now