Exemplo n.º 1
0
  @Test
  public void shouldSearchExistingFlwsAndUpdateFlw() {
    Flw toBeUpdatedFlw =
        flw(
            "5ba9a0928dde95d187544babf6c0ad24",
            "FirstName1",
            flwGroupWithNameAndId("64a9a0928dde95d187544babf6c0ad38", "oldGroupName"));
    Flw notToBeUpdateFlw = flw("5ba9a0928dde95d187544babf6c0ad25", "FirstName2", new FlwGroup());
    template.saveOrUpdateAll(Arrays.asList(toBeUpdatedFlw, notToBeUpdateFlw));

    Flw newFlw =
        flw(
            "5ba9a0928dde95d187544babf6c0ad24",
            "FirstName3",
            flwGroupWithNameAndId("38a9a0928dde95d187544babf6c0ad64", "newGroupName"));
    ArrayList<Flw> flwsToUpdate = new ArrayList<>();
    flwsToUpdate.add(newFlw);

    careService.saveOrUpdateAllByExternalPrimaryKey(Flw.class, flwsToUpdate);

    Flw updatedFlw = template.load(Flw.class, toBeUpdatedFlw.getId());
    assertReflectionEqualsWithIgnore(
        newFlw, updatedFlw, new String[] {"id", "creationTime", "lastModifiedTime"});
    assertDateIgnoringSeconds(new Date(), updatedFlw.getCreationTime());
    assertDateIgnoringSeconds(new Date(), updatedFlw.getLastModifiedTime());

    Flw unchangedFlw = template.load(Flw.class, notToBeUpdateFlw.getId());
    assertEquals("FirstName2", unchangedFlw.getFirstName());
  }
Exemplo n.º 2
0
 static {
   tmp.add("/sam/test_2.sam");
   filenamesTryIndex = tmp.toArray(new String[tmp.size()]);
 }