Ejemplo n.º 1
0
  @Test
  public void testCreateCaseXml() throws FileNotFoundException, CaseParserException {

    CaseTask task = new CaseTask();

    task.setCaseId("CASE_ID");
    task.setUserId("USER_ID");
    task.setXmlns("XMLNS");
    task.setDateModified("DATE_MODIFIED");

    CreateTask createTask = new CreateTask();

    createTask.setCaseName("CASE_NAME");
    createTask.setCaseType("CASE_TYPE");
    createTask.setOwnerId("OWNER_ID");

    task.setCreateTask(createTask);

    String xml = caseConverter.convertToCaseXml(task);

    Assert.assertTrue(xml.contains("xmlns=\"XMLNS\""));
    Assert.assertTrue(xml.contains("case_id=\"CASE_ID\""));
    Assert.assertTrue(xml.contains("date_modified=\"DATE_MODIFIED\""));
    Assert.assertTrue(xml.contains("user_id=\"USER_ID\""));
    Assert.assertTrue(xml.contains("<create>"));
    Assert.assertTrue(xml.contains("</create>"));
    Assert.assertTrue(xml.contains("<case_type>CASE_TYPE</case_type>"));
    Assert.assertTrue(xml.contains("<case_name>CASE_NAME</case_name>"));
    Assert.assertTrue(xml.contains("<owner_id>OWNER_ID</owner_id>"));
  }
Ejemplo n.º 2
0
  @Test
  public void testUpdateCaseXml() throws FileNotFoundException, CaseParserException {

    CaseTask task = new CaseTask();

    task.setCaseId("CASE_ID");
    task.setUserId("USER_ID");
    task.setXmlns("XMLNS");
    task.setDateModified("DATE_MODIFIED");

    UpdateTask updateTask = new UpdateTask();

    Map<String, Object> fieldValues = new HashMap<>();

    fieldValues.put("KEY1", "VALUE1");
    fieldValues.put("KEY2", "VALUE2");
    fieldValues.put("KEY3", "VALUE3");
    fieldValues.put("KEY4", 4);
    fieldValues.put("KEY5", new DateTime(1456250266046L, DateTimeZone.UTC));

    updateTask.setCaseName("CASE_NAME");
    updateTask.setCaseType("CASE_TYPE");
    updateTask.setDateOpened("DATE_OPENED");
    updateTask.setFieldValues(fieldValues);
    updateTask.setOwnerId("OWNER_ID");

    task.setUpdateTask(updateTask);

    String xml = caseConverter.convertToCaseXml(task);

    Assert.assertTrue(xml.contains("xmlns=\"XMLNS\""));
    Assert.assertTrue(xml.contains("case_id=\"CASE_ID\""));
    Assert.assertTrue(xml.contains("date_modified=\"DATE_MODIFIED\""));
    Assert.assertTrue(xml.contains("user_id=\"USER_ID\""));
    Assert.assertTrue(xml.contains("<update>"));
    Assert.assertTrue(xml.contains("</update>"));
    Assert.assertTrue(xml.contains("<case_type>CASE_TYPE</case_type>"));
    Assert.assertTrue(xml.contains("<case_name>CASE_NAME</case_name>"));
    Assert.assertTrue(xml.contains("<owner_id>OWNER_ID</owner_id>"));
    Assert.assertTrue(xml.contains("<KEY2>VALUE2</KEY2>"));
    Assert.assertTrue(xml.contains("<KEY1>VALUE1</KEY1>"));
    Assert.assertTrue(xml.contains("<KEY3>VALUE3</KEY3>"));
    Assert.assertTrue(xml.contains("<KEY4>4</KEY4>"));
    Assert.assertTrue(xml.contains("<KEY5>2016-02-23T17:57:46.046Z</KEY5>"));
  }