anchor.diff:  
   
   %%%===================================================================
  -%%% Replication test functions
  +%%% File transfer test functions
   %%%===================================================================
   
   
   create_file_replication(Config) ->
  -    [P2, P1] = Providers = ?config(op_worker_nodes, Config),
  +    [P2, _P1] = ?config(op_worker_nodes, Config),
   
       Callback = get_callback_url(),
       RequiredPrivs = [?SPACE_SCHEDULE_REPLICATION],
  +
  +    TransferDataSpec = #data_spec{
  +        required = [
  +            <<"type">>, <<"dataSourceType">>,
  +            <<"replicatingProviderId">>,
  +            <<"fileId">>
  +        ],
  +        optional = [<<"callback">>],
  +        correct_values = #{
  +            <<"type">> => [<<"replication">>],
  +            <<"dataSourceType">> => [<<"file">>],
  +            <<"replicatingProviderId">> => [?GET_DOMAIN_BIN(P2)],
  +            <<"fileId">> => [?PLACEHOLDER],
  +            <<"callback">> => [Callback]
  +        },
  +        bad_values = ?TYPE_AND_DATA_SOURCE_TYPE_BAD_VALUES ++ [
  +            {<<"replicatingProviderId">>, 100, ?ERROR_BAD_VALUE_BINARY(<<"replicatingProviderId">>)},
  +            {<<"replicatingProviderId">>, <<"NonExistingProvider">>, ?ERROR_SPACE_NOT_SUPPORTED_BY(<<"NonExistingProvider">>)},
  +            {<<"callback">>, 100, ?ERROR_BAD_VALUE_BINARY(<<"callback">>)}
  +        ]
  +    },
  +    ReplicaDataSpec = #data_spec{
  +        required = [<<"provider_id">>],
  +        optional = [<<"url">>],
  +        correct_values = #{
  +            <<"provider_id">> => [?GET_DOMAIN_BIN(P2)],
  +            <<"url">> => [Callback]
  +        },
  +        bad_values = [
  +            {<<"provider_id">>, 100, {gs, ?ERROR_BAD_VALUE_BINARY(<<"provider_id">>)}},
  +            {<<"provider_id">>, <<"NonExistingProvider">>, ?ERROR_SPACE_NOT_SUPPORTED_BY(<<"NonExistingProvider">>)},
  +            {<<"url">>, 100, {gs, ?ERROR_BAD_VALUE_BINARY(<<"url">>)}}
  +        ]
  +    },
  +
  +    create_file_transfer(Config, replication, TransferDataSpec, ReplicaDataSpec, RequiredPrivs).
  +
  +
  +create_file_eviction(Config) ->
  +    [_P2, P1] = ?config(op_worker_nodes, Config),
  +
  +    Callback = get_callback_url(),
  +    RequiredPrivs = [?SPACE_SCHEDULE_EVICTION],
  +
  +    TransferDataSpec = #data_spec{
  +        required = [
  +            <<"type">>, <<"dataSourceType">>,
  +            <<"evictingProviderId">>,
  +            <<"fileId">>
  +        ],
  +        optional = [<<"callback">>],
  +        correct_values = #{
  +            <<"type">> => [<<"eviction">>],
  +            <<"dataSourceType">> => [<<"file">>],
  +            <<"evictingProviderId">> => [?GET_DOMAIN_BIN(P1)],
  +            <<"fileId">> => [?PLACEHOLDER],
  +            <<"callback">> => [Callback]
  +        },
  +        bad_values = ?TYPE_AND_DATA_SOURCE_TYPE_BAD_VALUES ++ [
  +            {<<"evictingProviderId">>, 100, ?ERROR_BAD_VALUE_BINARY(<<"evictingProviderId">>)},
  +            {<<"evictingProviderId">>, <<"NonExistingProvider">>, ?ERROR_SPACE_NOT_SUPPORTED_BY(<<"NonExistingProvider">>)},
  +            {<<"callback">>, 100, ?ERROR_BAD_VALUE_BINARY(<<"callback">>)}
  +        ]
  +    },
  +    ReplicaDataSpec = #data_spec{
  +        required = [<<"provider_id">>],
  +        correct_values = #{
  +            <<"provider_id">> => [?GET_DOMAIN_BIN(P1)]
  +        },
  +        bad_values = [
  +            {<<"provider_id">>, 100, {gs, ?ERROR_BAD_VALUE_BINARY(<<"provider_id">>)}},
  +            {<<"provider_id">>, <<"NonExistingProvider">>, ?ERROR_SPACE_NOT_SUPPORTED_BY(<<"NonExistingProvider">>)}
  +        ]
  +    },
  +
  +    create_file_transfer(Config, eviction, TransferDataSpec, ReplicaDataSpec, RequiredPrivs).
  +
  +
  +create_file_transfer(Config, Type, TransferDataSpec, ReplicaDataSpec, RequiredPrivs) ->
  +    [P2, P1] = Providers = ?config(op_worker_nodes, Config),
  +
       set_space_privileges(Providers, ?SPACE_2, ?USER_IN_SPACE_2, privileges:space_admin() -- RequiredPrivs),
       set_space_privileges(Providers, ?SPACE_2, ?USER_IN_BOTH_SPACES, RequiredPrivs),
   
  
positive.code: 
          case TransferType of
              replication ->
                  % Wait until FilesToTransfer are all indexed by view on DstNode.
                  % Otherwise some of them could be omitted from replication.
                  ?assertViewQuery(ObjectIds, DstNode, ?SPACE_2, ViewName,  QueryViewParams);
              eviction ->
                  % Wait until file_distribution containing entries for both nodes
                  % and all FilesToTransfer are indexed by view on SrcNode.
                  % Otherwise some of them could be omitted from eviction (if data
                  % replicas don't exist on other providers it is skipped).
                  assert_distribution(
                      SrcNode, SessId1, OtherFiles ++ FilesToTransfer,
                      [{SrcNode, ?BYTES_NUM}, {DstNode, ?BYTES_NUM}]
                  ),
                  ?assertViewQuery(ObjectIds, SrcNode, ?SPACE_2, ViewName,  QueryViewParams);
              migration ->
                  % Wait until FilesToTransfer are all indexed by view on SrcNode and DstNode.
  
negative.code: 
  -export([
      create_file_replication/1,
      create_file_eviction/1,
  
      create_view_replication/1,
      create_view_eviction/1,
  