Author: ozizka(a)redhat.com
Date: 2009-05-07 15:23:46 -0400 (Thu, 07 May 2009)
New Revision: 401
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java
Removed:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTest.java
Log:
EjbTest renamed to Ejb20Test
Copied: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java
(from rev 400,
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTest.java)
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java
(rev 0)
+++
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/Ejb20Test.java 2009-05-07
19:23:46 UTC (rev 401)
@@ -0,0 +1,135 @@
+/*
+ * 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.*;
+import com.gargoylesoftware.htmlunit.html.*;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import javax.faces.application.FacesMessage;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+
+
+
+/**
+ * This class contains tests for testing the EmbJopr Application
+ * Management Functions for Enterprise JavaBean archives with JBoss AS 5.
+ *
+ * @author Shelly McGowan
+ *
+ */
+public class Ejb20Test extends ApplicationTestBaseAS5 {
+
+ public static final DeployableTypes APP_TYPE = DeployableTypes.EJB2;
+
+
+ /**
+ * @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.
+ *
+ */
+
+ public void testBasicEjbDeployment() throws IOException, EmbJoprTestException
+ {
+
+ final String DEPLOYABLE_NAME = BASIC_EJB2;
+
+ // 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));
+
+ }// testBasicEjbDeployment()
+
+
+
+}// class
+
+
+
Deleted: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTest.java 2009-05-07
19:23:02 UTC (rev 400)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/ejb/EjbTest.java 2009-05-07
19:23:46 UTC (rev 401)
@@ -1,135 +0,0 @@
-/*
- * 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.*;
-import com.gargoylesoftware.htmlunit.html.*;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import javax.faces.application.FacesMessage;
-import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
-
-
-
-/**
- * This class contains tests for testing the EmbJopr Application
- * Management Functions for Enterprise JavaBean archives with JBoss AS 5.
- *
- * @author Shelly McGowan
- *
- */
-public class EjbTest extends ApplicationTestBaseAS5 {
-
- public static final DeployableTypes APP_TYPE = DeployableTypes.EJB2;
-
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite(EjbTest.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 testBasicEjbDeployment() throws IOException, EmbJoprTestException
- {
-
- final String DEPLOYABLE_NAME = BASIC_EJB2;
-
- // 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));
-
- }// testBasicEjbDeployment()
-
-
-
-}// class
-
-
-