private ClassLoader getDeploymentClassLoader(ClassLoader parent, ClassLoader scl) throws Exception { List<URL> constituents = new ArrayList<URL>(); for (String constituent : deploymentClasspath) { constituents.add(new URL(constituent)); } ClassLoader dcl = null; try { String className = "org.bluestemsoftware.specification.eoa.DeploymentClassLoader"; Class<?> clazz = parent.loadClass(className); Constructor<?> ctr = clazz.getConstructor(new Class[] { String.class, URL[].class, ClassLoader.class, scl.getClass() }); String id = null; if (packaging.equals("eoa-component")) { id = groupID + "/" + artifactID + "/" + version + "/" + packaging; } else { id = groupID + "/" + artifactID + "/" + packaging; } dcl = (ClassLoader)ctr.newInstance(new Object[] { id, toArray(constituents), parent, scl }); } catch (Exception ex) { if (ex.getMessage() == null) { throw new SurefireExecutionException("Error creating deployment classloader.", ex); } else { throw new SurefireExecutionException("Error creating deployment classloader. " + ex.getMessage(), ex); } } dcl.setDefaultAssertionStatus(true); System.getProperties().put("eoa.system.deployment.classloader", dcl); return dcl; }
throw new SurefireExecutionException("Error creating shared classloader.", ex); } else { throw new SurefireExecutionException("Error creating shared classloader. " + ex.getMessage(), ex);
throw new SurefireExecutionException( e.getTargetException().getMessage(), e.getTargetException() ); throw new SurefireExecutionException( "Unable to instantiate and execute Surefire", e );
clazz = cl.loadClass(classNames.get(0)); } catch (RuntimeException re) { throw new SurefireExecutionException("Error loading service provider implementation of " + pcp + ". ", re);
throw new SurefireExecutionException( e.getTargetException().getMessage(), e.getTargetException() ); throw new SurefireExecutionException( "Unable to instantiate and execute Surefire", e );
public ClassLoader createClassLoader( boolean childDelegation, boolean enableAssertions, @Nonnull String roleName ) throws SurefireExecutionException { try { ClassLoader parent = SystemUtils.platformClassLoader(); IsolatedClassLoader classLoader = new IsolatedClassLoader( parent, childDelegation, roleName ); for ( String classPathElement : unmodifiableElements ) { classLoader.addURL( new File( classPathElement ).toURL() ); } if ( parent != null ) { parent.setDefaultAssertionStatus( enableAssertions ); } classLoader.setDefaultAssertionStatus( enableAssertions ); return classLoader; } catch ( MalformedURLException e ) { throw new SurefireExecutionException( "When creating classloader", e ); } }
throw new SurefireExecutionException(ex.getMessage(), ex); } catch (Exception ex) { if (ex.getMessage() == null) { throw new SurefireExecutionException("Error executing configuration.", ex); } else { throw new SurefireExecutionException("Error executing configuration. " + ex.getMessage(), ex); .loadClass("org.bluestemsoftware.open.eoa.test.system.cfg.ApplicationConfiguration"); } catch (ClassNotFoundException ce) { throw new SurefireExecutionException("Error executing configuration. " + ce.getMessage(), ce); } catch (Exception ex) { if (ex.getMessage() == null) { throw new SurefireExecutionException("Error executing configuration.", ex); } else { throw new SurefireExecutionException("Error executing configuration. " + ex.getMessage(), ex); "eoa.system.test.properties"); if (testProperties == null) { throw new SurefireExecutionException( "Error executing configuration. ApplicationConfiguration instance " + " failed to define test properties map as system property", null); } catch (Exception ex) { if (ex.getMessage() == null) { throw new SurefireExecutionException("Error executing tests.", ex); } else {
public int run() throws SurefireBooterForkException, SurefireExecutionException { int result; if ( ForkConfiguration.FORK_NEVER.equals( forkConfiguration.getForkMode() ) ) { result = runSuitesInProcess(); } else if ( ForkConfiguration.FORK_ONCE.equals( forkConfiguration.getForkMode() ) ) { result = runSuitesForkOnce(); } else if ( ForkConfiguration.FORK_ALWAYS.equals( forkConfiguration.getForkMode() ) ) { result = runSuitesForkPerTestSet(); } else { throw new SurefireExecutionException( "Unknown forkmode: " + forkConfiguration.getForkMode(), null ); } return result; }
public RunResult runSuitesInProcess( @Nonnull DefaultScanResult scanResult ) throws SurefireExecutionException, TestSetFailedException { // The test classloader must be constructed first to avoid issues with commons-logging until we properly // separate the TestNG classloader Map<String, String> providerProperties = providerConfig.getProviderProperties(); scanResult.writeTo( providerProperties ); startupConfig.writeSurefireTestClasspathProperty(); ClassLoader testClassLoader = startupConfig.getClasspathConfiguration() .toRealPath( ClasspathConfiguration.class ) .createMergedClassLoader(); CommonReflector surefireReflector = new CommonReflector( testClassLoader ); Object factory = surefireReflector.createReportingReporterFactory( startupReportConfig, consoleLogger ); try { return invokeProvider( null, testClassLoader, factory, providerConfig, false, startupConfig, true ); } catch ( InvocationTargetException e ) { throw new SurefireExecutionException( "Exception in provider", e.getTargetException() ); } }
public RunResult runSuitesInProcess( @Nonnull DefaultScanResult scanResult ) throws SurefireExecutionException, TestSetFailedException { // The test classloader must be constructed first to avoid issues with commons-logging until we properly // separate the TestNG classloader Map<String, String> providerProperties = providerConfig.getProviderProperties(); scanResult.writeTo( providerProperties ); startupConfig.writeSurefireTestClasspathProperty(); ClassLoader testClassLoader = startupConfig.getClasspathConfiguration() .toRealPath( ClasspathConfiguration.class ) .createMergedClassLoader(); CommonReflector surefireReflector = new CommonReflector( testClassLoader ); Object factory = surefireReflector.createReportingReporterFactory( startupReportConfig, consoleLogger ); try { return invokeProvider( null, testClassLoader, factory, providerConfig, false, startupConfig, true ); } catch ( InvocationTargetException e ) { throw new SurefireExecutionException( "Exception in provider", e.getTargetException() ); } }