Пример #1
0
 Object createStartupReportConfiguration(
     @Nonnull StartupReportConfiguration reporterConfiguration) {
   Constructor<?> constructor =
       ReflectionUtils.getConstructor(
           startupReportConfiguration,
           boolean.class,
           boolean.class,
           String.class,
           boolean.class,
           boolean.class,
           File.class,
           boolean.class,
           String.class,
           String.class,
           boolean.class,
           int.class);
   //noinspection BooleanConstructorCall
   Object[] params = {
     reporterConfiguration.isUseFile(),
     reporterConfiguration.isPrintSummary(),
     reporterConfiguration.getReportFormat(),
     reporterConfiguration.isRedirectTestOutputToFile(),
     reporterConfiguration.isDisableXmlReport(),
     reporterConfiguration.getReportsDirectory(),
     reporterConfiguration.isTrimStackTrace(),
     reporterConfiguration.getReportNameSuffix(),
     reporterConfiguration.getConfigurationHash(),
     reporterConfiguration.isRequiresRunHistory(),
     reporterConfiguration.getRerunFailingTestsCount()
   };
   return ReflectionUtils.newInstance(constructor, params);
 }
 public Iterator getSuites() {
   ClassLoader current = swapClassLoader(testsClassLoader);
   try {
     return (Iterator) ReflectionUtils.invokeGetter(providerInOtherClassLoader, "getSuites");
   } finally {
     Thread.currentThread().setContextClassLoader(current);
   }
 }
Пример #3
0
 public Object createReportingReporterFactory(
     @Nonnull StartupReportConfiguration startupReportConfiguration) {
   Class<?>[] args = new Class[] {this.startupReportConfiguration};
   Object src = createStartupReportConfiguration(startupReportConfiguration);
   Object[] params = new Object[] {src};
   return ReflectionUtils.instantiateObject(
       DefaultReporterFactory.class.getName(), args, params, surefireClassLoader);
 }
    public RunResult invoke(Object forkTestSet)
        throws TestSetFailedException, ReporterException, InvocationTargetException {
      ClassLoader current = swapClassLoader(testsClassLoader);
      try {
        final Method invoke =
            ReflectionUtils.getMethod(
                providerInOtherClassLoader.getClass(), "invoke", invokeParamaters);

        final Object result =
            ReflectionUtils.invokeMethodWithArray2(
                providerInOtherClassLoader, invoke, new Object[] {forkTestSet});
        return (RunResult) surefireReflector.convertIfRunResult(result);
      } finally {
        if (System.getSecurityManager() == null) {
          Thread.currentThread().setContextClassLoader(current);
        }
      }
    }
 public void cancel() {
   final Method invoke =
       ReflectionUtils.getMethod(
           providerInOtherClassLoader.getClass(), "cancel", new Class[] {});
   ReflectionUtils.invokeMethodWithArray(providerInOtherClassLoader, invoke, null);
 }