EMBJOPR SVN: r277 - in trunk/core/src/main/webapp: secure and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2009-04-06 17:23:13 -0400 (Mon, 06 Apr 2009)
New Revision: 277
Modified:
trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
trunk/core/src/main/webapp/secure/categorySummary.xhtml
trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml
Log:
require confirmation when user clicks the DELETE button on a Resource subcategory Summary page (https://jira.jboss.org/jira/browse/EMBJOPR-91)
Modified: trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
===================================================================
--- trunk/core/src/main/webapp/WEB-INF/classes/messages.properties 2009-04-04 16:58:23 UTC (rev 276)
+++ trunk/core/src/main/webapp/WEB-INF/classes/messages.properties 2009-04-06 21:23:13 UTC (rev 277)
@@ -103,6 +103,7 @@
summary.category.type=Type
summary.category.types=Types
+summary.category.confirmDelete=Are you sure you want to delete this Resource?
#Messages for resourceInstanceMetrics.xhtml
metrics.resourceInstance.title=Metrics
Modified: trunk/core/src/main/webapp/secure/categorySummary.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/categorySummary.xhtml 2009-04-04 16:58:23 UTC (rev 276)
+++ trunk/core/src/main/webapp/secure/categorySummary.xhtml 2009-04-06 21:23:13 UTC (rev 277)
@@ -117,8 +117,10 @@
<h:outputText value="#{resourceItem.availability}"/>
</rich:column>
<rich:column>
+ <ui:param name="confirmDeleteMessage" value="#{messages['summary.category.confirmDelete']}"/>
<s:button id="removeButton"
action="#{resourceCRUDAction.removeResourceAction()}" value="Delete"
+ onclick="if (!confirm('#{confirmDeleteMessage}')) return false;"
styleClass="buttonsmall"
rendered="#{resourceItem.resource.resourceType.deletable}">
<f:param name="resourceId" value="#{resourceItem.resource.id}"/>
Modified: trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml 2009-04-04 16:58:23 UTC (rev 276)
+++ trunk/core/src/main/webapp/secure/resourceTypeSummary.xhtml 2009-04-06 21:23:13 UTC (rev 277)
@@ -108,7 +108,7 @@
<ui:param name="confirmDeleteMessage" value="#{messages['summary.resourceType.confirmDelete']}"/>
<s:button id="removeButton"
action="#{resourceCRUDAction.removeResourceAction()}" value="Delete"
- onclick="if (!confirm('#{confirmDeleteMessage}')) return false"
+ onclick="if (!confirm('#{confirmDeleteMessage}')) return false;"
rendered="#{resourceItem.resource.resourceType.deletable}"
styleClass="buttonsmall">
<f:param name="resourceId" value="#{resourceItem.resource.id}"/>
15 years, 8 months
EMBJOPR SVN: r276 - in trunk/core/src/main: java/org/jboss/on/embedded/manager/pc and 4 other directories.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2009-04-04 12:58:23 -0400 (Sat, 04 Apr 2009)
New Revision: 276
Added:
trunk/core/src/main/java/org/jboss/on/embedded/ui/ApplicationInfoAction.java
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java
trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/DiscoveryAction.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/UpdateBackingContentAction.java
trunk/core/src/main/webapp/errorLayout.xhtml
trunk/core/src/main/webapp/layout.xhtml
trunk/core/src/main/webapp/login.xhtml
trunk/core/src/main/webapp/secure/resourceInstanceContent.xhtml
Log:
do bootstrap after first successful login, rather than at webapp startup time (https://jira.jboss.org/jira/browse/EMBJOPR-85)
Modified: trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java 2009-04-03 15:41:45 UTC (rev 275)
+++ trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java 2009-04-04 16:58:23 UTC (rev 276)
@@ -24,16 +24,17 @@
import org.jboss.on.embedded.bean.history.content.ContentServerServiceImpl;
import org.jboss.on.embedded.bean.history.content.ContentHistoryManagerBean;
import org.jboss.on.embedded.bean.history.operation.OperationServerServiceImpl;
-import org.jboss.on.embedded.manager.ResourceManager;
+import org.jboss.on.embedded.manager.history.operation.OperationHistoryManager;
import org.jboss.on.embedded.manager.ResourceManagerFactory;
-import org.jboss.on.embedded.manager.history.operation.OperationHistoryManager;
+
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Create;
+import org.jboss.seam.security.Identity;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Startup;
import org.jboss.seam.annotations.Destroy;
+import org.jboss.seam.annotations.Observer;
import org.jboss.seam.contexts.ServletLifecycle;
import org.jetbrains.annotations.Nullable;
import org.rhq.core.pc.PluginContainer;
@@ -43,7 +44,6 @@
import org.rhq.core.pc.plugin.SimplePluginFinder;
import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
import java.io.File;
import java.io.FileInputStream;
@@ -57,7 +57,9 @@
import java.util.logging.Level;
/**
- * A Seam managed bean that bootstraps the admin console immediately after the admin console WAR is deployed.
+ * A Seam component that is in charge of initializing and shutting down the Admin Console.
+ *
+ * @author Ian Springer
*/
@Name("bootstrapAction")
@Scope(ScopeType.APPLICATION)
@@ -79,53 +81,75 @@
@In(value = "inventoryEventListener", create = true)
private EmbeddedInventoryEventListener inventoryEventListener;
+ private boolean initialized;
+
private File tempDir;
- @Create
- public void init() throws ServletException
+ /**
+ * Initializes the Admin Console after the first user logs in.
+ */
+ @Observer(Identity.EVENT_LOGIN_SUCCESSFUL)
+ public void init()
{
- try
- {
- bootstrap();
+ if (!this.initialized) {
+ try
+ {
+ String version = getVersion();
+ LOG.info("Bootstrapping Administration Console" + ((version != null) ? (" v" + version) : "") + "...");
+ long startTime = System.currentTimeMillis();
+ reconfigureJdkLogging();
+ initPluginContainer();
+ ResourceManagerFactory.resourceManager().discoverResources();
+ long elapsedTime = System.currentTimeMillis() - startTime;
+ LOG.info("Done bootstrapping Administration Console (" + elapsedTime + " ms elapsed).");
+ this.initialized = true;
+ }
+ catch (Exception e)
+ {
+ LOG.error("*** Failed to initialize Administration Console. ***", e);
+ }
}
- catch (Exception e)
- {
- LOG.error("Error bootstrapping Administration Console", e);
- }
}
/**
- * Shutdown the plugin container when the webapp gets undeployed.
+ * Shuts down the Admin Console when the webapp is stopped.
*/
@Destroy
public void shutdown()
{
- PluginContainer.getInstance().shutdown();
+ if (this.initialized) {
+ try
+ {
+ PluginContainer.getInstance().shutdown();
+ }
+ catch (RuntimeException e)
+ {
+ LOG.error("*** Failed to shutdown Administration Console. ***", e);
+ }
+ }
}
+ public boolean isInitialized()
+ {
+ return this.initialized;
+ }
+
public File getTempDir()
{
return this.tempDir;
}
- private void bootstrap()
- throws Exception
+ private void initPluginContainer()
+ throws MalformedURLException
{
- String version = getVersion();
- LOG.info("Bootstrapping Administration Console" + ((version != null) ? (" v" + version) : "") + "...");
- reconfigureJdkLogging();
PluginContainerConfiguration pluginContainerConfig = createPluginContainerConfiguration();
PluginContainer pluginContainer = PluginContainer.getInstance();
pluginContainer.setConfiguration(pluginContainerConfig);
configureMockScenarioLoader();
pluginContainer.initialize();
logLoadedPlugins(pluginContainer);
- // Add our inventory listener BEFORE initiating Resource discovery.
pluginContainer.getInventoryManager().addInventoryEventListener(this.inventoryEventListener);
pluginContainer.getInventoryManager().addInventoryEventListener(new LoggingInventoryEventListener());
- ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
- resourceManager.discoverResources();
- LOG.info("Done bootstrapping Administration Console.");
}
@Nullable
@@ -233,6 +257,7 @@
if (baseTempDir == null)
baseTempDir = File.separatorChar == '/' ? "/tmp" : "C:/tmp";
this.tempDir = new File(baseTempDir, "embjopr");
+ //noinspection ResultOfMethodCallIgnored
this.tempDir.mkdirs();
if (!this.tempDir.exists())
throw new IllegalStateException("Failed to initialize temporary directory: " + this.tempDir);
@@ -245,9 +270,7 @@
File directory = null;
String directoryPath = System.getProperty(systemProperty);
if (directoryPath != null)
- {
directory = new File(directoryPath);
- }
return directory;
}
}
Modified: trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java 2009-04-03 15:41:45 UTC (rev 275)
+++ trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java 2009-04-04 16:58:23 UTC (rev 276)
@@ -329,7 +329,7 @@
public Availability getAvailability(Resource resource)
{
- return getInventoryService().getAvailability(resource);
+ return getInventoryService().getCurrentAvailability(resource);
}
public List<OperationDefinition> getOperationsForResource(Resource resource)
Added: trunk/core/src/main/java/org/jboss/on/embedded/ui/ApplicationInfoAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/ApplicationInfoAction.java (rev 0)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/ApplicationInfoAction.java 2009-04-04 16:58:23 UTC (rev 276)
@@ -0,0 +1,54 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.jboss.on.embedded.ui;
+
+import javax.faces.context.FacesContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Startup;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.ScopeType;
+
+/**
+ * @author Ian Springer
+ */
+@Name("applicationInfoAction")
+(a)Scope(ScopeType.APPLICATION)
+@Startup
+public class ApplicationInfoAction
+{
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ @Factory(value = "baseUrl")
+ public String getBaseUrl()
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
+ int indexAfterContextRoot = request.getRequestURL().indexOf(request.getServletPath());
+ String baseUrl = request.getRequestURL().substring(0, indexAfterContextRoot) + "/";
+ log.debug("Base URL: " + baseUrl);
+ return baseUrl;
+ }
+}
Property changes on: trunk/core/src/main/java/org/jboss/on/embedded/ui/ApplicationInfoAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Author Id Revision HeadURL
Name: svn:eol-style
+ LF
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/DiscoveryAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/DiscoveryAction.java 2009-04-03 15:41:45 UTC (rev 275)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/DiscoveryAction.java 2009-04-04 16:58:23 UTC (rev 276)
@@ -22,24 +22,29 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.on.embedded.manager.ResourceManagerFactory;
+import org.jboss.on.embedded.BootstrapAction;
+
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.In;
/**
- * A managed bean that periodically asynchronously executes runtime discovery scans.
+ * A managed bean that periodically asynchronously executes service discovery scans.
* The {@link #checkAutodiscovery()} action will get triggered every time the user
- * hits any page, but it will only kick off a scan if the last scan was more than
- * one minute ago.
+ * hits any page (configured in pages.xml), but it will only kick off a scan if the
+ * last scan was more than one minute ago.
*
* @author Charles Crouch
*/
-// Make this application-scoped so each user doesn't trigger their own discovery.
@Scope(ScopeType.APPLICATION)
@Name("discoveryAction")
public class DiscoveryAction {
- private static final Log log = LogFactory.getLog(DiscoveryAction.class);
-
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ @In
+ private BootstrapAction bootstrapAction;
+
private volatile long lastDiscoveryTime;
// the minimum length of time (in milliseconds) between consecutive discoveries
@@ -54,25 +59,20 @@
}
public void checkAutodiscovery() {
- if (System.currentTimeMillis() - lastDiscoveryTime > scanPeriod) {
+ if (this.bootstrapAction.isInitialized() && (System.currentTimeMillis() - lastDiscoveryTime) > scanPeriod) {
// try the timestamp check in a synchronized block
tryAutodiscovery();
}
}
synchronized private void tryAutodiscovery() {
- log.debug("DiscoveryFilter tryAutodiscovery");
- if (System.currentTimeMillis() - lastDiscoveryTime > scanPeriod) {
- // put the timestamp updating above doAutodiscovery() so we don't continuously
- // retry on failure, and that we don't block subsequent requests
- // waiting to get into tryAutodiscovery()
+ log.trace("Checking if service discovery scan is needed...");
+ if ((System.currentTimeMillis() - lastDiscoveryTime) > scanPeriod) {
+ // Put the timestamp updating above the call to discoverServicesAsync(), so we don't continuously
+ // retry on failure, and so we don't block subsequent requests waiting to get into tryAutodiscovery().
lastDiscoveryTime = System.currentTimeMillis();
- doAutodiscovery();
+ log.debug("Performing service discovery scan...");
+ ResourceManagerFactory.resourceManager().discoverServicesAsync();
}
}
-
- private void doAutodiscovery() {
- log.debug("DiscoveryAction doAutodiscovery");
- ResourceManagerFactory.resourceManager().discoverServicesAsync();
- }
}
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java 2009-04-03 15:41:45 UTC (rev 275)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java 2009-04-04 16:58:23 UTC (rev 276)
@@ -26,8 +26,6 @@
import java.io.Serializable;
import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -82,8 +80,6 @@
this.openDepth = n;
}
- private String baseUrl;
-
private static final Log log = LogFactory.getLog(NavigationAction.class);
private Object navigationState;
@@ -103,24 +99,7 @@
return ResourceManagerFactory.resourceManager();
}
- public String getBaseUrl()
- {
- // TODO consider moving this initialization code into @Create method
- if (baseUrl == null)
- {
- StringBuilder url = new StringBuilder();
- FacesContext context = FacesContext.getCurrentInstance();
- HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
- int indexAfterContextRoot = request.getRequestURL().indexOf(request.getServletPath());
- baseUrl = request.getRequestURL().substring(0, indexAfterContextRoot) + "/";
-
- log.debug("Base URL: " + url);
- }
-
- return baseUrl;
- }
-
@In(value = "rootNode", create=true)
private JONTreeNode rootNode;
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java 2009-04-03 15:41:45 UTC (rev 275)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java 2009-04-04 16:58:23 UTC (rev 276)
@@ -65,15 +65,14 @@
{
File tempFile;
File tempDir = this.bootstrapAction.getTempDir();
+ File uploadsDir = new File(tempDir, "uploads");
try {
-
- tempDir.mkdirs(); // just in case the temp dir got deleted since this webapp was last deployed
- tempFile = new File(tempDir, this.fileName);
- log.debug("Writing temp file to " + tempFile + "...");
- if (tempFile.exists())
- tempFile.delete();
+ uploadsDir.mkdirs();
+ tempFile = new File(uploadsDir, this.fileName);
+ log.debug("Writing uploaded file to '" + tempFile + "'...");
FileOutputStream fos = new FileOutputStream(tempFile);
fos.write(this.file);
+ log.debug("Wrote " + this.file.length + " bytes to '" + tempFile + "'.");
fos.close();
}
catch (IOException e) {
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/content/UpdateBackingContentAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/content/UpdateBackingContentAction.java 2009-04-03 15:41:45 UTC (rev 275)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/content/UpdateBackingContentAction.java 2009-04-04 16:58:23 UTC (rev 276)
@@ -179,8 +179,12 @@
try {
report = PluginContainer.getInstance().getContentManager().executeResourcePackageDiscoveryImmediately(
this.resource.getId(), this.packageType.getName());
- if (report.getDeployedPackages().size() != 1)
- throw new IllegalStateException("ContentManager.executeResourcePackageDiscoveryImmediately() returned more than one package.");
+ if (report.getDeployedPackages().isEmpty())
+ throw new IllegalStateException("Backing " + this.packageType.getName() + " package not found for "
+ + this.resource + ".");
+ if (report.getDeployedPackages().size() > 1)
+ throw new IllegalStateException("More than one " + this.packageType.getName() + " package found for "
+ + this.resource + ".");
}
catch (PluginContainerException e) {
throw new Exception("Failed to discover underlying " + this.packageType.getName() + " package for "
Modified: trunk/core/src/main/webapp/errorLayout.xhtml
===================================================================
--- trunk/core/src/main/webapp/errorLayout.xhtml 2009-04-03 15:41:45 UTC (rev 275)
+++ trunk/core/src/main/webapp/errorLayout.xhtml 2009-04-04 16:58:23 UTC (rev 276)
@@ -35,7 +35,7 @@
<f:view contentType="text/html; charset=UTF-8">
<head>
- <base href="#{navigationAction.baseUrl}" />
+ <base href="#{baseUrl}" />
<title>
<ui:insert name="title">#{messages['default.windowTitle']}</ui:insert>
</title>
Modified: trunk/core/src/main/webapp/layout.xhtml
===================================================================
--- trunk/core/src/main/webapp/layout.xhtml 2009-04-03 15:41:45 UTC (rev 275)
+++ trunk/core/src/main/webapp/layout.xhtml 2009-04-04 16:58:23 UTC (rev 276)
@@ -33,7 +33,7 @@
</ui:remove>
<f:view contentType="text/html; charset=UTF-8">
<head>
- <base href="#{navigationAction.baseUrl}"/>
+ <base href="#{baseUrl}"/>
<title>
<ui:insert name="title">#{messages['default.windowTitle']}</ui:insert>
</title>
Modified: trunk/core/src/main/webapp/login.xhtml
===================================================================
--- trunk/core/src/main/webapp/login.xhtml 2009-04-03 15:41:45 UTC (rev 275)
+++ trunk/core/src/main/webapp/login.xhtml 2009-04-04 16:58:23 UTC (rev 276)
@@ -34,7 +34,7 @@
</ui:remove>
<f:view contentType="text/html; charset=UTF-8">
<head>
- <base href="#{navigationAction.baseUrl}"/>
+ <base href="#{baseUrl}"/>
<title><ui:insert name="title">#{messages['default.windowTitle']}</ui:insert></title>
<link href="css/console-style.css" rel="stylesheet" type="text/css"/>
@@ -56,7 +56,7 @@
<h:messages layout="table" styleClass="loginerror-msg"/>
<h:form id="login_form">
<div>
- <h2>Welcome to the JBoss administration console.</h2>
+ <h2>Welcome to the JBoss Administration Console.</h2>
<h2>Please login to proceed.</h2>
<p/>
<h:outputLabel for="name" value="#{messages['security.username']}"/><br/>
Modified: trunk/core/src/main/webapp/secure/resourceInstanceContent.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceInstanceContent.xhtml 2009-04-03 15:41:45 UTC (rev 275)
+++ trunk/core/src/main/webapp/secure/resourceInstanceContent.xhtml 2009-04-04 16:58:23 UTC (rev 276)
@@ -46,11 +46,13 @@
<ui:include src="../include/displayGlobalMessages.xhtml"/>
<h:panelGroup layout="block" rendered="#{not empty packageDetails.location}"
styleClass="instructionalText">
- <b>File Path:</b> #{packageDetails.location}
+ <b>File Path: </b> #{packageDetails.location}
</h:panelGroup>
<h:panelGroup layout="block" rendered="#{not empty packageDetails.fileSize}"
styleClass="instructionalText">
- <b>File Size:</b> #{packageDetails.fileSize} bytes
+ <b>File Size: </b>
+ <h:outputText value=" "/>
+ <h:outputText value="#{packageDetails.fileSize}"><f:convertNumber/></h:outputText> bytes
</h:panelGroup>
<hr/>
<div class="instructionalText">
15 years, 9 months
EMBJOPR SVN: r275 - trunk/jsfunit/testdata/ear.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-03 11:41:45 -0400 (Fri, 03 Apr 2009)
New Revision: 275
Added:
trunk/jsfunit/testdata/ear/EarWithWar-Counter.ear
trunk/jsfunit/testdata/ear/EarWithWarNB.ear
Log:
Added EAR archives for EAR tests to testdata dir
Added: trunk/jsfunit/testdata/ear/EarWithWar-Counter.ear
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/ear/EarWithWar-Counter.ear
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/ear/EarWithWarNB.ear
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/ear/EarWithWarNB.ear
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 9 months
EMBJOPR SVN: r274 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5 and 1 other directories.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-03 11:34:16 -0400 (Fri, 03 Apr 2009)
New Revision: 274
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/
Log:
WAR and EAR tests updated
EAR with WAR test added
EAR tests added for Stop-Start and Restart
WAR test added for bad extension archive
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-04-02 19:22:16 UTC (rev 273)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-04-03 15:34:16 UTC (rev 274)
@@ -115,6 +115,8 @@
public static final String BASIC_EAR = "eardeployment.ear";
public static final String EAR_UNPACKED = "unpacked-ear1.ear";
public static final String EAR_UNPACKED_ZIP = "unpacked-ear1.ear.zip";
+ public static final String EAR_WITH_WAR = "EarWithWarNB.ear";
+ public static final String EAR_WITH_WAR_COUNTER = "EarWithWar-Counter.ear";
public static final String BASIC_WAR = "hellothere.war";
public static final String BASIC_WAR_02 = "hellothere02.war";
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-04-02 19:22:16 UTC (rev 273)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-04-03 15:34:16 UTC (rev 274)
@@ -22,6 +22,7 @@
package org.jboss.jopr.jsfunit.as5;
+import com.gargoylesoftware.htmlunit.WebClient;
import org.jboss.jopr.jsfunit.util.DescribedCondition;
import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
import org.jboss.jopr.jsfunit.*;
@@ -30,10 +31,12 @@
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-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.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;
@@ -394,7 +397,7 @@
try {
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
// Navigate to the Configuration tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
@@ -447,7 +450,7 @@
try {
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
// Navigate to the Configuration tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
@@ -496,7 +499,7 @@
try {
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
// Navigate to the Configuration tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
@@ -535,7 +538,7 @@
try {
// Wait for EAR to be deployed and UP
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits");
ContentInfoTable infoTable = ejtt.getTabMenu().getTabContentBox().getContentInfoTable(table.getElement());
@@ -564,7 +567,7 @@
try {
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
// Navigate to the Metrics tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
@@ -605,7 +608,7 @@
try {
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
// Navigate to the Metrics tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
@@ -646,7 +649,7 @@
try {
// Loop, wait for the app to appear.
log.info("Waiting for EAR to appear.");
- waitActivelyForDeployment( DeployableTypes.EAR, EAR_UNPACKED, 5000, 5 );
+ ejtt.deployment.waitActivelyForDeployment( DeployableTypes.EAR, EAR_UNPACKED, 5000, 5 );
ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
@@ -673,12 +676,246 @@
/**
+ * Deploys an EAR with WAR as a module, and checks whether the web app runs.
+ */
+ public void testEarWithWar() throws IOException, EmbJoprTestException {
+
+ final String DEPLOYABLE_NAME = EAR_WITH_WAR;
+
+ // Deploy the EAR.
+ String earFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
+ deployEar( earFilePath );
+
+ // Get the HTTP port and the URL of the test page.
+ HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+ int port = tmpRequest.getLocalPort();
+ // Eventually remove ".war" suffix and add "-war" (convention)
+ String context = StringUtils.chomp( DEPLOYABLE_NAME, ".ear" ) +"-war";
+ String testPageUrl = "http://localhost:"+port+"/"+context+"/index.jsp";
+
+ // Create web client we will use to check the web app.
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(false);
+ HtmlPage page;
+
+ try {
+
+ // Wait until the EAR is UP.
+ ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME, 3000, 15, this);
+
+ // Assert that the app is running.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
+ assertTrue("Page should contain 'Hello World'", page.asText().contains("Hello World"));
+
+ }
+ finally {
+ undeployEar(BASIC_EAR);
+ }
+
+
+ }
+
+
+
+
+
+
+
+
+
+ public void testStopAndStartEar() throws IOException, EmbJoprTestException
+ {
+ final String DEPLOYABLE_NAME = EAR_WITH_WAR_COUNTER;
+
+ // Get the HTTP port and the URL of the test page.
+ HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+ int port = tmpRequest.getLocalPort();
+ String context = StringUtils.chomp( DEPLOYABLE_NAME, ".ear" )+"-war"; // Eventually remove ".ear" suffix.
+ String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
+
+ // Create web client we will use to check the web app.
+ WebClient webClient = new WebClient();
+ // We'll get 404 after stopping the app.
+ webClient.setThrowExceptionOnFailingStatusCode(false);
+ HtmlPage page;
+
+
+ // Deploy the EAR.
+ String appfilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
+ deployEar( appfilePath );
+
+ try {
+
+ // Wait until app is UP
+ ejtt.getNavTree().getNodeByLabel(DeployableTypes.EAR.getNavTreeLabel()).click();
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME,
+ 3000, 15, this);
+
+ // Assert that the app is running.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
+ assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
+
+ // Refresh the page several times to increase the counter.
+ page.refresh();
+ page.refresh();
+
+ // Get the counter number.
+ Integer count1 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+
+
+ // 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();
+
+ // Check the latest message.
+ /*
+ HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().getElement();
+ HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tr[contains(@class, 'rich-table-firstrow')]");
+ assertTrue( tr.getTextContent().contains("Success") );
+ /**/
+ assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().wasLastOperationSuccesful() );
+
+
+ // Assert that the app is stopped.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assert( 200 != page.getWebResponse().getStatusCode() );
+
+
+ // Click the Start button.
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start").click();
+
+ // Check the latest message. TODO: EJTT class for ops history table?
+ HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().getElement();
+ HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tr[contains(@class, 'rich-table-firstrow')]");
+ assertTrue( tr.getTextContent().contains("Success") );
+
+
+ // Assert that the app is running.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assert( 200 == page.getWebResponse().getStatusCode() );
+ assertTrue(page.asText().contains("HELLO WORLD"));
+
+ // Get the counter number.
+ Integer count2 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+ assertTrue( "Counter is reset upon app restart, thus should be lower after.", count1 > count2 );
+
+
+ }
+ finally {
+ undeployEar(DEPLOYABLE_NAME);
+ }
+ }
+
+
+ /**
+ * Restarts the EAR in Control tab and checks whether it was really restarted.
+ */
+ public void testRestartEar() throws IOException, EmbJoprTestException
+ {
+ final String DEPLOYABLE_NAME = EAR_WITH_WAR_COUNTER;
+
+ // Get the HTTP port and the URL of the test page.
+ HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+ int port = tmpRequest.getLocalPort();
+ String context = StringUtils.chomp( DEPLOYABLE_NAME, ".ear" )+"-war";
+ String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
+
+ // Create web client we will use to check the web app.
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(false);
+ HtmlPage page;
+
+
+ // Deploy the app.
+ String appFilePath = ejtt.getTestDataDir() + "/ear/"+DEPLOYABLE_NAME;
+ deployEar( appFilePath );
+
+ try {
+
+ // Wait until app is UP
+ ejtt.getNavTree().getNodeByLabel(DeployableTypes.EAR.getNavTreeLabel()).click();
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME,
+ 3000, 15, this);
+
+ // Assert that the app is running.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
+ assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
+
+ // Refresh the page several times to increase the counter.
+ page.refresh();
+ page.refresh();
+
+ // Get the counter number.
+ Integer count1 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+
+
+ // 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 Restart button.
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Restart").click();
+
+ // Check the latest message. TODO: EJTT class for ops history table?
+ HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().getElement();
+ HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tr[contains(@class, 'rich-table-firstrow')]");
+ assertTrue( tr.getTextContent().contains("Success") );
+
+
+ // Assert that the app is running.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assert( 200 == page.getWebResponse().getStatusCode() );
+ assertTrue(page.asText().contains("HELLO WORLD"));
+
+ // Get the counter number.
+ Integer count2 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+ assertTrue( "Counter is reset upon app restart, thus should be lower after.", count1 > count2 );
+
+ }
+ finally {
+ undeployEar(DEPLOYABLE_NAME);
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /**
* Waits for the deployable to be in the UP State.
*
* @param type Type of deployable - EAR, WAR, SAR, ...
* @param name Name of the deployable, like 'hello.war'.
+ @deprecated Moved to EJTT.Deployment.
*/
- private void waitActivelyForDeployment(
+ private void XwaitActivelyForDeployment(
final DeployableTypes type, final String name,
int intervalMS, int retries
)
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-02 19:22:16 UTC (rev 273)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-03 15:34:16 UTC (rev 274)
@@ -22,6 +22,7 @@
package org.jboss.jopr.jsfunit.as5;
+import javax.faces.application.FacesMessage.Severity;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import com.gargoylesoftware.htmlunit.WebClient;
@@ -31,6 +32,7 @@
import com.gargoylesoftware.htmlunit.html.*;
import java.io.*;
import java.util.Properties;
+import javax.faces.application.FacesMessage;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.lang.StringUtils;
@@ -989,15 +991,53 @@
+ /**
+ * Deploys a WAR with bad farchive extension (.zip)
+ * and checks whether EmbJopr reports deployment failure.
+ */
+ public void testDeployWarWithIncorrectExtension() throws IOException, EmbJoprTestException
+ {
+ final String DEPLOYABLE_NAME = WAR_UNPACKED_ZIP;
+ // Deploy the WAR.
+ String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+ deployWarRepeatedly( WARFilePath );
+ try {
+ assertTrue( "There should be a faces message informing about failure.",
+ server.getFacesMessages().hasNext() );
+ assertTrue( "The failure message should have ERROR severity.",
+ FacesMessage.SEVERITY_ERROR == server.getFacesMessages().next().getSeverity() );
+ assertTrue( "Page should contain 'Incorrect extension' string (deployer message).",
+ client.getPageAsText().contains("Incorrect extension") );
+ }
+ finally {
+ // Undeploy for the case it was (errorneously) deployed.
+ try {
+ undeployWAR(DEPLOYABLE_NAME);
+ } catch( Exception ex ){
+ log.debug("Cathed an expected exception when trying to undeploy "+DEPLOYABLE_NAME+": "+ex );
+ }
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
/**
* Deploys WAR.
*/
Property changes on: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util
___________________________________________________________________
Name: svn:ignore
+ JVMUtils.java
15 years, 9 months
EMBJOPR SVN: r273 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-02 15:22:16 -0400 (Thu, 02 Apr 2009)
New Revision: 273
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
Log:
WAR tests updated
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-02 19:20:48 UTC (rev 272)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-02 19:22:16 UTC (rev 273)
@@ -120,7 +120,7 @@
- public void XtestBadWarRedeploy() throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
+ public void testBadWarRedeploy() throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
final String DEPLOYABLE_NAME = AppConstants.WAR_FILENAME_MALFORMED_APP;
@@ -145,7 +145,7 @@
* Various ways to navigate to a WAR application:
* Nav tree, apps listing, WARs listing.
*/
- public void XtestNavigationToWar() throws IOException, HtmlElementNotFoundException, ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException, ActionOutOfSyncException
+ public void testNavigationToWar() throws IOException, HtmlElementNotFoundException, ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException, ActionOutOfSyncException
{
// JBossAS Servers node
@@ -286,7 +286,7 @@
*
* FAILS because of: EMBJOPR-110
*/
- public void XtestWarSummaryTab() throws EmbJoprTestException, IOException, Exception {
+ public void testWarSummaryTab() throws EmbJoprTestException, IOException, Exception {
final int DEPLOY_TIMEOUT_SEC = 120;
@@ -386,7 +386,7 @@
*
* FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void XtestWarConfigurationTab() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
+ public void testWarConfigurationTab() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
final String DEPLOYABLE_NAME = BASIC_WAR_04;
@@ -443,7 +443,7 @@
*
* FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void XtestWarConfigurationTabCancel() throws IOException, EmbJoprTestException {
+ public void testWarConfigurationTabCancel() throws IOException, EmbJoprTestException {
final String DEPLOYABLE_NAME = BASIC_WAR_05;
@@ -498,7 +498,7 @@
*
* Fails because of: EMBJOPR-109
*/
- public void XtestWarRedeployment() throws IOException, EmbJoprTestException {
+ public void testWarRedeployment() throws IOException, EmbJoprTestException {
final String DEPLOYABLE_NAME = BASIC_WAR_06;
@@ -586,7 +586,7 @@
* Deploys the WAR, undeploys it and deploys again.
* All these actions are done using EmbJopr.
*/
- public void XtestWarDeployUndeployDeployRetryOnErrors() throws IOException, EmbJoprTestException {
+ public void testWarDeployUndeployDeployRetryOnErrors() throws IOException, EmbJoprTestException {
final String DEPLOYABLE_NAME = BASIC_WAR_DUD_RETRY;
@@ -670,7 +670,7 @@
/**
* Checks WAR metrics tab.
*/
- public void XtestWarMetricsTab() throws IOException, EmbJoprTestException {
+ public void testWarMetricsTab() throws IOException, EmbJoprTestException {
final String DEPLOYABLE_NAME = BASIC_WAR_08;
@@ -715,7 +715,7 @@
*
* FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void XtestWarMetricsTabRefreshButton() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
+ public void testWarMetricsTabRefreshButton() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
final String DEPLOYABLE_NAME = BASIC_WAR_09;
@@ -775,7 +775,7 @@
* Should we wait more? Or is it caused by failures of some previous tests?
*
*/
- public void XtestDeployUnpackedWar() throws IOException, EmbJoprTestException {
+ public void testDeployUnpackedWar() throws IOException, EmbJoprTestException {
// Deploy the unpacked WAR.
15 years, 9 months
EMBJOPR SVN: r272 - in trunk/jsfunit: src/test/java/org/jboss/jopr/jsfunit and 3 other directories.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-02 15:20:48 -0400 (Thu, 02 Apr 2009)
New Revision: 272
Added:
trunk/jsfunit/src/test/resources/
trunk/jsfunit/testdata/war/hellothere-DUD.war
trunk/jsfunit/testdata/war/hellothere-DUD_RETRY.war
trunk/jsfunit/testdata/war/hellothere-RESTART.war
trunk/jsfunit/testdata/war/hellothere-STOP_START.war
trunk/jsfunit/testdata/war/hellothere02.war
trunk/jsfunit/testdata/war/hellothere03.war
trunk/jsfunit/testdata/war/hellothere04.war
trunk/jsfunit/testdata/war/hellothere05.war
trunk/jsfunit/testdata/war/hellothere06.war
trunk/jsfunit/testdata/war/hellothere07.war
trunk/jsfunit/testdata/war/hellothere08.war
trunk/jsfunit/testdata/war/hellothere09.war
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
WAR tests updated;
WAR tests added for Stop-Start and Restart operations.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-04-02 15:55:55 UTC (rev 271)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-04-02 19:20:48 UTC (rev 272)
@@ -26,6 +26,7 @@
public static final String SYSPROP_DEPLOY_DIR = "jsfunit.deploy.dir";
public static final String SYSPROP_TESTDATA_DIR = "jsfunit.testdata";
+ public static final String SYSPROP_TEMP_DIR = "jsfunit.tempdir";
@@ -116,6 +117,19 @@
public static final String EAR_UNPACKED_ZIP = "unpacked-ear1.ear.zip";
public static final String BASIC_WAR = "hellothere.war";
+ public static final String BASIC_WAR_02 = "hellothere02.war";
+ public static final String BASIC_WAR_03 = "hellothere03.war";
+ public static final String BASIC_WAR_04 = "hellothere04.war";
+ public static final String BASIC_WAR_05 = "hellothere05.war";
+ public static final String BASIC_WAR_06 = "hellothere06.war";
+ public static final String BASIC_WAR_07 = "hellothere07.war";
+ public static final String BASIC_WAR_08 = "hellothere08.war";
+ public static final String BASIC_WAR_09 = "hellothere09.war";
+ public static final String BASIC_WAR_DUD = "hellothere-DUD.war";
+ public static final String BASIC_WAR_DUD_RETRY = "hellothere-DUD_RETRY.war";
+ public static final String BASIC_WAR_STOPSTART = "hellothere-STOP_START.war";
+ public static final String BASIC_WAR_RESTART = "hellothere-RESTART.war";
+
public static final String WAR_UNPACKED = "unpacked-web1.war";
public static final String WAR_UNPACKED_ZIP = "unpacked-web1.war.zip";
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-02 15:55:55 UTC (rev 271)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-02 19:20:48 UTC (rev 272)
@@ -31,10 +31,10 @@
import com.gargoylesoftware.htmlunit.html.*;
import java.io.*;
import java.util.Properties;
-import javax.faces.application.FacesMessage;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.apache.commons.lang.math.RandomUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.math.NumberUtils;
import org.jboss.jopr.jsfunit.exceptions.*;
import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
import org.jboss.jopr.jsfunit.util.DescribedCondition;
@@ -75,8 +75,10 @@
throws IOException, HtmlElementNotFoundException, ActionNotAvailableException
{
- String filePath = ejtt.getTestDataDir() + "/war/"+BASIC_WAR;
+ final String DEPLOYABLE_NAME = BASIC_WAR;
+ String filePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+
try {
deployWAR( filePath );
@@ -85,7 +87,7 @@
checkClientAndServerMessages(expectedMessage, expectedMessage, false);
// Use JMX to assert that the WAR really did deploy successfully
- assertTrue("WAR was not deployed according to JMX", isWarDeployed(BASIC_WAR));
+ assertTrue("WAR was not deployed according to JMX", isWarDeployed(DEPLOYABLE_NAME));
// use HtmlUnit to test the newly deployed war in a new WebClient session
// note that I have full access to the FacesContext and the previous request
@@ -99,16 +101,16 @@
}
finally {
- //undeployWAR(BASIC_WAR);
+ //undeployWAR(DEPLOYABLE_NAME);
// Undeploy the WAR
- HtmlButtonInput deleteButton = getAppDeleteButton(BASIC_WAR);
+ HtmlButtonInput deleteButton = getAppDeleteButton(DEPLOYABLE_NAME);
deleteButton.click();
// This assert doesn't work. jopr does remove the WAR, but for some
// reason, JBoss doesn't undeploy the MBeans
// JBAS-XXXX
- //assertFalse(isWarDeployed(BASIC_WAR));
+ //assertFalse(isWarDeployed(DEPLOYABLE_NAME));
}
}
@@ -118,16 +120,19 @@
- public void DISABLEDtestBadWarRedeploy() throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
+ public void XtestBadWarRedeploy() throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
+ final String DEPLOYABLE_NAME = AppConstants.WAR_FILENAME_MALFORMED_APP;
+
try {
- String filePath = ejtt.getTestDataDir() + "/war/"+AppConstants.WAR_FILENAME_MALFORMED_APP;
+
+ String filePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
deployWAR(filePath);
checkClientAndServerMessages("Failed to create Resource", "Failed to create Resource", true);
}
finally {
- undeployWAR(BASIC_WAR);
+ undeployWAR(DEPLOYABLE_NAME);
}
}
@@ -136,8 +141,11 @@
-
- public void testNavigationToWar() throws IOException, HtmlElementNotFoundException, ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException, ActionOutOfSyncException
+ /**
+ * Various ways to navigate to a WAR application:
+ * Nav tree, apps listing, WARs listing.
+ */
+ public void XtestNavigationToWar() throws IOException, HtmlElementNotFoundException, ActionOutOfSyncException, ActionNotAvailableException, EmbJoprTestException, InterruptedException, ActionOutOfSyncException
{
// JBossAS Servers node
@@ -187,7 +195,6 @@
// Applications node
{
- // Whooo-hooo! So much to click through!
ejtt.getTabMenu().clickTab("Summary");
@@ -216,37 +223,39 @@
// Concrete appliction node.
{
+ final String DEPLOYABLE_NAME = BASIC_WAR_02;
+
// Deploy the WAR.
- String filePath = ejtt.getTestDataDir() + "/war/"+BASIC_WAR;
+ String filePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
deployWarRepeatedly( filePath );
ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
// Get to the app through listing.
- log.debug("Looking for row with: "+BASIC_WAR);
+ log.debug("Looking for row with: "+DEPLOYABLE_NAME);
// Commented out: we would have to click trough pages.
- //ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_WAR);
+ //ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
ContentTableRow row = ejtt.getTabMenu().getTabContentBox()
- .findLinkRowInDataTableUsingPagination(BASIC_WAR);
+ .findLinkRowInDataTableUsingPagination(DEPLOYABLE_NAME);
- assertTrue("Page doesn't list "+BASIC_WAR+" in Summary tab.", row != null );
+ assertTrue("Page doesn't list "+DEPLOYABLE_NAME+" in Summary tab.", row != null );
// Go to the summary through listed item.
- row.getLinkByLabel(BASIC_WAR).click();
+ row.getLinkByLabel(DEPLOYABLE_NAME).click();
/**/
// Other way to get to app: through nav tree.
ejtt.getNavTree().getNodeArrow(NAV_WAR).click();
- ejtt.navTree.waitUntilNodeLoadedByAjax(BASIC_WAR, 500, 15);
- ejtt.navTree.getNodeByLabel(BASIC_WAR).click();
+ ejtt.navTree.waitUntilNodeLoadedByAjax(DEPLOYABLE_NAME, 500, 15);
+ ejtt.navTree.getNodeByLabel(DEPLOYABLE_NAME).click();
/**/
// Check that we have the summary tab for the selected WAR.
- assertTrue( "WAR name "+BASIC_WAR+" not found in the content box.",
- ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(BASIC_WAR) );
+ assertTrue( "WAR name "+DEPLOYABLE_NAME+" not found in the content box.",
+ ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(DEPLOYABLE_NAME) );
// Go to the summary through nav tree node.
NavTreeNode appNode = ejtt.getNavTree().getNodeByLabel(NAV_WAR);
@@ -255,11 +264,11 @@
appNode.getArrowLink().click();
Thread.sleep(2000);
}
- ejtt.getNavTree().getNodeByLabel(BASIC_WAR).click();
+ ejtt.getNavTree().getNodeByLabel(DEPLOYABLE_NAME).click();
// Check that we have the summary tab for the selected WAR.
- ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(BASIC_WAR);
+ ejtt.getTabMenu().getTabContentBox().getElement().getTextContent().contains(DEPLOYABLE_NAME);
- undeployWAR(BASIC_WAR);
+ undeployWAR(DEPLOYABLE_NAME);
}
@@ -277,12 +286,14 @@
*
* FAILS because of: EMBJOPR-110
*/
- public void testWarSummaryTab() throws EmbJoprTestException, IOException, Exception {
+ public void XtestWarSummaryTab() throws EmbJoprTestException, IOException, Exception {
final int DEPLOY_TIMEOUT_SEC = 120;
+ final String DEPLOYABLE_NAME = BASIC_WAR_03;
+
// Deploy the WAR
- String appFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/war/"+BASIC_WAR;
+ String appFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/war/"+DEPLOYABLE_NAME;
deployWarRepeatedly( appFilePath );
try {
@@ -294,14 +305,14 @@
public boolean isTrue() throws Exception {
// Refresh, then check.
ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
- ContentTableRow appRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(BASIC_WAR);
+ ContentTableRow appRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(DEPLOYABLE_NAME);
return null != appRow;
}
}).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 5);
/**/
- ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_WAR);
+ ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
// Wait until the Status is "UP".
// TODO: Replace with ActiveConditionChecker.
@@ -314,16 +325,16 @@
// Refresh page after 1 second.
ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
- appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_WAR);
+ appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
// We don't want an infinite loop by mistake.
if( maxLoops-- <= 0 ){
- throw new EmbJoprTestException("WAR "+BASIC_WAR+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
+ throw new EmbJoprTestException("WAR "+DEPLOYABLE_NAME+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
}
} while( true );
// FAILS because of EMBJOPR-80.
- appRow.getLinkByLabel(BASIC_WAR).click();
+ appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
// Check the values in info table(s)
@@ -334,7 +345,7 @@
Properties props = infoTable.getProperties();
log.info("General Properties: "+props.toString());
- assertEquals(BASIC_WAR, props.getProperty("Name").trim());
+ assertEquals(DEPLOYABLE_NAME, props.getProperty("Name").trim());
//assertEquals("?", props.getProperty("Version")); // TODO: Where does RHQ get the version from?
@@ -346,7 +357,7 @@
log.debug("Path: "+props.getProperty("Path"));///
- String path = ejtt.getDeployDir()+"/"+BASIC_WAR;
+ String path = ejtt.getDeployDir()+"/"+DEPLOYABLE_NAME;
assertEquals(path, props.getProperty("Path").trim()); // EMBJOPR-110 here
assertEquals("no", props.getProperty("Exploded?").trim());
@@ -359,7 +370,7 @@
}
finally {
// Undeploy the WAR
- undeployWAR( BASIC_WAR );
+ undeployWAR( DEPLOYABLE_NAME );
}
}// testWarSummary()
@@ -375,20 +386,22 @@
*
* FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void testWarConfigurationTab() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
+ public void XtestWarConfigurationTab() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
+ final String DEPLOYABLE_NAME = BASIC_WAR_04;
+
// Deploy the WAR.
- String filePath = ejtt.getTestDataDir() +"/war/"+ BASIC_WAR;
+ String filePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
deployWarRepeatedly( filePath );
try {
ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, BASIC_WAR, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
// Navigate to the Configuration tab
- ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_WAR);
- appRow.getLinkByLabel(BASIC_WAR).click();
+ ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
ejtt.tabMenu.clickConfigurationTab();
// Read properties.
@@ -416,7 +429,7 @@
}
finally {
- undeployWAR(BASIC_WAR);
+ undeployWAR(DEPLOYABLE_NAME);
}
}
@@ -430,21 +443,23 @@
*
* FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void testWarConfigurationTabCancel() throws IOException, EmbJoprTestException {
+ public void XtestWarConfigurationTabCancel() throws IOException, EmbJoprTestException {
+ final String DEPLOYABLE_NAME = BASIC_WAR_05;
+
// Deploy the WAR.
- String filePath = ejtt.getTestDataDir() +"/war/"+ BASIC_WAR;
+ String filePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
deployWarRepeatedly( filePath );
try {
ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, BASIC_WAR,
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
// Navigate to the Configuration tab
- ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_WAR);
- row.getLinkByLabel(BASIC_WAR).click();
+ ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ row.getLinkByLabel(DEPLOYABLE_NAME).click();
ejtt.tabMenu.clickConfigurationTab();
@@ -470,7 +485,7 @@
}
finally {
- undeployWAR(BASIC_WAR);
+ undeployWAR(DEPLOYABLE_NAME);
}
}
@@ -479,24 +494,26 @@
/**
- * Redeploys WAR.
+ * Redeploys WAR, using WAR's Content tab upload form.
*
* Fails because of: EMBJOPR-109
*/
- public void testWarRedeployment() throws IOException, EmbJoprTestException {
+ public void XtestWarRedeployment() throws IOException, EmbJoprTestException {
+ final String DEPLOYABLE_NAME = BASIC_WAR_06;
+
// Deploy the WAR.
- String appFilePath = ejtt.getTestDataDir() +"/war/"+ BASIC_WAR;
+ String appFilePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
deployWarRepeatedly( appFilePath );
try {
ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, BASIC_WAR, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
// Navigate to the Configuration tab
- ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_WAR);
- row.getLinkByLabel(BASIC_WAR).click();
+ ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ row.getLinkByLabel(DEPLOYABLE_NAME).click();
ejtt.tabMenu.clickContentTab();
String xPath = ".//table//input[@type='file']";
@@ -510,7 +527,7 @@
finally {
try {
DebugUtils.writeFile("target/redeployment.html", client.getPageAsText());///
- undeployWAR(BASIC_WAR); // EMBJOPR-109 here
+ undeployWAR(DEPLOYABLE_NAME); // EMBJOPR-109 here
}catch( Exception ex ){
log.error("Exception caught in finally: "+ex.getMessage(), ex);
}
@@ -519,26 +536,116 @@
}
+ /**
+ * Deploys the WAR, undeploys it and deploys again.
+ * All these actions are done using EmbJopr.
+ *
+ * Fails because of EMBJOPR-125
+ */
+ public void testWarDeployUndeployDeploy() throws IOException, EmbJoprTestException {
+ final String DEPLOYABLE_NAME = BASIC_WAR_DUD;
+
+
+ // Deploy the WAR.
+ String appFilePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
+ deployWarRepeatedly( appFilePath );
+
+ try {
+
+ // Undeploy.
+ log.info("Undeploying "+DEPLOYABLE_NAME);
+ undeployWAR(DEPLOYABLE_NAME);
+ //DebugUtils.writeFile("target/DUD-undeploy.html", client.getPageAsText());///
+ assertFalse( "Deployable "+DEPLOYABLE_NAME+" shouldn't be listed as deployed after undeployment.",
+ ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
+
+ // Deploy the same war again.
+ log.info("Deploying "+DEPLOYABLE_NAME+" again.");
+ deployWAR( appFilePath );
+ //DebugUtils.writeFile("target/DUD-deploy.html", client.getPageAsText());///
+ // EMBJOPR-125 here.
+ assertTrue( "Deployable "+DEPLOYABLE_NAME+" should be listed as deployed after deployment.",
+ ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
+
+ }
+ finally {
+ try {
+ DebugUtils.writeFile("target/testDeployUndeployDeploy-finally.html", client.getPageAsText());///
+ undeployWAR(DEPLOYABLE_NAME);
+ }catch( Exception ex ){
+ log.error("Exception caught in finally: "+ex.getMessage(), ex);
+ }
+ }
+
+ }
+
+
+
/**
+ * Deploys the WAR, undeploys it and deploys again.
+ * All these actions are done using EmbJopr.
+ */
+ public void XtestWarDeployUndeployDeployRetryOnErrors() throws IOException, EmbJoprTestException {
+
+ final String DEPLOYABLE_NAME = BASIC_WAR_DUD_RETRY;
+
+
+ // Deploy the WAR.
+ String appFilePath = ejtt.getTestDataDir() +"/war/"+ DEPLOYABLE_NAME;
+ deployWarRepeatedly( appFilePath );
+
+ try {
+
+ // Undeploy.
+ log.info("Undeploying "+DEPLOYABLE_NAME);
+ undeployWAR(DEPLOYABLE_NAME); // EMBJOPR-109 here
+ DebugUtils.writeFile("target/DUD_RETRY-undeploy.html", client.getPageAsText());///
+ assertFalse( "Deployable "+DEPLOYABLE_NAME+" shouldn't be listed as deployed after undeployment.",
+ ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
+
+ // Deploy the same war again.
+ log.info("Deploying "+DEPLOYABLE_NAME+" again.");
+ deployWarRepeatedly( appFilePath );
+ DebugUtils.writeFile("target/DUD_RETRY-deploy.html", client.getPageAsText());///
+ assertTrue( "Deployable "+DEPLOYABLE_NAME+" should be listed as deployed after deployment.",
+ ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, DEPLOYABLE_NAME, false) );
+
+ }
+ finally {
+ try {
+ DebugUtils.writeFile("target/testDeployUndeployDeployRetryOnErrors-finally.html", client.getPageAsText());///
+ undeployWAR(DEPLOYABLE_NAME); // EMBJOPR-109 here
+ }catch( Exception ex ){
+ log.error("Exception caught in finally: "+ex.getMessage(), ex);
+ }
+ }
+
+ }
+
+
+
+ /**
* Deploys exploded WAR and checks whether it is reported as exploded.
*
* DISABLED - Badly written test, to be fixed. TODO: Hot-deploy
*/
public void DISABLEDtestUnzippedWarReportedAsExploded() throws IOException, EmbJoprTestException {
+ final String DEPLOYABLE_NAME = BASIC_WAR_07;
+
// Deploy the WAR.
- String WARFilePath = ejtt.getTestDataDir() + "/war/"+BASIC_WAR;
+ String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
deployWarRepeatedly( WARFilePath );
try {
// Wait for WAR to be deployed and UP
ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, BASIC_WAR, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
// Click the WAR link
ejtt.getTabMenu().getTabContentBox().getFirstTable()
- .getFirstRowContainingText(BASIC_WAR).getFirstLinkFromColumn("Name").click();
+ .getFirstRowContainingText(DEPLOYABLE_NAME).getFirstLinkFromColumn("Name").click();
DebugUtils.writeFile("target/res_traits.html", client.getPageAsText());///
@@ -552,7 +659,7 @@
}
finally {
- undeployWAR(BASIC_WAR);
+ undeployWAR(DEPLOYABLE_NAME);
}
}
@@ -563,20 +670,22 @@
/**
* Checks WAR metrics tab.
*/
- public void testWarMetricsTab() throws IOException, EmbJoprTestException {
+ public void XtestWarMetricsTab() throws IOException, EmbJoprTestException {
+ final String DEPLOYABLE_NAME = BASIC_WAR_08;
+
// Deploy the WAR.
- String WARFilePath = ejtt.getTestDataDir() + "/war/"+BASIC_WAR;
+ String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
deployWarRepeatedly( WARFilePath );
try {
ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, BASIC_WAR, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME, DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
// Navigate to the Metrics tab
- ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_WAR);
- row.getLinkByLabel(BASIC_WAR).click();
+ ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ row.getLinkByLabel(DEPLOYABLE_NAME).click();
ejtt.tabMenu.clickMetricsTab();
// Resource Traits
@@ -589,13 +698,13 @@
log.debug("Trait Values: "+ props.toString());
- String path = ejtt.getDeployDir()+"/"+BASIC_WAR;
+ String path = ejtt.getDeployDir()+"/"+DEPLOYABLE_NAME;
assertEquals(path, props.getProperty("Path").trim());
}
finally {
- undeployWAR(BASIC_WAR);
+ undeployWAR(DEPLOYABLE_NAME);
}
}
@@ -606,21 +715,23 @@
*
* FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void testWarMetricsTabRefreshButton() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
+ public void XtestWarMetricsTabRefreshButton() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
+ final String DEPLOYABLE_NAME = BASIC_WAR_09;
+
// Deploy the WAR.
- String WARFilePath = ejtt.getTestDataDir() + "/war/"+BASIC_WAR;
+ String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
deployWarRepeatedly( WARFilePath );
try {
ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, BASIC_WAR,
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
// Navigate to the Metrics tab
- ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_WAR);
- row.getLinkByLabel(BASIC_WAR).click();
+ ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
+ row.getLinkByLabel(DEPLOYABLE_NAME).click();
ejtt.tabMenu.clickMetricsTab();
// Click the Refresh button.
@@ -629,12 +740,12 @@
// Check that we are still on the right tab.
assertTrue("Metrics tab is active", ejtt.tabMenu.isTabActive("Metrics") );
- assertTrue("Page contains WAR name", client.getPageAsText().contains(BASIC_WAR) );
+ assertTrue("Page contains WAR name", client.getPageAsText().contains(DEPLOYABLE_NAME) );
assertTrue("Page contains 'Refresh'", client.getPageAsText().contains("Refresh") );
}
finally {
- undeployWAR(BASIC_WAR);
+ undeployWAR(DEPLOYABLE_NAME);
}
}
@@ -664,14 +775,24 @@
* Should we wait more? Or is it caused by failures of some previous tests?
*
*/
- public void testDeployUnpackedWar() throws IOException, EmbJoprTestException {
+ public void XtestDeployUnpackedWar() throws IOException, EmbJoprTestException {
// Deploy the unpacked WAR.
// We have to use hotdeploy - can't upload a directory.
- log.info("Unzipping war/"+WAR_UNPACKED_ZIP);
- ejtt.deployment.unzipToDeployDir("war/"+WAR_UNPACKED_ZIP, "");
+ //ejtt.deployment.unzipToDeployDir("war/"+WAR_UNPACKED_ZIP, "");
+ String archivePath = ejtt.getTestDataDir()+"/war/"+WAR_UNPACKED_ZIP;
+ String tempDir = ejtt.getTempDir();
+ String destDir = ejtt.getDeployDir();
+ log.info("Unzipping "+archivePath+" to "+tempDir);
+ ejtt.deployment.unzipArchive( archivePath, tempDir );
+
+ log.info("Moving "+tempDir+"/"+WAR_UNPACKED+" to "+destDir+"/"+WAR_UNPACKED);
+ ejtt.deployment.moveDir(tempDir+"/"+WAR_UNPACKED, destDir+"/"+WAR_UNPACKED);
+
+
+
try {
// Loop, wait for the app to appear.
log.info("Waiting for WAR to appear.");
@@ -700,13 +821,184 @@
+ public void testStopAndStartWar() throws IOException, EmbJoprTestException
+ {
+ final String DEPLOYABLE_NAME = BASIC_WAR_STOPSTART;
+ // Get the HTTP port and the URL of the test page.
+ HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+ int port = tmpRequest.getLocalPort();
+ String context = StringUtils.chomp( DEPLOYABLE_NAME, ".war" ); // Eventually remove ".war" suffix.
+ String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
+ // Create web client we will use to check the web app.
+ WebClient webClient = new WebClient();
+ // We'll get 404 after stopping the app.
+ webClient.setThrowExceptionOnFailingStatusCode(false);
+ HtmlPage page;
+ // Deploy the WAR.
+ String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+ deployWarRepeatedly( WARFilePath );
+ try {
+ // Wait until app is UP
+ ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
+ DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+ // Assert that the app is running.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
+ assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
+
+ // Refresh the page several times to increase the counter.
+ page.refresh();
+ page.refresh();
+
+ // Get the counter number.
+ Integer count1 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+
+
+ // 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();
+
+ // Check the latest message.
+ /*
+ HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().getElement();
+ HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tr[contains(@class, 'rich-table-firstrow')]");
+ assertTrue( tr.getTextContent().contains("Success") );
+ /**/
+ assertTrue( ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().wasLastOperationSuccesful() );
+
+
+ // Assert that the app is stopped.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assert( 200 != page.getWebResponse().getStatusCode() );
+
+
+ // Click the Start button.
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start").click();
+
+ // Check the latest message. TODO: EJTT class for ops history table?
+ HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().getElement();
+ HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tr[contains(@class, 'rich-table-firstrow')]");
+ assertTrue( tr.getTextContent().contains("Success") );
+
+
+ // Assert that the app is running.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assert( 200 == page.getWebResponse().getStatusCode() );
+ assertTrue(page.asText().contains("HELLO WORLD"));
+
+ // Get the counter number.
+ Integer count2 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+ assertTrue( "Counter is reset upon app restart, thus should be lower after.", count1 > count2 );
+
+
+ }
+ finally {
+ undeployWAR(DEPLOYABLE_NAME);
+ }
+ }
+
+
/**
+ * Restarts the WAR in Control tab and checks whether it was really restarted.
+ */
+ public void testRestartWar() throws IOException, EmbJoprTestException
+ {
+ final String DEPLOYABLE_NAME = BASIC_WAR_RESTART;
+
+ // Get the HTTP port and the URL of the test page.
+ HttpServletRequest tmpRequest = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
+ int port = tmpRequest.getLocalPort();
+ String context = StringUtils.chomp( DEPLOYABLE_NAME, ".war" ); // Eventually remove ".war" suffix.
+ String testPageUrl = "http://localhost:"+port+"/"+context+"/hello.jsp";
+
+ // Create web client we will use to check the web app.
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(false);
+ HtmlPage page;
+
+
+ // Deploy the WAR.
+ String WARFilePath = ejtt.getTestDataDir() + "/war/"+DEPLOYABLE_NAME;
+ deployWarRepeatedly( WARFilePath );
+
+ try {
+
+ // Wait until app is UP
+ ejtt.getNavTree().getNodeByLabel(NAV_WAR).click();
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.WAR, DEPLOYABLE_NAME,
+ DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL, DEPLOY_UP_STATE_WAIT_CHECK_RETRIES, this);
+
+ // Assert that the app is running.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assertEquals( "HTTP status of "+testPageUrl+" should be 200", 200, page.getWebResponse().getStatusCode() );
+ assertTrue("Page should contain 'HELLO WORLD'", page.asText().contains("HELLO WORLD"));
+
+ // Refresh the page several times to increase the counter.
+ page.refresh();
+ page.refresh();
+
+ // Get the counter number.
+ Integer count1 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+
+
+ // 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 Restart button.
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Restart").click();
+
+ // Check the latest message. TODO: EJTT class for ops history table?
+ HtmlTable operationHistoryTable = ejtt.getTabMenu().getTabContentBox().getOperationHistoryTable().getElement();
+ HtmlTableRow tr = operationHistoryTable.getFirstByXPath("tr[contains(@class, 'rich-table-firstrow')]");
+ assertTrue( tr.getTextContent().contains("Success") );
+
+
+ // Assert that the app is running.
+ page = (HtmlPage)webClient.getPage(testPageUrl);
+ assert( 200 == page.getWebResponse().getStatusCode() );
+ assertTrue(page.asText().contains("HELLO WORLD"));
+
+ // Get the counter number.
+ Integer count2 = NumberUtils.createInteger(page.getBody().getHtmlElementById("count").getTextContent());
+
+ assertTrue( "Counter is reset upon app restart, thus should be lower after.", count1 > count2 );
+
+ }
+ finally {
+ undeployWAR(DEPLOYABLE_NAME);
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /**
* Deploys WAR.
*/
private void deployWAR( String warFilePath )
@@ -747,10 +1039,13 @@
throws IOException, HtmlElementNotFoundException, EmbJoprTestException
{
+ File warFile = new File(warFilePath);
+ final String warFileName = warFile.getName();
+
try {
// Try it 5x in 5 second interval.
- new ActiveConditionChecker( new DescribedCondition("WAR '"+warFilePath+"' succesfuly deployed") {
+ new ActiveConditionChecker( new DescribedCondition("WAR '"+warFileName+"' succesfuly deployed") {
public boolean isTrue() throws Exception {
deployWAR(warFilePath);
@@ -772,9 +1067,8 @@
*/
// Check whether the WAR is listed in EmbJopr.
- File file = new File(warFilePath);
- log.debug("Looking for listed WAR: "+file.getName());
- boolean listed = ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, file.getName(), isJBoss4);
+ log.debug("Looking for listed WAR: "+warFileName);
+ boolean listed = ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, warFileName, isJBoss4);
if( listed )
return true;
else
@@ -784,7 +1078,7 @@
}
catch( Exception ex ){
- throw new EmbJoprTestException(ex.getMessage(), ex);
+ throw new EmbJoprTestException(ex.getClass().getName()+": "+ex.getMessage(), ex);
}
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-04-02 15:55:55 UTC (rev 271)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-04-02 19:20:48 UTC (rev 272)
@@ -93,6 +93,10 @@
return System.getProperty(AppConstants.SYSPROP_TESTDATA_DIR);
}
+ public String getTempDir() {
+ return System.getProperty(AppConstants.SYSPROP_TESTDATA_DIR);
+ }
+
public String getDeployDir() {
return System.getProperty(AppConstants.SYSPROP_DEPLOY_DIR);
}
@@ -624,6 +628,15 @@
return new ContentTable();
}
+ /**
+ * Returns the operation history table from the Content tab.
+ */
+ public OperationsHistoryTable getOperationHistoryTable() throws HtmlElementNotFoundException
+ {
+ //HtmlTable table = (HtmlTable) client.getElement("operationHistoryForm:dataTable");
+ //return new OperationsHistoryTable(table);
+ return new OperationsHistoryTable();
+ }
/**
@@ -715,7 +728,7 @@
public static final String ID_CATEGORY_DATA_TABLE = "categorySummaryForm:dataTable";
public static final String ID_RESOURCE_DATA_TABLE = "resourceSummaryForm:dataTable";
- private HtmlTable element;
+ protected HtmlTable element;
public HtmlTable getElement() { return element; }
/**
@@ -971,6 +984,45 @@
+ public class OperationsHistoryTable extends ContentTable {
+
+ public OperationsHistoryTable() throws HtmlElementNotFoundException {
+
+ // Find the ops history table.
+ String elemID = "operationHistoryForm:dataTable";
+ Element elem = client.getElement(elemID);
+ if( null == elem ){
+ throw new HtmlElementNotFoundException(
+ "Can't find the ops history table element, searched ID: " + elemID);
+ }
+
+ this.element = (HtmlTable)elem;
+ }
+
+ public OperationsHistoryTable(HtmlTable element) {
+ super(element);
+ }
+
+
+ public boolean wasLastOperationSuccesful() throws HtmlElementNotFoundException
+ {
+ if( 0 == this.getRows().size() )
+ throw new HtmlElementNotFoundException(
+ "Operation table has no rows (no operations are listed).");
+
+ String xPath = "tr[contains(@class, 'rich-table-firstrow')]";
+ HtmlTableRow tr = this.element.getFirstByXPath(xPath);
+ if( null == tr ){
+ throw new HtmlElementNotFoundException(
+ "Operation status row not recognized; used XPath: "+xPath);
+ }
+ return tr.getTextContent().contains("Success");
+ }
+
+
+ }
+
+
/**
* Row of a content table.
* Contains convenience methods for accessing content table rows in EmbJopr.
@@ -1422,10 +1474,10 @@
- /** Convenience method, setting mustBeUP to true. */
+ /** Convenience method, setting mustBeUP to false. */
public boolean isDeployedAccordingToEmbJopr( DeployableTypes type, String deployableName )
throws HtmlElementNotFoundException, IOException, ActionNotAvailableException{
- return isDeployedAccordingToEmbJopr( type, deployableName, true );
+ return isDeployedAccordingToEmbJopr( type, deployableName, false );
}
/**
@@ -1527,7 +1579,7 @@
selfEjtt.refreshPage();
}
// If found, return true.
- return isDeployedAccordingToEmbJopr(type, name);
+ return isDeployedAccordingToEmbJopr(type, name, true);
// If found, return true.
}
}).throwOnTimeout();
@@ -1587,7 +1639,7 @@
throws FileNotFoundException, IOException
{
- String destDir = getTestDataDir()+"/"+relativeDestDir;
+ String destDir = getDeployDir()+"/"+relativeDestDir;
String archivePath = getTestDataDir()+"/"+relativeArchivePath;
log.info("Unzipping '"+archivePath+"' to '"+destDir+"'.");
@@ -1640,10 +1692,19 @@
}
+ public void moveDir( String from, String to )
+ {
+ File dirFrom = new File(from);
+ File dirTo = new File(to);
+ dirFrom.renameTo(dirTo);
+ }
- public void deleteFromDeployDir( String deployableName ) throws IOException, EmbJoprTestException{
+
+ public void deleteFromDeployDir( String deployableName ) throws IOException, EmbJoprTestException
+ {
+
String deployDir = getDeployDir();
File dirToDelete = new File( deployDir, deployableName);
Added: trunk/jsfunit/testdata/war/hellothere-DUD.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere-DUD.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere-DUD_RETRY.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere-DUD_RETRY.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere-RESTART.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere-RESTART.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere-STOP_START.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere-STOP_START.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere02.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere02.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere03.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere03.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere04.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere04.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere05.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere05.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere06.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere06.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere07.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere07.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere08.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere08.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jsfunit/testdata/war/hellothere09.war
===================================================================
(Binary files differ)
Property changes on: trunk/jsfunit/testdata/war/hellothere09.war
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 9 months
EMBJOPR SVN: r269 - trunk/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-02 06:51:10 -0400 (Thu, 02 Apr 2009)
New Revision: 269
Modified:
trunk/jsfunit/pom.xml
Log:
POM: Added tmp dir property; Surefire includes set back to original
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-04-01 15:34:01 UTC (rev 268)
+++ trunk/jsfunit/pom.xml 2009-04-02 10:51:10 UTC (rev 269)
@@ -169,6 +169,7 @@
<!-- snoops request and response from client side result is in server.log
<jsfunit.htmlunitsnooper>enabled</jsfunit.htmlunitsnooper> -->
<jsfunit.testdata>${basedir}/testdata</jsfunit.testdata>
+ <jsfunit.tempdir>${basedir}/target/jboss42x/tmp</jsfunit.tempdir>
<jsfunit.deploy.dir>${basedir}/target/jboss42x/deploy</jsfunit.deploy.dir>
</systemProperties>
</container>
@@ -284,6 +285,7 @@
<!-- Snoops request and response from client side. Result is in server.log
<jsfunit.htmlunitsnooper>enabled</jsfunit.htmlunitsnooper> -->
<jsfunit.testdata>${basedir}/testdata</jsfunit.testdata>
+ <jsfunit.tempdir>${basedir}/target/jboss5x/tmp</jsfunit.tempdir>
<jsfunit.deploy.dir>${basedir}/target/jboss5x/deploy</jsfunit.deploy.dir>
</systemProperties>
</container>
@@ -372,17 +374,10 @@
<configuration>
<skip>false</skip>
<includes>
- <!--
<include>**/as5/*Test.java</include>
<include>**/jsfunit/*Test.java</include>
-
- <include>**/as5/ApplicationsPageTest.java</include>
- <include>**/as5/EarTest.java</include>
- <include>**/JavaScriptTest.java</include>
- <include>**/as5/EarTest.java</include>
- <include>**/jsfunit/MultipleUserLoginTest.java</include>
+ <!--
-->
- <include>**/as5/WarTest.java</include>
</includes>
<excludes>
<exclude>**/as4/**</exclude>
15 years, 9 months
EMBJOPR SVN: r268 - trunk/jsfunit/testdata/jboss-configuration/conf.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-01 11:34:01 -0400 (Wed, 01 Apr 2009)
New Revision: 268
Modified:
trunk/jsfunit/testdata/jboss-configuration/conf/jboss-log4j.xml
Log:
Copying org.jboss.jopr.jsfunit.* output to .../log/embjopr.log
Modified: trunk/jsfunit/testdata/jboss-configuration/conf/jboss-log4j.xml
===================================================================
--- trunk/jsfunit/testdata/jboss-configuration/conf/jboss-log4j.xml 2009-04-01 14:51:03 UTC (rev 267)
+++ trunk/jsfunit/testdata/jboss-configuration/conf/jboss-log4j.xml 2009-04-01 15:34:01 UTC (rev 268)
@@ -16,6 +16,20 @@
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+ <appender name="EmbJopr" class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="File" value="${jboss.server.log.dir}/embjopr.log"/>
+ <param name="Append" value="false"/>
+ <param name="Threshold" value="ALL"/>
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] (Thread) Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n"/>
+ </layout>
+ </appender>
+
+
+
<!-- ================================= -->
<!-- Preserve messages in a local file -->
<!-- ================================= -->
@@ -210,6 +224,7 @@
<!-- We care much about JOPR and JSFUnit tests. -->
<category name="org.jboss.jopr.jsfunit">
<priority value="DEBUG"/>
+ <appender-ref ref="EmbJopr"/>
</category>
<category name="org.jboss.on.embedded">
15 years, 9 months
EMBJOPR SVN: r267 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: util and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-01 10:51:03 -0400 (Wed, 01 Apr 2009)
New Revision: 267
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
War tests updated
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-03-31 18:34:17 UTC (rev 266)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-01 14:51:03 UTC (rev 267)
@@ -347,7 +347,7 @@
String path = ejtt.getDeployDir()+"/"+BASIC_WAR;
- assertEquals(path, props.getProperty("Path").trim());
+ assertEquals(path, props.getProperty("Path").trim()); // EMBJOPR-110 here
assertEquals("no", props.getProperty("Exploded?").trim());
// Metrics Summary
@@ -508,8 +508,12 @@
}
finally {
- DebugUtils.writeFile("target/redeployment.html", client.getPageAsText());///
- undeployWAR(BASIC_WAR);
+ try {
+ DebugUtils.writeFile("target/redeployment.html", client.getPageAsText());///
+ undeployWAR(BASIC_WAR); // EMBJOPR-109 here
+ }catch( Exception ex ){
+ log.error("Exception caught in finally: "+ex.getMessage(), ex);
+ }
}
}
@@ -583,6 +587,8 @@
ContentInfoTable infoTable = ejtt.getContentInfoTable( tbl );
Properties props = infoTable.getProperties();
+ log.debug("Trait Values: "+ props.toString());
+
String path = ejtt.getDeployDir()+"/"+BASIC_WAR;
assertEquals(path, props.getProperty("Path").trim());
@@ -743,10 +749,19 @@
try {
- // Try it 3x in 5 second interval.
+ // Try it 5x in 5 second interval.
new ActiveConditionChecker( new DescribedCondition("WAR '"+warFilePath+"' succesfuly deployed") {
public boolean isTrue() throws Exception {
deployWAR(warFilePath);
+
+ // Check whether deployment ended with success message.
+ /* Now broken, EmbJopr reports an error even when deployed successfully:
+ * Failed to create Resource hellothere.war - cause:
+ java.lang.RuntimeException:java.lang.NullPointerException
+ -> java.lang.NullPointerException:null
+ * See EMBJOPR-116
+ */
+ /*
if( server.getFacesMessages().hasNext() ){
FacesMessage msg = server.getFacesMessages().next();
if( msg.getSeverity() == FacesMessage.SEVERITY_INFO )
@@ -754,13 +769,22 @@
else
ejtt.logServerMessage("Deployment error: ");
}
- return false;
+ */
+
+ // Check whether the WAR is listed in EmbJopr.
+ File file = new File(warFilePath);
+ log.debug("Looking for listed WAR: "+file.getName());
+ boolean listed = ejtt.deployment.isDeployedAccordingToEmbJopr(DeployableTypes.WAR, file.getName(), isJBoss4);
+ if( listed )
+ return true;
+ else
+ return false;
}
- }).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(5000, 3);
+ }).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(5000, 8);
}
catch( Exception ex ){
- throw new EmbJoprTestException(ex.getMessage());
+ throw new EmbJoprTestException(ex.getMessage(), ex);
}
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-03-31 18:34:17 UTC (rev 266)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-04-01 14:51:03 UTC (rev 267)
@@ -1089,7 +1089,8 @@
/**
* Pagination control
- * Not much tested yet.
+ * @returns the pagination DIV, or null if the pagination is not displayed
+ * (DIV can exist, but contains no First, Prev, Next, Last etc.
*/
public class ContentBoxPagination {
@@ -1103,8 +1104,20 @@
/** Returns the HTML element of the bar with "First | Prev | 1 2 | Next Last" controls. */
public HtmlDivision getPageContols() throws HtmlElementNotFoundException {
//return (HtmlDivision) client.getElement(ID_PAGE_CONTROLS);
- return (HtmlDivision) getTabMenu().getTabContentBox().getElement()
+ HtmlDivision div = (HtmlDivision) getTabMenu().getTabContentBox().getElement()
.getFirstByXPath(".//*[contains(@id, 'SummaryForm:dataTableScroller')]");
+ if( null == div )
+ return null;
+
+ // When no pagination is needed, #dataTableScroller div contains only a script element.
+ // So if their number is the same, return null, which means
+ List allElems = div.getByXPath("*");
+ List scriptElems = div.getByXPath("script");
+ if( allElems.size() == scriptElems.size() )
+ return null;
+
+ // Else if it contains something besides script, return.
+ return div;
}
/** Returns the HTML Select element of page size selection. */
15 years, 9 months