All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.stapi.test.disabledImplementations.DisabledQueryGateway Maven / Gradle / Ivy

There is a newer version: 0.2.3
Show newest version
package ai.stapi.test.disabledImplementations;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import org.axonframework.common.Registration;
import org.axonframework.messaging.MessageDispatchInterceptor;
import org.axonframework.messaging.responsetypes.ResponseType;
import org.axonframework.queryhandling.QueryGateway;
import org.axonframework.queryhandling.QueryMessage;
import org.axonframework.queryhandling.SubscriptionQueryBackpressure;
import org.axonframework.queryhandling.SubscriptionQueryResult;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.reactivestreams.Publisher;

public class DisabledQueryGateway implements QueryGateway {

  @Override
  public  CompletableFuture query(
      @NotNull String queryName,
      @NotNull Q query,
      @NotNull ResponseType responseType
  ) {
    throw InvalidTestOperation.becauseTestCaseDoesntAllowQuerying();
  }

  @Override
  public  Publisher streamingQuery(
      String queryName,
      Q query,
      Class responseType
  ) {
    throw InvalidTestOperation.becauseTestCaseDoesntAllowQuerying();
  }

  @Override
  public  Stream scatterGather(
      @NotNull String queryName,
      @NotNull Q query,
      @NotNull ResponseType responseType,
      long timeout,
      @NotNull TimeUnit timeUnit
  ) {
    throw InvalidTestOperation.becauseTestCaseDoesntAllowQuerying();
  }

  @Override
  public  SubscriptionQueryResult subscriptionQuery(
      @NotNull String queryName,
      @NotNull Q query,
      @NotNull ResponseType initialResponseType,
      @NotNull ResponseType updateResponseType,
      @Nullable SubscriptionQueryBackpressure backpressure,
      int updateBufferSize
  ) {
    throw InvalidTestOperation.becauseTestCaseDoesntAllowQuerying();
  }

  @Override
  public  SubscriptionQueryResult subscriptionQuery(
      @NotNull String queryName,
      @NotNull Q query,
      @NotNull ResponseType initialResponseType,
      @NotNull ResponseType updateResponseType,
      int updateBufferSize
  ) {
    throw InvalidTestOperation.becauseTestCaseDoesntAllowQuerying();
  }

  @Override
  public Registration registerDispatchInterceptor(
      @NotNull MessageDispatchInterceptor> dispatchInterceptor
  ) {
    return () -> false;
  }
}