EMBJOPR SVN: r512 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-08 11:46:19 -0400 (Mon, 08 Jun 2009)
New Revision: 512
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java
Log:
EarTest#testEarDeploymentRepeated() updated
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-06-08 13:58:52 UTC (rev 511)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java 2009-06-08 15:46:19 UTC (rev 512)
@@ -155,6 +155,10 @@
ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
}
}
+ catch( EmbJoprTestException ex ){
+ log.error(ex.toString());
+ throw ex;
+ }
finally {
try {
// Undeploy the EAR.
15 years, 6 months
EMBJOPR SVN: r511 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-08 09:58:52 -0400 (Mon, 08 Jun 2009)
New Revision: 511
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
Log:
EmbjoprTestCase base class updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-06-05 18:52:41 UTC (rev 510)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-06-08 13:58:52 UTC (rev 511)
@@ -86,6 +86,8 @@
public JSFClientSession getClient() { return client; }
public JSFServerSession getServer() { return server; }
+ private long testStartTime;
+
/**
* Start a JSFUnit session by logging in to the main page. Note that
* because setUp() is called before each test, a new HttpSession will be
@@ -99,7 +101,10 @@
log.info(" Setting up test "+this.getClass().getName()+"#"+this.getName());
log.info("========================================================================================");
+ // Save the startup time.
+ this.testStartTime = System.currentTimeMillis();
+
// JVM version
log.info("Java version: "+System.getProperty("java.version") + "," +
" vendor: " +System.getProperty("java.vendor"));
@@ -157,7 +162,7 @@
@Override
protected void tearDown() throws Exception {
// Denounce this test in the JBoss log.
- log.info("------ END OF TEST "+this.getName()+" -------");
+ log.info("------ END OF TEST "+this.getName()+" - took "+((System.currentTimeMillis() - this.testStartTime)/1000)+" seconds. -------");
}
15 years, 6 months
EMBJOPR SVN: r510 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-05 14:52:41 -0400 (Fri, 05 Jun 2009)
New Revision: 510
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java
Log:
EJB tests updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java 2009-06-05 18:37:30 UTC (rev 509)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java 2009-06-05 18:52:41 UTC (rev 510)
@@ -308,7 +308,7 @@
// Finally, click the Refresh button.
- String xPath = ".//input[normalize-space(value)='Refresh']";
+ String xPath = ".//input[normalize-space(@value)='Refresh']";
HtmlInput button = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
if( null == button )
throw new HtmlElementNotFoundException("Refresh button not found using XPath: "+xPath);
15 years, 6 months
EMBJOPR SVN: r509 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-05 14:37:30 -0400 (Fri, 05 Jun 2009)
New Revision: 509
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
EJTT updated - JSF error message after undeployment causes undeployViaEmbJopr() throw an exception.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-06-05 18:20:40 UTC (rev 508)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-06-05 18:37:30 UTC (rev 509)
@@ -1750,13 +1750,14 @@
+
/**
* Undeploys the deployable using EmbJopr's web UI.
*
* @param type Type of the deployable - EAR, SAR, WAR, ...
*/
public void undeployViaEmbJopr( AppConstants.DeployableTypes type, String fileName )
- throws IOException, HtmlElementNotFoundException, ActionNotAvailableException, ActionOutOfSyncException
+ throws IOException, HtmlElementNotFoundException, ActionNotAvailableException, ActionOutOfSyncException, EmbJoprTestException
{
// Navigate to Enterprise Archives
@@ -1770,14 +1771,23 @@
deleteButton.click();
// Log the message (with prefix of potential warning)
- logServerMessage("Something went wrong with undeploy: ");
+ //logServerMessage("Something went wrong with undeploy: ");
+ // In case of error, throw an exception.
+ if( server.getFacesMessages().hasNext() ){
+ FacesMessage msg = server.getFacesMessages().next();
+ if( msg.getSeverity() == FacesMessage.SEVERITY_INFO ){
+ log.info( msg.getSummary() +"\n"+ msg.getDetail() );
+ }else{
+ throw new EmbJoprTestException( "Undeployment error: " + msg.getSummary() +"\n"+ msg.getDetail() );
+ }
+ }
+
// Sleep for 3 sec. TODO: write some waitForUndeployed()
sleep( 3000 );
}// undeployViaEmbJopr()
-
// TODO: The following was copied from EarTest.java; remove from there.
15 years, 6 months
EMBJOPR SVN: r508 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5/app/ejb and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-05 14:20:40 -0400 (Fri, 05 Jun 2009)
New Revision: 508
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java
Log:
EJB tests updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-06-05 17:27:04 UTC (rev 507)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-06-05 18:20:40 UTC (rev 508)
@@ -222,4 +222,6 @@
public static final String EJB_DEL_MSG_FORMAT = "Successfully deleted %s JAR '%s'.";
public static final String DELETE_MSG_FORMAT = "Successfully deleted %s '%s'.";
+ public static final String MSG_FORMAT_DEPLOY_SUCCESS = "Resource %s created successfully!";
+
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java 2009-06-05 17:27:04 UTC (rev 507)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java 2009-06-05 18:20:40 UTC (rev 508)
@@ -181,13 +181,9 @@
FacesMessage successMessage = server.getFacesMessages().next();
assertTrue(FacesMessage.SEVERITY_INFO.equals(successMessage.getSeverity()));
assertTrue(successMessage.getDetail().contains("Resource " + REDEPLOY_JAR_NAME + " created successfully!"));
-
// Use JMX to assert that the EJB components really did deploy successfully.
- assertTrue("JMX shouldn't report " + REDEPLOY_JAR_NAME + " as deployed.", isEJBDeployed(REDEPLOY_JAR_NAME));
-
- String expectedMessage = String.format( DELETE_MSG_FORMAT, APP_TYPE.getDisplayName(), REDEPLOY_JAR_NAME);
- assertTrue("Page doesn't contain success message.", client.getPageAsText().contains(expectedMessage));
- assertFalse("Deployable seems not to be deployed: " + REDEPLOY_JAR_NAME, isEJBDeployed(REDEPLOY_JAR_NAME));
+ assertTrue("JMX should report " + REDEPLOY_JAR_NAME + " as deployed.", isEJBDeployed(REDEPLOY_JAR_NAME));
+
}
finally {
// Undeploy the EJB JAR
@@ -287,15 +283,17 @@
// Check the values in info table(s)
+ /* Was removed.
// General Properties
HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
ContentInfoTable infoTable = ejtt.getContentInfoTable(genpropTable);
Properties props = infoTable.getProperties();
+ */
// Traits
- infoTable = ejtt.getContentInfoTable(
+ ContentInfoTable infoTable = ejtt.getContentInfoTable(
ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Traits").getElement());
- props = infoTable.getProperties();
+ Properties props = infoTable.getProperties();
// Path
String path = ejtt.getDeployDir() + "/" + DEPLOYABLE_NAME;
@@ -348,7 +346,7 @@
// Deploy the APP.
String appfilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME;
- ejtt.deployment.deployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, appfilePath);
try {
15 years, 6 months
EMBJOPR SVN: r507 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-05 13:27:04 -0400 (Fri, 05 Jun 2009)
New Revision: 507
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java
Log:
EJB tests updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java 2009-06-05 17:07:07 UTC (rev 506)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java 2009-06-05 17:27:04 UTC (rev 507)
@@ -41,7 +41,7 @@
* @return the suite of tests being tested
*/
public static Test suite() {
- return new TestSuite(Ejb20Test.class);
+ return new TestSuite(Ejb30Test.class);
}
15 years, 6 months
EMBJOPR SVN: r506 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-05 13:07:07 -0400 (Fri, 05 Jun 2009)
New Revision: 506
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java
Log:
EJB tests updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java 2009-06-05 16:43:20 UTC (rev 505)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java 2009-06-05 17:07:07 UTC (rev 506)
@@ -21,6 +21,8 @@
*/
package org.jboss.jopr.jsfunit.as5.app.ejb;
+import junit.framework.Test;
+import junit.framework.TestSuite;
import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
@@ -35,6 +37,14 @@
*/
public class Ejb20Test extends EjbTestBase {
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite() {
+ return new TestSuite(Ejb20Test.class);
+ }
+
+
public DeployableTypes getAppType() {
return DeployableTypes.EJB2;
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java 2009-06-05 16:43:20 UTC (rev 505)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java 2009-06-05 17:07:07 UTC (rev 506)
@@ -21,6 +21,8 @@
*/
package org.jboss.jopr.jsfunit.as5.app.ejb;
+import junit.framework.Test;
+import junit.framework.TestSuite;
import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
@@ -35,6 +37,14 @@
*/
public class Ejb30Test extends EjbTestBase {
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite() {
+ return new TestSuite(Ejb20Test.class);
+ }
+
+
public DeployableTypes getAppType() {
return DeployableTypes.EJB3;
}
15 years, 6 months
EMBJOPR SVN: r505 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5/app/ejb and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-05 12:43:20 -0400 (Fri, 05 Jun 2009)
New Revision: 505
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java
Log:
EJB tests updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-06-05 13:55:21 UTC (rev 504)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-06-05 16:43:20 UTC (rev 505)
@@ -41,22 +41,25 @@
*/
public enum DeployableTypes {
- // Nav tree link label, testdata/$dir, extension, suffix, mime type.
- EAR(AppConstants.NAV_EAR, "ear", ".ear", null, "application/ear"),
- WAR(AppConstants.NAV_WAR, "war", ".war", null, "application/war"),
- EJB2(AppConstants.NAV_EJB2, "ejb2", ".jar", null, "application/java-archive"),
- EJB3(AppConstants.NAV_EJB3, "ejb3", ".jar", null, "application/java-archive"),
- SAR(AppConstants.NAV_SAR, "sar", ".sar", "-service.xml", "application/sar"),
- RAR(AppConstants.NAV_RAR, "rar", ".rar", null, "application/rar"),
- EMB_RAR(AppConstants.NAV_EMB_RAR,"", ".rar", null, "application/rar"),
- MC_BEAN(AppConstants.NAV_MC, "mc", "", null, "application/java-archive"),
- EMB_WAR(AppConstants.NAV_EMB_WAR,"",".war", null, "application/war");
+ // Nav tree link label, EmbJopr display name, testdata/$dir, extension, suffix, mime type.
+ EAR(AppConstants.NAV_EAR, "EAR", "ear", ".ear", null, "application/ear"),
+ WAR(AppConstants.NAV_WAR, "WAR", "war", ".war", null, "application/war"),
+ EJB2(AppConstants.NAV_EJB2, "EJB2 JAR", "ejb2", ".jar", null, "application/java-archive"),
+ EJB3(AppConstants.NAV_EJB3, "EJB3 JAR", "ejb3", ".jar", null, "application/java-archive"),
+ SAR(AppConstants.NAV_SAR, "SAR", "sar", ".sar", "-service.xml", "application/sar"),
+ RAR(AppConstants.NAV_RAR, "RAR", "rar", ".rar", null, "application/rar"),
+ EMB_RAR(AppConstants.NAV_EMB_RAR,"Embedded RAR", "", ".rar", null, "application/rar"),
+ MC_BEAN(AppConstants.NAV_MC, "?", "mc", "", null, "application/java-archive"),
+ EMB_WAR(AppConstants.NAV_EMB_WAR,"Embbedded WAR", "", ".war", null, "application/war");
// -- Fields --
protected final String navTreeLabel;
public String getNavTreeLabel() { return navTreeLabel; }
+ protected final String displayName;
+ public String getDisplayName() { return displayName; }
+
protected final String dataDir;
public String getDataDir() { return dataDir; }
@@ -76,11 +79,13 @@
private DeployableTypes(
String navTreeLabel,
+ String displayName,
String dataDir,
String extension,
String suffix, String mimeType)
{
this.navTreeLabel = navTreeLabel;
+ this.displayName = displayName;
this.dataDir = dataDir;
this.extension = extension;
this.suffix = suffix;
@@ -131,14 +136,17 @@
// EJB 2.x
+ public static final String BASIC_EJB2 = "deployment-ejb.jar";
public static final String BAD_EJB2_JAR = "ejbredeploy-bad.jar";
public static final String GOOD_EJB2_JAR = "ejbredeploy-good.jar";
public static final String REDEPLOY_EJB2_JAR = "ejbredeploy.jar";
// EJB 3.0
- public static final String BASIC_EJB2 = "deployment-ejb.jar";
public static final String BASIC_EJB3 = "BasicEJB3.jar";
+ public static final String BAD_EJB3_JAR = "BasicEJB3-bad.jar";
+ public static final String GOOD_EJB3_JAR = "BasicEJB3-good.jar";
+ public static final String REDEPLOY_EJB3_JAR = "BasicEJB3.jar";
// EAR
@@ -208,8 +216,10 @@
"sqlexception-service.xml", "transaction-service.xml", "uuid-key-generator.sar"
};
- // Status Messages
- public static final String EJB2_DEL_MSG = "Successfully deleted EJB2 JAR";
- public static final String EJB3_DEL_MSG = "Successfully deleted EJB3 JAR";
+ // Status Messages
+ //public static final String EJB2_DEL_MSG = "Successfully deleted EJB2 JAR";
+ //public static final String EJB3_DEL_MSG = "Successfully deleted EJB3 JAR";
+ public static final String EJB_DEL_MSG_FORMAT = "Successfully deleted %s JAR '%s'.";
+ public static final String DELETE_MSG_FORMAT = "Successfully deleted %s '%s'.";
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java 2009-06-05 13:55:21 UTC (rev 504)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java 2009-06-05 16:43:20 UTC (rev 505)
@@ -23,21 +23,7 @@
import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
-import com.gargoylesoftware.htmlunit.WebClient;
-import org.jboss.jopr.jsfunit.*;
-import com.gargoylesoftware.htmlunit.html.*;
-import java.io.*;
-import java.util.*;
-import javax.faces.application.FacesMessage;
-import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletRequest;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.math.NumberUtils;
import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
-import org.jboss.jopr.jsfunit.exceptions.*;
import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
/**
@@ -47,387 +33,36 @@
* @author Shelly McGowan
*
*/
-public class Ejb20Test extends ApplicationTestBaseAS5 {
+public class Ejb20Test extends EjbTestBase {
- public static final DeployableTypes APP_TYPE = DeployableTypes.EJB2;
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite() {
- return new TestSuite(Ejb20Test.class);
+ public DeployableTypes getAppType() {
+ return DeployableTypes.EJB2;
}
-
-
-
-
- /*
- * testName: testBasicEjbDeployment
- * assertion: verify basic deployment of an EJB JAR.
- * test Strategy: Navigate to EJB Applications.
- * Add a new resource. Verify the resource was successfully
- * deployed. Undeploy the archive.
- *
- */
- public void testBasicEjbDeployment() throws IOException, EmbJoprTestException {
-
- final String DEPLOYABLE_NAME = BASIC_EJB2;
-
- try {
- // Navigate to EJB Applications
- HtmlAnchor ejbLink = getNavTreeLink(APP_TYPE.getNavTreeLabel());
- ejbLink.click();
-
- // click on the "Add new resource" button
- client.click("actionHeaderForm:addNewContent"); // 404 if setThrowExceptionOnFailingStatusCode(true) above
-
- // TODO: "/ejb/BASIC_JAR" causes exceptions in seam:
- // http://wwwapps.rdu.redhat.com/w3xpastebin/pastebin.php?show=9842
-
- String filePath = ejtt.getTestDataDir() + "/" + APP_TYPE.getDataDir() + "/" + DEPLOYABLE_NAME;
- log.info("Uploading EJB2 archive: " + filePath);
- File uploadFile = new File(filePath);
- if (!uploadFile.exists()) {
- throw new EmbJoprTestException("Can't find EJB2 file to upload: '" + filePath + "'");
- }
-
- // upload ejb
- HtmlFileInput fileInput = (HtmlFileInput) client.getElement("createContentForm:file");
- fileInput.setContentType("application/ejb");
- fileInput.setValueAttribute(filePath);
- client.click("createContentForm:addButton");
-
- log.info("HTTP status after EJB2 upload: " + client.getContentPage().getWebResponse().getStatusCode());
- log.info("renderResponse() called: " + server.getFacesContext().getRenderResponse());
- log.info("responseComplete() called: " + server.getFacesContext().getResponseComplete());
-
- String errorMessage =
- (server.getFacesMessages().hasNext() && server.getFacesMessages().next().getSeverity() != FacesMessage.SEVERITY_INFO) ? " Faces message: " + server.getFacesMessages().next()
- : ""; // Awful code
-
- // FAILS because of NPE and HTTP 500.
- // assert that the success message appeared on the client side
- assertTrue("Success message not found." + errorMessage, client.getPageAsText().contains("Resource " + DEPLOYABLE_NAME + " created successfully!"));
-
- // assert text and severity level for FacesMessage on server side
- assertTrue(server.getFacesMessages().hasNext());
- FacesMessage successMessage = server.getFacesMessages().next();
- assertTrue(FacesMessage.SEVERITY_INFO.equals(successMessage.getSeverity()));
- assertTrue(successMessage.getDetail().contains("Resource " + DEPLOYABLE_NAME + " created successfully!"));
-
- assertFalse("Page contains 'Total: 0', EJBs probably not listed.", client.getPageAsText().contains("Total: 0"));
-
-
- // Use JMX to assert that the EJB components really did deploy successfully
- assertTrue(isEJBDeployed(DEPLOYABLE_NAME));
-
- // Undeploy the EJB JAR
- HtmlButtonInput deleteButton = getAppDeleteButton(DEPLOYABLE_NAME);
- deleteButton.click();
-
- assertTrue("Page doesn't contain success message.", client.getPageAsText().contains(EJB2_DEL_MSG + " '" + DEPLOYABLE_NAME + "'."));
-
- assertFalse("Deployable seems not to be deployed: " + DEPLOYABLE_NAME, isEJBDeployed(DEPLOYABLE_NAME));
- } finally {
- // Undeploy the EJB JAR
- try {
- ejtt.deployment.undeployViaEmbJopr(APP_TYPE, REDEPLOY_EJB2_JAR);
- } catch (EmbJoprTestException ex) {
- log.debug("Exception during undeployment - " + ex.getMessage());
- }
- }
-
- }// testBasicEjbDeployment()
-
-
-
-
-
-
-
- /**
- test Strategy:
-
- Deploy an ejb-jar that is known to have a bad deployment
- descriptor. Verify the console shows deployment failed.
- Upload the fixed the achive, redeploy and
- verify the archive has been successfully deployed.
- */
- public void testBadEjbRedeploy() throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
-
- try {
- String badFileSrcPath = ejtt.getTestDataDir() + "/" + APP_TYPE.getDataDir() + "/" + BAD_EJB2_JAR;
- String goodFileSrcPath = ejtt.getTestDataDir() + "/" + APP_TYPE.getDataDir() + "/" + GOOD_EJB2_JAR;
- String ejbFilePath = ejtt.getTestDataDir() + "/" + APP_TYPE.getDataDir() + "/" + REDEPLOY_EJB2_JAR;
-
- FileUtils.copyFile(new File(badFileSrcPath), new File(ejbFilePath));
- //deployEJB(ejbFilePath);
- ejtt.deployment.deployViaEmbJopr(APP_TYPE, ejbFilePath);
- assertFalse("JMX doesn't report " + REDEPLOY_EJB2_JAR + " as deployed.", isEJBDeployed(REDEPLOY_EJB2_JAR));
-
- // Copy fixed archive to same name, and deploy
- FileUtils.copyFile(new File(goodFileSrcPath), new File(ejbFilePath));
-
- //deployEJB(ejbFilePath);
- ejtt.deployment.deployViaEmbJopr(APP_TYPE, ejbFilePath);
-
- // assert text and severity level for FacesMessage on server side
- assertTrue(server.getFacesMessages().hasNext());
- FacesMessage successMessage = server.getFacesMessages().next();
- assertTrue(FacesMessage.SEVERITY_INFO.equals(successMessage.getSeverity()));
- assertTrue(successMessage.getDetail().contains("Resource " + REDEPLOY_EJB2_JAR + " created successfully!"));
-
- // Use JMX to assert that the EJB components really did deploy successfully
- assertTrue(isEJBDeployed(REDEPLOY_EJB2_JAR));
-
- assertTrue("Page doesn't contain success message.", client.getPageAsText().contains(EJB2_DEL_MSG + " '" + REDEPLOY_EJB2_JAR + "'."));
- assertFalse("Deployable seems not to be deployed: " + REDEPLOY_EJB2_JAR, isEJBDeployed(REDEPLOY_EJB2_JAR));
- } finally {
- // Undeploy the EJB JAR
- try {
- ejtt.deployment.undeployViaEmbJopr(APP_TYPE, REDEPLOY_EJB2_JAR);
- } catch (EmbJoprTestException ex) {
- log.debug("Exception during undeployment - " + ex.getMessage());
- }
- }
+ @Override
+ public String getArchiveNameBasic() {
+ return BASIC_EJB2;
}
-
-
-
- /**
- *
- */
- public void testEjb20SummaryTab() throws EmbJoprTestException, IOException {
-
- final String DEPLOYABLE_NAME = BASIC_EJB2;
-
- try {
-
- // Deploy the APP
- String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/" + DEPLOYABLE_NAME;
- ejtt.deployment.deployViaEmbJopr(APP_TYPE, appFilePath);
-
- // Click on the app link.
- ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
- appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
-
-
- // Check the values in info table(s)
-
- // General Properties
- HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
- ContentInfoTable infoTable = ejtt.getContentInfoTable(genpropTable);
- Properties props = infoTable.getProperties();
-
- // Name
- assertEquals(DEPLOYABLE_NAME, props.getProperty("Name").trim());
- // Version: "--"
- // Description: "a standalone EJB 2.x application"
-
-
- // Traits
- infoTable = ejtt.getContentInfoTable(
- ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Traits").getElement());
- props = infoTable.getProperties();
-
- // Path
- String path = ejtt.getDeployDir() + "/" + DEPLOYABLE_NAME;
- assertEquals(path, props.getProperty("Path").trim());
-
- // Exploded
- assertEquals("no", props.getProperty("Exploded?").trim());
-
- /* Currently hidden.
- // Metrics Summary
- HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Numeric Metrics").getElement();
- infoTable = ejtt.getContentInfoTable(summaryTable);
- /**/
-
- } finally {
- try {
- ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
- } catch (Exception ex) {
- log.error("Caught exception when undeploying: " + ex, ex);
- }
- }
-
+ @Override
+ public String getArchiveNameGood() {
+ return GOOD_EJB2_JAR;
}
- /**
- *
- */
- public void testEjb20MetricsTab() throws EmbJoprTestException, IOException {
-
- final String DEPLOYABLE_NAME = BASIC_EJB2;
-
- try {
-
- // Deploy the APP
- String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/" + DEPLOYABLE_NAME;
- ejtt.deployment.deployViaEmbJopr(APP_TYPE, appFilePath);
-
- // Click on the app link.
- ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
- appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
-
- // Switch to the Metrics tab.
- ejtt.tabMenu.getTabByID(METRICS_TAB).click();
-
-
- // Check the values in info table(s)
-
- // General Properties
- HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
- ContentInfoTable infoTable = ejtt.getContentInfoTable(genpropTable);
- Properties props = infoTable.getProperties();
-
- // Traits
- infoTable = ejtt.getContentInfoTable(
- ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Traits").getElement());
- props = infoTable.getProperties();
-
- // Path
- String path = ejtt.getDeployDir() + "/" + DEPLOYABLE_NAME;
- assertEquals(path, props.getProperty("Path").trim());
-
-
- /* Currently no num metrics..
- // Metrics Summary
- HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Numeric Metrics").getElement();
- infoTable = ejtt.getContentInfoTable(summaryTable);
- /**/
-
-
- // Finally, click the Refresh button.
- String xPath = ".//input[normalize-space(value)='Refresh']";
- HtmlInput button = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
- if( null == button )
- throw new HtmlElementNotFoundException("Refresh button not found using XPath: "+xPath);
-
- button.click();
-
- // Check that we are still on Metrics tab.
- assertTrue( ejtt.tabMenu.isTabActiveByID(METRICS_TAB) );
-
-
- } finally {
- try {
- ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
- } catch (Exception ex) {
- log.error("Caught exception when undeploying: " + ex, ex);
- }
- }
-
+ @Override
+ public String getArchiveNameBad() {
+ return BAD_EJB2_JAR;
}
-
-
-
-
-
-
-
-
- /**
- * Stops and Starts an EJB.
- *
- * Was failing because of EMBJOPR-133.
- * Now FAILS because of EMBJOPR-172.
- */
- public void testEjbStopAndStart() throws IOException, EmbJoprTestException
- {
- final String DEPLOYABLE_NAME = BASIC_EJB2;
-
-
- // Deploy the APP.
- String appfilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME;
- ejtt.deployment.deployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
-
-
- try {
-
- // Wait until app is UP
- ejtt.getNavTree().getNodeByLabel(APP_TYPE.getNavTreeLabel()).click();
- ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME,
- 3000, 15, this);
-
- // Navigate to the web app, then to it's Control tab.
- ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
- row.getLinkByLabel(DEPLOYABLE_NAME).click();
- ejtt.getTabMenu().clickControlTab();
-
- // Click the Stop button.
- ejtt.tabMenu.getTabContentBox().getButtonByLabel("Stop").click();
-
- // Wait for the op to finish and check the final status.
- ejtt.operations.waitActivelyForOperationToFinish("Stop", 1500, 5);
- assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
-
-
-
- // Click the Start button.
- ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start").click();
- ejtt.operations.waitActivelyForOperationToFinish("Start", 1500, 5);
-
- }
- finally {
- try {
- ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
- }catch( Exception ex ){
- log.error("Caught exception when undeploying: "+ex, ex);
- }
- }
+ @Override
+ public String getArchiveNameRedeploy() {
+ return REDEPLOY_EJB2_JAR;
}
- /**
- * Restarts the EJB in Control tab.
- */
- public void testEjbRestart() throws IOException, EmbJoprTestException
- {
- final String DEPLOYABLE_NAME = BASIC_EJB2;
- // Deploy the app.
- String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME;
- ejtt.deployment.deployViaEmbJopr(APP_TYPE, appFilePath);
- try {
-
- // Wait until app is UP
- ejtt.getNavTree().getNodeByLabel(APP_TYPE.getNavTreeLabel()).click();
- ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME,
- 3000, 15, this);
-
-
- // Navigate to the app, then to it's Control tab.
- ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
- row.getLinkByLabel(DEPLOYABLE_NAME).click();
- ejtt.getTabMenu().clickControlTab();
-
- // Click the Restart button.
- ejtt.tabMenu.getTabContentBox().getButtonByLabel("Restart").click();
-
- // Wait for the op to finish and check the final status.
- ejtt.operations.waitActivelyForOperationToFinish("Restart", 1500, 5);
- assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
-
- }
- finally {
- try {
- ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
- }catch( Exception ex ){
- log.error("Caught exception when undeploying: "+ex, ex);
- }
- }
- }
-
-
-
-
-
}// class
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb30Test.java 2009-06-05 16:43:20 UTC (rev 505)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jopr.jsfunit.as5.app.ejb;
+
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
+
+import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
+
+/**
+ * This class contains tests for testing the EmbJopr Application
+ * Management Functions for Enterprise JavaBean archives with JBoss AS 5.
+ *
+ * @author Shelly McGowan
+ *
+ */
+public class Ejb30Test extends EjbTestBase {
+
+ public DeployableTypes getAppType() {
+ return DeployableTypes.EJB3;
+ }
+
+ @Override
+ public String getArchiveNameBasic() {
+ return BASIC_EJB3;
+ }
+
+ @Override
+ public String getArchiveNameGood() {
+ return GOOD_EJB3_JAR;
+ }
+
+ @Override
+ public String getArchiveNameBad() {
+ return BAD_EJB3_JAR;
+ }
+
+ @Override
+ public String getArchiveNameRedeploy() {
+ return REDEPLOY_EJB3_JAR;
+ }
+
+
+
+
+
+}// class
+
+
+
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTestBase.java 2009-06-05 16:43:20 UTC (rev 505)
@@ -0,0 +1,441 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jopr.jsfunit.as5.app.ejb;
+
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
+
+import org.jboss.jopr.jsfunit.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.*;
+import java.util.*;
+import javax.faces.application.FacesMessage;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.io.FileUtils;
+import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
+import org.jboss.jopr.jsfunit.exceptions.*;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
+
+/**
+ * This class contains tests for testing the EmbJopr Application
+ * Management Functions for Enterprise JavaBean archives with JBoss AS 5.
+ *
+ * @author Ondrej Zizka
+ *
+ */
+public abstract class EjbTestBase extends ApplicationTestBaseAS5 {
+
+ public abstract DeployableTypes getAppType();
+ public abstract String getArchiveNameBasic();
+ public abstract String getArchiveNameGood();
+ public abstract String getArchiveNameBad();
+ public abstract String getArchiveNameRedeploy();
+
+
+ public final DeployableTypes APP_TYPE = this.getAppType();
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite() {
+ return new TestSuite(EjbTestBase.class);
+ }
+
+
+
+
+
+ /*
+ * testName: testBasicEjbDeployment
+ * assertion: verify basic deployment of an EJB JAR.
+ * test Strategy: Navigate to EJB Applications.
+ * Add a new resource. Verify the resource was successfully
+ * deployed. Undeploy the archive.
+ *
+ */
+ public void testEjbBasicDeployment() throws IOException, EmbJoprTestException {
+
+ final String DEPLOYABLE_NAME = getArchiveNameBasic();
+
+ try {
+ // Navigate to EJB Applications
+ HtmlAnchor ejbLink = getNavTreeLink(APP_TYPE.getNavTreeLabel());
+ ejbLink.click();
+
+ // click on the "Add new resource" button
+ client.click("actionHeaderForm:addNewContent"); // 404 if setThrowExceptionOnFailingStatusCode(true) above
+
+ // TODO: "/ejb/BASIC_JAR" causes exceptions in seam:
+ // http://wwwapps.rdu.redhat.com/w3xpastebin/pastebin.php?show=9842
+
+ String filePath = ejtt.getTestDataDir() + "/" + APP_TYPE.getDataDir() + "/" + DEPLOYABLE_NAME;
+ log.info("Uploading EJB archive: " + filePath);
+ File uploadFile = new File(filePath);
+ if (!uploadFile.exists()) {
+ throw new EmbJoprTestException("Can't find EJB file to upload: '" + filePath + "'");
+ }
+
+ // upload ejb
+ HtmlFileInput fileInput = (HtmlFileInput) client.getElement("createContentForm:file");
+ fileInput.setContentType("application/ejb");
+ fileInput.setValueAttribute(filePath);
+ client.click("createContentForm:addButton");
+
+ log.info("HTTP status after EJB upload: " + client.getContentPage().getWebResponse().getStatusCode());
+ log.info("renderResponse() called: " + server.getFacesContext().getRenderResponse());
+ log.info("responseComplete() called: " + server.getFacesContext().getResponseComplete());
+
+ String errorMessage =
+ (server.getFacesMessages().hasNext() && server.getFacesMessages().next().getSeverity() != FacesMessage.SEVERITY_INFO)
+ ? " Faces message: " + server.getFacesMessages().next()
+ : ""; // Awful code
+
+ // FAILS because of NPE and HTTP 500.
+ // assert that the success message appeared on the client side
+ assertTrue("Success message not found." + errorMessage, client.getPageAsText().contains("Resource " + DEPLOYABLE_NAME + " created successfully!"));
+
+ // assert text and severity level for FacesMessage on server side
+ assertTrue(server.getFacesMessages().hasNext());
+ FacesMessage successMessage = server.getFacesMessages().next();
+ assertTrue(FacesMessage.SEVERITY_INFO.equals(successMessage.getSeverity()));
+ assertTrue(successMessage.getDetail().contains("Resource " + DEPLOYABLE_NAME + " created successfully!"));
+
+ assertFalse("Page contains 'Total: 0', EJBs probably not listed.", client.getPageAsText().contains("Total: 0"));
+
+
+ // Use JMX to assert that the EJB components really did deploy successfully
+ assertTrue(isEJBDeployed(DEPLOYABLE_NAME));
+
+ // Undeploy the EJB JAR
+ HtmlButtonInput deleteButton = getAppDeleteButton(DEPLOYABLE_NAME);
+ deleteButton.click();
+
+ String expectedMessage = String.format(EJB_DEL_MSG_FORMAT, APP_TYPE, DEPLOYABLE_NAME);
+ assertTrue("Page doesn't contain success message.", client.getPageAsText().contains(expectedMessage));
+ assertFalse("Deployable should be undeployed: " + DEPLOYABLE_NAME, isEJBDeployed(DEPLOYABLE_NAME));
+ }
+ finally {
+ // Undeploy the EJB JAR
+ try {
+ ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ } catch (EmbJoprTestException ex) {
+ log.debug("Expected exception during undeployment - " + ex.getMessage());
+ }
+ }
+
+ }//
+
+
+
+
+
+
+
+ /**
+ test Strategy:
+
+ Deploy an ejb-jar that is known to have a bad deployment
+ descriptor. Verify the console shows deployment failed.
+ Upload the fixed the achive, redeploy and
+ verify the archive has been successfully deployed.
+ */
+ public void testEjbDeployBadAndRedeploy() throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
+
+ final String REDEPLOY_JAR_NAME = getArchiveNameRedeploy();
+
+ try {
+ String badFileSrcPath = ejtt.getTestDataDir() + "/" + APP_TYPE.getDataDir() + "/" + getArchiveNameBad();
+ String goodFileSrcPath = ejtt.getTestDataDir() + "/" + APP_TYPE.getDataDir() + "/" + getArchiveNameGood();
+ String ejbFilePath = ejtt.getTestDataDir() + "/" + APP_TYPE.getDataDir() + "/" + REDEPLOY_JAR_NAME;
+
+ // Copy bad file under good file's name (we need to keep the filename the same for redeployment).
+ FileUtils.copyFile(new File(badFileSrcPath), new File(ejbFilePath));
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, ejbFilePath);
+ assertFalse("JMX shouldn't report " + REDEPLOY_JAR_NAME + " as deployed - it's renamed malformed jar '"+getArchiveNameBad()+"'.", isEJBDeployed(REDEPLOY_JAR_NAME));
+
+ // Copy fixed archive to same name, and deploy.
+ FileUtils.copyFile(new File(goodFileSrcPath), new File(ejbFilePath));
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, ejbFilePath);
+
+ // Assert text and severity level for FacesMessage on server side.
+ assertTrue(server.getFacesMessages().hasNext());
+ FacesMessage successMessage = server.getFacesMessages().next();
+ assertTrue(FacesMessage.SEVERITY_INFO.equals(successMessage.getSeverity()));
+ assertTrue(successMessage.getDetail().contains("Resource " + REDEPLOY_JAR_NAME + " created successfully!"));
+
+ // Use JMX to assert that the EJB components really did deploy successfully.
+ assertTrue("JMX shouldn't report " + REDEPLOY_JAR_NAME + " as deployed.", isEJBDeployed(REDEPLOY_JAR_NAME));
+
+ String expectedMessage = String.format( DELETE_MSG_FORMAT, APP_TYPE.getDisplayName(), REDEPLOY_JAR_NAME);
+ assertTrue("Page doesn't contain success message.", client.getPageAsText().contains(expectedMessage));
+ assertFalse("Deployable seems not to be deployed: " + REDEPLOY_JAR_NAME, isEJBDeployed(REDEPLOY_JAR_NAME));
+ }
+ finally {
+ // Undeploy the EJB JAR
+ try {
+ ejtt.deployment.undeployViaEmbJopr(APP_TYPE, REDEPLOY_JAR_NAME);
+ } catch (EmbJoprTestException ex) {
+ log.debug("Exception during undeployment - " + ex.getMessage());
+ }
+ }
+ }
+
+
+
+
+ /**
+ *
+ */
+ public void testEjbSummaryTab() throws EmbJoprTestException, IOException {
+
+ final String DEPLOYABLE_NAME = getArchiveNameBasic();
+
+ try {
+
+ // Deploy the APP
+ String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/" + DEPLOYABLE_NAME;
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, appFilePath);
+
+ // Click on the app link.
+ ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
+
+
+ // Check the values in info table(s)
+
+ // General Properties
+ HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
+ ContentInfoTable infoTable = ejtt.getContentInfoTable(genpropTable);
+ Properties props = infoTable.getProperties();
+
+ // Name
+ assertEquals(DEPLOYABLE_NAME, props.getProperty("Name").trim());
+ // Version: "--"
+ // Description: "a standalone EJB 2.x application"
+
+
+ // Traits
+ infoTable = ejtt.getContentInfoTable(
+ ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Traits").getElement());
+ props = infoTable.getProperties();
+
+ // Path
+ String path = ejtt.getDeployDir() + "/" + DEPLOYABLE_NAME;
+ assertEquals(path, props.getProperty("Path").trim());
+
+ // Exploded
+ assertEquals("no", props.getProperty("Exploded?").trim());
+
+ /* Currently hidden.
+ // Metrics Summary
+ HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Numeric Metrics").getElement();
+ infoTable = ejtt.getContentInfoTable(summaryTable);
+ /**/
+
+ } finally {
+ try {
+ ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ } catch (Exception ex) {
+ log.error("Caught exception when undeploying: " + ex, ex);
+ }
+ }
+
+ }
+
+
+
+
+ /**
+ *
+ */
+ public void testEjbMetricsTab() throws EmbJoprTestException, IOException {
+
+ final String DEPLOYABLE_NAME = getArchiveNameBasic();
+
+ try {
+
+ // Deploy the APP
+ String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/" + DEPLOYABLE_NAME;
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, appFilePath);
+
+ // Click on the app link.
+ ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
+
+ // Switch to the Metrics tab.
+ ejtt.tabMenu.getTabByID(METRICS_TAB).click();
+
+
+ // Check the values in info table(s)
+
+ // General Properties
+ HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
+ ContentInfoTable infoTable = ejtt.getContentInfoTable(genpropTable);
+ Properties props = infoTable.getProperties();
+
+ // Traits
+ infoTable = ejtt.getContentInfoTable(
+ ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Traits").getElement());
+ props = infoTable.getProperties();
+
+ // Path
+ String path = ejtt.getDeployDir() + "/" + DEPLOYABLE_NAME;
+ assertEquals(path, props.getProperty("Path").trim());
+
+
+ /* Currently no num metrics..
+ // Metrics Summary
+ HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Numeric Metrics").getElement();
+ infoTable = ejtt.getContentInfoTable(summaryTable);
+ /**/
+
+
+ // Finally, click the Refresh button.
+ String xPath = ".//input[normalize-space(value)='Refresh']";
+ HtmlInput button = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+ if( null == button )
+ throw new HtmlElementNotFoundException("Refresh button not found using XPath: "+xPath);
+
+ button.click();
+
+ // Check that we are still on Metrics tab.
+ assertTrue( ejtt.tabMenu.isTabActiveByID(METRICS_TAB) );
+
+
+ } finally {
+ try {
+ ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ } catch (Exception ex) {
+ log.error("Caught exception when undeploying: " + ex, ex);
+ }
+ }
+
+ }
+
+
+
+
+
+ /**
+ * Stops and Starts an EJB.
+ *
+ * Was failing because of EMBJOPR-133.
+ * Now FAILS because of EMBJOPR-172.
+ */
+ public void testEjbStopAndStart() throws IOException, EmbJoprTestException
+ {
+ final String DEPLOYABLE_NAME = getArchiveNameBasic();
+
+
+ // Deploy the APP.
+ String appfilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME;
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+
+
+ try {
+
+ // Wait until app is UP
+ ejtt.getNavTree().getNodeByLabel(APP_TYPE.getNavTreeLabel()).click();
+ ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME,
+ 3000, 15, this);
+
+ // Navigate to the web app, then to it's Control tab.
+ ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ row.getLinkByLabel(DEPLOYABLE_NAME).click();
+ ejtt.getTabMenu().clickControlTab();
+
+ // Click the Stop button.
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Stop").click();
+
+ // Wait for the op to finish and check the final status.
+ ejtt.operations.waitActivelyForOperationToFinish("Stop", 1500, 5);
+ assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
+
+
+
+ // Click the Start button.
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start").click();
+ ejtt.operations.waitActivelyForOperationToFinish("Start", 1500, 5);
+
+ }
+ finally {
+ try {
+ ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ }catch( Exception ex ){
+ log.error("Caught exception when undeploying: "+ex, ex);
+ }
+ }
+ }
+
+
+
+
+ /**
+ * Restarts the EJB in Control tab.
+ */
+ public void testEjbRestart() throws IOException, EmbJoprTestException
+ {
+ final String DEPLOYABLE_NAME = getArchiveNameBasic();
+
+
+ // Deploy the app.
+ String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME;
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, appFilePath);
+
+ try {
+
+ // Wait until app is UP
+ ejtt.getNavTree().getNodeByLabel(APP_TYPE.getNavTreeLabel()).click();
+ ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME,
+ 3000, 15, this);
+
+
+ // Navigate to the app, then to it's Control tab.
+ ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ row.getLinkByLabel(DEPLOYABLE_NAME).click();
+ ejtt.getTabMenu().clickControlTab();
+
+ // Click the Restart button.
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Restart").click();
+
+ // Wait for the op to finish and check the final status.
+ ejtt.operations.waitActivelyForOperationToFinish("Restart", 1500, 5);
+ assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
+
+ }
+ finally {
+ try {
+ ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ }catch( Exception ex ){
+ log.error("Caught exception when undeploying: "+ex, ex);
+ }
+ }
+ }
+
+
+
+
+
+}// class
+
+
+
15 years, 6 months
EMBJOPR SVN: r504 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-05 09:55:21 -0400 (Fri, 05 Jun 2009)
New Revision: 504
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
Log:
EmbjoprTestCase updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-06-05 13:46:55 UTC (rev 503)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-06-05 13:55:21 UTC (rev 504)
@@ -891,7 +891,7 @@
protected Map<String, MetaValue> getComponentProperties(String componentName,
ComponentType type) throws Exception {
ManagedComponent component = getManagedComponent(componentName, type);
- assertNotNull("The returned component was null", component);
+ assertNotNull("The returned component was null; Name: "+componentName, component);
assertEquals(componentName, component.getName());
Map<String, ManagedProperty> actualProperties = component.getProperties();
15 years, 6 months
EMBJOPR SVN: r503 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/embwar.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-05 09:46:55 -0400 (Fri, 05 Jun 2009)
New Revision: 503
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/embwar/EmbWarTest.java
Log:
EmbWarTest updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/embwar/EmbWarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/embwar/EmbWarTest.java 2009-06-05 13:39:21 UTC (rev 502)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/embwar/EmbWarTest.java 2009-06-05 13:46:55 UTC (rev 503)
@@ -41,7 +41,8 @@
embWarNode.getLabelLink().click();
// Check that the embedded WAR is listed.
- ContentTableRow embWarLink = ejtt.tabMenu.getTabContentBox().findLinkRowInDataTableUsingPagination(EAR_WITH_WAR_EMB__WAR_NAME);
+ ContentTableRow embWarLink = ejtt.tabMenu.getTabContentBox()
+ .findLinkRowInDataTableUsingPagination(EAR_WITH_WAR_EMB__WAR_NAME);
if( null == embWarLink )
throw new EmbJoprTestException("Embedded WAR '"+EAR_WITH_WAR_EMB__WAR_NAME+"' not listed.");
@@ -49,8 +50,11 @@
}
finally {
- // Undeploy the EAR.
- ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ try {
+ ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ }catch( Exception ex ){
+ log.error("Caught exception when undeploying: "+ex, ex);
+ }
}
}// testEarWithEmbWarDeployment()
15 years, 6 months