List of usage examples for java.lang Throwable toString
public String toString()
From source file:com.vmware.photon.controller.api.client.resource.DeploymentRestApiTest.java
@Test public void testGetVmsAsyncForPagination() throws IOException, InterruptedException { Vm vm1 = new Vm(); vm1.setId("vm1"); Vm vm2 = new Vm(); vm2.setId("vm2"); Vm vm3 = new Vm(); vm3.setId("vm3"); String nextPageLink = "nextPageLink"; final ResourceList<Vm> vmList = new ResourceList<>(Arrays.asList(vm1, vm2), nextPageLink, null); final ResourceList<Vm> vmListNextPage = new ResourceList<>(Arrays.asList(vm3)); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(vmList); String serializedTaskNextPage = mapper.writeValueAsString(vmListNextPage); setupMocksForPagination(serializedTask, serializedTaskNextPage, nextPageLink, HttpStatus.SC_OK); DeploymentApi deploymentApi = new DeploymentRestApi(restClient); final CountDownLatch latch = new CountDownLatch(1); deploymentApi.getAllDeploymentVmsAsync("foo", new FutureCallback<ResourceList<Vm>>() { @Override//from w ww.j a v a 2s. c o m public void onSuccess(ResourceList<Vm> result) { assertEquals(result.getItems().size(), vmList.getItems().size() + vmListNextPage.getItems().size()); assertTrue(result.getItems().containsAll(vmList.getItems())); assertTrue(result.getItems().containsAll(vmListNextPage.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.xemplar.games.android.nerdshooter.screens.DownloadScreen.java
public void resize(int width, int height) { this.width = width; this.height = height; this.buttonHeight = height / 9F; this.spacer = buttonHeight / 10F; this.buttonWidth = (width * ((3F / 4F) / 2F)); button = NerdShooter.label_small;//from ww w . java2 s.c o m button.setColor(0, 0, 0, 1); lbl = new Label(NerdShooter.text, "Downloadable: ", (width / 2F) - (buttonWidth), height - (buttonHeight + spacer), (buttonWidth * 2F), buttonHeight); non = new Label(NerdShooter.text, "You have them all!!!", (width / 2F) - (buttonWidth), lbl.y - (buttonHeight + spacer) * 2F, (buttonWidth * 2F), buttonHeight); delt = new Button(NerdShooter.label, NerdShooter.button, "Delete", (width / 2F) - (buttonWidth), spacer, (buttonWidth) - (spacer), buttonHeight); back = new Button(NerdShooter.label, NerdShooter.button, "Back", delt.x + delt.width + spacer, spacer, (buttonWidth) - (spacer), buttonHeight); back.setActionNumber(1); views.clear(); views.add(lbl); views.add(delt); views.add(back); System.out.println("Levels Retrieval Started"); NETWORK_HANDLE.getPackList(new NetworkListener() { public void finished(String data) { System.out.println("Levels Retrieval Success"); System.out.println(data); try { dat = new JSONArray(data); } catch (Exception e) { e.printStackTrace(); } ready = true; } public void length(long l) { System.out.println(l); } public void failed(Throwable t) { System.out.println("Levels Retrieval Failed: " + t.toString()); } }); System.out.println("Levels Retrieval Sent"); }
From source file:com.vmware.photon.controller.api.client.resource.FlavorApiTest.java
@Test public void testGetFlavorAsync() throws IOException, InterruptedException { final Flavor flavor1 = new Flavor(); flavor1.setId("flavor1"); flavor1.setKind("vm"); ObjectMapper mapper = new ObjectMapper(); String serializedResponse = mapper.writeValueAsString(flavor1); setupMocks(serializedResponse, HttpStatus.SC_OK); FlavorApi flavorApi = new FlavorApi(restClient); final CountDownLatch latch = new CountDownLatch(1); flavorApi.getFlavorAsync(flavor1.getId(), new FutureCallback<Flavor>() { @Override/*w w w . j ava 2 s.c o m*/ public void onSuccess(@Nullable Flavor result) { assertEquals(result, flavor1); 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.FlavorRestApiTest.java
@Test public void testGetFlavorAsync() throws IOException, InterruptedException { final Flavor flavor1 = new Flavor(); flavor1.setId("flavor1"); flavor1.setKind("vm"); ObjectMapper mapper = new ObjectMapper(); String serializedResponse = mapper.writeValueAsString(flavor1); setupMocks(serializedResponse, HttpStatus.SC_OK); FlavorApi flavorApi = new FlavorRestApi(restClient); final CountDownLatch latch = new CountDownLatch(1); flavorApi.getFlavorAsync(flavor1.getId(), new FutureCallback<Flavor>() { @Override/*from w ww . ja va 2 s. c om*/ public void onSuccess(@Nullable Flavor result) { assertEquals(result, flavor1); 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.FlavorApiTest.java
@Test public void testCreateAsync() throws Exception { final Task responseTask = new Task(); responseTask.setId("12345"); responseTask.setState("QUEUED"); responseTask.setQueuedTime(Date.from(Instant.now())); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(responseTask); setupMocks(serializedTask, HttpStatus.SC_CREATED); FlavorApi flavorApi = new FlavorApi(restClient); final CountDownLatch latch = new CountDownLatch(1); flavorApi.createAsync(new FlavorCreateSpec(), new FutureCallback<Task>() { @Override/*from w w w . j a v a2 s .c om*/ public void onSuccess(@Nullable 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.FlavorApiTest.java
@Test public void testDeleteAsync() throws IOException, InterruptedException { final Task responseTask = new Task(); responseTask.setId("12345"); responseTask.setState("QUEUED"); responseTask.setQueuedTime(Date.from(Instant.now())); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(responseTask); setupMocks(serializedTask, HttpStatus.SC_CREATED); FlavorApi flavorApi = new FlavorApi(restClient); final CountDownLatch latch = new CountDownLatch(1); flavorApi.deleteAsync("foo", new FutureCallback<Task>() { @Override//from w ww.j ava 2 s . co m public void onSuccess(@Nullable 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.FlavorRestApiTest.java
@Test public void testCreateAsync() throws Exception { final Task responseTask = new Task(); responseTask.setId("12345"); responseTask.setState("QUEUED"); responseTask.setQueuedTime(Date.from(Instant.now())); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(responseTask); setupMocks(serializedTask, HttpStatus.SC_CREATED); FlavorApi flavorApi = new FlavorRestApi(restClient); final CountDownLatch latch = new CountDownLatch(1); flavorApi.createAsync(new FlavorCreateSpec(), new FutureCallback<Task>() { @Override//from ww w. j a va 2s .c o m public void onSuccess(@Nullable 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.FlavorRestApiTest.java
@Test public void testDeleteAsync() throws IOException, InterruptedException { final Task responseTask = new Task(); responseTask.setId("12345"); responseTask.setState("QUEUED"); responseTask.setQueuedTime(Date.from(Instant.now())); ObjectMapper mapper = new ObjectMapper(); String serializedTask = mapper.writeValueAsString(responseTask); setupMocks(serializedTask, HttpStatus.SC_CREATED); FlavorApi flavorApi = new FlavorRestApi(restClient); final CountDownLatch latch = new CountDownLatch(1); flavorApi.deleteAsync("foo", new FutureCallback<Task>() { @Override//from w w w . ja v a 2 s.c o m public void onSuccess(@Nullable 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:it.classhidra.core.controller.wsController.java
public String PerformActionSOAP(String id_action, String ssoid, String inputXML, String isCodedInput, String isCodedOutput) {//from ww w . j a va 2s . c om HashMap wsParameters = new HashMap(); wsParameters.put(bsController.CONST_ID, id_action); wsParameters.put(bsController.CONST_SSOID, ssoid); String outputXML = ""; Vector errors = new Vector(); auth_init auth = null; if (auth == null) auth = new auth_init(); StatisticEntity stat = null; try { stat = new StatisticEntity("ws", auth.get_user_ip(), auth.get_matricola(), auth.get_language(), id_action, null, new Date(), null, null); } catch (Exception e) { } if (isCodedInput != null && isCodedInput.toUpperCase().equals("TRUE")) { try { inputXML = new String(Base64.decodeBase64(inputXML.getBytes())); } catch (Exception e) { } } if (id_action != null) { Vector _streams = new Vector(); Vector _streams_orig = (Vector) bsController.getAction_config().get_streams_apply_to_actions().get("*"); if (_streams_orig != null) _streams.addAll(_streams_orig); Vector _streams4action = (Vector) bsController.getAction_config().get_streams_apply_to_actions() .get(id_action); if (_streams4action != null) _streams.addAll(_streams4action); i_action action_instance = null; try { try { performStream_Enter(_streams, id_action, action_instance, wsParameters); } catch (Exception e) { throw e; } action_instance = bsController.getAction_config().actionFactory(id_action); i_bean bean_instance = bsController.getAction_config() .beanFactory(action_instance.get_infoaction().getName()); if (bean_instance != null) { bean_instance.reimposta(); i_bean fromXML = null; try { fromXML = (i_bean) util_beanMessageFactory.message2bean(inputXML); } catch (Exception e) { } if (fromXML != null) bean_instance.reInit(fromXML); } action_instance.onPreSet_bean(); action_instance.set_bean(bean_instance); action_instance.onPostSet_bean(); action_instance.onPreInit(wsParameters); action_instance.init(wsParameters); action_instance.onPostInit(wsParameters); redirects redirect = null; if (action_instance.get_infoaction().getSyncro().toLowerCase().equals("true")) { action_instance.onPreSyncroservice(wsParameters); redirect = action_instance.syncroservice(wsParameters); action_instance.onPostSyncroservice(redirect, wsParameters); } else { action_instance.onPreActionservice(wsParameters); redirect = action_instance.actionservice(wsParameters); action_instance.onPostActionservice(redirect, wsParameters); } // redirects redirect = action_instance.actionservice(wsParameters); if (action_instance != null && action_instance.get_bean() != null) { String output4SOAP = (String) action_instance.get_bean().get(bsConstants.CONST_ID_OUTPUT4SOAP); if (output4SOAP == null) outputXML = util_beanMessageFactory.bean2xml(action_instance.get_bean(), action_instance.get_bean().get_infobean().getName(), true); else outputXML = output4SOAP; } try { performStream_Exit(_streams, id_action, action_instance, wsParameters); } catch (Exception e) { throw e; } if (redirect != null) { String id_current = check_DO(redirect.get_uri()); if (id_current != null) { outputXML = PerformActionSOAP(id_action, ssoid, outputXML, isCodedInput, isCodedOutput); } } } catch (bsControllerException e) { errors.add(e.toString()); } catch (Exception ex) { errors.add(ex.toString()); } catch (Throwable t) { errors.add(t.toString()); } } if (errors.size() > 0) { outputXML += util_beanMessageFactory.bean2xml(errors); } if (isCodedOutput != null && isCodedOutput.toUpperCase().equals("TRUE")) { try { outputXML = new String(Base64.encodeBase64(outputXML.getBytes())); } catch (Exception e) { } } if (stat != null) { stat.setFt(new Date()); bsController.putToStatisticProvider(stat); } return outputXML; }