dliatkouski/poa — Issue #1: RejectedExecutionException - 
Author: dliatkouski
Created: 2011-11-03 09:48:24+00:00
State: open

@ExternalTestcaseId( id = {81434} )
@Test( dependsOnMethods = {"closeScripts"}, description = "Request this script in several streams via ssh" )
public void runScriptViaSsh()
{
for( int i = 0; i < NUMBER_OF_STREAMS; i++ )
{
executorService.submit( new Runnable()
{
@Override
public void run()
{
sshOperationsService.executeCommand( "/usr/bin/perl webspace/cgi-bin/" + SCRIPT_FILE_NAME,
firstDomain.getDomainName(), sshUser, SSH_PASS );
}
} );
}
}

@ExternalTestcaseId( id = {81434} )
@Test( dependsOnMethods = {"runScriptViaSsh"}, description = "Check there are as many processes in \"watch\" output as \"ssh\" streams" )
public void checkNumberOfProcessesViaSsh()
{
limitingService.checkUserProccessesCount( firstDomain, SCRIPT_FILE_NAME, NUMBER_OF_STREAMS );
}

@ExternalTestcaseId( id = {81434} )
@Test( description = "Close ssh streams", dependsOnMethods = {"checkNumberOfProcessesViaSsh"} )
public void closeThreads() throws InterruptedException
{
limitingService.killAllProcesses( firstDomain, SCRIPT_FILE_NAME );
executorService.shutdownNow();
boolean terminated = executorService.awaitTermination(1800, TimeUnit.MILLISECONDS);
if (!terminated) {
Assert.fail();
}
}

@ExternalTestcaseId( id = {81434} )
@Test( dependsOnMethods = {"closeThreads"}, description = "Request this script in several streams via ssh and wget" )
public void runScriptViaBoth()
{
for( int i = 0; i < NUMBER_OF_STREAMS; i++ )
{
executorService.submit( new Runnable()

{
@Override
public void run()
{
sshOperationsService.executeCommand( "/usr/bin/perl webspace/cgi-bin/" + SCRIPT_FILE_NAME, firstDomain
.getDomainName(), sshUser, SSH_PASS );
}
} );
browsers.add( limitingService.runScript( firstDomain, SCRIPT_FILE_NAME, "http://" ) );
}
}