#######################################################
#
# Test setting a field in a line longer than 4k
#
#######################################################

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

bundle agent init
{
  vars:
      "states" slist => { "actual", "expected" };

      "actual" string =>
      "a:a:[encoded data, 5796 characters]";
      
      "expected" string =>
      "a:b:[encoded data, 5796 characters]";
      
  files:
      "$(G.testfile).$(states)"
      create => "true",
      edit_line => init_insert("$(init.$(states))"),
      edit_defaults => init_empty;
}

bundle edit_line init_insert(str)
{
  insert_lines:
      "$(str)";
}

body edit_defaults init_empty
{
      empty_file_before_editing => "true";
}

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

bundle agent test
{
  files:
      "$(G.testfile).actual"
      edit_line => test_edit;

}

bundle edit_line test_edit
{
  field_edits:
      "a.*"
      edit_field => test_col;
}

body edit_field test_col
{
      allow_blank_fields => "true";
      extend_fields => "true";
      field_operation => "set";
      field_separator => ":";
      field_value => "b";
      select_field => "2";
      start_fields_from_zero => "false";
      value_separator => "+";
}

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

bundle agent check
{
  methods:
      "any" usebundle => dcs_check_diff("$(G.testfile).actual",
					    "$(G.testfile).expected",
					    "$(this.promise_filename)");
}
