Author: ozizka(a)redhat.com
Date: 2009-05-18 08:29:19 -0400 (Mon, 18 May 2009)
New Revision: 434
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java
Log:
EarTest - cleanup.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java 2009-05-18
12:25:53 UTC (rev 433)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java 2009-05-18
12:29:19 UTC (rev 434)
@@ -1210,99 +1210,10 @@
}
- /**
- * Waits for the deployable to be in the UP State.
- *
- * @param type Type of deployable - EAR, WAR, SAR, ...
- * @param name Name of the deployable, like 'hello.war'.
- @deprecated Moved to EJTT.Deployment.
- */
- private void XwaitActivelyForDeployment(
- final DeployableTypes type, final String name,
- int intervalMS, int retries
- )
- throws EmbJoprTestException, IOException
- {
- try {
- String conditionDesc = type.name()+" "+name+" appears in embjopr as
deployed";
- final EmbJoprTestToolkit selfEjtt = ejtt;
- boolean deployedSuccessfuly =
- new ActiveConditionChecker( new DescribedCondition(conditionDesc) {
- int callsMade = 0;
- public boolean isTrue() throws HtmlElementNotFoundException, IOException {
- // Refresh the page if this is not the first call.
- if( callsMade++ > 0 )
- selfEjtt.refreshPage();
- // If found, return true.
- return new DeploymentUtils().isDeployedAccordingToEmbJopr( type, name );
- }
- } ).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout( intervalMS, retries );
- }
- catch( EmbJoprTestException ex ){ throw ex; }
- catch( IOException ex ){ throw ex; }
- // Wrap all exceptions to EmbJoprTestException.
- catch( Exception ex ){
- throw new EmbJoprTestException("Exception thrown while actively waiting for
condition.", ex);
- }
- }
- /**
- * Utilities for performing and checking deployment.
- * In the future, it should be general interface like
- * boolean isDeployed( DeployableType type, String name ).
- */
- protected class DeploymentUtils {
-
- /**
- * Returns true if EmbJopr lists a deployable of given type and name,
- * and it's State is UP; false otherwise.
- */
- private boolean isDeployedAccordingToEmbJopr( DeployableTypes type, String
deployableName )
- throws HtmlElementNotFoundException, IOException
- {
- // Refresh / go to the appropriate page.
- ejtt.getNavTree().getNodeByLabel( type.getNavTreeLabel() ).click();
- ContentTableRow earRow =
ejtt.getDefaultContentTable().findFirstRowContainingLink(deployableName);
- if( null == earRow ){
- log.debug("Row with "+deployableName+" not present.");
- return false;
- }
-
- String statusText = earRow.getCellTextByColumnName("Status");
- if( "UP".equals(statusText) ){
- return true;
- }else{
- log.debug("Row with "+deployableName+" has Status ==
'"+statusText+"' != UP.");
- return false;
- }
- }
-
-
- private void undeployViaFileSystem( String name ) throws EmbJoprTestException{
- String deployPath = System.getProperty(SYSPROP_DEPLOY_DIR);
- String fileName = deployPath+"/"+name;
- File fileToDelete = new File(fileName);
-
- if( !fileToDelete.exists() )
- throw new EmbJoprTestException("Deployable doesn't exist: "+fileName);
-
- if(fileToDelete.isFile()){
- if( !fileToDelete.delete() ){
- throw new EmbJoprTestException("Unable to delete: "+fileName);
- }
- }else if(fileToDelete.isDirectory()){
- deleteDirectory(fileToDelete);
- }
-
- }// isDeployedAccordingToFileSystem()
-
-
- }// class DeploymentUtils
-
-