Example usage for java.lang Throwable toString

List of usage examples for java.lang Throwable toString

Introduction

In this page you can find the example usage for java.lang Throwable toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:com.vmware.photon.controller.api.client.resource.DeploymentApiTest.java

@Test
public void testPauseSystemAsync() throws IOException, InterruptedException {
    final Task responseTask = getExpectedTaskResponse();
    DeploymentApi deploymentApi = new DeploymentApi(restClient);

    final CountDownLatch latch = new CountDownLatch(1);

    deploymentApi.pauseSystemAsync("deploymentId1", new FutureCallback<Task>() {
        @Override/*w  w w .  ja  v a 2 s .c  o m*/
        public void onSuccess(Task result) {
            assertEquals(result, responseTask);
            latch.countDown();
        }

        @Override
        public void onFailure(Throwable t) {
            fail(t.toString());
            latch.countDown();
        }
    });

    assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true));
}

From source file:com.vmware.photon.controller.api.client.resource.DeploymentApiTest.java

@Test
public void testResumeSystemAsync() throws Exception {
    Task responseTask = getExpectedTaskResponse();
    DeploymentApi deploymentApi = new DeploymentApi(restClient);

    final CountDownLatch latch = new CountDownLatch(1);

    deploymentApi.resumeSystemAsync("deploymentId1", new FutureCallback<Task>() {
        @Override//from   ww  w.ja  va  2  s .  co  m
        public void onSuccess(Task result) {
            assertEquals(result, responseTask);
            latch.countDown();
        }

        @Override
        public void onFailure(Throwable t) {
            fail(t.toString());
            latch.countDown();
        }
    });

    assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true));
}

From source file:com.vmware.photon.controller.api.client.resource.DeploymentRestApiTest.java

@Test
public void testPauseSystemAsync() throws IOException, InterruptedException {
    final Task responseTask = getExpectedTaskResponse();
    DeploymentApi deploymentApi = new DeploymentRestApi(restClient);

    final CountDownLatch latch = new CountDownLatch(1);

    deploymentApi.pauseSystemAsync("deploymentId1", new FutureCallback<Task>() {
        @Override/*from   w w  w.  ja  v a2  s  .  c o m*/
        public void onSuccess(Task result) {
            assertEquals(result, responseTask);
            latch.countDown();
        }

        @Override
        public void onFailure(Throwable t) {
            fail(t.toString());
            latch.countDown();
        }
    });

    assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true));
}

From source file:com.vmware.photon.controller.api.client.resource.DeploymentRestApiTest.java

@Test
public void testResumeSystemAsync() throws Exception {
    Task responseTask = getExpectedTaskResponse();
    DeploymentApi deploymentApi = new DeploymentRestApi(restClient);

    final CountDownLatch latch = new CountDownLatch(1);

    deploymentApi.resumeSystemAsync("deploymentId1", new FutureCallback<Task>() {
        @Override//from   ww w.  j  av a 2  s.  c om
        public void onSuccess(Task result) {
            assertEquals(result, responseTask);
            latch.countDown();
        }

        @Override
        public void onFailure(Throwable t) {
            fail(t.toString());
            latch.countDown();
        }
    });

    assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true));
}

From source file:ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException.java

/**
 * Constructor/* w ww.ja  v  a2s  . co  m*/
 * 
 * @param theStatusCode
 *            The HTTP status code corresponding to this problem
 * @param theCause
 *            The underlying cause exception
 * @param theBaseOperationOutcome
 *            An BaseOperationOutcome resource to return to the calling client (in a server) or the BaseOperationOutcome that was returned from the server (in a client)
 */
public BaseServerResponseException(int theStatusCode, Throwable theCause,
        IBaseOperationOutcome theBaseOperationOutcome) {
    super(theCause.toString(), theCause);
    myStatusCode = theStatusCode;
    myBaseOperationOutcome = theBaseOperationOutcome;
}

From source file:com.elasticbox.jenkins.k8s.repositories.error.RepositoryException.java

private void appendMessage(StringBuilder msg, Throwable initialCause) {
    if (initialCause instanceof KubernetesClientException) {
        KubernetesClientException kce = (KubernetesClientException) initialCause;
        final Status status = kce.getStatus();
        if (status != null) {
            msg.append(status.getMessage()).append(' ');
        }//w  ww  . jav a 2  s .co  m
    } else if (msg.indexOf(initialCause.toString()) == -1) {
        msg.append(initialCause.toString()).append(' ');
    }
}

From source file:com.pinterest.terrapin.thrift.TerrapinServiceImpl.java

private <T> Future<T> getExceptionFuture(Throwable t) {
    if (t instanceof TerrapinGetException) {
        return Future.exception(t);
    }//from ww w  . j ava 2s.  c  om
    return Future
            .exception(new TerrapinGetException("Failed due to " + t.toString(), TerrapinGetErrorCode.OTHER));
}

From source file:com.vmware.photon.controller.api.client.resource.DeploymentApiTest.java

@Test
public void testListAllAsync() throws Exception {
    Deployment deployment = getNewDeployment();

    ResourceList<Deployment> deploymentResourceList = new ResourceList<>(Arrays.asList(deployment));

    ObjectMapper mapper = new ObjectMapper();
    String serializedResponse = mapper.writeValueAsString(deploymentResourceList);

    setupMocks(serializedResponse, HttpStatus.SC_OK);

    DeploymentApi deploymentApi = new DeploymentApi(restClient);

    final CountDownLatch latch = new CountDownLatch(1);

    deploymentApi.listAllAsync(new FutureCallback<ResourceList<Deployment>>() {
        @Override/*  ww w . j a  va  2  s. c  om*/
        public void onSuccess(@Nullable ResourceList<Deployment> result) {
            assertEquals(result.getItems(), deploymentResourceList.getItems());
            latch.countDown();
        }

        @Override
        public void onFailure(Throwable t) {
            fail(t.toString());
            latch.countDown();
        }
    });

    assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true));
}

From source file:com.vmware.photon.controller.api.client.resource.DeploymentRestApiTest.java

@Test
public void testListAllAsync() throws Exception {
    Deployment deployment = getNewDeployment();

    ResourceList<Deployment> deploymentResourceList = new ResourceList<>(Arrays.asList(deployment));

    ObjectMapper mapper = new ObjectMapper();
    String serializedResponse = mapper.writeValueAsString(deploymentResourceList);

    setupMocks(serializedResponse, HttpStatus.SC_OK);

    DeploymentApi deploymentApi = new DeploymentRestApi(restClient);

    final CountDownLatch latch = new CountDownLatch(1);

    deploymentApi.listAllAsync(new FutureCallback<ResourceList<Deployment>>() {
        @Override/*w w w .  j a  v  a  2 s  .co m*/
        public void onSuccess(@Nullable ResourceList<Deployment> result) {
            assertEquals(result.getItems(), deploymentResourceList.getItems());
            latch.countDown();
        }

        @Override
        public void onFailure(Throwable t) {
            fail(t.toString());
            latch.countDown();
        }
    });

    assertThat(latch.await(COUNTDOWNLATCH_AWAIT_TIMEOUT, TimeUnit.SECONDS), is(true));
}

From source file:org.apache.solr.client.solrj.retry.RetryingSolrServer.java

protected String getExceptionKey(Throwable exception) {
    return normalizeExceptionKey(exception.toString());
}