fixed ScanErrorCallback error in ReceiverWebAPI
parent
09ee63eca4
commit
ed7b50de23
|
@ -2,7 +2,9 @@ package meerkat.pollingstation;
|
||||||
|
|
||||||
import com.google.common.util.concurrent.FutureCallback;
|
import com.google.common.util.concurrent.FutureCallback;
|
||||||
import com.google.protobuf.BoolValue;
|
import com.google.protobuf.BoolValue;
|
||||||
|
import meerkat.pollingstation.controller.callbacks.ScanCallback;
|
||||||
import meerkat.pollingstation.controller.callbacks.ScanDataCallback;
|
import meerkat.pollingstation.controller.callbacks.ScanDataCallback;
|
||||||
|
import meerkat.pollingstation.controller.callbacks.ScanErrorCallback;
|
||||||
import meerkat.protobuf.PollingStation;
|
import meerkat.protobuf.PollingStation;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
@ -28,7 +30,7 @@ public class ReceiverWebAPI implements PollingStationScanner.Producer {
|
||||||
@Context
|
@Context
|
||||||
ServletContext servletContext;
|
ServletContext servletContext;
|
||||||
|
|
||||||
LinkedBlockingQueue<FutureCallback<PollingStation.ScannedData>> callbacks;
|
LinkedBlockingQueue<ScanCallback> callbacks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called by the Jetty engine when instantiating the servlet
|
* This method is called by the Jetty engine when instantiating the servlet
|
||||||
|
@ -39,7 +41,7 @@ public class ReceiverWebAPI implements PollingStationScanner.Producer {
|
||||||
Object context = servletContext.getAttribute(ReceiverScanHandler.CALLBACKS_ATTRIBUTE_NAME);
|
Object context = servletContext.getAttribute(ReceiverScanHandler.CALLBACKS_ATTRIBUTE_NAME);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
callbacks = (LinkedBlockingQueue<FutureCallback<PollingStation.ScannedData>>) context;
|
callbacks = (LinkedBlockingQueue<ScanCallback>) context;
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +91,7 @@ public class ReceiverWebAPI implements PollingStationScanner.Producer {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
ScanDataCallback callback = new ScanDataCallback(errorMsg);
|
ScanErrorCallback callback = new ScanErrorCallback(errorMsg);
|
||||||
// scanner.subscribe(callback);
|
// scanner.subscribe(callback);
|
||||||
callbacks.add(callback);
|
callbacks.add(callback);
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ import meerkat.protobuf.PollingStation;
|
||||||
*/
|
*/
|
||||||
public class ScanErrorCallback extends ScanCallback implements FutureCallback<PollingStation.ErrorMsg> {
|
public class ScanErrorCallback extends ScanCallback implements FutureCallback<PollingStation.ErrorMsg> {
|
||||||
|
|
||||||
private final String expectedErrorMessage;
|
private final PollingStation.ErrorMsg expectedErrorMessage;
|
||||||
|
|
||||||
public ScanErrorCallback(String expectedErrorMessage) {
|
public ScanErrorCallback(PollingStation.ErrorMsg expectedErrorMessage) {
|
||||||
this.expectedErrorMessage = expectedErrorMessage;
|
this.expectedErrorMessage = expectedErrorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue