test_class.declarator: SORT = "sort(+/attributes/counter,+/thingId)"
test_class.modifier: private static final
test_class.original_string: private static final String SORT = "sort(+/attributes/counter,+/thingId)";
test_class.type: String
test_class.var_name: SORT
test_class.declarator: SORT_FIELDS = JsonFieldSelector.newInstance("attributes/counter", "thingId")
test_class.modifier: private static final
test_class.original_string: private static final JsonFieldSelector SORT_FIELDS = JsonFieldSelector.newInstance("attributes/counter", "thingId");
test_class.type: JsonFieldSelector
test_class.var_name: SORT_FIELDS
test_class.declarator: actorSystem
test_class.modifier: private
test_class.original_string: private ActorSystem actorSystem;
test_class.type: ActorSystem
test_class.var_name: actorSystem
test_class.declarator: materializer
test_class.modifier: private
test_class.original_string: private Materializer materializer;
test_class.type: Materializer
test_class.var_name: materializer
test_class.declarator: pubSubMediatorProbe
test_class.modifier: private
test_class.original_string: private TestProbe pubSubMediatorProbe;
test_class.type: TestProbe
test_class.var_name: pubSubMediatorProbe
test_class.declarator: conciergeForwarderProbe
test_class.modifier: private
test_class.original_string: private TestProbe conciergeForwarderProbe;
test_class.type: TestProbe
test_class.var_name: conciergeForwarderProbe
test_class.declarator: dittoHeaders
test_class.modifier: private
test_class.original_string: private DittoHeaders dittoHeaders;
test_class.type: DittoHeaders
test_class.var_name: dittoHeaders
test_class.declarator: sourceProbe
test_class.modifier: private
test_class.original_string: private TestPublisher.Probe<Object> sourceProbe;
test_class.type: TestPublisher.Probe<Object>
test_class.var_name: sourceProbe
test_class.declarator: sinkProbe
test_class.modifier: private
test_class.original_string: private TestSubscriber.Probe<Object> sinkProbe;
test_class.type: TestSubscriber.Probe<Object>
test_class.var_name: sinkProbe
test_class.file: services/utils/search/src/test/java/org/eclipse/ditto/services/utils/search/SearchSourceTest.java
test_class.identifier: SearchSourceTest
test_case.body: @Test
      public void cursorDeleted() {
          // Turn off logging to suppress stack trace. Comment out to debug.
          actorSystem.eventStream().setLogLevel(Attributes.logLevelOff());
  
          startTestSearchSource(null, null);
          sinkProbe.request(200L);
          conciergeForwarderProbe.expectMsg(streamThings(null));
          conciergeForwarderProbe.reply(materializeSourceProbe());
  
          // GIVEN: first search result goes through
          sourceProbe.expectRequest();
          sourceProbe.sendNext("t:3");
          conciergeForwarderProbe.expectMsg(retrieveThing("t:3", null));
          conciergeForwarderProbe.reply(retrieveThingResponse(3));
          sinkProbe.expectNext(getThing(3).toJson());
  
          // WHEN: search persistence deleted the cursor
          sourceProbe.sendError(new IllegalStateException("mock cursor-not-found error"));
  
          // THEN: the final thing is retrieved again to compute the cursor
          conciergeForwarderProbe.expectMsg(retrieveThing("t:3", SORT_FIELDS));
          conciergeForwarderProbe.reply(retrieveThingResponse(3));
  
          // THEN: stream resumes from the last result
          conciergeForwarderProbe.expectMsg(streamThings(JsonArray.of(997, "t:3")));
          conciergeForwarderProbe.reply(materializeSourceProbe());
          sourceProbe.expectRequest();
          sourceProbe.sendNext("t:2").sendComplete();
          conciergeForwarderProbe.expectMsg(retrieveThing("t:2", null));
          conciergeForwarderProbe.reply(retrieveThingResponse(2));
          sinkProbe.expectNext(getThing(2).toJson())
                  .expectComplete();
      }
test_case.class_method_signature: SearchSourceTest.cursorDeleted()
test_case.full_signature: @Test public void cursorDeleted()
test_case.identifier: cursorDeleted
test_case.invocations: setLogLevel eventStream logLevelOff startTestSearchSource request expectMsg streamThings reply materializeSourceProbe expectRequest sendNext expectMsg retrieveThing reply retrieveThingResponse expectNext toJson getThing sendError expectMsg retrieveThing reply retrieveThingResponse expectMsg streamThings of reply materializeSourceProbe expectRequest sendComplete sendNext expectMsg retrieveThing reply retrieveThingResponse expectComplete expectNext toJson getThing
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void cursorDeleted()
focal_class.declarator: LOGGER = DittoLoggerFactory.getLogger(SearchSource.class)
focal_class.modifier: private final
focal_class.original_string: private final DittoLogger LOGGER = DittoLoggerFactory.getLogger(SearchSource.class);
focal_class.type: DittoLogger
focal_class.var_name: LOGGER
focal_class.declarator: pubSubMediator
focal_class.modifier: private final
focal_class.original_string: private final ActorRef pubSubMediator;
focal_class.type: ActorRef
focal_class.var_name: pubSubMediator
focal_class.declarator: conciergeForwarder
focal_class.modifier: private final
focal_class.original_string: private final ActorRef conciergeForwarder;
focal_class.type: ActorRef
focal_class.var_name: conciergeForwarder
focal_class.declarator: thingsAskTimeout
focal_class.modifier: private final
focal_class.original_string: private final Duration thingsAskTimeout;
focal_class.type: Duration
focal_class.var_name: thingsAskTimeout
focal_class.declarator: searchAskTimeout
focal_class.modifier: private final
focal_class.original_string: private final Duration searchAskTimeout;
focal_class.type: Duration
focal_class.var_name: searchAskTimeout
focal_class.declarator: fields
focal_class.modifier: @Nullable private final
focal_class.original_string: @Nullable private final JsonFieldSelector fields;
focal_class.type: JsonFieldSelector
focal_class.var_name: fields
focal_class.declarator: sortFields
focal_class.modifier: private final
focal_class.original_string: private final JsonFieldSelector sortFields;
focal_class.type: JsonFieldSelector
focal_class.var_name: sortFields
focal_class.declarator: streamThings
focal_class.modifier: private final
focal_class.original_string: private final StreamThings streamThings;
focal_class.type: StreamThings
focal_class.var_name: streamThings
focal_class.declarator: thingIdOnly
focal_class.modifier: private final
focal_class.original_string: private final boolean thingIdOnly;
focal_class.type: boolean
focal_class.var_name: thingIdOnly
focal_class.declarator: lastThingId
focal_class.modifier: private final
focal_class.original_string: private final String lastThingId;
focal_class.type: String
focal_class.var_name: lastThingId
focal_class.file: services/utils/search/src/main/java/org/eclipse/ditto/services/utils/search/SearchSource.java
focal_class.identifier: SearchSource
focal_class.class_method_signature: SearchSource.SearchSource(final ActorRef pubSubMediator,
              final ActorRef conciergeForwarder,
              final Duration thingsAskTimeout,
              final Duration searchAskTimeout,
              @Nullable final JsonFieldSelector fields,
              final JsonFieldSelector sortFields,
              final StreamThings streamThings,
              final String lastThingId)
focal_class.full_signature:   SearchSource(final ActorRef pubSubMediator,
              final ActorRef conciergeForwarder,
              final Duration thingsAskTimeout,
              final Duration searchAskTimeout,
              @Nullable final JsonFieldSelector fields,
              final JsonFieldSelector sortFields,
              final StreamThings streamThings,
              final String lastThingId)
focal_class.identifier: SearchSource
focal_class.parameters: (final ActorRef pubSubMediator,
              final ActorRef conciergeForwarder,
              final Duration thingsAskTimeout,
              final Duration searchAskTimeout,
              @Nullable final JsonFieldSelector fields,
              final JsonFieldSelector sortFields,
              final StreamThings streamThings,
              final String lastThingId)
focal_class.signature:  SearchSource(final ActorRef pubSubMediator,
              final ActorRef conciergeForwarder,
              final Duration thingsAskTimeout,
              final Duration searchAskTimeout,
              @Nullable final JsonFieldSelector fields,
              final JsonFieldSelector sortFields,
              final StreamThings streamThings,
              final String lastThingId)
focal_class.class_method_signature: SearchSource.newBuilder()
focal_class.full_signature: public static SearchSourceBuilder newBuilder()
focal_class.identifier: newBuilder
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: SearchSourceBuilder
focal_class.signature: SearchSourceBuilder newBuilder()
focal_class.class_method_signature: SearchSource.start(final Consumer<ResumeSourceBuilder<?, ?>> configurer)
focal_class.full_signature: public Source<JsonObject, NotUsed> start(final Consumer<ResumeSourceBuilder<?, ?>> configurer)
focal_class.identifier: start
focal_class.modifiers: public
focal_class.parameters: (final Consumer<ResumeSourceBuilder<?, ?>> configurer)
focal_class.return: Source<JsonObject, NotUsed>
focal_class.signature: Source<JsonObject, NotUsed> start(final Consumer<ResumeSourceBuilder<?, ?>> configurer)
focal_class.class_method_signature: SearchSource.startAsPair(final Consumer<ResumeSourceBuilder<?, ?>> configurer)
focal_class.full_signature: public Source<Pair<String, JsonObject>, NotUsed> startAsPair(final Consumer<ResumeSourceBuilder<?, ?>> configurer)
focal_class.identifier: startAsPair
focal_class.modifiers: public
focal_class.parameters: (final Consumer<ResumeSourceBuilder<?, ?>> configurer)
focal_class.return: Source<Pair<String, JsonObject>, NotUsed>
focal_class.signature: Source<Pair<String, JsonObject>, NotUsed> startAsPair(final Consumer<ResumeSourceBuilder<?, ?>> configurer)
focal_class.class_method_signature: SearchSource.mapError(final Throwable error)
focal_class.full_signature: private Optional<Throwable> mapError(final Throwable error)
focal_class.identifier: mapError
focal_class.modifiers: private
focal_class.parameters: (final Throwable error)
focal_class.return: Optional<Throwable>
focal_class.signature: Optional<Throwable> mapError(final Throwable error)
focal_class.class_method_signature: SearchSource.resume(final String lastThingId)
focal_class.full_signature: private Source<Pair<String, JsonObject>, NotUsed> resume(final String lastThingId)
focal_class.identifier: resume
focal_class.modifiers: private
focal_class.parameters: (final String lastThingId)
focal_class.return: Source<Pair<String, JsonObject>, NotUsed>
focal_class.signature: Source<Pair<String, JsonObject>, NotUsed> resume(final String lastThingId)
focal_class.class_method_signature: SearchSource.nextSeed(final List<Pair<String, JsonObject>> finalElements)
focal_class.full_signature: private String nextSeed(final List<Pair<String, JsonObject>> finalElements)
focal_class.identifier: nextSeed
focal_class.modifiers: private
focal_class.parameters: (final List<Pair<String, JsonObject>> finalElements)
focal_class.return: String
focal_class.signature: String nextSeed(final List<Pair<String, JsonObject>> finalElements)
focal_class.class_method_signature: SearchSource.streamThingsFrom(final String lastThingId)
focal_class.full_signature: private Source<StreamThings, NotUsed> streamThingsFrom(final String lastThingId)
focal_class.identifier: streamThingsFrom
focal_class.modifiers: private
focal_class.parameters: (final String lastThingId)
focal_class.return: Source<StreamThings, NotUsed>
focal_class.signature: Source<StreamThings, NotUsed> streamThingsFrom(final String lastThingId)
focal_class.class_method_signature: SearchSource.retrieveSortValues(final String thingId)
focal_class.full_signature: private Source<JsonArray, NotUsed> retrieveSortValues(final String thingId)
focal_class.identifier: retrieveSortValues
focal_class.modifiers: private
focal_class.parameters: (final String thingId)
focal_class.return: Source<JsonArray, NotUsed>
focal_class.signature: Source<JsonArray, NotUsed> retrieveSortValues(final String thingId)
focal_class.class_method_signature: SearchSource.retrieveThingForElement(final String thingId)
focal_class.full_signature: private Source<Pair<String, JsonObject>, NotUsed> retrieveThingForElement(final String thingId)
focal_class.identifier: retrieveThingForElement
focal_class.modifiers: private
focal_class.parameters: (final String thingId)
focal_class.return: Source<Pair<String, JsonObject>, NotUsed>
focal_class.signature: Source<Pair<String, JsonObject>, NotUsed> retrieveThingForElement(final String thingId)
focal_class.class_method_signature: SearchSource.retrieveThing(final String thingId,
              @Nullable final JsonFieldSelector selector)
focal_class.full_signature: private Source<JsonObject, NotUsed> retrieveThing(final String thingId,
              @Nullable final JsonFieldSelector selector)
focal_class.identifier: retrieveThing
focal_class.modifiers: private
focal_class.parameters: (final String thingId,
              @Nullable final JsonFieldSelector selector)
focal_class.return: Source<JsonObject, NotUsed>
focal_class.signature: Source<JsonObject, NotUsed> retrieveThing(final String thingId,
              @Nullable final JsonFieldSelector selector)
focal_class.class_method_signature: SearchSource.getDittoHeaders()
focal_class.full_signature: private DittoHeaders getDittoHeaders()
focal_class.identifier: getDittoHeaders
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: DittoHeaders
focal_class.signature: DittoHeaders getDittoHeaders()
focal_class.class_method_signature: SearchSource.expectMsgClass(final Class<T> clazz)
focal_class.full_signature: private Flow<Object, T, NotUsed> expectMsgClass(final Class<T> clazz)
focal_class.identifier: expectMsgClass
focal_class.modifiers: private
focal_class.parameters: (final Class<T> clazz)
focal_class.return: Flow<Object, T, NotUsed>
focal_class.signature: Flow<Object, T, NotUsed> expectMsgClass(final Class<T> clazz)
focal_method.body: private Source<JsonObject, NotUsed> retrieveThing(final String thingId,
              @Nullable final JsonFieldSelector selector) {
          final RetrieveThing retrieveThing = RetrieveThing.getBuilder(ThingId.of(thingId), getDittoHeaders())
                  .withSelectedFields(selector)
                  .build();
  
          final CompletionStage<Object> responseFuture =
                  Patterns.ask(conciergeForwarder, retrieveThing, thingsAskTimeout);
  
          return Source.fromCompletionStage(responseFuture)
                  .via(expectMsgClass(RetrieveThingResponse.class))
                  .map(response -> response.getEntity().asObject());
      }
focal_method.class_method_signature: SearchSource.retrieveThing(final String thingId,
              @Nullable final JsonFieldSelector selector)
focal_method.full_signature: private Source<JsonObject, NotUsed> retrieveThing(final String thingId,
              @Nullable final JsonFieldSelector selector)
focal_method.identifier: retrieveThing
focal_method.invocations: build withSelectedFields getBuilder of getDittoHeaders ask map via fromCompletionStage expectMsgClass asObject getEntity
focal_method.modifiers: private
focal_method.parameters: (final String thingId,
              @Nullable final JsonFieldSelector selector)
focal_method.return: Source<JsonObject, NotUsed>
focal_method.signature: Source<JsonObject, NotUsed> retrieveThing(final String thingId,
              @Nullable final JsonFieldSelector selector)