EMBJOPR SVN: r502 - 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:39:21 -0400 (Fri, 05 Jun 2009)
New Revision: 502
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
Log:
AS node 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:39:12 UTC (rev 501)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-06-05 13:39:21 UTC (rev 502)
@@ -120,6 +120,13 @@
public static final String EAR_NOT_MALFORMED_APP_FILENAME = "not-malformed-application-xml.ear";
public static final String WAR_FILENAME_MALFORMED_APP = "malformed-web-xml.war";
+ // Info table headers
+ public static final String LABEL_TRAITS = "Traits";
+ public static final String LABEL_NUMERIC_METRICS = "Numeric Metrics";
+
+
+
+
// Test Archives
15 years, 6 months
EMBJOPR SVN: r501 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-05 09:39:12 -0400 (Fri, 05 Jun 2009)
New Revision: 501
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java
Log:
AS node tests updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java 2009-06-05 13:33:23 UTC (rev 500)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java 2009-06-05 13:39:12 UTC (rev 501)
@@ -12,6 +12,7 @@
import java.util.Properties;
import javax.management.JMException;
import org.apache.commons.lang.math.NumberUtils;
+import org.jboss.jopr.jsfunit.AppConstants;
import org.jboss.jopr.jsfunit.DebugUtils;
import org.jboss.jopr.jsfunit.EmbjoprTestCase;
import org.jboss.jopr.jsfunit.JMXUtils;
@@ -82,16 +83,16 @@
Build Date: April 22 2009
Start Date: Wed Apr 22 18:26:43 CEST 2009
*/
- headerText = "Resource Traits";
+ headerText = AppConstants.LABEL_TRAITS;
assertTrue("Page doesn't contain the header: "+headerText, pageText.contains(headerText));
table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(headerText);
infoTable = ejtt.getContentInfoTable(table.getElement());
properties = infoTable.getProperties();
- assertEquals("Resource Traits / Server Name", ejtt.getJBossConfig(),
+ assertEquals(AppConstants.LABEL_TRAITS+" / Server Name", ejtt.getJBossConfig(),
properties.getProperty("Server Name"));
- assertEquals("Resource Traits / Server Home Dir",
+ assertEquals(AppConstants.LABEL_TRAITS+" / Server Home Dir",
//String.format("%s/server/%s", ejtt.getJBossHomeDir(), ejtt.getJBossConfig()),
ejtt.getJBossHomeDir(),
properties.getProperty("Server Home Dir"));
@@ -106,7 +107,7 @@
TODO: Split - grab some resources and do a page refresh for every part?
*/
- headerText = "Metrics Summary";
+ headerText = AppConstants.LABEL_NUMERIC_METRICS;
assertTrue("Page doesn't contain the header: "+headerText, pageText.contains(headerText));
table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(headerText);
15 years, 6 months
EMBJOPR SVN: r500 - 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:33:23 -0400 (Fri, 05 Jun 2009)
New Revision: 500
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
Log:
EmbjoprTestCase#getMetricValueFromTable() now checks whether the metrics table was found.
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-04 18:36:07 UTC (rev 499)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-06-05 13:33:23 UTC (rev 500)
@@ -257,6 +257,8 @@
// Get the metrics data table
HtmlTable metricsTable = (HtmlTable)client.getElement(tableId);
+ if( null == metricsTable )
+ throw new IllegalStateException("Metrics table with ID '"+tableId+"' not found.");
List<HtmlTableRow> rows = metricsTable.getRows();
// Find the appropriate metric and return its value
15 years, 6 months
EMBJOPR SVN: r499 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-04 14:36:07 -0400 (Thu, 04 Jun 2009)
New Revision: 499
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java
Log:
War tests updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java 2009-06-04 18:35:27 UTC (rev 498)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java 2009-06-04 18:36:07 UTC (rev 499)
@@ -227,8 +227,12 @@
}
finally {
- // Undeploy the WAR
- ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ try {
+ // Undeploy the app.
+ ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ }catch( EmbJoprTestException ex ){
+ log.debug("Exception during undeploy - "+ex.getMessage());
+ }
}
}
15 years, 6 months
EMBJOPR SVN: r498 - 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-04 14:35:27 -0400 (Thu, 04 Jun 2009)
New Revision: 498
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java
Log:
Ejb20 tests added
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-04 18:07:45 UTC (rev 497)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java 2009-06-04 18:35:27 UTC (rev 498)
@@ -21,15 +21,22 @@
*/
package org.jboss.jopr.jsfunit.as5.app.ejb;
+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.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
+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 javax.faces.application.FacesMessage;
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.*;
@@ -52,6 +59,9 @@
}
+
+
+
/*
* testName: testBasicEjbDeployment
* assertion: verify basic deployment of an EJB JAR.
@@ -64,89 +74,103 @@
final String DEPLOYABLE_NAME = BASIC_EJB2;
- // Navigate to EJB Applications
- HtmlAnchor ejbLink = getNavTreeLink(APP_TYPE.getNavTreeLabel());
- ejbLink.click();
+ 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
+ // 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
+ // 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 + "'");
- }
+ 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");
+ // 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());
+ 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
+ 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!"));
+ // 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!"));
+ // 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"));
+ 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));
+ // 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();
+ // 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 + "'."));
+ 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));
+ 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);
+ //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);
+ //deployEJB(ejbFilePath);
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, ejbFilePath);
// assert text and severity level for FacesMessage on server side
assertTrue(server.getFacesMessages().hasNext());
@@ -157,75 +181,253 @@
// Use JMX to assert that the EJB components really did deploy successfully
assertTrue(isEJBDeployed(REDEPLOY_EJB2_JAR));
- // Undeploy the EJB JAR
- HtmlButtonInput deleteButton = getAppDeleteButton(REDEPLOY_EJB2_JAR);
- deleteButton.click();
-
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());
+ }
+ }
+ }
+
+
+ /**
+ *
+ */
+ 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 {
- undeployEJB(REDEPLOY_EJB2_JAR);
+ try {
+ ejtt.deployment.undeployViaEmbJopr(APP_TYPE, DEPLOYABLE_NAME);
+ } catch (Exception ex) {
+ log.error("Caught exception when undeploying: " + ex, ex);
+ }
}
+
}
+ /**
+ *
+ */
+ public void testEjb20MetricsTab() throws EmbJoprTestException, IOException {
- // Helpers
- private void undeployEJB(String ejbFileName)
- throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
+ final String DEPLOYABLE_NAME = BASIC_EJB2;
- // Navigate to Embedded EJB 2.x Applications
- ejtt.getNavTree().getNodeLink(NAV_EJB2).click();
+ try {
- ejtt.getTabMenu().clickSummaryTab();
+ // Deploy the APP
+ String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/" + DEPLOYABLE_NAME;
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, appFilePath);
- // Find the row containing the deployable. Use the pagination if needed.
- ContentTableRow appRow = ejtt.getTabMenu().getTabContentBox().
- findLinkRowInDataTableUsingPagination(ejbFileName);
+ // Click on the app link.
+ ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
- if (null == appRow) {
- log.warn("Can't find row with Ejb 2.x to undeploy: " + ejbFileName);
- return;
- }
+ // Switch to the Metrics tab.
+ ejtt.tabMenu.getTabByID(METRICS_TAB).click();
- appRow.getButtonByLabel("Delete").click();
- // Log the message (with prefix of potential warning)
- ejtt.logServerMessage("Something went wrong with undeploy: ");
+ // Check the values in info table(s)
- // Sleep for 3 sec. TODO: write some waitForUndeployed(), as negation of opposite.
- ejtt.sleep(2000);
+ // 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);
+ }
+ }
+
}
- private void deployEJB(String ejbFilePath)
- throws IOException, HtmlElementNotFoundException {
- if (!(new File(ejbFilePath)).exists()) {
- throw new FileNotFoundException(ejbFilePath);
+
+
+
+
+
+
+
+
+ /**
+ * 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);
+ }
+ }
+ }
- log.info("Deploying: " + ejbFilePath);
- // Navigate to Embedded EJB 2 Applications
- ejtt.getNavTree().getNodeLink(AppConstants.DeployableTypes.EJB2.getNavTreeLabel()).click();
+ /**
+ * Restarts the EJB in Control tab.
+ */
+ public void testEjbRestart() throws IOException, EmbJoprTestException
+ {
+ final String DEPLOYABLE_NAME = BASIC_EJB2;
- // click on the "Add new resource" button
- client.click("actionHeaderForm:addNewContent"); // 404 if setThrowExceptionOnFailingStatusCode(true) above
- // Upload the file
- HtmlFileInput fileInput = (HtmlFileInput) client.getElement("createContentForm:file");
- fileInput.setContentType("application/war");
- fileInput.setValueAttribute(ejbFilePath);
- client.click("createContentForm:addButton");
+ // Deploy the app.
+ String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME;
+ ejtt.deployment.deployViaEmbJopr(APP_TYPE, appFilePath);
- // Log server message.
- ejtt.logServerMessage();
+ try {
- // Todo: Write some waitUntilDeployed().
- ejtt.sleep(2000);
+ // 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: r497 - 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-04 14:07:45 -0400 (Thu, 04 Jun 2009)
New Revision: 497
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java
Log:
EarTest 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-04 17:31:52 UTC (rev 496)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java 2009-06-04 18:07:45 UTC (rev 497)
@@ -422,44 +422,10 @@
// Deploy the EAR
String earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
- //deployEar( earFilePath );
ejtt.deployment.deployViaEmbJopr(APP_TYPE, earFilePath);
try {
- /*
- // Wait until the EAR appears...
- new ActiveConditionChecker(new DescribedCondition("EAR appears in Summary tab list") {
- public boolean isTrue() throws Exception {
- // Refresh, then check.
- ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- ContentTableRow earRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(BASIC_EAR);
- return null != earRow;
- }
- }).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 10);
-
-
- ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
-
- // Wait until the Status is "UP".
- // TODO: Replace with ActiveConditionChecker.
- int maxLoops = DEPLOY_TIMEOUT_SEC;
- do {
- String statusText = earRow.getCellTextByColumnName("Status");
- log.debug("EAR Status: "+statusText);
- if( "UP".equals(statusText) )
- break;
-
- // Refresh page after 1 second.
- ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
-
- // We don't want an infinite loop by mistake.
- if( maxLoops-- <= 0 ){
- throw new EmbJoprTestException("EAR "+BASIC_EAR+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
- }
- } while( true );
- /**/
ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 2000, 10);
// FAILS because of EMBJOPR-80.
@@ -524,7 +490,7 @@
try {
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+ ejtt.deployment.waitActivelyForDeployment(APP_TYPE, BASIC_EAR, 3000, 15);
// Navigate to the Configuration tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
@@ -586,7 +552,7 @@
try {
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+ ejtt.deployment.waitActivelyForDeployment(APP_TYPE, BASIC_EAR, 3000, 15);
// Navigate to the Configuration tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
@@ -643,13 +609,13 @@
final String DEPLOYABLE_NAME = BASIC_EAR;
// Deploy the EAR.
- String appFilePath = ejtt.getTestDataDir() + "/"+DeployableTypes.EAR.getDataDir()+"/"+DEPLOYABLE_NAME;
+ String appFilePath = ejtt.getTestDataDir() + "/"+APP_TYPE.getDataDir()+"/"+DEPLOYABLE_NAME;
deployEar( appFilePath );
try {
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME, 3000, 15);
+ ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 3000, 15);
// Navigate to the Configuration tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
@@ -692,7 +658,7 @@
try {
// Wait for EAR to be deployed and UP
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+ ejtt.deployment.waitActivelyForDeployment(APP_TYPE, BASIC_EAR, 3000, 15);
ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits");
ContentInfoTable infoTable = ejtt.getTabMenu().getTabContentBox().getContentInfoTable(table.getElement());
@@ -873,7 +839,7 @@
// Wait until the EAR is UP.
ejtt.getNavTree().getNodeByLabel(APP_TYPE.getNavTreeLabel()).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME, 3000, 30, this);
+ ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME, 3000, 30, this);
// Assert that the app is running.
page = (HtmlPage)webClient.getPage(testPageUrl);
@@ -905,7 +871,7 @@
* Was failing because of EMBJOPR-133.
* Now FAILS because of EMBJOPR-172.
*/
- public void testStopAndStartEar() throws IOException, EmbJoprTestException
+ public void testEarStopAndStart() throws IOException, EmbJoprTestException
{
final String DEPLOYABLE_NAME = EAR_WITH_WAR_COUNTER;
@@ -929,8 +895,8 @@
try {
// Wait until app is UP
- ejtt.getNavTree().getNodeByLabel(DeployableTypes.EAR.getNavTreeLabel()).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME,
+ ejtt.getNavTree().getNodeByLabel(APP_TYPE.getNavTreeLabel()).click();
+ ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME,
3000, 15, this);
// Assert that the app is running.
@@ -969,25 +935,7 @@
// Click the Start button.
ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start").click();
-
- // Check the latest message. TODO: EJTT class for ops history table?
- //DebugUtils.writeFile("target/testStopAndStartEar-opsTable2.html", client.getPageAsText() );///
- //status = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getLastOperationStatus();
- //assertEquals("Start operation did not succeed, the status is: "+status, OperationStatusType.SUCCESS, status);
- //assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().wasLastOperationSuccesful() );
- /*try {
- new ActiveConditionChecker( new DescribedCondition("Start operation status changes from 'In Progreess'.") {
- int calls = 0;
- public boolean isTrue() throws Exception {
- if( ++calls > 1 ) ((HtmlPage)client.getContentPage()).refresh();
- OperationStatusType status = ejtt.getTabMenu().getTabContentBox().getOperationsHistoryTable().getLastOperationStatus();
- return ! OperationStatusType.IN_PROGRESS.equals( status );
- }
- }).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(1500, 5);
- }
- catch(Exception ex){
- throw new EmbJoprTestException(ex.getMessage(), ex.getCause());
- }/**/
+ // Check the latest message.
ejtt.operations.waitActivelyForOperationToFinish("Start", 1500, 5);
@@ -1019,7 +967,7 @@
*
* FAILS because of EMBJOPR-133.
*/
- public void testRestartEar() throws IOException, EmbJoprTestException
+ public void testEarRestart() throws IOException, EmbJoprTestException
{
final String DEPLOYABLE_NAME = EAR_WITH_WAR_COUNTER;
@@ -1042,8 +990,8 @@
try {
// Wait until app is UP
- ejtt.getNavTree().getNodeByLabel(DeployableTypes.EAR.getNavTreeLabel()).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME,
+ ejtt.getNavTree().getNodeByLabel(APP_TYPE.getNavTreeLabel()).click();
+ ejtt.deployment.waitActivelyForDeployment(APP_TYPE, DEPLOYABLE_NAME,
3000, 15, this);
// Assert that the app is running.
15 years, 6 months
EMBJOPR SVN: r496 - 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-04 13:31:52 -0400 (Thu, 04 Jun 2009)
New Revision: 496
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java
Log:
EarTest import 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-06-04 17:31:29 UTC (rev 495)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ear/EarTest.java 2009-06-04 17:31:52 UTC (rev 496)
@@ -24,8 +24,6 @@
import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebClient;
-import org.jboss.jopr.jsfunit.util.DescribedCondition;
-import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
import org.jboss.jopr.jsfunit.*;
import com.gargoylesoftware.htmlunit.html.*;
import java.io.*;
15 years, 6 months
EMBJOPR SVN: r495 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-04 13:31:29 -0400 (Thu, 04 Jun 2009)
New Revision: 495
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
Log:
AppConstants 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-04 17:22:59 UTC (rev 494)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-06-04 17:31:29 UTC (rev 495)
@@ -131,7 +131,7 @@
// EJB 3.0
public static final String BASIC_EJB2 = "deployment-ejb.jar";
- public static final String BASIC_EJB3 = "basic-ejb3.jar";
+ public static final String BASIC_EJB3 = "BasicEJB3.jar";
// EAR
15 years, 6 months
EMBJOPR SVN: r494 - 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-04 13:22:59 -0400 (Thu, 04 Jun 2009)
New Revision: 494
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java
Log:
(EJB2 test code format)
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-03 17:17:52 UTC (rev 493)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java 2009-06-04 17:22:59 UTC (rev 494)
@@ -19,7 +19,6 @@
* 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.*;
@@ -32,11 +31,8 @@
import javax.faces.application.FacesMessage;
import org.apache.commons.io.FileUtils;
import org.jboss.jopr.jsfunit.exceptions.*;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit;
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.
@@ -48,28 +44,24 @@
public static final DeployableTypes APP_TYPE = DeployableTypes.EJB2;
-
/**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
+ * @return the suite of tests being tested
+ */
+ public static Test suite() {
return new TestSuite(Ejb20Test.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.
- *
- */
+ /*
+ * 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 {
- public void testBasicEjbDeployment() throws IOException, EmbJoprTestException
- {
-
final String DEPLOYABLE_NAME = BASIC_EJB2;
// Navigate to EJB Applications
@@ -82,31 +74,30 @@
// 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);
+ 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+"'");
+ if (!uploadFile.exists()) {
+ throw new EmbJoprTestException("Can't find EJB2 file to upload: '" + filePath + "'");
+ }
// upload ejb
- HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
+ 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() );
+ 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
+ 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!"));
+ 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());
@@ -114,7 +105,7 @@
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"));
+ 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
@@ -124,39 +115,38 @@
HtmlButtonInput deleteButton = getAppDeleteButton(DEPLOYABLE_NAME);
deleteButton.click();
- assertTrue("Page doesn't contain success message.", client.getPageAsText().contains(EJB2_DEL_MSG + " '" + DEPLOYABLE_NAME +"'."));
+ 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));
-
+ assertFalse("Deployable seems not to be deployed: " + DEPLOYABLE_NAME, isEJBDeployed(DEPLOYABLE_NAME));
+
}// testBasicEjbDeployment()
+ /**
+ *
+ test Strategy:
- /**
- *
- 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 {
+ 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);
+ 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);
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) );
+ FileUtils.copyFile(new File(goodFileSrcPath), new File(ejbFilePath));
- deployEJB(ejbFilePath);
+ deployEJB(ejbFilePath);
// assert text and severity level for FacesMessage on server side
assertTrue(server.getFacesMessages().hasNext());
@@ -171,76 +161,71 @@
HtmlButtonInput deleteButton = getAppDeleteButton(REDEPLOY_EJB2_JAR);
deleteButton.click();
- 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));
+ 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 {
- undeployEJB(REDEPLOY_EJB2_JAR);
- }
- }
-
+ } finally {
+ undeployEJB(REDEPLOY_EJB2_JAR);
+ }
+ }
+
// Helpers
+ private void undeployEJB(String ejbFileName)
+ throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
- private void undeployEJB( String ejbFileName )
- throws IOException, HtmlElementNotFoundException, ActionNotAvailableException
- {
+ // Navigate to Embedded EJB 2.x Applications
+ ejtt.getNavTree().getNodeLink(NAV_EJB2).click();
- // Navigate to Embedded EJB 2.x Applications
- ejtt.getNavTree().getNodeLink(NAV_EJB2).click();
+ ejtt.getTabMenu().clickSummaryTab();
- ejtt.getTabMenu().clickSummaryTab();
+ // Find the row containing the deployable. Use the pagination if needed.
+ ContentTableRow appRow = ejtt.getTabMenu().getTabContentBox().
+ findLinkRowInDataTableUsingPagination(ejbFileName);
- // Find the row containing the deployable. Use the pagination if needed.
- ContentTableRow appRow = ejtt.getTabMenu().getTabContentBox().
- findLinkRowInDataTableUsingPagination(ejbFileName);
+ if (null == appRow) {
+ log.warn("Can't find row with Ejb 2.x to undeploy: " + ejbFileName);
+ return;
+ }
- if( null == appRow ){
- log.warn("Can't find row with Ejb 2.x to undeploy: "+ejbFileName);
- return;
- }
+ appRow.getButtonByLabel("Delete").click();
- appRow.getButtonByLabel("Delete").click();
+ // Log the message (with prefix of potential warning)
+ ejtt.logServerMessage("Something went wrong with undeploy: ");
- // Log the message (with prefix of potential warning)
- ejtt.logServerMessage("Something went wrong with undeploy: ");
+ // Sleep for 3 sec. TODO: write some waitForUndeployed(), as negation of opposite.
+ ejtt.sleep(2000);
- // Sleep for 3 sec. TODO: write some waitForUndeployed(), as negation of opposite.
- ejtt.sleep( 2000 );
+ }
- }
+ private void deployEJB(String ejbFilePath)
+ throws IOException, HtmlElementNotFoundException {
+ if (!(new File(ejbFilePath)).exists()) {
+ throw new FileNotFoundException(ejbFilePath);
+ }
- private void deployEJB( String ejbFilePath )
- throws IOException, HtmlElementNotFoundException
- {
- if( !(new File(ejbFilePath)).exists())
- throw new FileNotFoundException(ejbFilePath);
+ log.info("Deploying: " + ejbFilePath);
- log.info("Deploying: "+ejbFilePath);
+ // Navigate to Embedded EJB 2 Applications
+ ejtt.getNavTree().getNodeLink(AppConstants.DeployableTypes.EJB2.getNavTreeLabel()).click();
- // Navigate to Embedded EJB 2 Applications
- ejtt.getNavTree().getNodeLink(AppConstants.DeployableTypes.EJB2.getNavTreeLabel()).click();
+ // click on the "Add new resource" button
+ client.click("actionHeaderForm:addNewContent"); // 404 if setThrowExceptionOnFailingStatusCode(true) above
- // click on the "Add new resource" button
- client.click("actionHeaderForm:addNewContent"); // 404 if setThrowExceptionOnFailingStatusCode(true) above
+ // Upload the file
+ HtmlFileInput fileInput = (HtmlFileInput) client.getElement("createContentForm:file");
+ fileInput.setContentType("application/war");
+ fileInput.setValueAttribute(ejbFilePath);
+ client.click("createContentForm:addButton");
- // Upload the file
- HtmlFileInput fileInput = (HtmlFileInput)client.getElement("createContentForm:file");
- fileInput.setContentType("application/war");
- fileInput.setValueAttribute(ejbFilePath);
- client.click("createContentForm:addButton");
+ // Log server message.
+ ejtt.logServerMessage();
- // Log server message.
- ejtt.logServerMessage();
+ // Todo: Write some waitUntilDeployed().
+ ejtt.sleep(2000);
- // Todo: Write some waitUntilDeployed().
- ejtt.sleep( 2000 );
-
- }
-
-
+ }
}// class
15 years, 6 months
EMBJOPR SVN: r493 - trunk/jsfunit/testdata/ear.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-06-03 13:17:52 -0400 (Wed, 03 Jun 2009)
New Revision: 493
Added:
trunk/jsfunit/testdata/ear/malformed-application-xml-2.ear
trunk/jsfunit/testdata/ear/not-malformed-application-xml.ear
Log:
New EAR test files.
Added: trunk/jsfunit/testdata/ear/malformed-application-xml-2.ear
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/ear/malformed-application-xml-2.ear
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/ear/not-malformed-application-xml.ear
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/ear/not-malformed-application-xml.ear
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 7 months