예제 #1
0
  @Test
  public void testContainerSimpleDiffNoChange() throws Exception {
    System.out.println("\n\n===[ testContainerSimpleDiffNoChange ]===\n");

    // GIVEN
    PrismObjectDefinition<UserType> userDef = getUserTypeDefinition();
    PrismContainerDefinition<AssignmentType> assignmentContDef =
        userDef.findContainerDefinition(UserType.F_ASSIGNMENT);

    PrismContainer<AssignmentType> ass1 = assignmentContDef.instantiate();
    PrismContainerValue<AssignmentType> ass1cval = ass1.createNewValue();
    ass1cval.setPropertyRealValue(
        AssignmentType.F_DESCRIPTION, "blah blah", PrismTestUtil.getPrismContext());

    PrismContainer<AssignmentType> ass2 = assignmentContDef.instantiate();
    PrismContainerValue<AssignmentType> ass2cval = ass2.createNewValue();
    ass2cval.setPropertyRealValue(
        AssignmentType.F_DESCRIPTION, "blah blah", PrismTestUtil.getPrismContext());

    // WHEN
    Collection<? extends ItemDelta> modifications = ass1.diff(ass2);

    // THEN
    assertNotNull(modifications);
    System.out.println(DebugUtil.debugDump(modifications));
    assertEquals("Unexpected number of midifications", 0, modifications.size());
    ItemDelta.checkConsistence(modifications);
  }
예제 #2
0
  @Test
  public void testContainerDiffDesciption() throws Exception {
    System.out.println("\n\n===[ testContainerDiffDesciption ]===\n");

    // GIVEN
    PrismObjectDefinition<UserType> userDef = getUserTypeDefinition();
    PrismContainerDefinition<AssignmentType> assignmentContDef =
        userDef.findContainerDefinition(UserType.F_ASSIGNMENT);

    PrismContainer<AssignmentType> ass1 = assignmentContDef.instantiate();
    PrismContainerValue<AssignmentType> ass1cval = ass1.createNewValue();
    ass1cval.setId(1L);
    ass1cval.setPropertyRealValue(
        AssignmentType.F_DESCRIPTION, "blah blah", PrismTestUtil.getPrismContext());

    PrismContainer<AssignmentType> ass2 = assignmentContDef.instantiate();
    PrismContainerValue<AssignmentType> ass2cval = ass2.createNewValue();
    ass2cval.setId(1L);
    ass2cval.setPropertyRealValue(
        AssignmentType.F_DESCRIPTION,
        "chamalalia patlama paprtala",
        PrismTestUtil.getPrismContext());

    // WHEN
    Collection<? extends ItemDelta> modifications = ass1.diff(ass2);

    // THEN
    assertNotNull(modifications);
    System.out.println(DebugUtil.debugDump(modifications));
    assertEquals("Unexpected number of midifications", 1, modifications.size());
    PrismAsserts.assertPropertyReplace(
        modifications,
        new ItemPath(
            new NameItemPathSegment(UserType.F_ASSIGNMENT),
            new IdItemPathSegment(1L),
            new NameItemPathSegment(AssignmentType.F_DESCRIPTION)),
        "chamalalia patlama paprtala");
    ItemDelta.checkConsistence(modifications);
  }