List of usage examples for java.lang Throwable toString
public String toString()
From source file:axiom.main.Server.java
/** * initialize extensions/*w w w. j a v a 2 s .com*/ */ private void initExtensions() { StringBuffer exts = new StringBuffer(sysProps.getProperty("extensions", "")); if (exts.length() > 0) { exts.append(","); } exts.append("axiom.extensions.tal.TALExtension"); StringTokenizer tok = new StringTokenizer(exts.toString(), ","); while (tok.hasMoreTokens()) { String extClassName = tok.nextToken().trim(); try { Class extClass = Class.forName(extClassName); AxiomExtension ext = (AxiomExtension) extClass.newInstance(); ext.init(this); extensions.add(ext); logger.info("Loaded: " + extClassName); } catch (Throwable e) { logger.error("Error loading extension " + extClassName + ": " + e.toString()); } } }
From source file:com.vmware.photon.controller.api.client.resource.ProjectApiTest.java
@Test public void testGetProjectTasksAsync() throws IOException, InterruptedException { Task task1 = new Task(); task1.setId("task1"); Task task2 = new Task(); task2.setId("task2"); final ResourceList<Task> taskResourceList = new ResourceList<>(Arrays.asList(task1, task2)); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(taskResourceList); setupMocks(serializedTask, HttpStatus.SC_OK); ProjectApi projectApi = new ProjectApi(restClient); final CountDownLatch latch = new CountDownLatch(1); projectApi.getTasksForProjectAsync("foo", new FutureCallback<ResourceList<Task>>() { @Override/*from w w w. j av a 2 s .com*/ public void onSuccess(@Nullable ResourceList<Task> result) { assertEquals(result.getItems(), taskResourceList.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.ProjectApiTest.java
@Test public void testGetPersistentDisksAsync() throws IOException, InterruptedException { PersistentDisk persistentDisk1 = new PersistentDisk(); persistentDisk1.setId("persistentDisk1"); PersistentDisk persistentDisk2 = new PersistentDisk(); persistentDisk2.setId("persistentDisk2"); final ResourceList<PersistentDisk> persistentDiskResourceList = new ResourceList<>( Arrays.asList(persistentDisk1, persistentDisk2)); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(persistentDiskResourceList); setupMocks(serializedTask, HttpStatus.SC_OK); ProjectApi projectApi = new ProjectApi(restClient); final CountDownLatch latch = new CountDownLatch(1); projectApi.getDisksInProjectAsync("foo", new FutureCallback<ResourceList<PersistentDisk>>() { @Override// w ww. j a va2 s .c o m public void onSuccess(@Nullable ResourceList<PersistentDisk> result) { assertEquals(result.getItems(), persistentDiskResourceList.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.ProjectRestApiTest.java
@Test public void testGetProjectTasksAsync() throws IOException, InterruptedException { Task task1 = new Task(); task1.setId("task1"); Task task2 = new Task(); task2.setId("task2"); final ResourceList<Task> taskResourceList = new ResourceList<>(Arrays.asList(task1, task2)); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(taskResourceList); setupMocks(serializedTask, HttpStatus.SC_OK); ProjectApi projectApi = new ProjectRestApi(restClient); final CountDownLatch latch = new CountDownLatch(1); projectApi.getTasksForProjectAsync("foo", new FutureCallback<ResourceList<Task>>() { @Override//from ww w .j a va 2s . c o m public void onSuccess(@Nullable ResourceList<Task> result) { assertEquals(result.getItems(), taskResourceList.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.ProjectRestApiTest.java
@Test public void testGetPersistentDisksAsync() throws IOException, InterruptedException { PersistentDisk persistentDisk1 = new PersistentDisk(); persistentDisk1.setId("persistentDisk1"); PersistentDisk persistentDisk2 = new PersistentDisk(); persistentDisk2.setId("persistentDisk2"); final ResourceList<PersistentDisk> persistentDiskResourceList = new ResourceList<>( Arrays.asList(persistentDisk1, persistentDisk2)); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(persistentDiskResourceList); setupMocks(serializedTask, HttpStatus.SC_OK); ProjectApi projectApi = new ProjectRestApi(restClient); final CountDownLatch latch = new CountDownLatch(1); projectApi.getDisksInProjectAsync("foo", new FutureCallback<ResourceList<PersistentDisk>>() { @Override//from w w w . jav a 2 s .c o m public void onSuccess(@Nullable ResourceList<PersistentDisk> result) { assertEquals(result.getItems(), persistentDiskResourceList.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.ProjectApiTest.java
@Test public void testGetVmsAsync() throws IOException, InterruptedException { FlavoredCompact vm1 = new FlavoredCompact(); vm1.setId("vm1"); vm1.setKind("vm"); FlavoredCompact vm2 = new FlavoredCompact(); vm2.setId("vm2"); vm2.setKind("vm"); final ResourceList<FlavoredCompact> vmSummaryList = new ResourceList<>(Arrays.asList(vm1, vm2)); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(vmSummaryList); setupMocks(serializedTask, HttpStatus.SC_OK); ProjectApi projectApi = new ProjectApi(restClient); final CountDownLatch latch = new CountDownLatch(1); projectApi.getVmsInProjectAsync("foo", new FutureCallback<ResourceList<FlavoredCompact>>() { @Override/* w w w .j ava2 s .com*/ public void onSuccess(@Nullable ResourceList<FlavoredCompact> result) { assertEquals(result.getItems(), vmSummaryList.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.ProjectApiTest.java
@Test public void testGetClustersAsync() throws IOException, InterruptedException { Cluster cluster1 = new Cluster(); cluster1.setId("cluster1"); cluster1.setName("cluster1Name"); Cluster cluster2 = new Cluster(); cluster2.setId("cluster2"); cluster2.setName("cluster2Name"); final ResourceList<Cluster> clusterList = new ResourceList<>(Arrays.asList(cluster1, cluster2)); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(clusterList); setupMocks(serializedTask, HttpStatus.SC_OK); ProjectApi projectApi = new ProjectApi(restClient); final CountDownLatch latch = new CountDownLatch(1); projectApi.getClustersInProjectAsync("foo", new FutureCallback<ResourceList<Cluster>>() { @Override/*from w ww . j a va 2 s. co m*/ public void onSuccess(@Nullable ResourceList<Cluster> result) { assertEquals(result.getItems(), clusterList.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.ProjectRestApiTest.java
@Test public void testGetVmsAsync() throws IOException, InterruptedException { FlavoredCompact vm1 = new FlavoredCompact(); vm1.setId("vm1"); vm1.setKind("vm"); FlavoredCompact vm2 = new FlavoredCompact(); vm2.setId("vm2"); vm2.setKind("vm"); final ResourceList<FlavoredCompact> vmSummaryList = new ResourceList<>(Arrays.asList(vm1, vm2)); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(vmSummaryList); setupMocks(serializedTask, HttpStatus.SC_OK); ProjectApi projectApi = new ProjectRestApi(restClient); final CountDownLatch latch = new CountDownLatch(1); projectApi.getVmsInProjectAsync("foo", new FutureCallback<ResourceList<FlavoredCompact>>() { @Override/*w w w . j a va 2 s .co m*/ public void onSuccess(@Nullable ResourceList<FlavoredCompact> result) { assertEquals(result.getItems(), vmSummaryList.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.ProjectRestApiTest.java
@Test public void testGetClustersAsync() throws IOException, InterruptedException { Cluster cluster1 = new Cluster(); cluster1.setId("cluster1"); cluster1.setName("cluster1Name"); Cluster cluster2 = new Cluster(); cluster2.setId("cluster2"); cluster2.setName("cluster2Name"); final ResourceList<Cluster> clusterList = new ResourceList<>(Arrays.asList(cluster1, cluster2)); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(clusterList); setupMocks(serializedTask, HttpStatus.SC_OK); ProjectApi projectApi = new ProjectRestApi(restClient); final CountDownLatch latch = new CountDownLatch(1); projectApi.getClustersInProjectAsync("foo", new FutureCallback<ResourceList<Cluster>>() { @Override// www.ja va 2 s . c om public void onSuccess(@Nullable ResourceList<Cluster> result) { assertEquals(result.getItems(), clusterList.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.mirth.connect.client.ui.SettingsPanelResources.java
@Override public void doRefresh() { if (PlatformUI.MIRTH_FRAME.alertRefresh()) { return;// w w w . j av a2s. com } final String workingId = getFrame().startWorking("Loading resources..."); final int selectedRow = resourceTable.getSelectedRow(); SwingWorker<List<ResourceProperties>, Void> worker = new SwingWorker<List<ResourceProperties>, Void>() { @Override public List<ResourceProperties> doInBackground() throws ClientException { return getFrame().mirthClient.getResources(); } @Override public void done() { try { updateResourcesTable(get(), selectedRow, true); } catch (Throwable t) { if (t instanceof ExecutionException) { t = t.getCause(); } getFrame().alertThrowable(getFrame(), t, "Error loading resources: " + t.toString()); } finally { getFrame().stopWorking(workingId); } } }; worker.execute(); }