AsyncCallback replaced with MarkedAsyncCallback to support UI tests.

This commit is contained in:
D049941 committed 2014-02-12 02:42:11 +01:00
1 parent 1f9f70f785
commit 9760a7f47b
3 files changed
+16 -15

No files matched your search

@@ -19,7 +19,6 @@ import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
@@ -39,6 +38,7 @@ import com.sap.sailing.domain.common.TrackedRaceStatusEnum;
import com.sap.sailing.domain.common.dto.RaceDTO;
import com.sap.sailing.domain.common.impl.NaturalComparator;
import com.sap.sailing.gwt.ui.client.ErrorReporter;
import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback;
import com.sap.sailing.gwt.ui.client.RaceSelectionChangeListener;
import com.sap.sailing.gwt.ui.client.RaceSelectionProvider;
import com.sap.sailing.gwt.ui.client.RegattaDisplayer;
@@ -389,16 +389,16 @@ public abstract class AbstractTrackedRacesListComposite extends SimplePanel impl
if (raceIdentifiersToUpdate != null && !raceIdentifiersToUpdate.isEmpty()) {
sailingService.updateRacesDelayToLive(raceIdentifiersToUpdate, settings.getDelayToLiveInSeconds() * 1000l,
new AsyncCallback<Void>() {
new MarkedAsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
public void handleFailure(Throwable caught) {
errorReporter
.reportError("Exception trying to set the delay to live for the selected tracked races: "
+ caught.getMessage());
}
@Override
public void onSuccess(Void result) {
public void handleSuccess(Void result) {
regattaRefresher.fillRegattas();
}
});
@@ -7,13 +7,13 @@ import java.util.Set;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
import com.sap.sailing.domain.common.dto.RaceDTO;
import com.sap.sailing.gwt.ui.client.ErrorReporter;
import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback;
import com.sap.sailing.gwt.ui.client.RaceSelectionProvider;
import com.sap.sailing.gwt.ui.client.RegattaDisplayer;
import com.sap.sailing.gwt.ui.client.RegattaRefresher;
@@ -60,14 +60,14 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
racesToStopTracking.add(race.getRaceIdentifier());
}
}
sailingService.stopTrackingRaces(racesToStopTracking, new AsyncCallback<Void>() {
sailingService.stopTrackingRaces(racesToStopTracking, new MarkedAsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
public void handleFailure(Throwable caught) {
errorReporter.reportError("Exception trying to stop tracking races " + races + ": " + caught.getMessage());
}
@Override
public void onSuccess(Void result) {
public void handleSuccess(Void result) {
regattaRefresher.fillRegattas();
for (TrackedRaceChangedListener listener : raceIsTrackedRaceChangeListener) {
listener.changeTrackingRace(racesToStopTracking, false);
@@ -82,15 +82,15 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
regattaNamesAndRaceNames.add((RegattaNameAndRaceName) race.getRaceIdentifier());
}
sailingService.removeAndUntrackRaces(regattaNamesAndRaceNames,
new AsyncCallback<Void>() {
new MarkedAsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
public void handleFailure(Throwable caught) {
errorReporter.reportError("Exception trying to remove races " + regattaNamesAndRaceNames +
": " + caught.getMessage());
}
@Override
public void onSuccess(Void result) {
public void handleSuccess(Void result) {
regattaRefresher.fillRegattas();
for (TrackedRaceChangedListener listener : raceIsTrackedRaceChangeListener) {
listener.changeTrackingRace(regattaNamesAndRaceNames, false);
@@ -3,24 +3,25 @@ package com.sap.sailing.gwt.ui.leaderboardedit;
import java.util.List;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.sap.sailing.gwt.ui.actions.AsyncActionsExecutor;
import com.sap.sailing.gwt.ui.client.AbstractEntryPoint;
import com.sap.sailing.gwt.ui.client.LogoAndTitlePanel;
import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback;
public class LeaderboardEditPage extends AbstractEntryPoint {
@Override
protected void doOnModuleLoad() {
super.doOnModuleLoad();
sailingService.getLeaderboardNames(new AsyncCallback<List<String>>() {
sailingService.getLeaderboardNames(new MarkedAsyncCallback<List<String>>() {
@Override
public void onSuccess(List<String> leaderboardNames) {
public void handleSuccess(List<String> leaderboardNames) {
String leaderboardName = Window.Location.getParameter("name");
if (leaderboardNames.contains(leaderboardName)) {
LogoAndTitlePanel logoAndTitlePanel = new LogoAndTitlePanel(stringMessages.editScores(), stringMessages, LeaderboardEditPage.this);
logoAndTitlePanel.addStyleName("LogoAndTitlePanel");
// TODO: Here happens something async. We have to use the semaphore for ui tests.
EditableLeaderboardPanel leaderboardPanel = new EditableLeaderboardPanel(sailingService, new AsyncActionsExecutor(), leaderboardName, null,
LeaderboardEditPage.this, stringMessages, userAgent);
leaderboardPanel.ensureDebugId("EditableLeaderboardPanel");
@@ -31,7 +32,7 @@ public class LeaderboardEditPage extends AbstractEntryPoint {
}
}
@Override
public void onFailure(Throwable t) {
public void handleFailure(Throwable t) {
reportError("Error trying to obtain list of leaderboard names: "+t.getMessage());
}
});