Пример #1
0
  @Test
  public void test206SearchForRoles() throws Exception {
    final String TEST_NAME = "test206SearchForRoles";
    TestUtil.displayTestTile(this, TEST_NAME);

    // GIVEN
    OperationResult result = new OperationResult(DOT_CLASS + TEST_NAME);
    PrismProperty<SearchExpressionType> expression = parseAnyData(SEARCH_FOR_ROLES_FILE);

    // WHEN
    Data output =
        scriptingExpressionEvaluator
            .evaluateExpression(expression.getAnyValue().getValue(), result)
            .getFinalOutput();

    // THEN
    IntegrationTestTools.display("output", output.getData());
    result.computeStatus();
    TestUtil.assertSuccess(result);
    // assertEquals(9, output.getData().size());
  }
Пример #2
0
  @Test
  public void test500ScriptingUsers() throws Exception {
    final String TEST_NAME = "test500ScriptingUsers";
    TestUtil.displayTestTile(this, TEST_NAME);

    // GIVEN
    OperationResult result = new OperationResult(DOT_CLASS + TEST_NAME);
    PrismProperty<ScriptingExpressionType> expression = parseAnyData(SCRIPTING_USERS_FILE);

    // WHEN
    ExecutionContext output =
        scriptingExpressionEvaluator.evaluateExpression(
            expression.getAnyValue().getValue(), result);

    // THEN
    TestUtil.assertSuccess(result);
    Data data = output.getFinalOutput();
    assertEquals("Unexpected # of items in output", 5, data.getData().size());
    Set<String> realOids = new HashSet<>();
    for (PrismValue value : data.getData()) {
      PrismObject<UserType> user = ((PrismObjectValue<UserType>) value).asPrismObject();
      assertEquals("Description not set", "Test", user.asObjectable().getDescription());
      realOids.add(user.getOid());
    }
    assertEquals(
        "Unexpected OIDs in output",
        Sets.newHashSet(
            Arrays.asList(
                USER_ADMINISTRATOR_OID,
                USER_JACK_OID,
                USER_BARBOSSA_OID,
                USER_GUYBRUSH_OID,
                USER_ELAINE_OID)),
        realOids);
    IntegrationTestTools.display("stdout", output.getConsoleOutput());
    IntegrationTestTools.display(result);
    result.computeStatus();
  }
Пример #3
0
  @Test
  public void test225SearchForUsersAccountsNoFetch() throws Exception {
    final String TEST_NAME = "test225SearchForUsersAccountsNoFetch";
    TestUtil.displayTestTile(this, TEST_NAME);

    // GIVEN
    OperationResult result = new OperationResult(DOT_CLASS + TEST_NAME);
    PrismProperty<SearchExpressionType> expression =
        parseAnyData(SEARCH_FOR_USERS_ACCOUNTS_NOFETCH_FILE);

    // WHEN
    Data output =
        scriptingExpressionEvaluator
            .evaluateExpression(expression.getAnyValue().getValue(), result)
            .getFinalOutput();

    // THEN
    IntegrationTestTools.display("output", output.getData());
    result.computeStatus();
    TestUtil.assertSuccess(result);
    assertEquals(4, output.getData().size());
    assertAttributesNotFetched(output.getData());
  }
Пример #4
0
  @Test
  public void test200SearchUser() throws Exception {
    final String TEST_NAME = "test200SearchUser";
    TestUtil.displayTestTile(this, TEST_NAME);

    // GIVEN
    OperationResult result = new OperationResult(DOT_CLASS + TEST_NAME);
    PrismProperty<SearchExpressionType> expression = parseAnyData(SEARCH_FOR_USERS_FILE);

    // WHEN
    Data output =
        scriptingExpressionEvaluator
            .evaluateExpression(expression.getAnyValue().getValue(), result)
            .getFinalOutput();

    // THEN
    IntegrationTestTools.display("output", output.getData());
    result.computeStatus();
    TestUtil.assertSuccess(result);
    assertEquals(2, output.getData().size());
    // assertEquals("administrator", ((PrismObject<UserType>)
    // output.getData().get(0)).asObjectable().getName().getOrig());
  }