#######################################################
#
# Tries to copy using the "classic" protocol, to a server that has
# "allowlegacyconnects" closed and to one that does not have the
# setting at all.
#
# Both must fail.
#
#######################################################

body common control
{
      inputs => { "../../default.cf.sub" };
      bundlesequence  => { default("$(this.promise_filename)") };

      # FORCE CLASSIC PROTOCOL
      protocol_version => "classic";
}

bundle agent init
{
}

bundle agent test
{
  files:
      # Copy from server with allowlegacyconnects closed.
      "$(G.testdir)/destfile"
          copy_from => dcs_remote_cp("simple_source", "127.0.0.1", "9892"),
          classes   => classes_generic("copy");
      # Copy from server with allowlegacyconnects absent.
      "$(G.testdir)/destfile2"
          copy_from => dcs_remote_cp("simple_source", "127.0.0.1", "9891"),
          classes   => classes_generic("copy2");
}

#######################################################

bundle agent check
{
  classes:
      "dummy"   expression => regextract("(.*)\.sub", $(this.promise_filename), "fn");
      "exists"  expression => fileexists("$(G.testdir)/destfile");
      "exists2" expression => fileexists("$(G.testdir)/destfile2");

  reports:

    copy_failed.!copy_repaired.!exists.copy2_failed.!copy2_repaired.!exists2::
      "$(fn[1]) Pass";
}
