test_class.declarator: actorSystem = ActorSystem.create("test", ConfigFactory.load("test"))
test_class.modifier: private static final
test_class.original_string: private static final ActorSystem actorSystem = ActorSystem.create("test", ConfigFactory.load("test"));
test_class.type: ActorSystem
test_class.var_name: actorSystem
test_class.declarator: conciergeForwarderActorProbe
test_class.modifier: private
test_class.original_string: private TestProbe conciergeForwarderActorProbe;
test_class.type: TestProbe
test_class.var_name: conciergeForwarderActorProbe
test_class.declarator: sut
test_class.modifier: private
test_class.original_string: private PolicyIdReferencePlaceholderResolver sut;
test_class.type: PolicyIdReferencePlaceholderResolver
test_class.var_name: sut
test_class.declarator: THING_ID = ThingId.of("namespace:myThing")
test_class.modifier: private static final
test_class.original_string: private static final ThingId THING_ID = ThingId.of("namespace:myThing");
test_class.type: ThingId
test_class.var_name: THING_ID
test_class.file: services/concierge/enforcement/src/test/java/org/eclipse/ditto/services/concierge/enforcement/placeholders/references/PolicyIdReferencePlaceholderResolverTest.java
test_class.identifier: PolicyIdReferencePlaceholderResolverTest
test_case.body: @Test
      public void resolvePolicyIdFromThingThrowsExceptionIfResponseIsNotExpected() {
  
          final ReferencePlaceholder referencePlaceholder =
                  ReferencePlaceholder.fromCharSequence("{{ ref:things/" + THING_ID + "/policyId }}")
                          .orElseThrow(IllegalStateException::new);
  
          final CompletionStage<String> policyIdCS = sut.resolve(referencePlaceholder, DittoHeaders.empty());
  
          final RetrieveThing retrieveThing = conciergeForwarderActorProbe.expectMsgClass(RetrieveThing.class);
          assertThat((CharSequence) retrieveThing.getThingEntityId()).isEqualTo(THING_ID);
          assertThat(retrieveThing.getSelectedFields()).contains(JsonFieldSelector.newInstance("policyId"));
  
          conciergeForwarderActorProbe.reply("someThingUnexpected");
  
          Awaitility.await()
                  .atMost(org.awaitility.Duration.ONE_SECOND)
                  .until(() -> policyIdCS.toCompletableFuture().isDone());
          assertThat(policyIdCS.toCompletableFuture())
                  .hasFailedWithThrowableThat()
                  .isInstanceOf(GatewayInternalErrorException.class);
      }
test_case.class_method_signature: PolicyIdReferencePlaceholderResolverTest.resolvePolicyIdFromThingThrowsExceptionIfResponseIsNotExpected()
test_case.full_signature: @Test public void resolvePolicyIdFromThingThrowsExceptionIfResponseIsNotExpected()
test_case.identifier: resolvePolicyIdFromThingThrowsExceptionIfResponseIsNotExpected
test_case.invocations: orElseThrow fromCharSequence resolve empty expectMsgClass isEqualTo assertThat getThingEntityId contains assertThat getSelectedFields newInstance reply until atMost await isDone toCompletableFuture isInstanceOf hasFailedWithThrowableThat assertThat toCompletableFuture
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void resolvePolicyIdFromThingThrowsExceptionIfResponseIsNotExpected()
focal_class.declarator: LOGGER = DittoLoggerFactory.getLogger(PolicyIdReferencePlaceholderResolver.class)
focal_class.modifier: private static final
focal_class.original_string: private static final DittoLogger LOGGER = DittoLoggerFactory.getLogger(PolicyIdReferencePlaceholderResolver.class);
focal_class.type: DittoLogger
focal_class.var_name: LOGGER
focal_class.declarator: retrieveEntityTimeoutDuration
focal_class.modifier: private final
focal_class.original_string: private final Duration retrieveEntityTimeoutDuration;
focal_class.type: Duration
focal_class.var_name: retrieveEntityTimeoutDuration
focal_class.declarator: conciergeForwarderActor
focal_class.modifier: private final
focal_class.original_string: private final ActorRef conciergeForwarderActor;
focal_class.type: ActorRef
focal_class.var_name: conciergeForwarderActor
focal_class.declarator: supportedEntityTypesToActionMap = new EnumMap<>(ReferencePlaceholder.ReferencedEntityType.class)
focal_class.modifier: private final
focal_class.original_string: private final Map<ReferencePlaceholder.ReferencedEntityType, ResolveEntityReferenceStrategy>
              supportedEntityTypesToActionMap = new EnumMap<>(ReferencePlaceholder.ReferencedEntityType.class);
focal_class.type: Map<ReferencePlaceholder.ReferencedEntityType, ResolveEntityReferenceStrategy>
focal_class.var_name: supportedEntityTypesToActionMap
focal_class.declarator: supportedEntityTypeNames
focal_class.modifier: private final
focal_class.original_string: private final Set<CharSequence> supportedEntityTypeNames;
focal_class.type: Set<CharSequence>
focal_class.var_name: supportedEntityTypeNames
focal_class.file: services/concierge/enforcement/src/main/java/org/eclipse/ditto/services/concierge/enforcement/placeholders/references/PolicyIdReferencePlaceholderResolver.java
focal_class.identifier: PolicyIdReferencePlaceholderResolver
focal_class.interfaces: implements ReferencePlaceholderResolver<String>
focal_class.class_method_signature: PolicyIdReferencePlaceholderResolver.PolicyIdReferencePlaceholderResolver(final ActorRef conciergeForwarderActor,
              final Duration retrieveEntityTimeoutDuration)
focal_class.full_signature: private  PolicyIdReferencePlaceholderResolver(final ActorRef conciergeForwarderActor,
              final Duration retrieveEntityTimeoutDuration)
focal_class.identifier: PolicyIdReferencePlaceholderResolver
focal_class.modifiers: private
focal_class.parameters: (final ActorRef conciergeForwarderActor,
              final Duration retrieveEntityTimeoutDuration)
focal_class.signature:  PolicyIdReferencePlaceholderResolver(final ActorRef conciergeForwarderActor,
              final Duration retrieveEntityTimeoutDuration)
focal_class.class_method_signature: PolicyIdReferencePlaceholderResolver.initializeSupportedEntityTypeReferences()
focal_class.full_signature: private void initializeSupportedEntityTypeReferences()
focal_class.identifier: initializeSupportedEntityTypeReferences
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void initializeSupportedEntityTypeReferences()
focal_class.class_method_signature: PolicyIdReferencePlaceholderResolver.resolve(final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_class.full_signature: @Override public CompletionStage<String> resolve(final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_class.identifier: resolve
focal_class.modifiers: @Override public
focal_class.parameters: (final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_class.return: CompletionStage<String>
focal_class.signature: CompletionStage<String> resolve(final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_class.class_method_signature: PolicyIdReferencePlaceholderResolver.handlePolicyIdReference(final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_class.full_signature: private CompletionStage<String> handlePolicyIdReference(final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_class.identifier: handlePolicyIdReference
focal_class.modifiers: private
focal_class.parameters: (final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_class.return: CompletionStage<String>
focal_class.signature: CompletionStage<String> handlePolicyIdReference(final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_class.class_method_signature: PolicyIdReferencePlaceholderResolver.handleRetrieveThingResponse(final Object response,
              final ReferencePlaceholder referencePlaceholder, final DittoHeaders dittoHeaders)
focal_class.full_signature: private static String handleRetrieveThingResponse(final Object response,
              final ReferencePlaceholder referencePlaceholder, final DittoHeaders dittoHeaders)
focal_class.identifier: handleRetrieveThingResponse
focal_class.modifiers: private static
focal_class.parameters: (final Object response,
              final ReferencePlaceholder referencePlaceholder, final DittoHeaders dittoHeaders)
focal_class.return: String
focal_class.signature: String handleRetrieveThingResponse(final Object response,
              final ReferencePlaceholder referencePlaceholder, final DittoHeaders dittoHeaders)
focal_class.class_method_signature: PolicyIdReferencePlaceholderResolver.unknownFieldException(
              final ReferencePlaceholder placeholder, final DittoHeaders headers)
focal_class.full_signature: private static GatewayPlaceholderReferenceUnknownFieldException unknownFieldException(
              final ReferencePlaceholder placeholder, final DittoHeaders headers)
focal_class.identifier: unknownFieldException
focal_class.modifiers: private static
focal_class.parameters: (
              final ReferencePlaceholder placeholder, final DittoHeaders headers)
focal_class.return: GatewayPlaceholderReferenceUnknownFieldException
focal_class.signature: GatewayPlaceholderReferenceUnknownFieldException unknownFieldException(
              final ReferencePlaceholder placeholder, final DittoHeaders headers)
focal_class.class_method_signature: PolicyIdReferencePlaceholderResolver.notSupportedException(
              final CharSequence referencedEntityType, final DittoHeaders headers)
focal_class.full_signature: private GatewayPlaceholderReferenceNotSupportedException notSupportedException(
              final CharSequence referencedEntityType, final DittoHeaders headers)
focal_class.identifier: notSupportedException
focal_class.modifiers: private
focal_class.parameters: (
              final CharSequence referencedEntityType, final DittoHeaders headers)
focal_class.return: GatewayPlaceholderReferenceNotSupportedException
focal_class.signature: GatewayPlaceholderReferenceNotSupportedException notSupportedException(
              final CharSequence referencedEntityType, final DittoHeaders headers)
focal_class.class_method_signature: PolicyIdReferencePlaceholderResolver.of(final ActorRef conciergeForwarderActor,
              final Duration retrieveEntityTimeoutDuration)
focal_class.full_signature: public static PolicyIdReferencePlaceholderResolver of(final ActorRef conciergeForwarderActor,
              final Duration retrieveEntityTimeoutDuration)
focal_class.identifier: of
focal_class.modifiers: public static
focal_class.parameters: (final ActorRef conciergeForwarderActor,
              final Duration retrieveEntityTimeoutDuration)
focal_class.return: PolicyIdReferencePlaceholderResolver
focal_class.signature: PolicyIdReferencePlaceholderResolver of(final ActorRef conciergeForwarderActor,
              final Duration retrieveEntityTimeoutDuration)
focal_method.body: @Override
      public CompletionStage<String> resolve(final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders) {
  
          final ResolveEntityReferenceStrategy resolveEntityReferenceStrategy =
                  supportedEntityTypesToActionMap.get(referencePlaceholder.getReferencedEntityType());
  
          try (final AutoCloseableSlf4jLogger logger = LOGGER.setCorrelationId(dittoHeaders)) {
              if (null == resolveEntityReferenceStrategy) {
                  final String referencedEntityType = referencePlaceholder.getReferencedEntityType().name();
                  logger.info("Could not find a placeholder replacement strategy for entity type <{}> in supported" +
                          " entity types: {}", referencedEntityType, supportedEntityTypeNames);
                  throw notSupportedException(referencedEntityType, dittoHeaders);
              }
              logger.debug("Will resolve entity reference for placeholder: <{}>", referencePlaceholder);
          }
          return resolveEntityReferenceStrategy.handleEntityPolicyIdReference(referencePlaceholder, dittoHeaders);
      }
focal_method.class_method_signature: PolicyIdReferencePlaceholderResolver.resolve(final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_method.full_signature: @Override public CompletionStage<String> resolve(final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_method.identifier: resolve
focal_method.invocations: get getReferencedEntityType setCorrelationId name getReferencedEntityType info notSupportedException debug handleEntityPolicyIdReference
focal_method.modifiers: @Override public
focal_method.parameters: (final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)
focal_method.return: CompletionStage<String>
focal_method.signature: CompletionStage<String> resolve(final ReferencePlaceholder referencePlaceholder,
              final DittoHeaders dittoHeaders)