@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(); }
private void generateXmlTest( ISuite suite, XmlTest xmlTest, ITestContext context, Collection<ITestResult> failedTests, Collection<ITestResult> skippedTests) { // Note: we can have skipped tests and no failed tests // if a method depends on nonexistent groups if (skippedTests.size() > 0 || failedTests.size() > 0) { Set<ITestNGMethod> methodsToReRun = Sets.newHashSet(); // Get the transitive closure of all the failed methods and the methods // they depend on Collection[] allTests = new Collection[] {failedTests, skippedTests}; for (Collection<ITestResult> tests : allTests) { for (ITestResult failedTest : tests) { ITestNGMethod current = failedTest.getMethod(); if (current.isTest()) { methodsToReRun.add(current); ITestNGMethod method = failedTest.getMethod(); // Don't count configuration methods if (method.isTest()) { List<ITestNGMethod> methodsDependedUpon = MethodHelper.getMethodsDependedUpon(method, context.getAllTestMethods()); for (ITestNGMethod m : methodsDependedUpon) { if (m.isTest()) { methodsToReRun.add(m); } } } } } } // // Now we have all the right methods. Go through the list of // all the methods that were run and only pick those that are // in the methodToReRun map. Since the methods are already // sorted, we don't need to sort them again. // List<ITestNGMethod> result = Lists.newArrayList(); for (ITestNGMethod m : context.getAllTestMethods()) { if (methodsToReRun.contains(m)) { result.add(m); } } methodsToReRun.clear(); Collection<ITestNGMethod> invoked = suite.getInvokedMethods(); for (ITestNGMethod tm : invoked) { if (!tm.isTest()) { methodsToReRun.add(tm); } } result.addAll(methodsToReRun); createXmlTest(context, result, xmlTest); } }