Ejemplo n.º 1
0
  @Test(enabled = true)
  public void test030FormatAccount() throws Exception {

    // GIVEN

    PrismObject<ShadowType> jack = PrismTestUtil.parseObject(new File(ACCOUNT_JACK_FILE));
    System.out.println(jack.debugDump());
    // WHEN

    String jackFormattedHideNone =
        textFormatter.formatAccountAttributes(jack.asObjectable(), null, true);
    System.out.println("no hidden paths + show operational attributes: " + jackFormattedHideNone);

    String jackFormattedHideAux =
        textFormatter.formatAccountAttributes(jack.asObjectable(), auxiliaryPaths, true);
    System.out.println(
        "hide auxiliary paths + show operational attributes: " + jackFormattedHideAux);

    // THEN

    assertTrue("account name is not shown", jackFormattedHideNone.contains("Name: jack"));
    assertTrue(
        "account password is not shown", jackFormattedHideNone.contains("(protected string)"));
    assertTrue(
        "administrative status is not shown",
        jackFormattedHideNone.contains("Administrative Status: ENABLED"));
    assertTrue(
        "effective status is not shown",
        jackFormattedHideNone.contains("Effective Status: ENABLED"));

    assertTrue("account name is not shown", jackFormattedHideAux.contains("Name: jack"));
    assertTrue(
        "account password is not shown", jackFormattedHideAux.contains("(protected string)"));
    assertTrue(
        "administrative status is not shown",
        jackFormattedHideAux.contains("Administrative Status: ENABLED"));
    assertTrue(
        "effective status is shown although it should be hidden",
        !jackFormattedHideAux.contains("Effective Status: ENABLED"));

    //        AssertJUnit.assertTrue("hidden operational attribute when it should be shown ('hide
    // none')", jackFormattedHideNone.contains("createTimestamp:"));
    //        AssertJUnit.assertTrue("hidden auxiliary attribute (effective status) when it should
    // be shown ('hide none')", jackFormattedHideNone.contains("Effective Status: ENABLED"));
    //        AssertJUnit.assertTrue("hidden auxiliary attribute (family name) when it should be
    // shown ('hide none')", jackFormattedHideNone.contains("Family Name: Sparrow"));
    //        AssertJUnit.assertTrue("hidden standard attribute when it should be shown ('hide
    // none')", jackFormattedHideNone.contains("ship: Black Pearl"));
    //
    //        AssertJUnit.assertTrue("shown operational attribute when it should be hidden ('hide
    // oper')", !jackFormattedHideOper.contains("createTimestamp:"));
    //        AssertJUnit.assertTrue("hidden auxiliary attribute when it should be shown ('hide
    // oper')", jackFormattedHideOper.contains("Effective Status: ENABLED"));
    //        AssertJUnit.assertTrue("hidden auxiliary attribute (family name) when it should be
    // shown ('hide oper')", jackFormattedHideOper.contains("Family Name: Sparrow"));
    //        AssertJUnit.assertTrue("hidden standard attribute when it should be shown ('hide
    // oper')", jackFormattedHideOper.contains("ship: Black Pearl"));
    //
    //        AssertJUnit.assertTrue("shown auxiliary attribute (metadata) when it should be hidden
    // ('hide aux')", !jackFormattedHideAux.contains("createTimestamp:"));
    //        AssertJUnit.assertTrue("shown auxiliary attribute (family name) when it should be
    // hidden ('hide aux')", !jackFormattedHideAux.contains("Family Name: Sparrow"));
    //        AssertJUnit.assertTrue("shown auxiliary attribute (effective status) when it should be
    // hidden ('hide aux')", !jackFormattedHideAux.contains("Effective Status: ENABLED"));
    //        AssertJUnit.assertTrue("hidden standard attribute when it should be shown ('hide
    // aux')", jackFormattedHideAux.contains("ship: Black Pearl"));
    //
    //        AssertJUnit.assertTrue("shown operational attribute when it should be hidden ('hide
    // aux and oper')", !jackFormattedHideAuxAndOper.contains("createTimestamp:"));
    //        AssertJUnit.assertTrue("shown auxiliary attribute (effective status) when it should be
    // hidden ('hide aux and oper')", !jackFormattedHideAuxAndOper.contains("Effective Status:
    // ENABLED"));
    //        AssertJUnit.assertTrue("shown auxiliary attribute (family name) when it should be
    // hidden ('hide aux and oper')", !jackFormattedHideAuxAndOper.contains("Family Name:
    // Sparrow"));
    //        AssertJUnit.assertTrue("hidden standard attribute when it should be shown ('hide aux
    // and oper')", jackFormattedHideAuxAndOper.contains("ship: Black Pearl"));

  }
Ejemplo n.º 2
0
  @Test(enabled = true)
  public void test010FormatUser() throws Exception {

    // GIVEN

    PrismObject<UserType> jack = PrismTestUtil.parseObject(new File(USER_JACK_FILE));
    System.out.println(jack.debugDump());
    // WHEN

    String jackFormattedHideNone = textFormatter.formatObject(jack, null, true);
    System.out.println("no hidden paths + show operational attributes: " + jackFormattedHideNone);

    String jackFormattedHideOper = textFormatter.formatObject(jack, null, false);
    System.out.println("no hidden paths + hide operational attributes: " + jackFormattedHideOper);

    String jackFormattedHideAux = textFormatter.formatObject(jack, auxiliaryPaths, true);
    System.out.println(
        "hide auxiliary paths + show operational attributes: " + jackFormattedHideAux);

    String jackFormattedHideAuxAndOper = textFormatter.formatObject(jack, auxiliaryPaths, false);
    System.out.println(
        "hide auxiliary paths + hide operational attributes: " + jackFormattedHideAuxAndOper);

    // THEN

    assertTrue(
        "hidden operational attribute when it should be shown ('hide none')",
        jackFormattedHideNone.contains("createTimestamp:"));
    assertTrue(
        "hidden auxiliary attribute (effective status) when it should be shown ('hide none')",
        jackFormattedHideNone.contains("Effective Status: ENABLED"));
    assertTrue(
        "hidden auxiliary attribute (family name) when it should be shown ('hide none')",
        jackFormattedHideNone.contains("Family Name: Sparrow"));
    assertTrue(
        "hidden standard attribute when it should be shown ('hide none')",
        jackFormattedHideNone.contains("ship: Black Pearl"));

    assertTrue(
        "shown operational attribute when it should be hidden ('hide oper')",
        !jackFormattedHideOper.contains("createTimestamp:"));
    assertTrue(
        "hidden auxiliary attribute when it should be shown ('hide oper')",
        jackFormattedHideOper.contains("Effective Status: ENABLED"));
    assertTrue(
        "hidden auxiliary attribute (family name) when it should be shown ('hide oper')",
        jackFormattedHideOper.contains("Family Name: Sparrow"));
    assertTrue(
        "hidden standard attribute when it should be shown ('hide oper')",
        jackFormattedHideOper.contains("ship: Black Pearl"));

    assertTrue(
        "shown auxiliary attribute (metadata) when it should be hidden ('hide aux')",
        !jackFormattedHideAux.contains("createTimestamp:"));
    assertTrue(
        "shown auxiliary attribute (family name) when it should be hidden ('hide aux')",
        !jackFormattedHideAux.contains("Family Name: Sparrow"));
    assertTrue(
        "shown auxiliary attribute (effective status) when it should be hidden ('hide aux')",
        !jackFormattedHideAux.contains("Effective Status: ENABLED"));
    assertTrue(
        "hidden standard attribute when it should be shown ('hide aux')",
        jackFormattedHideAux.contains("ship: Black Pearl"));

    assertTrue(
        "shown operational attribute when it should be hidden ('hide aux and oper')",
        !jackFormattedHideAuxAndOper.contains("createTimestamp:"));
    assertTrue(
        "shown auxiliary attribute (effective status) when it should be hidden ('hide aux and oper')",
        !jackFormattedHideAuxAndOper.contains("Effective Status: ENABLED"));
    assertTrue(
        "shown auxiliary attribute (family name) when it should be hidden ('hide aux and oper')",
        !jackFormattedHideAuxAndOper.contains("Family Name: Sparrow"));
    assertTrue(
        "hidden standard attribute when it should be shown ('hide aux and oper')",
        jackFormattedHideAuxAndOper.contains("ship: Black Pearl"));
  }
Ejemplo n.º 3
0
  @Test(enabled = true)
  public void test020FormatUserModification() throws Exception {

    // GIVEN

    ObjectDelta<UserType> delta = parseDelta(USER_JACK_MODIFICATION_FILE);
    PrismObject<UserType> jack = PrismTestUtil.parseObject(new File(USER_JACK_FILE));

    System.out.println(delta.debugDump());
    // WHEN

    String deltaFormattedHideNone =
        textFormatter.formatObjectModificationDelta(delta, null, true, jack, null);
    System.out.println("no hidden paths + show operational attributes: " + deltaFormattedHideNone);

    String deltaFormattedHideOper =
        textFormatter.formatObjectModificationDelta(delta, null, false, jack, null);
    System.out.println("no hidden paths + hide operational attributes: " + deltaFormattedHideOper);

    String deltaFormattedHideAux =
        textFormatter.formatObjectModificationDelta(delta, auxiliaryPaths, true, jack, null);
    System.out.println(
        "hide auxiliary paths + show operational attributes: " + deltaFormattedHideAux);

    String deltaFormattedHideAuxAndOper =
        textFormatter.formatObjectModificationDelta(delta, auxiliaryPaths, false, jack, null);
    System.out.println(
        "hide auxiliary paths + hide operational attributes: " + deltaFormattedHideAuxAndOper);

    // THEN

    checkNotes(deltaFormattedHideAux);
    checkNotes(deltaFormattedHideAuxAndOper);
    checkNotes(deltaFormattedHideNone);
    checkNotes(deltaFormattedHideOper);

    assertTrue(
        "hidden operational attribute when it should be shown ('hide none')",
        deltaFormattedHideNone.contains("createTimestamp:"));
    assertTrue(
        "hidden auxiliary attribute (family name) when it should be shown ('hide none')",
        deltaFormattedHideNone.contains("SPARROW"));
    assertTrue(
        "hidden password change when it should be shown ('hide none')",
        deltaFormattedHideNone.contains("(protected string)"));
    assertTrue(
        "hidden standard attribute when it should be shown ('hide none')",
        deltaFormattedHideNone.contains("BLACK PEARL"));

    assertTrue(
        "shown operational attribute when it should be hidden ('hide oper')",
        !deltaFormattedHideOper.contains("createTimestamp:"));
    assertTrue(
        "hidden auxiliary attribute (family name) when it should be shown ('hide oper')",
        deltaFormattedHideOper.contains("SPARROW"));
    assertTrue(
        "hidden password change when it should be shown ('hide oper')",
        deltaFormattedHideOper.contains("(protected string)"));
    assertTrue(
        "hidden standard attribute when it should be shown ('hide oper')",
        deltaFormattedHideOper.contains("BLACK PEARL"));

    assertTrue(
        "shown auxiliary attribute (metadata) when it should be hidden ('hide aux')",
        !deltaFormattedHideAux.contains("createTimestamp:"));
    assertTrue(
        "shown auxiliary attribute (family name) when it should be hidden ('hide aux')",
        !deltaFormattedHideAux.contains("SPARROW"));
    assertTrue(
        "hidden standard attribute when it should be shown ('hide aux')",
        deltaFormattedHideAux.contains("BLACK PEARL"));

    assertTrue(
        "shown operational attribute when it should be hidden ('hide aux and oper')",
        !deltaFormattedHideAuxAndOper.contains("createTimestamp:"));
    assertTrue(
        "shown auxiliary attribute (family name) when it should be hidden ('hide aux and oper')",
        !deltaFormattedHideAuxAndOper.contains("SPARROW"));
    assertTrue(
        "hidden standard attribute when it should be shown ('hide aux and oper')",
        deltaFormattedHideAuxAndOper.contains("BLACK PEARL"));
  }