test_class.declarator: DITTO_PROTOCOL_ADAPTER = DittoProtocolAdapter.newInstance()
test_class.modifier: private static final
test_class.original_string: private static final DittoProtocolAdapter DITTO_PROTOCOL_ADAPTER = DittoProtocolAdapter.newInstance();
test_class.type: DittoProtocolAdapter
test_class.var_name: DITTO_PROTOCOL_ADAPTER
test_class.declarator: HEADER_HONO_DEVICE_ID = "device_id"
test_class.modifier: private static final
test_class.original_string: private static final String HEADER_HONO_DEVICE_ID = "device_id";
test_class.type: String
test_class.var_name: HEADER_HONO_DEVICE_ID
test_class.declarator: HEADER_HONO_GATEWAY_ID = "gateway_id"
test_class.modifier: private static final
test_class.original_string: private static final String HEADER_HONO_GATEWAY_ID = "gateway_id";
test_class.type: String
test_class.var_name: HEADER_HONO_GATEWAY_ID
test_class.declarator: THING_TEMPLATE = JsonObject.newBuilder()
              .set("thingId", "{{ header:device_id }}")
              .set("_copyPolicyFrom", "{{ header:gateway_id }}")
              .set("attributes", JsonObject.newBuilder()
                      .set("Info", JsonObject.newBuilder()
                              .set("gatewayId", "{{ header:gateway_id }}")
                              .build())
                      .build())
              .build()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject THING_TEMPLATE = JsonObject.newBuilder()
              .set("thingId", "{{ header:device_id }}")
              .set("_copyPolicyFrom", "{{ header:gateway_id }}")
              .set("attributes", JsonObject.newBuilder()
                      .set("Info", JsonObject.newBuilder()
                              .set("gatewayId", "{{ header:gateway_id }}")
                              .build())
                      .build())
              .build();
test_class.type: JsonObject
test_class.var_name: THING_TEMPLATE
test_class.declarator: COMMAND_HEADERS = JsonObject.newBuilder()
              .set("test-header", "this-is-a-test-header")
              .set("other-test-header", "{{ header:gateway_id }}")
              .set("empty-test-header", "{{ header:gateway_id | fn:filter(header:foobar, 'eq', 'bar') }}")
              .build()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject COMMAND_HEADERS = JsonObject.newBuilder()
              .set("test-header", "this-is-a-test-header")
              .set("other-test-header", "{{ header:gateway_id }}")
              .set("empty-test-header", "{{ header:gateway_id | fn:filter(header:foobar, 'eq', 'bar') }}")
              .build();
test_class.type: JsonObject
test_class.var_name: COMMAND_HEADERS
test_class.declarator: INITIAL_POLICY = Policy.newBuilder()
              .forLabel("DEFAULT")
              .setSubject(SubjectIssuer.INTEGRATION, "solutionId:connectionId")
              .setGrantedPermissions(PoliciesResourceType.policyResource("/"), READ, WRITE)
              .setGrantedPermissions(PoliciesResourceType.thingResource("/"), READ, WRITE)
              .setGrantedPermissions(PoliciesResourceType.messageResource("/"), READ, WRITE)
              .build()
              .toJson()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject INITIAL_POLICY = Policy.newBuilder()
              .forLabel("DEFAULT")
              .setSubject(SubjectIssuer.INTEGRATION, "solutionId:connectionId")
              .setGrantedPermissions(PoliciesResourceType.policyResource("/"), READ, WRITE)
              .setGrantedPermissions(PoliciesResourceType.thingResource("/"), READ, WRITE)
              .setGrantedPermissions(PoliciesResourceType.messageResource("/"), READ, WRITE)
              .build()
              .toJson();
test_class.type: JsonObject
test_class.var_name: INITIAL_POLICY
test_class.declarator: THING_TEMPLATE_WITH_POLICY = JsonObject.newBuilder()
              .set("thingId", "{{ header:device_id }}")
              .set("policyId", "{{ header:device_id }}")
              .set("_policy", INITIAL_POLICY)
              .set("attributes", JsonObject.newBuilder()
                      .set("Info", JsonObject.newBuilder()
                              .set("gatewayId", "{{ header:gateway_id }}")
                              .build())
                      .build())
              .build()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject THING_TEMPLATE_WITH_POLICY = JsonObject.newBuilder()
              .set("thingId", "{{ header:device_id }}")
              .set("policyId", "{{ header:device_id }}")
              .set("_policy", INITIAL_POLICY)
              .set("attributes", JsonObject.newBuilder()
                      .set("Info", JsonObject.newBuilder()
                              .set("gatewayId", "{{ header:gateway_id }}")
                              .build())
                      .build())
              .build();
test_class.type: JsonObject
test_class.var_name: THING_TEMPLATE_WITH_POLICY
test_class.declarator: THING_TEMPLATE_WITHOUT_PLACEHOLDERS = JsonObject.newBuilder()
              .set("thingId", "some:validThingId!")
              .set("policyId", "some:validPolicyId!")
              .set("attributes", JsonObject.newBuilder()
                      .set("Info", JsonObject.newBuilder()
                              .set("gatewayId", "some:validGatewayId!")
                              .build())
                      .build())
              .build()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject THING_TEMPLATE_WITHOUT_PLACEHOLDERS = JsonObject.newBuilder()
              .set("thingId", "some:validThingId!")
              .set("policyId", "some:validPolicyId!")
              .set("attributes", JsonObject.newBuilder()
                      .set("Info", JsonObject.newBuilder()
                              .set("gatewayId", "some:validGatewayId!")
                              .build())
                      .build())
              .build();
test_class.type: JsonObject
test_class.var_name: THING_TEMPLATE_WITHOUT_PLACEHOLDERS
test_class.declarator: GATEWAY_ID = "headerNamespace:headerGatewayId"
test_class.modifier: public static final
test_class.original_string: public static final String GATEWAY_ID = "headerNamespace:headerGatewayId";
test_class.type: String
test_class.var_name: GATEWAY_ID
test_class.declarator: DEVICE_ID = "headerNamespace:headerDeviceId"
test_class.modifier: public static final
test_class.original_string: public static final String DEVICE_ID = "headerNamespace:headerDeviceId";
test_class.type: String
test_class.var_name: DEVICE_ID
test_class.declarator: mappingConfig
test_class.modifier: private static
test_class.original_string: private static MappingConfig mappingConfig;
test_class.type: MappingConfig
test_class.var_name: mappingConfig
test_class.declarator: underTest
test_class.modifier: private
test_class.original_string: private MessageMapper underTest;
test_class.type: MessageMapper
test_class.var_name: underTest
test_class.file: services/connectivity/mapping/src/test/java/org/eclipse/ditto/services/connectivity/mapping/ImplicitThingCreationMessageMapperTest.java
test_class.identifier: ImplicitThingCreationMessageMapperTest
test_case.body: @Test
      public void doForwardWithoutPlaceholders() {
          final Map<String, String> headers = createValidHeaders();
          underTest.configure(mappingConfig, createMapperConfig(THING_TEMPLATE_WITHOUT_PLACEHOLDERS, COMMAND_HEADERS));
  
          final ExternalMessage externalMessage = ExternalMessageFactory.newExternalMessageBuilder(headers).build();
          final List<Adaptable> mappingResult = underTest.map(externalMessage);
  
          final Signal<?> firstMappedSignal = getFirstMappedSignal(mappingResult);
          assertThat(firstMappedSignal).isInstanceOf(CreateThing.class);
          final CreateThing createThing = (CreateThing) firstMappedSignal;
  
          final Thing expectedThing =
                  createExpectedThing("some:validThingId!", "some:validPolicyId!", "some:validGatewayId!");
          assertThat(createThing.getThing().getEntityId()).isEqualTo(expectedThing.getEntityId());
          assertThat(createThing.getThing().getPolicyEntityId()).isEqualTo(expectedThing.getPolicyEntityId());
      }
test_case.class_method_signature: ImplicitThingCreationMessageMapperTest.doForwardWithoutPlaceholders()
test_case.full_signature: @Test public void doForwardWithoutPlaceholders()
test_case.identifier: doForwardWithoutPlaceholders
test_case.invocations: createValidHeaders configure createMapperConfig build newExternalMessageBuilder map getFirstMappedSignal isInstanceOf assertThat createExpectedThing isEqualTo assertThat getEntityId getThing getEntityId isEqualTo assertThat getPolicyEntityId getThing getPolicyEntityId
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void doForwardWithoutPlaceholders()
focal_class.declarator: LOGGER = DittoLoggerFactory.getLogger(ImplicitThingCreationMessageMapper.class)
focal_class.modifier: private static final
focal_class.original_string: private static final DittoLogger LOGGER = DittoLoggerFactory.getLogger(ImplicitThingCreationMessageMapper.class);
focal_class.type: DittoLogger
focal_class.var_name: LOGGER
focal_class.declarator: DITTO_PROTOCOL_ADAPTER = DittoProtocolAdapter.newInstance()
focal_class.modifier: private static final
focal_class.original_string: private static final DittoProtocolAdapter DITTO_PROTOCOL_ADAPTER = DittoProtocolAdapter.newInstance();
focal_class.type: DittoProtocolAdapter
focal_class.var_name: DITTO_PROTOCOL_ADAPTER
focal_class.declarator: HEADERS_PLACEHOLDER = PlaceholderFactory.newHeadersPlaceholder()
focal_class.modifier: private static final
focal_class.original_string: private static final HeadersPlaceholder HEADERS_PLACEHOLDER = PlaceholderFactory.newHeadersPlaceholder();
focal_class.type: HeadersPlaceholder
focal_class.var_name: HEADERS_PLACEHOLDER
focal_class.declarator: THING_TEMPLATE = "thing"
focal_class.modifier: private static final
focal_class.original_string: private static final String THING_TEMPLATE = "thing";
focal_class.type: String
focal_class.var_name: THING_TEMPLATE
focal_class.declarator: ALLOW_POLICY_LOCKOUT_OPTION = "allowPolicyLockout"
focal_class.modifier: private static final
focal_class.original_string: private static final String ALLOW_POLICY_LOCKOUT_OPTION = "allowPolicyLockout";
focal_class.type: String
focal_class.var_name: ALLOW_POLICY_LOCKOUT_OPTION
focal_class.declarator: COMMAND_HEADERS = "commandHeaders"
focal_class.modifier: private static final
focal_class.original_string: private static final String COMMAND_HEADERS = "commandHeaders";
focal_class.type: String
focal_class.var_name: COMMAND_HEADERS
focal_class.declarator: THING_ID = "thingId"
focal_class.modifier: private static final
focal_class.original_string: private static final String THING_ID = "thingId";
focal_class.type: String
focal_class.var_name: THING_ID
focal_class.declarator: THING_ID_CONFIGURATION_PROPERTY = THING_TEMPLATE + "/" + THING_ID
focal_class.modifier: private static final
focal_class.original_string: private static final String THING_ID_CONFIGURATION_PROPERTY = THING_TEMPLATE + "/" + THING_ID;
focal_class.type: String
focal_class.var_name: THING_ID_CONFIGURATION_PROPERTY
focal_class.declarator: POLICY_ID = "policyId"
focal_class.modifier: private static final
focal_class.original_string: private static final String POLICY_ID = "policyId";
focal_class.type: String
focal_class.var_name: POLICY_ID
focal_class.declarator: POLICY_ID_CONFIGURATION_PROPERTY = THING_TEMPLATE + "/" + POLICY_ID
focal_class.modifier: private static final
focal_class.original_string: private static final String POLICY_ID_CONFIGURATION_PROPERTY = THING_TEMPLATE + "/" + POLICY_ID;
focal_class.type: String
focal_class.var_name: POLICY_ID_CONFIGURATION_PROPERTY
focal_class.declarator: thingTemplate
focal_class.modifier: private
focal_class.original_string: private String thingTemplate;
focal_class.type: String
focal_class.var_name: thingTemplate
focal_class.declarator: commandHeaders
focal_class.modifier: private
focal_class.original_string: private Map<String, String> commandHeaders;
focal_class.type: Map<String, String>
focal_class.var_name: commandHeaders
focal_class.declarator: allowPolicyLockout
focal_class.modifier: private
focal_class.original_string: private boolean allowPolicyLockout;
focal_class.type: boolean
focal_class.var_name: allowPolicyLockout
focal_class.file: services/connectivity/mapping/src/main/java/org/eclipse/ditto/services/connectivity/mapping/ImplicitThingCreationMessageMapper.java
focal_class.identifier: ImplicitThingCreationMessageMapper
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.doConfigure(final MappingConfig mappingConfig, final MessageMapperConfiguration configuration)
focal_class.full_signature: @Override protected void doConfigure(final MappingConfig mappingConfig, final MessageMapperConfiguration configuration)
focal_class.identifier: doConfigure
focal_class.modifiers: @Override protected
focal_class.parameters: (final MappingConfig mappingConfig, final MessageMapperConfiguration configuration)
focal_class.return: void
focal_class.signature: void doConfigure(final MappingConfig mappingConfig, final MessageMapperConfiguration configuration)
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.validateThingEntityId(final String thingId)
focal_class.full_signature: private static void validateThingEntityId(final String thingId)
focal_class.identifier: validateThingEntityId
focal_class.modifiers: private static
focal_class.parameters: (final String thingId)
focal_class.return: void
focal_class.signature: void validateThingEntityId(final String thingId)
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.validatePolicyEntityId(final String policyId)
focal_class.full_signature: private static void validatePolicyEntityId(final String policyId)
focal_class.identifier: validatePolicyEntityId
focal_class.modifiers: private static
focal_class.parameters: (final String policyId)
focal_class.return: void
focal_class.signature: void validatePolicyEntityId(final String policyId)
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.map(final ExternalMessage message)
focal_class.full_signature: @Override public List<Adaptable> map(final ExternalMessage message)
focal_class.identifier: map
focal_class.modifiers: @Override public
focal_class.parameters: (final ExternalMessage message)
focal_class.return: List<Adaptable>
focal_class.signature: List<Adaptable> map(final ExternalMessage message)
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.getExpressionResolver(final Map<String, String> headers)
focal_class.full_signature: private static ExpressionResolver getExpressionResolver(final Map<String, String> headers)
focal_class.identifier: getExpressionResolver
focal_class.modifiers: private static
focal_class.parameters: (final Map<String, String> headers)
focal_class.return: ExpressionResolver
focal_class.signature: ExpressionResolver getExpressionResolver(final Map<String, String> headers)
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.applyPlaceholderReplacement(final String template, final ExpressionResolver resolver)
focal_class.full_signature: private static String applyPlaceholderReplacement(final String template, final ExpressionResolver resolver)
focal_class.identifier: applyPlaceholderReplacement
focal_class.modifiers: private static
focal_class.parameters: (final String template, final ExpressionResolver resolver)
focal_class.return: String
focal_class.signature: String applyPlaceholderReplacement(final String template, final ExpressionResolver resolver)
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.getCreateThingSignal(final ExternalMessage message, final String template)
focal_class.full_signature: private Signal<CreateThing> getCreateThingSignal(final ExternalMessage message, final String template)
focal_class.identifier: getCreateThingSignal
focal_class.modifiers: private
focal_class.parameters: (final ExternalMessage message, final String template)
focal_class.return: Signal<CreateThing>
focal_class.signature: Signal<CreateThing> getCreateThingSignal(final ExternalMessage message, final String template)
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.resolveCommandHeaders(final ExternalMessage externalMessage,
              final Map<String, String> errorResponseHeaders)
focal_class.full_signature: private static Map<String, String> resolveCommandHeaders(final ExternalMessage externalMessage,
              final Map<String, String> errorResponseHeaders)
focal_class.identifier: resolveCommandHeaders
focal_class.modifiers: private static
focal_class.parameters: (final ExternalMessage externalMessage,
              final Map<String, String> errorResponseHeaders)
focal_class.return: Map<String, String>
focal_class.signature: Map<String, String> resolveCommandHeaders(final ExternalMessage externalMessage,
              final Map<String, String> errorResponseHeaders)
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.createInlinePolicyJson(final JsonObject thingJson)
focal_class.full_signature: @Nullable private static JsonObject createInlinePolicyJson(final JsonObject thingJson)
focal_class.identifier: createInlinePolicyJson
focal_class.modifiers: @Nullable private static
focal_class.parameters: (final JsonObject thingJson)
focal_class.return: JsonObject
focal_class.signature: JsonObject createInlinePolicyJson(final JsonObject thingJson)
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.getCopyPolicyFrom(final JsonObject thingJson)
focal_class.full_signature: @Nullable private static String getCopyPolicyFrom(final JsonObject thingJson)
focal_class.identifier: getCopyPolicyFrom
focal_class.modifiers: @Nullable private static
focal_class.parameters: (final JsonObject thingJson)
focal_class.return: String
focal_class.signature: String getCopyPolicyFrom(final JsonObject thingJson)
focal_class.class_method_signature: ImplicitThingCreationMessageMapper.map(final Adaptable adaptable)
focal_class.full_signature: @Override public List<ExternalMessage> map(final Adaptable adaptable)
focal_class.identifier: map
focal_class.modifiers: @Override public
focal_class.parameters: (final Adaptable adaptable)
focal_class.return: List<ExternalMessage>
focal_class.signature: List<ExternalMessage> map(final Adaptable adaptable)
focal_class.superclass: extends AbstractMessageMapper
focal_method.body: @Override
      public List<Adaptable> map(final ExternalMessage message) {
          LOGGER.withCorrelationId(message.getInternalHeaders()).debug("Received ExternalMessage: {}", message);
  
          final Map<String, String> externalHeaders = message.getHeaders();
          final ExpressionResolver expressionResolver = getExpressionResolver(externalHeaders);
  
          final String resolvedTemplate;
          if (Placeholders.containsAnyPlaceholder(thingTemplate)) {
              resolvedTemplate = applyPlaceholderReplacement(thingTemplate, expressionResolver);
          } else {
              resolvedTemplate = thingTemplate;
          }
  
          if (Placeholders.containsAnyPlaceholder(thingTemplate)) {
              commandHeaders = resolveCommandHeaders(message, commandHeaders);
          }
  
          final Signal<CreateThing> createThing = getCreateThingSignal(message, resolvedTemplate);
          final Adaptable adaptable = DITTO_PROTOCOL_ADAPTER.toAdaptable(createThing);
  
          // we cannot set the header on CreateThing directly because it is filtered when mapped to an adaptable
          final DittoHeaders modifiedHeaders =
                  adaptable.getDittoHeaders().toBuilder().allowPolicyLockout(allowPolicyLockout).build();
          final Adaptable adaptableWithModifiedHeaders = adaptable.setDittoHeaders(modifiedHeaders);
  
          LOGGER.withCorrelationId(message.getInternalHeaders())
                  .debug("Mapped ExternalMessage to Adaptable: {}", adaptableWithModifiedHeaders);
  
          return Collections.singletonList(adaptableWithModifiedHeaders);
      }
focal_method.class_method_signature: ImplicitThingCreationMessageMapper.map(final ExternalMessage message)
focal_method.full_signature: @Override public List<Adaptable> map(final ExternalMessage message)
focal_method.identifier: map
focal_method.invocations: debug withCorrelationId getInternalHeaders getHeaders getExpressionResolver containsAnyPlaceholder applyPlaceholderReplacement containsAnyPlaceholder resolveCommandHeaders getCreateThingSignal toAdaptable build allowPolicyLockout toBuilder getDittoHeaders setDittoHeaders debug withCorrelationId getInternalHeaders singletonList
focal_method.modifiers: @Override public
focal_method.parameters: (final ExternalMessage message)
focal_method.return: List<Adaptable>
focal_method.signature: List<Adaptable> map(final ExternalMessage message)