test_class.declarator: ID = ConnectionId.generateRandom()
test_class.modifier: private static final
test_class.original_string: private static final ConnectionId ID = ConnectionId.generateRandom();
test_class.type: ConnectionId
test_class.var_name: ID
test_class.declarator: NAME = "my-connection"
test_class.modifier: private static final
test_class.original_string: private static final String NAME = "my-connection";
test_class.type: String
test_class.var_name: NAME
test_class.declarator: TYPE = ConnectionType.AMQP_10
test_class.modifier: private static final
test_class.original_string: private static final ConnectionType TYPE = ConnectionType.AMQP_10;
test_class.type: ConnectionType
test_class.var_name: TYPE
test_class.declarator: STATUS = ConnectivityStatus.OPEN
test_class.modifier: private static final
test_class.original_string: private static final ConnectivityStatus STATUS = ConnectivityStatus.OPEN;
test_class.type: ConnectivityStatus
test_class.var_name: STATUS
test_class.declarator: URI = "amqps://foo:bar@example.com:443"
test_class.modifier: private static final
test_class.original_string: private static final String URI = "amqps://foo:bar@example.com:443";
test_class.type: String
test_class.var_name: URI
test_class.declarator: LEGACY_FIELD_FILTERS = "filters"
test_class.modifier: private static final
test_class.original_string: private static final String LEGACY_FIELD_FILTERS = "filters";
test_class.type: String
test_class.var_name: LEGACY_FIELD_FILTERS
test_class.declarator: AUTHORIZATION_CONTEXT = AuthorizationContext.newInstance(
              DittoAuthorizationContextType.PRE_AUTHENTICATED_CONNECTION, AuthorizationSubject.newInstance("myIssuer:mySubject"))
test_class.modifier: private static final
test_class.original_string: private static final AuthorizationContext AUTHORIZATION_CONTEXT = AuthorizationContext.newInstance(
              DittoAuthorizationContextType.PRE_AUTHENTICATED_CONNECTION, AuthorizationSubject.newInstance("myIssuer:mySubject"));
test_class.type: AuthorizationContext
test_class.var_name: AUTHORIZATION_CONTEXT
test_class.declarator: ALT_AUTHORIZATION_CONTEXT = AuthorizationContext.newInstance(
              DittoAuthorizationContextType.PRE_AUTHENTICATED_CONNECTION, AuthorizationSubject.newInstance("myAltIssuer:customSubject"))
test_class.modifier: private static final
test_class.original_string: private static final AuthorizationContext ALT_AUTHORIZATION_CONTEXT = AuthorizationContext.newInstance(
              DittoAuthorizationContextType.PRE_AUTHENTICATED_CONNECTION, AuthorizationSubject.newInstance("myAltIssuer:customSubject"));
test_class.type: AuthorizationContext
test_class.var_name: ALT_AUTHORIZATION_CONTEXT
test_class.declarator: FILTERS =
              JsonFactory.newArrayBuilder().add("{{thing:id}}").add("{{thing:name}}").build()
test_class.modifier: private static final
test_class.original_string: private static final JsonArray FILTERS =
              JsonFactory.newArrayBuilder().add("{{thing:id}}").add("{{thing:name}}").build();
test_class.type: JsonArray
test_class.var_name: FILTERS
test_class.declarator: SOURCE1_JSON = JsonObject
              .newBuilder()
              .set(Source.JsonFields.ADDRESSES, JsonFactory.newArrayBuilder().add("amqp/source1").build())
              .set(Source.JsonFields.CONSUMER_COUNT, 2)
              .set(LEGACY_FIELD_FILTERS, FILTERS)
              .build()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject SOURCE1_JSON = JsonObject
              .newBuilder()
              .set(Source.JsonFields.ADDRESSES, JsonFactory.newArrayBuilder().add("amqp/source1").build())
              .set(Source.JsonFields.CONSUMER_COUNT, 2)
              .set(LEGACY_FIELD_FILTERS, FILTERS)
              .build();
test_class.type: JsonObject
test_class.var_name: SOURCE1_JSON
test_class.declarator: SOURCE2_JSON = JsonObject
              .newBuilder()
              .set(Source.JsonFields.ADDRESSES, JsonFactory.newArrayBuilder().add("amqp/source2").build())
              .set(Source.JsonFields.CONSUMER_COUNT, 1)
              .set(Source.JsonFields.HEADER_MAPPING, JsonObject.newBuilder()
                      .set("source-action", JsonValue.of("source/{{ topic:action }}"))
                      .set("source-subject", JsonValue.of("source/{{topic:action|subject }}"))
                      .set("source-subject-next-gen", JsonValue.of("source/{{    topic:action-subject }}"))
                      .set("source-some-header", JsonValue.of("source/{{ topic:full | fn:substring-before('/') }}"))
                      .build()
              )
              .build()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject SOURCE2_JSON = JsonObject
              .newBuilder()
              .set(Source.JsonFields.ADDRESSES, JsonFactory.newArrayBuilder().add("amqp/source2").build())
              .set(Source.JsonFields.CONSUMER_COUNT, 1)
              .set(Source.JsonFields.HEADER_MAPPING, JsonObject.newBuilder()
                      .set("source-action", JsonValue.of("source/{{ topic:action }}"))
                      .set("source-subject", JsonValue.of("source/{{topic:action|subject }}"))
                      .set("source-subject-next-gen", JsonValue.of("source/{{    topic:action-subject }}"))
                      .set("source-some-header", JsonValue.of("source/{{ topic:full | fn:substring-before('/') }}"))
                      .build()
              )
              .build();
test_class.type: JsonObject
test_class.var_name: SOURCE2_JSON
test_class.declarator: OLD_SOURCES_JSON = JsonArray.newBuilder().add(SOURCE1_JSON, SOURCE2_JSON).build()
test_class.modifier: private static final
test_class.original_string: private static final JsonArray OLD_SOURCES_JSON = JsonArray.newBuilder().add(SOURCE1_JSON, SOURCE2_JSON).build();
test_class.type: JsonArray
test_class.var_name: OLD_SOURCES_JSON
test_class.declarator: TARGET1_JSON = JsonObject
              .newBuilder()
              .set(Target.JsonFields.TOPICS, JsonFactory.newArrayBuilder()
                      .add(TWIN_EVENTS.getName())
                      .add(LIVE_EVENTS.getName())
                      .build()
              )
              .set(Target.JsonFields.ADDRESS, "amqp/target1")
              .build()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject TARGET1_JSON = JsonObject
              .newBuilder()
              .set(Target.JsonFields.TOPICS, JsonFactory.newArrayBuilder()
                      .add(TWIN_EVENTS.getName())
                      .add(LIVE_EVENTS.getName())
                      .build()
              )
              .set(Target.JsonFields.ADDRESS, "amqp/target1")
              .build();
test_class.type: JsonObject
test_class.var_name: TARGET1_JSON
test_class.declarator: TARGET2_JSON = JsonObject
              .newBuilder()
              .set(Target.JsonFields.TOPICS, JsonFactory.newArrayBuilder()
                      .add(LIVE_MESSAGES.getName())
                      .add(LIVE_MESSAGES.getName())
                      .add(LIVE_EVENTS.getName())
                      .build()
              )
              .set(Target.JsonFields.ADDRESS, "amqp/target2")
              .set(Target.JsonFields.HEADER_MAPPING, JsonObject.newBuilder()
                      .set("target-action", JsonValue.of("target/{{ topic:action }}"))
                      .set("target-subject", JsonValue.of("target/{{topic:action|subject }}"))
                      .set("target-subject-next-gen", JsonValue.of("target/{{    topic:action-subject }}"))
                      .set("target-some-header", JsonValue.of("target/{{ topic:full | fn:substring-before('/') }}"))
                      .build()
              )
              .build()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject TARGET2_JSON = JsonObject
              .newBuilder()
              .set(Target.JsonFields.TOPICS, JsonFactory.newArrayBuilder()
                      .add(LIVE_MESSAGES.getName())
                      .add(LIVE_MESSAGES.getName())
                      .add(LIVE_EVENTS.getName())
                      .build()
              )
              .set(Target.JsonFields.ADDRESS, "amqp/target2")
              .set(Target.JsonFields.HEADER_MAPPING, JsonObject.newBuilder()
                      .set("target-action", JsonValue.of("target/{{ topic:action }}"))
                      .set("target-subject", JsonValue.of("target/{{topic:action|subject }}"))
                      .set("target-subject-next-gen", JsonValue.of("target/{{    topic:action-subject }}"))
                      .set("target-some-header", JsonValue.of("target/{{ topic:full | fn:substring-before('/') }}"))
                      .build()
              )
              .build();
test_class.type: JsonObject
test_class.var_name: TARGET2_JSON
test_class.declarator: TARGET3_JSON = JsonObject
              .newBuilder()
              .set(Target.JsonFields.TOPICS, JsonFactory.newArrayBuilder()
                      .add(LIVE_MESSAGES.getName())
                      .add(LIVE_MESSAGES.getName())
                      .add(LIVE_COMMANDS.getName())
                      .build()
              )
              .set(Target.JsonFields.ADDRESS, "amqp/target3/{{topic:action|subject}}")
              .build()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject TARGET3_JSON = JsonObject
              .newBuilder()
              .set(Target.JsonFields.TOPICS, JsonFactory.newArrayBuilder()
                      .add(LIVE_MESSAGES.getName())
                      .add(LIVE_MESSAGES.getName())
                      .add(LIVE_COMMANDS.getName())
                      .build()
              )
              .set(Target.JsonFields.ADDRESS, "amqp/target3/{{topic:action|subject}}")
              .build();
test_class.type: JsonObject
test_class.var_name: TARGET3_JSON
test_class.declarator: OLD_TARGETS_JSON =
              JsonArray.newBuilder().add(TARGET1_JSON, TARGET2_JSON, TARGET3_JSON).build()
test_class.modifier: private static final
test_class.original_string: private static final JsonArray OLD_TARGETS_JSON =
              JsonArray.newBuilder().add(TARGET1_JSON, TARGET2_JSON, TARGET3_JSON).build();
test_class.type: JsonArray
test_class.var_name: OLD_TARGETS_JSON
test_class.declarator: KNOWN_TAGS = Collections.singleton("HONO")
test_class.modifier: private static final
test_class.original_string: private static final Set<String> KNOWN_TAGS = Collections.singleton("HONO");
test_class.type: Set<String>
test_class.var_name: KNOWN_TAGS
test_class.declarator: KNOWN_CONNECTION_JSON = JsonObject.newBuilder()
              .set(Connection.JsonFields.ID, ID.toString())
              .set(Connection.JsonFields.NAME, NAME)
              .set(ConnectionMigrationUtil.AUTHORIZATION_CONTEXT, AUTHORIZATION_CONTEXT.getAuthorizationSubjects()
                      .stream()
                      .map(AuthorizationSubject::getId)
                      .map(JsonValue::of)
                      .collect(JsonCollectors.valuesToArray())
              )
              .set(Connection.JsonFields.CONNECTION_TYPE, TYPE.getName())
              .set(Connection.JsonFields.CONNECTION_STATUS, STATUS.getName())
              .set(Connection.JsonFields.URI, URI)
              .set(Connection.JsonFields.SOURCES, OLD_SOURCES_JSON)
              .set(Connection.JsonFields.TARGETS, OLD_TARGETS_JSON)
              .set(Connection.JsonFields.CLIENT_COUNT, 2)
              .set(Connection.JsonFields.FAILOVER_ENABLED, true)
              .set(Connection.JsonFields.VALIDATE_CERTIFICATES, true)
              .set(Connection.JsonFields.PROCESSOR_POOL_SIZE, 5)
              .set(Connection.JsonFields.TAGS, KNOWN_TAGS.stream()
                      .map(JsonFactory::newValue)
                      .collect(JsonCollectors.valuesToArray()))
              .build()
test_class.modifier: private static final
test_class.original_string: private static final JsonObject KNOWN_CONNECTION_JSON = JsonObject.newBuilder()
              .set(Connection.JsonFields.ID, ID.toString())
              .set(Connection.JsonFields.NAME, NAME)
              .set(ConnectionMigrationUtil.AUTHORIZATION_CONTEXT, AUTHORIZATION_CONTEXT.getAuthorizationSubjects()
                      .stream()
                      .map(AuthorizationSubject::getId)
                      .map(JsonValue::of)
                      .collect(JsonCollectors.valuesToArray())
              )
              .set(Connection.JsonFields.CONNECTION_TYPE, TYPE.getName())
              .set(Connection.JsonFields.CONNECTION_STATUS, STATUS.getName())
              .set(Connection.JsonFields.URI, URI)
              .set(Connection.JsonFields.SOURCES, OLD_SOURCES_JSON)
              .set(Connection.JsonFields.TARGETS, OLD_TARGETS_JSON)
              .set(Connection.JsonFields.CLIENT_COUNT, 2)
              .set(Connection.JsonFields.FAILOVER_ENABLED, true)
              .set(Connection.JsonFields.VALIDATE_CERTIFICATES, true)
              .set(Connection.JsonFields.PROCESSOR_POOL_SIZE, 5)
              .set(Connection.JsonFields.TAGS, KNOWN_TAGS.stream()
                      .map(JsonFactory::newValue)
                      .collect(JsonCollectors.valuesToArray()))
              .build();
test_class.type: JsonObject
test_class.var_name: KNOWN_CONNECTION_JSON
test_class.file: services/connectivity/messaging/src/test/java/org/eclipse/ditto/services/connectivity/messaging/persistence/ConnectionMigrationUtilTest.java
test_class.identifier: ConnectionMigrationUtilTest
test_case.body: @Test
      public void migrateConnectionWithGlobalAuthorizationContext() {
  
          final Connection migratedConnection =
                  ConnectionMigrationUtil.connectionFromJsonWithMigration(KNOWN_CONNECTION_JSON);
          assertThat((CharSequence) migratedConnection.getId()).isEqualTo(ID);
          assertThat(migratedConnection.getName()).contains(NAME);
          assertThat((Object) migratedConnection.getConnectionType()).isEqualTo(TYPE);
          assertThat(migratedConnection.getUri()).isEqualTo(URI);
          migratedConnection.getSources().forEach(source ->
                  assertThat(source.getAuthorizationContext()).isEqualTo(AUTHORIZATION_CONTEXT));
          migratedConnection.getTargets().forEach(target ->
                  assertThat(target.getAuthorizationContext()).isEqualTo(AUTHORIZATION_CONTEXT));
      }
test_case.class_method_signature: ConnectionMigrationUtilTest.migrateConnectionWithGlobalAuthorizationContext()
test_case.full_signature: @Test public void migrateConnectionWithGlobalAuthorizationContext()
test_case.identifier: migrateConnectionWithGlobalAuthorizationContext
test_case.invocations: connectionFromJsonWithMigration isEqualTo assertThat getId contains assertThat getName isEqualTo assertThat getConnectionType isEqualTo assertThat getUri forEach getSources isEqualTo assertThat getAuthorizationContext forEach getTargets isEqualTo assertThat getAuthorizationContext
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void migrateConnectionWithGlobalAuthorizationContext()
focal_class.declarator: AUTHORIZATION_CONTEXT =
              JsonFactory.newJsonArrayFieldDefinition("authorizationContext", FieldType.REGULAR,
                      JsonSchemaVersion.V_1, JsonSchemaVersion.V_2)
focal_class.modifier: static final
focal_class.original_string: static final JsonFieldDefinition<JsonArray> AUTHORIZATION_CONTEXT =
              JsonFactory.newJsonArrayFieldDefinition("authorizationContext", FieldType.REGULAR,
                      JsonSchemaVersion.V_1, JsonSchemaVersion.V_2);
focal_class.type: JsonFieldDefinition<JsonArray>
focal_class.var_name: AUTHORIZATION_CONTEXT
focal_class.file: services/connectivity/messaging/src/main/java/org/eclipse/ditto/services/connectivity/messaging/persistence/ConnectionMigrationUtil.java
focal_class.identifier: ConnectionMigrationUtil
focal_class.class_method_signature: ConnectionMigrationUtil.ConnectionMigrationUtil()
focal_class.full_signature: private  ConnectionMigrationUtil()
focal_class.identifier: ConnectionMigrationUtil
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  ConnectionMigrationUtil()
focal_class.class_method_signature: ConnectionMigrationUtil.connectionFromJsonWithMigration(@Nonnull final JsonObject connectionJsonObject)
focal_class.full_signature: static Connection connectionFromJsonWithMigration(@Nonnull final JsonObject connectionJsonObject)
focal_class.identifier: connectionFromJsonWithMigration
focal_class.modifiers: static
focal_class.parameters: (@Nonnull final JsonObject connectionJsonObject)
focal_class.return: Connection
focal_class.signature: Connection connectionFromJsonWithMigration(@Nonnull final JsonObject connectionJsonObject)
focal_method.body: static Connection connectionFromJsonWithMigration(@Nonnull final JsonObject connectionJsonObject) {
          final UnaryOperator<JsonObject> migrateSourceFilters = new MigrateSourceFilters();
          final UnaryOperator<JsonObject> migrateTopicActionSubjectFilters = new MigrateTopicActionSubjectFilters();
          final UnaryOperator<JsonObject> migrateAuthorizationContexts = new MigrateAuthorizationContexts();
  
          return ConnectivityModelFactory.connectionFromJson(
                  migrateAuthorizationContexts
                          .andThen(migrateSourceFilters)
                          .andThen(migrateTopicActionSubjectFilters)
                          .apply(connectionJsonObject));
      }
focal_method.class_method_signature: ConnectionMigrationUtil.connectionFromJsonWithMigration(@Nonnull final JsonObject connectionJsonObject)
focal_method.full_signature: static Connection connectionFromJsonWithMigration(@Nonnull final JsonObject connectionJsonObject)
focal_method.identifier: connectionFromJsonWithMigration
focal_method.invocations: connectionFromJson apply andThen andThen
focal_method.modifiers: static
focal_method.parameters: (@Nonnull final JsonObject connectionJsonObject)
focal_method.return: Connection
focal_method.signature: Connection connectionFromJsonWithMigration(@Nonnull final JsonObject connectionJsonObject)