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

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

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

body agent control
{
  # Here we explicitly target the testfile.
  files_single_copy => { $(G.testfile) };
}

bundle agent init
{
  vars:
    "copy_files" slist => { "one", "two" };

   files:
    "$(G.testdir)/$(copy_files)"
      create => "true",
      edit_line => insert_lines("$(copy_files)");
}

bundle agent test
{
  meta:
      "description" string => "Test that files_single_copy prevents subsequnt copy of a file when there is an exact match.";

      "test_skip_needs_work"
        string => "windows",
        meta => { "CFE-2459" };

  files:

    # Here we iterate over each copy_file to promise the content
    # of the testfile. We expect that with files_single_copy in
    # effect only the first file should be copied.

    "$(G.testfile)"
      copy_from => local_dcp( "$(G.testdir)/$(init.copy_files)" );
}

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

bundle agent check
{

  methods:
    "" usebundle => dcs_check_diff($(G.testfile), "$(G.testdir)/one", $(this.promise_filename));
}
