AsyncReportStatusListener implements IAsyncReportListener { @Override public synchronized void setStatus( final AsyncExecutionStatus status ) { if ( this.status == null || !this.status.isFinal() ) { this.status = status; } } AsyncReportStatusListener( final String path,
                                    final UUID uuid,
                                    final String mimeType,
                                    final List<? extends ReportProgressListener> callbackListeners ); @Override synchronized void setStatus( final AsyncExecutionStatus status ); @Override synchronized void setErrorMessage( final String errorMessage ); boolean isFirstPageMode(); synchronized void setRequestedPage( final int requestedPage ); @Override synchronized int getRequestedPage(); @Override synchronized void updateGenerationStatus( final int generatedPage ); @Override synchronized boolean isScheduled(); @Override synchronized void reportProcessingStarted( final ReportProgressEvent event ); @Override synchronized void reportProcessingUpdate( final ReportProgressEvent event ); @Override synchronized void reportProcessingFinished( final ReportProgressEvent event ); @Override String toString(); synchronized IAsyncReportState getState(); boolean isQueryLimitReached(); @Override void setIsQueryLimitReached( boolean isQueryLimitReached ); @Override int getTotalRows(); synchronized void cancel();  }
@Test public void setStatus() throws Exception { final AsyncReportStatusListener listener = new AsyncReportStatusListener( "", UUID.randomUUID(), "", Collections.<ReportProgressListener>emptyList() ); listener.setStatus( null ); listener.setStatus( AsyncExecutionStatus.QUEUED ); assertEquals( AsyncExecutionStatus.QUEUED, listener.getState().getStatus() ); listener.setStatus( AsyncExecutionStatus.FINISHED ); assertEquals( AsyncExecutionStatus.FINISHED, listener.getState().getStatus() ); listener.setStatus( AsyncExecutionStatus.CANCELED ); assertEquals( AsyncExecutionStatus.CANCELED, listener.getState().getStatus() ); listener.setStatus( AsyncExecutionStatus.FINISHED ); assertEquals( AsyncExecutionStatus.CANCELED, listener.getState().getStatus() ); }