public ConfigurationImpl(Configuration configuration) { this.outputDirectory = configuration.getOutputDirectory(); this.standalone = configuration.isStandalone(); this.runIntegrationTests = configuration.isRunIntegrationTests(); this.connectTimeout = configuration.getConnectTimeout(); this.libraryDirectory = configuration.getLibraryDirectory(); this.testLauncher = configuration.getInContainerTestLauncher(); this.containers = configuration.getContainers(); this.standaloneContainers = configuration.getStandaloneContainers(); this.host = configuration.getHost(); this.extraPackages = configuration.getExtraPackages(); this.extraResources = configuration.getExtraResources(); }
private static InputStream getDeploymentProperties(Class<?> declaringClass) throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { Writer writer = new PrintWriter( os ); writer.write( "className=" + declaringClass.getName() + "\n" ); writer.write( Configuration.STANDALONE_PROPERTY_NAME + "=false\n" ); for ( String line : ConfigurationImpl.get().getExtraDeploymentProperties() ) { writer.write( line + "\n" ); } writer.flush(); return new ByteArrayInputStream( os.toByteArray() ); } finally { os.close(); } }
public TCKArtifact createArtifact(Class<?> declaringClass) { if ( declaringClass.isAnnotationPresent( Artifact.class ) ) { return new ArtifactProcessor( declaringClass, configuration.isStandalone(), configuration.getLibraryDirectory() ).createArtifact(); } else { return null; } }
@AfterSuite(alwaysRun = true, groups = "scaffold") public void afterSuite() throws Exception { if (isSuiteDeployingTestsToContainer()) { getCurrentConfiguration().getContainers().cleanup(); } if (getCurrentConfiguration().isStandalone()) { getCurrentConfiguration().getStandaloneContainers().cleanup(); } }
public ArtifactDescriptor initialize() { for ( String packageName : ConfigurationImpl.get().getExtraPackages() ) { addPackage( packageName, false ); } getResources().addAll( ConfigurationImpl.get().getExtraResources() ); return this; }
String url = "http://" + configuration.getHost() + "/" + testClass.getName() + "/?outputMode=serializedObject&methodName=" + method.getName(); long timeoutTime = System.currentTimeMillis() + configuration.getConnectTimeout(); boolean interrupted = false; while (timeoutTime > System.currentTimeMillis())
if (!getCurrentConfiguration().getContainers().deploy(jar, artifact.getDefaultName())) this.deploymentException = handleDeploymentFailure(getCurrentConfiguration().getContainers().getDeploymentException()); if (!getCurrentConfiguration().getStandaloneContainers().deploy(classes, xmlResourcesAsList())) this.deploymentException = handleDeploymentFailure(getCurrentConfiguration().getStandaloneContainers().getDeploymentException());
if (!getCurrentConfiguration().isStandalone() && !isInContainer() && !artifact.isRunLocally()) TestResult result = getCurrentConfiguration().getInContainerTestLauncher().launchTest(new TestNGInvocationContext(testResult, callback)); if (result.getStatus().equals(Status.FAILED) || result.getStatus().equals(Status.SKIPPED))
protected String getContextPath() { return "http://" + getCurrentConfiguration().getHost() + "/" + this.getClass().getName() + "/"; }
public void dumpArtifacts(String basePackageName) { if ( basePackageName == null ) { throw new IllegalArgumentException( "Cannot dump artifacts as no package to dump from set. Specify org.jboss.testharness.testPackage" ); } List<TCKArtifact> artifacts = createArtifacts( basePackageName ); File file = new File( configuration.getOutputDirectory() ); if ( !file.exists() ) { file.mkdirs(); } else if ( file.isFile() ) { throw new IllegalStateException( "Cannot use debug directory " + configuration.getOutputDirectory() + ", it already exists" ); } log.info( "Writing " + artifacts.size() + " artifact(s) to " + configuration.getOutputDirectory() ); for ( TCKArtifact artifact : artifacts ) { try { artifact.writeArtifactToDisk( configuration.getOutputDirectory() ); log.info( "Written artifact to disk " + artifact ); } catch ( IOException e ) { log.warn( "Error writing artifact to disk " + artifact, e ); } } }
private void undeployArtifact() throws Exception { if (isDeployToContainerNeeded()) { getCurrentConfiguration().getContainers().undeploy(artifact.getDefaultName()); } if (getCurrentConfiguration().isStandalone() && artifact != null && artifact.isUnit()) { getCurrentConfiguration().getStandaloneContainers().undeploy(); } }
@BeforeSuite(alwaysRun = true, groups = "scaffold") public void beforeSuite(ITestContext context) throws Exception { if (isSuiteDeployingTestsToContainer()) { getCurrentConfiguration().getContainers().setup(); } if (getCurrentConfiguration().isStandalone()) { getCurrentConfiguration().getStandaloneContainers().setup(); } checkAssertionsEnabled(); }