public abstract class IdentityProcessorVerification<T> extends WithHelperPublisher<T> implements SubscriberWhiteboxVerificationRules, PublisherVerificationRules
Modifier and Type | Class and Description |
---|---|
class |
IdentityProcessorVerification.ManualSubscriberWithErrorCollection<A> |
class |
IdentityProcessorVerification.TestSetup |
Constructor and Description |
---|
IdentityProcessorVerification(TestEnvironment env)
Test class must specify the expected time it takes for the publisher to
shut itself down when the the last downstream
Subscription is cancelled. |
IdentityProcessorVerification(TestEnvironment env,
long publisherReferenceGCTimeoutMillis)
Test class must specify the expected time it takes for the publisher to
shut itself down when the the last downstream
Subscription is cancelled. |
IdentityProcessorVerification(TestEnvironment env,
long publisherReferenceGCTimeoutMillis,
int processorBufferSize)
Test class must specify the expected time it takes for the publisher to
shut itself down when the the last downstream
Subscription is cancelled. |
createElement, createHelperPublisher, publisherExecutorService
public IdentityProcessorVerification(TestEnvironment env)
Subscription
is cancelled.
The processor will be required to be able to buffer TestEnvironment.TEST_BUFFER_SIZE
elements.public IdentityProcessorVerification(TestEnvironment env, long publisherReferenceGCTimeoutMillis)
Subscription
is cancelled.
The processor will be required to be able to buffer TestEnvironment.TEST_BUFFER_SIZE
elements.publisherReferenceGCTimeoutMillis
- used to determine after how much time a reference to a Subscriber should be already dropped by the Publisher.public IdentityProcessorVerification(TestEnvironment env, long publisherReferenceGCTimeoutMillis, int processorBufferSize)
Subscription
is cancelled.publisherReferenceGCTimeoutMillis
- used to determine after how much time a reference to a Subscriber should be already dropped by the Publisher.processorBufferSize
- number of elements the processor is required to be able to buffer.public abstract org.reactivestreams.Processor<T,T> createIdentityProcessor(int bufferSize)
bufferSize
- number of elements the processor is required to be able to buffer.public abstract org.reactivestreams.Publisher<T> createFailedPublisher()
Publisher
returned by this method is hand out a subscription,
followed by signalling onError
on it, as specified by Rule 1.9.
If you ignore these additional tests, return null
from this method.public long maxElementsFromPublisher()
1
from this method.
Defaults to Long.MAX_VALUE - 1
, meaning that the Publisher can be produce a huge but NOT an unbounded number of elements.
To mark your Publisher will *never* signal an onComplete
override this method and return Long.MAX_VALUE
,
which will result in *skipping all tests which require an onComplete to be triggered* (!).public long boundedDepthOfOnNextAndRequestRecursion()
Subscription
actually solves the "unbounded recursion" problem by not allowing the number of
recursive calls to exceed the number returned by this method.public boolean skipStochasticTests()
true
in order to skip executing tests marked as Stochastic
.
Such tests MAY sometimes fail even though the implpublic long maxSupportedSubscribers()
Publisher
under test to support multiple Subscribers,
yet the spec does not require all publishers to be able to do so, thus – if an implementation
supports only a limited number of subscribers (e.g. only 1 subscriber, also known as "no fanout")
you MUST return that number from this method by overriding it.public void setUp() throws java.lang.Exception
java.lang.Exception
public org.reactivestreams.Publisher<T> createPublisher(long elements)
public void required_validate_maxElementsFromPublisher() throws java.lang.Exception
required_validate_maxElementsFromPublisher
in interface PublisherVerificationRules
java.lang.Exception
public void required_validate_boundedDepthOfOnNextAndRequestRecursion() throws java.lang.Exception
required_validate_boundedDepthOfOnNextAndRequestRecursion
in interface PublisherVerificationRules
java.lang.Exception
public void required_createPublisher1MustProduceAStreamOfExactly1Element() throws java.lang.Throwable
required_createPublisher1MustProduceAStreamOfExactly1Element
in interface PublisherVerificationRules
java.lang.Throwable
public void required_createPublisher3MustProduceAStreamOfExactly3Elements() throws java.lang.Throwable
required_createPublisher3MustProduceAStreamOfExactly3Elements
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements() throws java.lang.Throwable
required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec102_maySignalLessThanRequestedAndTerminateSubscription() throws java.lang.Throwable
required_spec102_maySignalLessThanRequestedAndTerminateSubscription
in interface PublisherVerificationRules
java.lang.Throwable
public void stochastic_spec103_mustSignalOnMethodsSequentially() throws java.lang.Throwable
stochastic_spec103_mustSignalOnMethodsSequentially
in interface PublisherVerificationRules
java.lang.Throwable
public void optional_spec104_mustSignalOnErrorWhenFails() throws java.lang.Throwable
optional_spec104_mustSignalOnErrorWhenFails
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates() throws java.lang.Throwable
required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates
in interface PublisherVerificationRules
java.lang.Throwable
public void optional_spec105_emptyStreamMustTerminateBySignallingOnComplete() throws java.lang.Throwable
optional_spec105_emptyStreamMustTerminateBySignallingOnComplete
in interface PublisherVerificationRules
java.lang.Throwable
public void untested_spec106_mustConsiderSubscriptionCancelledAfterOnErrorOrOnCompleteHasBeenCalled() throws java.lang.Throwable
untested_spec106_mustConsiderSubscriptionCancelledAfterOnErrorOrOnCompleteHasBeenCalled
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled() throws java.lang.Throwable
required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled
in interface PublisherVerificationRules
java.lang.Throwable
public void untested_spec107_mustNotEmitFurtherSignalsOnceOnErrorHasBeenSignalled() throws java.lang.Throwable
untested_spec107_mustNotEmitFurtherSignalsOnceOnErrorHasBeenSignalled
in interface PublisherVerificationRules
java.lang.Throwable
public void untested_spec108_possiblyCanceledSubscriptionShouldNotReceiveOnErrorOrOnCompleteSignals() throws java.lang.Throwable
untested_spec108_possiblyCanceledSubscriptionShouldNotReceiveOnErrorOrOnCompleteSignals
in interface PublisherVerificationRules
java.lang.Throwable
public void untested_spec109_subscribeShouldNotThrowNonFatalThrowable() throws java.lang.Throwable
untested_spec109_subscribeShouldNotThrowNonFatalThrowable
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec109_subscribeThrowNPEOnNullSubscriber() throws java.lang.Throwable
required_spec109_subscribeThrowNPEOnNullSubscriber
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe() throws java.lang.Throwable
required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec109_mustIssueOnSubscribeForNonNullSubscriber() throws java.lang.Throwable
required_spec109_mustIssueOnSubscribeForNonNullSubscriber
in interface PublisherVerificationRules
java.lang.Throwable
public void untested_spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice() throws java.lang.Throwable
untested_spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice
in interface PublisherVerificationRules
java.lang.Throwable
public void optional_spec111_maySupportMultiSubscribe() throws java.lang.Throwable
optional_spec111_maySupportMultiSubscribe
in interface PublisherVerificationRules
java.lang.Throwable
public void optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingOneByOne() throws java.lang.Throwable
optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingOneByOne
in interface PublisherVerificationRules
java.lang.Throwable
public void optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront() throws java.lang.Throwable
optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront
in interface PublisherVerificationRules
java.lang.Throwable
public void optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected() throws java.lang.Throwable
optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe() throws java.lang.Throwable
required_spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec303_mustNotAllowUnboundedRecursion() throws java.lang.Throwable
required_spec303_mustNotAllowUnboundedRecursion
in interface PublisherVerificationRules
java.lang.Throwable
public void untested_spec304_requestShouldNotPerformHeavyComputations() throws java.lang.Exception
untested_spec304_requestShouldNotPerformHeavyComputations
in interface PublisherVerificationRules
java.lang.Exception
public void untested_spec305_cancelMustNotSynchronouslyPerformHeavyCompuatation() throws java.lang.Exception
untested_spec305_cancelMustNotSynchronouslyPerformHeavyCompuatation
in interface PublisherVerificationRules
java.lang.Exception
public void required_spec306_afterSubscriptionIsCancelledRequestMustBeNops() throws java.lang.Throwable
required_spec306_afterSubscriptionIsCancelledRequestMustBeNops
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops() throws java.lang.Throwable
required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec309_requestZeroMustSignalIllegalArgumentException() throws java.lang.Throwable
required_spec309_requestZeroMustSignalIllegalArgumentException
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec309_requestNegativeNumberMustSignalIllegalArgumentException() throws java.lang.Throwable
required_spec309_requestNegativeNumberMustSignalIllegalArgumentException
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling() throws java.lang.Throwable
required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber() throws java.lang.Throwable
required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec317_mustSupportAPendingElementCountUpToLongMaxValue() throws java.lang.Throwable
required_spec317_mustSupportAPendingElementCountUpToLongMaxValue
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue() throws java.lang.Throwable
required_spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue() throws java.lang.Throwable
required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue
in interface PublisherVerificationRules
java.lang.Throwable
public void required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError() throws java.lang.Throwable
java.lang.Throwable
public org.reactivestreams.Subscriber<T> createSubscriber(SubscriberWhiteboxVerification.WhiteboxSubscriberProbe<T> probe)
public void mustImmediatelyPassOnOnErrorEventsReceivedFromItsUpstreamToItsDownstream() throws java.lang.Exception
java.lang.Exception
public void required_exerciseWhiteboxHappyPath() throws java.lang.Throwable
required_exerciseWhiteboxHappyPath
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void required_spec201_mustSignalDemandViaSubscriptionRequest() throws java.lang.Throwable
required_spec201_mustSignalDemandViaSubscriptionRequest
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void untested_spec202_shouldAsynchronouslyDispatch() throws java.lang.Exception
untested_spec202_shouldAsynchronouslyDispatch
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete() throws java.lang.Throwable
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError() throws java.lang.Throwable
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError() throws java.lang.Exception
untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal() throws java.lang.Throwable
required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid() throws java.lang.Exception
untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void untested_spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization() throws java.lang.Exception
untested_spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel() throws java.lang.Throwable
required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall() throws java.lang.Throwable
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall() throws java.lang.Throwable
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall() throws java.lang.Throwable
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall() throws java.lang.Throwable
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents() throws java.lang.Exception
untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws java.lang.Throwable
untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void untested_spec213_failingOnSignalInvocation() throws java.lang.Exception
untested_spec213_failingOnSignalInvocation
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull() throws java.lang.Throwable
required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull() throws java.lang.Throwable
required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull() throws java.lang.Throwable
required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void untested_spec301_mustNotBeCalledOutsideSubscriberContext() throws java.lang.Exception
untested_spec301_mustNotBeCalledOutsideSubscriberContext
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void required_spec308_requestMustRegisterGivenNumberElementsToBeProduced() throws java.lang.Throwable
required_spec308_requestMustRegisterGivenNumberElementsToBeProduced
in interface SubscriberWhiteboxVerificationRules
java.lang.Throwable
public void untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber() throws java.lang.Exception
untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError() throws java.lang.Exception
untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists() throws java.lang.Exception
untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError() throws java.lang.Exception
untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber() throws java.lang.Exception
untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber
in interface SubscriberWhiteboxVerificationRules
java.lang.Exception
public void required_mustRequestFromUpstreamForElementsThatHaveBeenRequestedLongAgo() throws java.lang.Throwable
java.lang.Throwable
public void notVerified()
public void notVerified(java.lang.String message)
public void optionalMultipleSubscribersTest(long requiredSubscribersSupport, Function<java.lang.Long,IdentityProcessorVerification.TestSetup> body) throws java.lang.Throwable
java.lang.Throwable