package org.realityforge.replicant.client.runtime;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.realityforge.replicant.client.transport.AreaOfInterestAction;
import org.realityforge.replicant.client.transport.DataLoaderListener;
import org.realityforge.replicant.client.transport.DataLoaderListenerSupport;
import org.realityforge.replicant.client.transport.DataLoaderService;
import replicant.ChannelAddress;

final class TestDataLoaderService
  implements DataLoaderService
{
  private final String _key;
  private final Class<? extends Enum> _systemType;
  private State _state;
  private boolean _connectCalled;
  private boolean _disconnectCalled;
  private final DataLoaderListenerSupport _listenerSupport = new DataLoaderListenerSupport();

  TestDataLoaderService( @Nonnull final String key, @Nonnull final Class<? extends Enum> systemType )
  {
    _key = key;
    _systemType = systemType;
    _state = State.DISCONNECTED;
  }

  void setState( @Nonnull final State state )
  {
    _state = state;
  }

  @Nonnull
  @Override
  public State getState()
  {
    return _state;
  }

  void reset()
  {
    _connectCalled = false;
    _disconnectCalled = false;
  }

  @Override
  public void connect()
  {
    _connectCalled = true;
  }

  boolean isConnectCalled()
  {
    return _connectCalled;
  }

  @Override
  public void disconnect()
  {
    _disconnectCalled = true;
  }

  boolean isDisconnectCalled()
  {
    return _disconnectCalled;
  }

  @Override
  public void scheduleDataLoad()
  {
  }

  @Override
  public boolean addDataLoaderListener( @Nonnull final DataLoaderListener listener )
  {
    return _listenerSupport.addListener( listener );
  }

  @Override
  public boolean removeDataLoaderListener( @Nonnull final DataLoaderListener listener )
  {
    return _listenerSupport.removeListener( listener );
  }

  DataLoaderListenerSupport getListener()
  {
    return _listenerSupport;
  }

  @Nonnull
  @Override
  public String getKey()
  {
    return _key;
  }

  @Nonnull
  @Override
  public Class<? extends Enum> getSystemType()
  {
    return _systemType;
  }

  @Override
  public boolean isAreaOfInterestActionPending( @Nonnull final AreaOfInterestAction action,
                                                @Nonnull final ChannelAddress address,
                                                @Nullable final Object filter )
  {
    return false;
  }

  @Override
  public void requestSubscribe( @Nonnull final ChannelAddress address, @Nullable final Object filterParameter )
  {
  }

  @Override
  public void requestSubscriptionUpdate( @Nonnull final ChannelAddress address,
                                         @Nullable final Object filterParameter )
  {
  }

  @Override
  public void requestUnsubscribe( @Nonnull final ChannelAddress address )
  {
  }

  @Override
  public int indexOfPendingAreaOfInterestAction( @Nonnull final AreaOfInterestAction action,
                                                 @Nonnull final ChannelAddress address,
                                                 @Nullable final Object filter )
  {
    return -1;
  }
}

@@ -260,86 +260,8 @@
 er;%0A
-import org.realityforge.replicant.client.transport.DataLoaderListenerSupport;%0A
 impo
@@ -605,102 +605,8 @@
 led;
-%0A  private final DataLoaderListenerSupport _listenerSupport = new DataLoaderListenerSupport();
 %0A%0A  
@@ -1387,23 +1387,20 @@
  public 
-boolean
+void
  addData
@@ -1468,61 +1468,8 @@
   %7B%0A
-    return _listenerSupport.addListener( listener );%0A
   %7D%0A
@@ -1490,23 +1490,20 @@
  public 
-boolean
+void
  removeD
@@ -1574,144 +1574,8 @@
   %7B%0A
-    return _listenerSupport.removeListener( listener );%0A  %7D%0A%0A  DataLoaderListenerSupport getListener()%0A  %7B%0A    return _listenerSupport;%0A
   %7D%0A

Remove unused listener support