EMBJOPR SVN: r328 - trunk/core/src/main/webapp/secure.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2009-04-23 17:00:19 -0400 (Thu, 23 Apr 2009)
New Revision: 328
Modified:
trunk/core/src/main/webapp/secure/resourceInstanceOperation.xhtml
Log:
fix cut-and-paste error on operations page that was causing error details for failed ops to not be displayed
Modified: trunk/core/src/main/webapp/secure/resourceInstanceOperation.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceInstanceOperation.xhtml 2009-04-23 20:08:03 UTC (rev 327)
+++ trunk/core/src/main/webapp/secure/resourceInstanceOperation.xhtml 2009-04-23 21:00:19 UTC (rev 328)
@@ -216,12 +216,12 @@
</h:panelGroup>
<!-- Error -->
- <h:panelGroup layout="block" rendered="#{operationHistory.status eq 'FAILURE'}">
+ <h:panelGroup layout="block" rendered="#{selectedHistory.status eq 'FAILURE'}">
<h3>#{messages['control.resourceInstance.previous.error']}</h3>
- <h:inputTextarea value="#{operationHistory.errorMessage}" readonly="true"
- rendered="#{operationHistory.errorMessage ne null}"
+ <h:inputTextarea value="#{selectedHistory.errorMessage}" readonly="true"
+ rendered="#{selectedHistory.errorMessage ne null}"
style="width: 100%;" rows="7"/>
- <h:panelGroup rendered="#{operationHistory.errorMessage eq null}">
+ <h:panelGroup layout="block" rendered="#{selectedHistory.errorMessage eq null}">
<i>The operation failed for an unknown reason.</i>
</h:panelGroup>
</h:panelGroup>
15 years, 8 months
EMBJOPR SVN: r327 - in trunk/core/src/main: webapp/WEB-INF/classes and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2009-04-23 16:08:03 -0400 (Thu, 23 Apr 2009)
New Revision: 327
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/ui/configuration/resource/ResourceConfigurationUIBean.java
trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
Log:
on config create/update pages, don't show plugin-generated property-specific errors at the top of the page, since they are already shown next to the corresponding properties (https://jira.jboss.org/jira/browse/EMBJOPR-162)
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/configuration/resource/ResourceConfigurationUIBean.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/configuration/resource/ResourceConfigurationUIBean.java 2009-04-23 19:46:16 UTC (rev 326)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/configuration/resource/ResourceConfigurationUIBean.java 2009-04-23 20:08:03 UTC (rev 327)
@@ -31,9 +31,10 @@
import org.jboss.on.embedded.ui.CommonActionUtil;
import org.rhq.core.gui.configuration.ConfigHelperUIBean;
import org.rhq.core.gui.util.IdChunkGeneratorUIBean;
-import org.rhq.core.gui.util.PropertyIdGeneratorUtility;
import org.rhq.core.clientapi.agent.inventory.CreateResourceResponse;
import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
+import org.jetbrains.annotations.NotNull;
+
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.In;
@@ -109,9 +110,7 @@
public void setTemplateConfiguration(Configuration template)
{
if (template != null)
- {
- setConfiguration(template);
- }
+ setConfiguration(template);
}
//Instance Variables used by this class but not bijected
@@ -175,9 +174,8 @@
}
}
- if (result == "success") {
+ if (result.equals("success"))
Conversation.instance().end(false);
- }
return result;
}
@@ -186,10 +184,10 @@
String result;
Configuration resourceConfig = getConfiguration();
- ConfigurationUpdateResponse updateResponse = configurationManager.updateResource(this.listItem.getResource(),
+ ConfigurationUpdateResponse pluginResponse = configurationManager.updateResource(this.listItem.getResource(),
resourceConfig);
- switch (updateResponse.getStatus()) {
+ switch (pluginResponse.getStatus()) {
case SUCCESS:
{
facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO, "resource.status.update.success",
@@ -200,8 +198,8 @@
default:
{
String baseMessage = this.messages.getString("resource.status.update.failure");
- addActionFailureMessageToFacesMessages(baseMessage, updateResponse.getErrorMessage());
- addPropertyErrorsToFacesMessages(updateResponse.getConfiguration());
+ addActionFailureMessageToFacesMessages(baseMessage, pluginResponse.getErrorMessage(),
+ pluginResponse.getConfiguration());
result = Constants.OUTCOME_FAILURE;
}
}
@@ -223,9 +221,9 @@
pluginConfig = configDef.getDefaultTemplate().getConfiguration();
}
}
- CreateResourceResponse response = configurationManager.createResource("newResource", serviceType,
+ CreateResourceResponse pluginResponse = configurationManager.createResource("newResource", serviceType,
ancestorResource, pluginConfig, resourceConfig);
- switch (response.getStatus())
+ switch (pluginResponse.getStatus())
{
case SUCCESS:
{
@@ -237,8 +235,8 @@
default:
{
String baseMessage = this.messages.getString("resource.status.create.failure");
- addActionFailureMessageToFacesMessages(baseMessage, response.getErrorMessage());
- addPropertyErrorsToFacesMessages(response.getResourceConfiguration());
+ addActionFailureMessageToFacesMessages(baseMessage, pluginResponse.getErrorMessage(),
+ pluginResponse.getResourceConfiguration());
result = Constants.OUTCOME_FAILURE;
break;
}
@@ -268,36 +266,36 @@
return configHelperUIBean;
}
- private void addActionFailureMessageToFacesMessages(String baseMessage, String errorDetails)
+ private void addActionFailureMessageToFacesMessages(@NotNull String baseMessage, String errorDetails,
+ Configuration resourceConfiguration)
{
- if (baseMessage != null && !baseMessage.trim().equals(""))
- {
- if (errorDetails == null || errorDetails.trim().equals(""))
+ if (errorDetails == null || errorDetails.trim().equals("")) {
+ if (containsPropertyErrors(resourceConfiguration))
errorDetails = this.messages.getString("resource.status.invalidProps");
- // TODO When this is internationalized, the method call "add" will change to addFromResourceBundle
- this.facesMessages.add(new FacesMessage(FacesMessage.SEVERITY_ERROR, baseMessage + " " + errorDetails, null));
+ else
+ errorDetails = this.messages.getString("resource.status.failedForUnknownReason");
}
+ // TODO When this is internationalized, the method call "add" will change to addFromResourceBundle
+ this.facesMessages.add(new FacesMessage(FacesMessage.SEVERITY_ERROR, baseMessage + " " + errorDetails, null));
}
- private void addPropertyErrorsToFacesMessages(Configuration configuration)
+ private static boolean containsPropertyErrors(Configuration configuration)
{
if (configuration == null)
- return;
- // TODO: This only handles top-level simples. What about simples within lists and maps?
+ return false;
+ // TODO: This only handles top-level simples. It should recurse into lists and maps.
Map<String, PropertySimple> properties = configuration.getSimpleProperties();
- Set<String> keys = properties.keySet();
- for (String key : keys)
+ Set<String> propNames = properties.keySet();
+ for (String propName : propNames)
{
- PropertySimple property = properties.get(key);
+ PropertySimple property = properties.get(propName);
if (property != null)
{
String error = property.getErrorMessage();
if (error != null && !error.equals(""))
- {
- // TODO When this is internationalized, the method call "addToControl" will change to addToControlFromResourceBundle
- this.facesMessages.addToControl(PropertyIdGeneratorUtility.getIdentifier(property, null), FacesMessage.SEVERITY_ERROR, error);
- }
+ return true;
}
}
+ return false;
}
}
Modified: trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
===================================================================
--- trunk/core/src/main/webapp/WEB-INF/classes/messages.properties 2009-04-23 19:46:16 UTC (rev 326)
+++ trunk/core/src/main/webapp/WEB-INF/classes/messages.properties 2009-04-23 20:08:03 UTC (rev 327)
@@ -56,6 +56,7 @@
resource.status.remove.failure=Failed to delete {0} '{1}' - {2}
resource.status.remove.success=Successfully deleted {0} '{1}'.
resource.status.invalidProps=One or more property values was invalid - see below for details.
+resource.status.failedForUnknownReason=Failed for unknown reason.
resource.edit.title=Edit Resource
15 years, 8 months
EMBJOPR SVN: r326 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-23 15:46:16 -0400 (Thu, 23 Apr 2009)
New Revision: 326
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java
Log:
JBoss AS node test fixed
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java 2009-04-23 18:52:45 UTC (rev 325)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java 2009-04-23 19:46:16 UTC (rev 326)
@@ -114,9 +114,9 @@
log.info( headerText +" 1st: "+ metricsProps.toString() );
// Active Thread Count
- int threads1 = NumberUtils.toInt(metricsProps.getProperty("Active Thread Count").replace(',', '.'));
- double memFree1 = NumberUtils.toDouble(metricsProps.getProperty("JVM Free Memory").replace(',', '.'));
- double memTotal1 = NumberUtils.toDouble(metricsProps.getProperty("JVM Total Memory").replace(',', '.'));
+ int threads1 = (int)NumberUtils.toDouble(metricsProps.getProperty("Active Thread Count").replace(',', '.'));
+ double memFree1 = NumberUtils.toDouble(metricsProps.getProperty("JVM Free Memory").replace(',', '.').replace("MB", ""));
+ double memTotal1 = NumberUtils.toDouble(metricsProps.getProperty("JVM Total Memory").replace(',', '.').replace("MB", ""));
// Do some requests to add threads.
@@ -147,9 +147,11 @@
log.info( headerText +" 2nd: "+ metricsProps.toString() );
// Active Thread Count
- int threads2 = NumberUtils.toInt( metricsProps.getProperty("Active Thread Count").replace(',', '.') );
- double memFree2 = NumberUtils.toDouble(metricsProps.getProperty("JVM Free Memory").replace(',', '.') );
- double memTotal2 = NumberUtils.toDouble(metricsProps.getProperty("JVM Total Memory").replace(',', '.') );
+ int threads2 = (int)NumberUtils.toDouble( metricsProps.getProperty("Active Thread Count").replace(',', '.') );
+ //log.info( "DEBUG - memFree2: "+ metricsProps.getProperty("JVM Free Memory").replace(',', '.') );///
+ double memFree2 = NumberUtils.toDouble(metricsProps.getProperty("JVM Free Memory").replace(',', '.').replace("MB", "") );
+ //log.info( "DEBUG - memFree2: "+ metricsProps.getProperty("JVM Total Memory").replace(',', '.') );///
+ double memTotal2 = NumberUtils.toDouble(metricsProps.getProperty("JVM Total Memory").replace(',', '.').replace("MB", "") );
log.info( "Value | old | new ");
log.info( String.format("Threads: %d, %d", threads1, threads2) );
15 years, 8 months
EMBJOPR SVN: r325 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-23 14:52:45 -0400 (Thu, 23 Apr 2009)
New Revision: 325
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
Log:
ResourceTestBase.java#performResourceOperation(): operation_form changed to operationsForm
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java 2009-04-23 17:53:14 UTC (rev 324)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java 2009-04-23 18:52:45 UTC (rev 325)
@@ -264,7 +264,7 @@
navigateToPage(resourceCategory, resourceSubCategory,
resourceName, CONTROL_TAB);
- HtmlForm form = (HtmlForm)client.getElement("operation_form");
+ HtmlForm form = (HtmlForm)client.getElement("operationsForm");
String xpath = ".//input[@value=\"" + operationName + "\"]";
HtmlButtonInput operationButton = (HtmlButtonInput)form.getFirstByXPath(xpath);
15 years, 8 months
EMBJOPR SVN: r324 - trunk/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-23 13:53:14 -0400 (Thu, 23 Apr 2009)
New Revision: 324
Modified:
trunk/jsfunit/pom.xml
Log:
JSFUnit POM: added jsfunit.jboss.home.dir property to Cargo
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-04-23 17:46:05 UTC (rev 323)
+++ trunk/jsfunit/pom.xml 2009-04-23 17:53:14 UTC (rev 324)
@@ -166,11 +166,14 @@
<log>${basedir}/target/jboss4.2.logs/cargo.log</log>
<timeout>300000</timeout> <!-- 5 minutes -->
<systemProperties>
+ <jboss.server.log.threshold>ALL</jboss.server.log.threshold>
<!-- 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>
+ <jboss.configuration>${cargo.jboss.configuration}</jboss.configuration>
+ <jsfunit.jboss.home.dir>${basedir}/target/jboss42x</jsfunit.jboss.home.dir>
</systemProperties>
</container>
@@ -310,7 +313,7 @@
<wait>false</wait>
<container>
<containerId>jboss5x</containerId>
- <home>${JBOSS_HOME}</home>
+ <home>${JBOSS_HOME}</home> <!-- Binaries used by Cargo. -->
<log>${basedir}/target/jboss5.x.logs/cargo.log</log>
<timeout>300000</timeout> <!-- 5 minutes -->
<systemProperties>
@@ -322,6 +325,8 @@
<jsfunit.tempdir>${basedir}/target/jboss5x/tmp</jsfunit.tempdir>
<jsfunit.deploy.dir>${basedir}/target/jboss5x/deploy</jsfunit.deploy.dir>
<jboss.configuration>${cargo.jboss.configuration}</jboss.configuration>
+ <!-- Home dir for Cargo's JBoss instance. -->
+ <jsfunit.jboss.home.dir>${basedir}/target/jboss5x</jsfunit.jboss.home.dir>
</systemProperties>
</container>
15 years, 8 months
EMBJOPR SVN: r323 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-23 13:46:05 -0400 (Thu, 23 Apr 2009)
New Revision: 323
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java
Log:
JBossASNodeTest updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java 2009-04-23 16:35:49 UTC (rev 322)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java 2009-04-23 17:46:05 UTC (rev 323)
@@ -12,6 +12,7 @@
import java.util.Properties;
import javax.management.JMException;
import org.apache.commons.lang.math.NumberUtils;
+import org.jboss.jopr.jsfunit.DebugUtils;
import org.jboss.jopr.jsfunit.EmbjoprTestCase;
import org.jboss.jopr.jsfunit.JMXUtils;
import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
@@ -26,11 +27,17 @@
public void testASNodeMetricsTab() throws EmbJoprTestException, IOException, JMException {
+ String jbossConfig = ejtt.getJBossConfig();
+
+ // Go to the AS node.
+ String nodeText = "JBoss AS 5 ("+jbossConfig+")";
+ ejtt.getNavTree().getNodeByLabel(nodeText, true).click();
+
+
// JBoss App Server:${config} node
String pageText = client.getPageAsText();
// Whole page contains
- String jbossConfig = ejtt.getJBossConfig();
String pageHeaderText = "JBoss AS 5 ("+jbossConfig+")";
//assertTrue("Page doesn't contain the header: "+headerText, pageText.contains(headerText));
assertTrue("Content doesn't contain the header: "+pageHeaderText,
@@ -85,7 +92,8 @@
properties.getProperty("Server Name"));
assertEquals("Resource Traits / Server Home Dir",
- String.format("%s/server/%s", ejtt.getJBossHomeDir(), ejtt.getJBossConfig()),
+ //String.format("%s/server/%s", ejtt.getJBossHomeDir(), ejtt.getJBossConfig()),
+ ejtt.getJBossHomeDir(),
properties.getProperty("Server Home Dir"));
@@ -106,9 +114,9 @@
log.info( headerText +" 1st: "+ metricsProps.toString() );
// Active Thread Count
- int threads1 = NumberUtils.toInt(metricsProps.getProperty("Active Thread Count"));
- double memFree1 = NumberUtils.toDouble(metricsProps.getProperty("JVM Free Memory"));
- double memTotal1 = NumberUtils.toDouble(metricsProps.getProperty("JVM Total Memory"));
+ int threads1 = NumberUtils.toInt(metricsProps.getProperty("Active Thread Count").replace(',', '.'));
+ double memFree1 = NumberUtils.toDouble(metricsProps.getProperty("JVM Free Memory").replace(',', '.'));
+ double memTotal1 = NumberUtils.toDouble(metricsProps.getProperty("JVM Total Memory").replace(',', '.'));
// Do some requests to add threads.
@@ -139,9 +147,9 @@
log.info( headerText +" 2nd: "+ metricsProps.toString() );
// Active Thread Count
- int threads2 = NumberUtils.toInt(metricsProps.getProperty("Active Thread Count"));
- double memFree2 = NumberUtils.toDouble(metricsProps.getProperty("JVM Free Memory"));
- double memTotal2 = NumberUtils.toDouble(metricsProps.getProperty("JVM Total Memory"));
+ int threads2 = NumberUtils.toInt( metricsProps.getProperty("Active Thread Count").replace(',', '.') );
+ double memFree2 = NumberUtils.toDouble(metricsProps.getProperty("JVM Free Memory").replace(',', '.') );
+ double memTotal2 = NumberUtils.toDouble(metricsProps.getProperty("JVM Total Memory").replace(',', '.') );
log.info( "Value | old | new ");
log.info( String.format("Threads: %d, %d", threads1, threads2) );
15 years, 8 months
EMBJOPR SVN: r322 - 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-23 12:35:49 -0400 (Thu, 23 Apr 2009)
New Revision: 322
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java
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/EmbJoprTestToolkit.java
Log:
EAR and WAR tests updated - ConfigurationTab tests enabled
Added JBossASNodeTest.java
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-23 14:17:52 UTC (rev 321)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java 2009-04-23 16:35:49 UTC (rev 322)
@@ -28,6 +28,7 @@
public static final String SYSPROP_TESTDATA_DIR = "jsfunit.testdata";
public static final String SYSPROP_TEMP_DIR = "jsfunit.tempdir";
public static String SYSPROP_JBOSS_CONFIG = "jboss.configuration";
+ public static String SYSPROP_CARGO_JBOSS_HOME_DIR = "jsfunit.jboss.home.dir";
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-23 14:17:52 UTC (rev 321)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-04-23 16:35:49 UTC (rev 322)
@@ -22,6 +22,7 @@
package org.jboss.jopr.jsfunit.as5;
+import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebClient;
import org.jboss.jopr.jsfunit.util.DescribedCondition;
import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
@@ -396,7 +397,7 @@
* Changes EAR configuration, and checks whether the changes were saved.
*
*/
- public void DISABLEDtestEarConfigurationTab() throws IOException, EmbJoprTestException {
+ public void testEarConfigurationTab() throws IOException, EmbJoprTestException {
// Deploy the EAR.
String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
@@ -410,7 +411,11 @@
// Navigate to the Configuration tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
earRow.getLinkByLabel(BASIC_EAR).click();
+
+ Page prevPage = client.getContentPage();
ejtt.tabMenu.clickConfigurationTab();
+ assertNotSame("We should move to other page after clicking the Config tab.",
+ prevPage, client.getContentPage());
// Read properties.
Properties props = new Properties();
@@ -452,7 +457,7 @@
* Changes EAR configuration, and verifies that the changes were NOT saved.
*
*/
- public void DISABLEDtestEarConfigurationTabCancel() throws IOException, EmbJoprTestException {
+ public void testEarConfigurationTabCancel() throws IOException, EmbJoprTestException {
// Deploy the EAR.
String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
@@ -466,7 +471,11 @@
// Navigate to the Configuration tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
earRow.getLinkByLabel(BASIC_EAR).click();
+
+ Page prevPage = client.getContentPage();
ejtt.tabMenu.clickConfigurationTab();
+ assertNotSame("We should move to other page after clicking the Config tab.",
+ prevPage, client.getContentPage());
// Load properties (we will use their names).
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JBossASNodeTest.java 2009-04-23 16:35:49 UTC (rev 322)
@@ -0,0 +1,162 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jboss.jopr.jsfunit.as5;
+
+import com.gargoylesoftware.htmlunit.BrowserVersion;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import java.io.IOException;
+import java.util.Properties;
+import javax.management.JMException;
+import org.apache.commons.lang.math.NumberUtils;
+import org.jboss.jopr.jsfunit.EmbjoprTestCase;
+import org.jboss.jopr.jsfunit.JMXUtils;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.ContentInfoTable;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.ContentTable;
+
+/**
+ *
+ * @author ondra
+ */
+public class JBossASNodeTest extends EmbjoprTestCase {
+
+ public void testASNodeMetricsTab() throws EmbJoprTestException, IOException, JMException {
+
+ // JBoss App Server:${config} node
+ String pageText = client.getPageAsText();
+
+ // Whole page contains
+ String jbossConfig = ejtt.getJBossConfig();
+ String pageHeaderText = "JBoss AS 5 ("+jbossConfig+")";
+ //assertTrue("Page doesn't contain the header: "+headerText, pageText.contains(headerText));
+ assertTrue("Content doesn't contain the header: "+pageHeaderText,
+ client.getElement("content").getTextContent().contains(pageHeaderText));
+
+ ContentTable table;
+ ContentInfoTable infoTable;
+ String headerText;
+ Properties properties;
+
+ JMXUtils jmxUtils = JMXUtils.getInstanceForLocalJBoss();
+
+
+ /*
+ * General Properties
+ Name:JBoss AS 5 (default)
+ Version:5.1.0.CR1
+ Description:JBoss Application Server
+ */
+ headerText = "General Properties";
+ assertTrue("Page doesn't contain the header: "+headerText, pageText.contains(headerText));
+ table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(headerText);
+ infoTable = ejtt.getContentInfoTable(table.getElement());
+ properties = infoTable.getProperties();
+
+ assertEquals("General Properties / Name", pageHeaderText, properties.getProperty("Name") );
+
+ String versionPrefix = "5.1";
+ String jmxMBeanName = "jboss.system:type=Server";
+ versionPrefix = (String) jmxUtils.getMBeanAttribute(jmxMBeanName, "VersionNumber");
+
+ assertTrue("General Properties / Version startsWith('"+versionPrefix+"')",
+ properties.getProperty("Version","~not found~").startsWith(versionPrefix) );
+ assertEquals("General Properties / Description", "JBoss Application Server", properties.get("Description") );
+
+
+ /*
+ * Resource Traits
+ Server Name: default
+ Server Home Dir: /home/brq/ozizka/.../jboss-as-5.x/build/output/jboss-5.1.0.CR1/server/default
+ Version Name: The Oracle
+ Build Date: April 22 2009
+ Start Date: Wed Apr 22 18:26:43 CEST 2009
+ */
+ headerText = "Resource Traits";
+ assertTrue("Page doesn't contain the header: "+headerText, pageText.contains(headerText));
+ table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(headerText);
+ infoTable = ejtt.getContentInfoTable(table.getElement());
+ properties = infoTable.getProperties();
+
+ assertEquals("Resource Traits / Server Name", ejtt.getJBossConfig(),
+ properties.getProperty("Server Name"));
+
+ assertEquals("Resource Traits / Server Home Dir",
+ String.format("%s/server/%s", ejtt.getJBossHomeDir(), ejtt.getJBossConfig()),
+ properties.getProperty("Server Home Dir"));
+
+
+ /*
+ * Metrics Summary
+ Name Value Description
+ Active Thread Count 7.0 The current number of active threads for this app server instance
+ JVM Free Memory 183.6MB The amount of free memory for the JVM this app server instance is running on
+ JVM Total Memory 218.7MB The amount of total memory for the JVM this app server instance is running on
+ */
+ headerText = "Metrics Summary";
+ assertTrue("Page doesn't contain the header: "+headerText, pageText.contains(headerText));
+ table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(headerText);
+
+ // Get values as properties.
+ table.analyzeColumns();
+ Properties metricsProps = table.getProperties("Name", "Value");
+ log.info( headerText +" 1st: "+ metricsProps.toString() );
+
+ // Active Thread Count
+ int threads1 = NumberUtils.toInt(metricsProps.getProperty("Active Thread Count"));
+ double memFree1 = NumberUtils.toDouble(metricsProps.getProperty("JVM Free Memory"));
+ double memTotal1 = NumberUtils.toDouble(metricsProps.getProperty("JVM Total Memory"));
+
+
+ // Do some requests to add threads.
+
+ // Create HTMLUnit WebClient.
+ WebClient wc = new WebClient(BrowserVersion.FIREFOX_3);
+ wc.setCssEnabled(false);
+ wc.setJavaScriptEnabled(false);
+ // Get some page.
+ wc.getPage("http://localhost:8080/");
+
+ // Allocate some memory to decrease free mem.
+ byte tmp[] = new byte[5 * 1024 * 1024]; // Few MB.
+
+
+
+ // Refresh the page
+ ((HtmlPage)client.getContentPage()).refresh();
+
+ // Read new values.
+ headerText = "Metrics Summary";
+ assertTrue("Page doesn't contain the header: "+headerText, pageText.contains(headerText));
+ table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(headerText);
+
+ // Get values as properties.
+ table.analyzeColumns();
+ metricsProps = table.getProperties("Name", "Value");
+ log.info( headerText +" 2nd: "+ metricsProps.toString() );
+
+ // Active Thread Count
+ int threads2 = NumberUtils.toInt(metricsProps.getProperty("Active Thread Count"));
+ double memFree2 = NumberUtils.toDouble(metricsProps.getProperty("JVM Free Memory"));
+ double memTotal2 = NumberUtils.toDouble(metricsProps.getProperty("JVM Total Memory"));
+
+ log.info( "Value | old | new ");
+ log.info( String.format("Threads: %d, %d", threads1, threads2) );
+ log.info( String.format("Mem free: %f, %f", memFree1, memFree2) );
+ log.info( String.format("Mem total: %f, %f", memTotal1, memTotal2) );
+
+ assertTrue("New thread count should be >= old. Is: "+threads1 +","+ threads2, threads1 > threads2);
+ assertTrue("New free mem should be <= old. Is: "+memFree1 +","+ memFree2, memFree1 < memFree2);
+ assertTrue("New total mem should be = old. Is: "+memTotal1 +","+ memTotal2, memTotal1 == memTotal2);
+
+ }
+
+
+}// class
+
+
+
+
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-23 14:17:52 UTC (rev 321)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-23 16:35:49 UTC (rev 322)
@@ -22,6 +22,7 @@
package org.jboss.jopr.jsfunit.as5;
+import com.gargoylesoftware.htmlunit.Page;
import javax.faces.application.FacesMessage.Severity;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
@@ -389,7 +390,7 @@
* Changes WAR configuration, and checks whether the changes were saved.
*
*/
- public void DISABLEDtestWarConfigurationTab() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
+ public void testWarConfigurationTab() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
final String DEPLOYABLE_NAME = BASIC_WAR_04;
@@ -405,9 +406,11 @@
// Navigate to the Configuration tab
ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
- DebugUtils.writeFile("target/A1.html", client.getPageAsText());
+
+ Page prevPage = client.getContentPage();
ejtt.tabMenu.clickConfigurationTab();
- DebugUtils.writeFile("target/A2.html", client.getPageAsText());
+ assertNotSame("We should move to other page after clicking the Config tab.",
+ prevPage, client.getContentPage());
// Read properties.
Properties props = new Properties();
@@ -448,7 +451,7 @@
*
* FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void DISABLEDtestWarConfigurationTabCancel() throws IOException, EmbJoprTestException {
+ public void testWarConfigurationTabCancel() throws IOException, EmbJoprTestException {
final String DEPLOYABLE_NAME = BASIC_WAR_05;
@@ -465,7 +468,11 @@
// Navigate to the Configuration tab
ContentTableRow row = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
row.getLinkByLabel(DEPLOYABLE_NAME).click();
+
+ Page prevPage = client.getContentPage();
ejtt.tabMenu.clickConfigurationTab();
+ assertNotSame("We should move to other page after clicking the Config tab.",
+ prevPage, client.getContentPage());
// Load properties (we will use their names).
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-23 14:17:52 UTC (rev 321)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-04-23 16:35:49 UTC (rev 322)
@@ -107,6 +107,10 @@
return System.getProperty(AppConstants.SYSPROP_JBOSS_CONFIG);
}
+ public String getJBossHomeDir() {
+ return System.getProperty(AppConstants.SYSPROP_CARGO_JBOSS_HOME_DIR);
+ }
+
public JavaScriptEngine getJavaScriptEngine(){
return client.getContentPage().getEnclosingWindow().getWebClient().getJavaScriptEngine();
}
@@ -978,9 +982,36 @@
return index;
}
+
+ /**
+ * Creates a properties using values from this table.
+ * @param keyColName Name of column containing the key (e.g. "Name").
+ * @param valueColName Name of column containing the value (e.g. "Value").
+ */
+ public Properties getProperties( String keyColName, String valueColName ) throws HtmlElementNotFoundException
+ {
+ int keyColIndex = this.getColumnIndexByName(keyColName);
+ int valColindex = this.getColumnIndexByName(valueColName);
+
+ Properties props = new Properties();
+
+ for( ContentTableRow row : this.getRows() ){
+ String key = row.getCell( keyColIndex ).getTextContent();
+ String value = row.getCell( valColindex ).getTextContent();
+ props.setProperty(key, value);
+ }
+
+ return props;
+ }
+
+
+
}// inner class ContentTable
+
+
+
/**
* Creates a data table wrapper for first found element with one of these IDs:
* ID_CATEGORY_DATA_TABLE, ID_RESOURCE_DATA_TABLE
15 years, 8 months
EMBJOPR SVN: r321 - in trunk/core/src/main: java/org/jboss/on/embedded/bean/history/operation and 7 other directories.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2009-04-23 10:17:52 -0400 (Thu, 23 Apr 2009)
New Revision: 321
Added:
trunk/core/src/main/java/org/jboss/on/embedded/ui/BootstrapAction.java
Removed:
trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationHistoryManagerBean.java
trunk/core/src/main/java/org/jboss/on/embedded/manager/history/operation/OperationHistoryManager.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/SingleResourceOperationAction.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/SummaryAction.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java
trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
trunk/core/src/main/webapp/css/console-style.css
trunk/core/src/main/webapp/secure/resourceInstanceOperation.xhtml
Log:
fix operations page, i.e Control tab (https://jira.jboss.org/jira/browse/EMBJOPR-87); move BootstrapAction to ui package
Deleted: trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java 2009-04-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java 2009-04-23 14:17:52 UTC (rev 321)
@@ -1,275 +0,0 @@
-/*
- * Embedded Jopr Project
- * Copyright (C) 2006-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 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 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-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.history.operation.OperationHistoryManager;
-import org.jboss.on.embedded.manager.ResourceManagerFactory;
-
-import org.jboss.seam.ScopeType;
-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;
-import org.rhq.core.pc.PluginContainerConfiguration;
-import org.rhq.core.pc.ServerServices;
-import org.rhq.core.pc.plugin.PluginEnvironment;
-import org.rhq.core.pc.plugin.SimplePluginFinder;
-
-import javax.servlet.ServletContext;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.Collection;
-import java.util.Set;
-import java.util.jar.Manifest;
-import java.util.jar.Attributes;
-import java.util.logging.Logger;
-import java.util.logging.Level;
-
-/**
- * A Seam component that is in charge of initializing and shutting down the Admin Console.
- *
- * @author Ian Springer
- */
-@Name("bootstrapAction")
-(a)Scope(ScopeType.APPLICATION)
-@Startup
-public class BootstrapAction
-{
- private static final Log LOG = LogFactory.getLog(BootstrapAction.class);
-
- private static final String FACES_API_LOGGER_NAME = "javax.faces";
- private static final String FACES_RI_LOGGER_NAME = "javax.enterprise.resource.webcontainer.jsf";
- private static final String FACELETS_LOGGER_NAME = "facelets";
-
- @In(value = "historyManager", create = true)
- private OperationHistoryManager historyManager;
-
- @In(value = "contentHistoryManager", create = true)
- private ContentHistoryManagerBean contentHistoryManager;
-
- @In(value = "inventoryEventListener", create = true)
- private EmbeddedInventoryEventListener inventoryEventListener;
-
- private boolean initialized;
-
- private File tempDir;
-
- /**
- * Initializes the Admin Console after the first user logs in.
- */
- @Observer(Identity.EVENT_LOGIN_SUCCESSFUL)
- public void init()
- {
- if (!this.initialized) {
- try
- {
- String version = getVersion();
- LOG.info("Initializing Administration Console" + ((version != null) ? (" v" + version) : "") + "...");
- long startTime = System.currentTimeMillis();
- reconfigureJdkLogging();
- initPluginContainer();
- ResourceManagerFactory.resourceManager().discoverResources();
- long elapsedTime = System.currentTimeMillis() - startTime;
- LOG.debug("Done initializing Administration Console (" + elapsedTime + " ms elapsed).");
- this.initialized = true;
- }
- catch (Exception e)
- {
- LOG.error("*** Failed to initialize Administration Console. ***", e);
- }
- }
- }
-
- /**
- * Shuts down the Admin Console when the webapp is stopped.
- */
- @Destroy
- public void shutdown()
- {
- if (this.initialized) {
- try
- {
- LOG.info("Shutting down Administration Console...");
- 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 initPluginContainer()
- throws MalformedURLException
- {
- PluginContainerConfiguration pluginContainerConfig = createPluginContainerConfiguration();
- PluginContainer pluginContainer = PluginContainer.getInstance();
- pluginContainer.setConfiguration(pluginContainerConfig);
- configureMockScenarioLoader();
- pluginContainer.initialize();
- logLoadedPlugins(pluginContainer);
- pluginContainer.getInventoryManager().addInventoryEventListener(this.inventoryEventListener);
- pluginContainer.getInventoryManager().addInventoryEventListener(new LoggingInventoryEventListener());
- }
-
- @Nullable
- private String getVersion() {
- String version = null;
- try {
- version = this.getClass().getPackage().getImplementationVersion();
- if (version == null) {
- ServletContext servletContext = ServletLifecycle.getServletContext();
- String manifestPath = servletContext.getRealPath("/META-INF/MANIFEST.MF");
- Manifest manifest = new Manifest(new FileInputStream(manifestPath));
- version = (String)manifest.getMainAttributes().get(Attributes.Name.IMPLEMENTATION_VERSION);
- if (version == null) {
- throw new IllegalStateException(Attributes.Name.IMPLEMENTATION_VERSION + " attribute is not set in WAR's manifest.");
- }
- }
- }
- catch (Exception e) {
- LOG.error("Could not determine Administration Console version.", e);
- }
- return version;
- }
-
- private static void reconfigureJdkLogging() {
- try {
- LOG.trace("Reconfiguring JDK logging...");
- setJdkLoggerLevel(FACES_API_LOGGER_NAME, Level.WARNING);
- setJdkLoggerLevel(FACES_RI_LOGGER_NAME, Level.WARNING);
- setJdkLoggerLevel(FACELETS_LOGGER_NAME, Level.WARNING);
- } catch (Exception e) {
- LOG.warn("Failed to reconfigure JDK logging.", e);
- }
- }
-
- private PluginContainerConfiguration createPluginContainerConfiguration() throws MalformedURLException {
- PluginContainerConfiguration config = new PluginContainerConfiguration();
- config.setPluginFinder(createPluginFinder());
- setPluginContainerDataDirectory(config);
- config.setTemporaryDirectory(initTempDir());
- config.setContentDiscoveryPeriod(0);
- ServerServices services = new ServerServices();
-
- // Create operation listener
- OperationServerServiceImpl callbackListener = new OperationServerServiceImpl();
- callbackListener.setHistoryBean(this.historyManager);
-
- // Create content listener
- ContentServerServiceImpl contentListener = new ContentServerServiceImpl();
- contentListener.setHistoryBean(this.contentHistoryManager);
-
- // Add listeners to ServerServices
- services.setOperationServerService(callbackListener);
- services.setContentServerService(contentListener);
- config.setServerServices(services);
- return config;
- }
-
- private static SimplePluginFinder createPluginFinder() throws MalformedURLException {
- ServletContext servletContext = ServletLifecycle.getServletContext();
- SimplePluginFinder pluginFinder = new SimplePluginFinder();
- Set<String> pluginStringSet = servletContext.getResourcePaths("/plugins/");
- for (String pluginString : pluginStringSet)
- {
- if (pluginString.endsWith(".jar"))
- {
- URL pluginUrl = servletContext.getResource(pluginString);
- pluginFinder.addUrl(pluginUrl);
- }
- }
- return pluginFinder;
- }
-
- private static void configureMockScenarioLoader() {
- LOG.trace("Configuring Mock Scenario Loader...");
- System.setProperty("on.mock.jboss.scenario", "scenario2.xml");
- }
-
- private static void logLoadedPlugins(PluginContainer pluginContainer) {
- Collection<PluginEnvironment> pluginEnvironments = pluginContainer.getPluginManager().getPlugins();
- for (PluginEnvironment pluginEnvironment : pluginEnvironments)
- LOG.debug("Loaded RHQ plugin [" + pluginEnvironment.getPluginName() + "].");
- }
-
- private static void setJdkLoggerLevel(String name, Level level) {
- Logger facesApiLogger = Logger.getLogger(name);
- facesApiLogger.setLevel(level);
- }
-
- private static void setPluginContainerDataDirectory(PluginContainerConfiguration config)
- {
- File dataDirectory = getDirectory("jboss.server.data.dir");
- if (dataDirectory != null)
- {
- config.setDataDirectory(dataDirectory);
- }
- }
-
- private File initTempDir()
- {
- String jbasTempDir = System.getProperty("jboss.server.temp.dir");
- String javaTempDir = System.getProperty("java.io.tmpdir");
- String baseTempDir = (jbasTempDir != null) ? jbasTempDir : javaTempDir;
- 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);
- return this.tempDir;
- }
-
- @Nullable
- private static File getDirectory(String systemProperty)
- {
- 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/bean/history/operation/OperationHistoryManagerBean.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationHistoryManagerBean.java 2009-04-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationHistoryManagerBean.java 2009-04-23 14:17:52 UTC (rev 321)
@@ -51,10 +51,10 @@
{
OperationHistory operationHistory = null;
OperationDefinition operationDefinition = getOperationDefinition(operationName, resourceType);
-
if (operationDefinition != null)
{
- String jobName = String.valueOf(jobNameId.incrementAndGet());
+ int id = jobNameId.incrementAndGet();
+ String jobName = operationDefinition.getName() + "-" + id;
operationHistory =
new ResourceOperationHistory(jobName,
"",
@@ -63,10 +63,9 @@
parameters,
resource,
null); //GroupOperationHistory
- operationHistory.setId(operationHistory.getJobId().hashCode());
+ operationHistory.setId(id);
addToMaps(operationHistory, resource, resourceType);
}
-
return operationHistory;
}
Modified: trunk/core/src/main/java/org/jboss/on/embedded/manager/history/operation/OperationHistoryManager.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/manager/history/operation/OperationHistoryManager.java 2009-04-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/java/org/jboss/on/embedded/manager/history/operation/OperationHistoryManager.java 2009-04-23 14:17:52 UTC (rev 321)
@@ -30,8 +30,9 @@
*/
public interface OperationHistoryManager extends HistoryManager<OperationHistory>
{
+ // TODO: Isn't passing the ResourceType here redundant?
public OperationHistory addOperationHistory(String operationName,
- Configuration configuration,
+ Configuration operationParameters,
Resource resource,
ResourceType resourceType);
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-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java 2009-04-23 14:17:52 UTC (rev 321)
@@ -20,7 +20,6 @@
package org.jboss.on.embedded.manager.pc;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@@ -332,18 +331,15 @@
return getInventoryService().getCurrentAvailability(resource);
}
+ @NotNull
public List<OperationDefinition> getOperationsForResource(Resource resource)
{
- List<OperationDefinition> operationDefinitions;
+ List<OperationDefinition> operationDefinitions = new ArrayList();
if (resource != null)
{
ResourceType resourceType = resource.getResourceType();
- operationDefinitions = new ArrayList(resourceType.getOperationDefinitions());
+ operationDefinitions.addAll(resourceType.getOperationDefinitions());
}
- else
- {
- operationDefinitions = Collections.emptyList();
- }
return operationDefinitions;
}
Added: trunk/core/src/main/java/org/jboss/on/embedded/ui/BootstrapAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/BootstrapAction.java (rev 0)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/BootstrapAction.java 2009-04-23 14:17:52 UTC (rev 321)
@@ -0,0 +1,277 @@
+/*
+ * Embedded Jopr Project
+ * Copyright (C) 2006-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 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 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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 org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.history.operation.OperationHistoryManager;
+import org.jboss.on.embedded.manager.ResourceManagerFactory;
+import org.jboss.on.embedded.EmbeddedInventoryEventListener;
+import org.jboss.on.embedded.LoggingInventoryEventListener;
+
+import org.jboss.seam.ScopeType;
+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;
+import org.rhq.core.pc.PluginContainerConfiguration;
+import org.rhq.core.pc.ServerServices;
+import org.rhq.core.pc.plugin.PluginEnvironment;
+import org.rhq.core.pc.plugin.SimplePluginFinder;
+
+import javax.servlet.ServletContext;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.Collection;
+import java.util.Set;
+import java.util.jar.Manifest;
+import java.util.jar.Attributes;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+/**
+ * A Seam component that is in charge of initializing and shutting down the Admin Console.
+ *
+ * @author Ian Springer
+ */
+@Name("bootstrapAction")
+(a)Scope(ScopeType.APPLICATION)
+@Startup
+public class BootstrapAction
+{
+ private static final Log LOG = LogFactory.getLog(BootstrapAction.class);
+
+ private static final String FACES_API_LOGGER_NAME = "javax.faces";
+ private static final String FACES_RI_LOGGER_NAME = "javax.enterprise.resource.webcontainer.jsf";
+ private static final String FACELETS_LOGGER_NAME = "facelets";
+
+ @In(value = "historyManager", create = true)
+ private OperationHistoryManager historyManager;
+
+ @In(value = "contentHistoryManager", create = true)
+ private ContentHistoryManagerBean contentHistoryManager;
+
+ @In(value = "inventoryEventListener", create = true)
+ private EmbeddedInventoryEventListener inventoryEventListener;
+
+ private boolean initialized;
+
+ private File tempDir;
+
+ /**
+ * Initializes the Admin Console after the first user logs in.
+ */
+ @Observer(Identity.EVENT_LOGIN_SUCCESSFUL)
+ public void init()
+ {
+ if (!this.initialized) {
+ try
+ {
+ String version = getVersion();
+ LOG.info("Initializing Administration Console" + ((version != null) ? (" v" + version) : "") + "...");
+ long startTime = System.currentTimeMillis();
+ reconfigureJdkLogging();
+ initPluginContainer();
+ ResourceManagerFactory.resourceManager().discoverResources();
+ long elapsedTime = System.currentTimeMillis() - startTime;
+ LOG.debug("Done initializing Administration Console (" + elapsedTime + " ms elapsed).");
+ this.initialized = true;
+ }
+ catch (Exception e)
+ {
+ LOG.error("*** Failed to initialize Administration Console. ***", e);
+ }
+ }
+ }
+
+ /**
+ * Shuts down the Admin Console when the webapp is stopped.
+ */
+ @Destroy
+ public void shutdown()
+ {
+ if (this.initialized) {
+ try
+ {
+ LOG.info("Shutting down Administration Console...");
+ 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 initPluginContainer()
+ throws MalformedURLException
+ {
+ PluginContainerConfiguration pluginContainerConfig = createPluginContainerConfiguration();
+ PluginContainer pluginContainer = PluginContainer.getInstance();
+ pluginContainer.setConfiguration(pluginContainerConfig);
+ configureMockScenarioLoader();
+ pluginContainer.initialize();
+ logLoadedPlugins(pluginContainer);
+ pluginContainer.getInventoryManager().addInventoryEventListener(this.inventoryEventListener);
+ pluginContainer.getInventoryManager().addInventoryEventListener(new LoggingInventoryEventListener());
+ }
+
+ @Nullable
+ private String getVersion() {
+ String version = null;
+ try {
+ version = this.getClass().getPackage().getImplementationVersion();
+ if (version == null) {
+ ServletContext servletContext = ServletLifecycle.getServletContext();
+ String manifestPath = servletContext.getRealPath("/META-INF/MANIFEST.MF");
+ Manifest manifest = new Manifest(new FileInputStream(manifestPath));
+ version = (String)manifest.getMainAttributes().get(Attributes.Name.IMPLEMENTATION_VERSION);
+ if (version == null) {
+ throw new IllegalStateException(Attributes.Name.IMPLEMENTATION_VERSION + " attribute is not set in WAR's manifest.");
+ }
+ }
+ }
+ catch (Exception e) {
+ LOG.error("Could not determine Administration Console version.", e);
+ }
+ return version;
+ }
+
+ private static void reconfigureJdkLogging() {
+ try {
+ LOG.trace("Reconfiguring JDK logging...");
+ setJdkLoggerLevel(FACES_API_LOGGER_NAME, Level.WARNING);
+ setJdkLoggerLevel(FACES_RI_LOGGER_NAME, Level.WARNING);
+ setJdkLoggerLevel(FACELETS_LOGGER_NAME, Level.WARNING);
+ } catch (Exception e) {
+ LOG.warn("Failed to reconfigure JDK logging.", e);
+ }
+ }
+
+ private PluginContainerConfiguration createPluginContainerConfiguration() throws MalformedURLException {
+ PluginContainerConfiguration config = new PluginContainerConfiguration();
+ config.setPluginFinder(createPluginFinder());
+ setPluginContainerDataDirectory(config);
+ config.setTemporaryDirectory(initTempDir());
+ config.setContentDiscoveryPeriod(0);
+ ServerServices services = new ServerServices();
+
+ // Create operation listener
+ OperationServerServiceImpl callbackListener = new OperationServerServiceImpl();
+ callbackListener.setHistoryBean(this.historyManager);
+
+ // Create content listener
+ ContentServerServiceImpl contentListener = new ContentServerServiceImpl();
+ contentListener.setHistoryBean(this.contentHistoryManager);
+
+ // Add listeners to ServerServices
+ services.setOperationServerService(callbackListener);
+ services.setContentServerService(contentListener);
+ config.setServerServices(services);
+ return config;
+ }
+
+ private static SimplePluginFinder createPluginFinder() throws MalformedURLException {
+ ServletContext servletContext = ServletLifecycle.getServletContext();
+ SimplePluginFinder pluginFinder = new SimplePluginFinder();
+ Set<String> pluginStringSet = servletContext.getResourcePaths("/plugins/");
+ for (String pluginString : pluginStringSet)
+ {
+ if (pluginString.endsWith(".jar"))
+ {
+ URL pluginUrl = servletContext.getResource(pluginString);
+ pluginFinder.addUrl(pluginUrl);
+ }
+ }
+ return pluginFinder;
+ }
+
+ private static void configureMockScenarioLoader() {
+ LOG.trace("Configuring Mock Scenario Loader...");
+ System.setProperty("on.mock.jboss.scenario", "scenario2.xml");
+ }
+
+ private static void logLoadedPlugins(PluginContainer pluginContainer) {
+ Collection<PluginEnvironment> pluginEnvironments = pluginContainer.getPluginManager().getPlugins();
+ for (PluginEnvironment pluginEnvironment : pluginEnvironments)
+ LOG.debug("Loaded RHQ plugin [" + pluginEnvironment.getPluginName() + "].");
+ }
+
+ private static void setJdkLoggerLevel(String name, Level level) {
+ Logger facesApiLogger = Logger.getLogger(name);
+ facesApiLogger.setLevel(level);
+ }
+
+ private static void setPluginContainerDataDirectory(PluginContainerConfiguration config)
+ {
+ File dataDirectory = getDirectory("jboss.server.data.dir");
+ if (dataDirectory != null)
+ {
+ config.setDataDirectory(dataDirectory);
+ }
+ }
+
+ private File initTempDir()
+ {
+ String jbasTempDir = System.getProperty("jboss.server.temp.dir");
+ String javaTempDir = System.getProperty("java.io.tmpdir");
+ String baseTempDir = (jbasTempDir != null) ? jbasTempDir : javaTempDir;
+ 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);
+ return this.tempDir;
+ }
+
+ @Nullable
+ private static File getDirectory(String systemProperty)
+ {
+ File directory = null;
+ String directoryPath = System.getProperty(systemProperty);
+ if (directoryPath != null)
+ directory = new File(directoryPath);
+ return directory;
+ }
+}
Property changes on: trunk/core/src/main/java/org/jboss/on/embedded/ui/BootstrapAction.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-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/DiscoveryAction.java 2009-04-23 14:17:52 UTC (rev 321)
@@ -22,7 +22,6 @@
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;
@@ -42,36 +41,38 @@
public class DiscoveryAction {
private final Log log = LogFactory.getLog(this.getClass());
+ // the minimum length of time (in milliseconds) between consecutive discoveries
+ private static final int DEFAULT_MINIMUM_SCAN_INTERVAL = 60000; // 1 minute
+
@In
private BootstrapAction bootstrapAction;
private volatile long lastDiscoveryTime;
- // the minimum length of time (in milliseconds) between consecutive discoveries
- private int scanPeriod = 60000;
+ private int scanPeriod = DEFAULT_MINIMUM_SCAN_INTERVAL;
- public int getScanPeriod() {
+ public int getScanPeriod() {
return this.scanPeriod;
}
- public void setScanPeriod(int n) {
- this.scanPeriod = n;
+ public void setScanPeriod(int scanPeriod) {
+ this.scanPeriod = scanPeriod;
}
public void checkAutodiscovery() {
- if (this.bootstrapAction.isInitialized() && (System.currentTimeMillis() - lastDiscoveryTime) > scanPeriod) {
- // try the timestamp check in a synchronized block
+ if (this.bootstrapAction.isInitialized() && (System.currentTimeMillis() - lastDiscoveryTime) > DEFAULT_MINIMUM_SCAN_INTERVAL) {
+ // Try the timestamp check in a synchronized block.
tryAutodiscovery();
}
}
synchronized private void tryAutodiscovery() {
log.trace("Checking if service discovery scan is needed...");
- if ((System.currentTimeMillis() - lastDiscoveryTime) > scanPeriod) {
+ if ((System.currentTimeMillis() - lastDiscoveryTime) > DEFAULT_MINIMUM_SCAN_INTERVAL) {
// 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();
- log.debug("Performing service discovery scan...");
+ log.trace("Performing service discovery scan...");
ResourceManagerFactory.resourceManager().discoverServicesAsync();
}
}
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceOperationAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceOperationAction.java 2009-04-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceOperationAction.java 2009-04-23 14:17:52 UTC (rev 321)
@@ -28,7 +28,6 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.web.RequestParameter;
import org.rhq.core.domain.operation.OperationDefinition;
@@ -67,7 +66,7 @@
@In
private OperationHistoryManager historyManager;
- @In(required = false)
+ @Out(required = false)
private OperationHistory selectedHistory;
@In(create = true)
@@ -80,7 +79,7 @@
private List<OperationDefinition> operations = new ArrayList<OperationDefinition>();
@Out(required = false)
- private List<ResourceOperationHistory> operationHistory;
+ private List<ResourceOperationHistory> operationHistories;
Map<Integer, ResourceOperationHistory> operationHistoryMap = new HashMap<Integer, ResourceOperationHistory>();
@@ -98,7 +97,7 @@
{
this.currentResource = this.commonActionUtil.getCurrentResource();
initOperations();
- initHistory();
+ initHistories();
}
/**
@@ -106,7 +105,6 @@
*
* @return a JSF outcome string
*/
- @End(ifOutcome={"success"}, beforeRedirect = true)
public String invokeOperation()
{
//this.facesMessages.clear();
@@ -117,30 +115,33 @@
initSelectedOperationInfo();
return "missingParams";
} else {
- OperationHistory newOperationHistory = this.historyManager.addOperationHistory(operationDef.getName(), null,
- this.currentResource, resourceType);
- newOperationHistory.setParameters(this.selectedOperationParameters);
+ OperationHistory newOperationHistory = this.historyManager.addOperationHistory(operationDef.getName(),
+ this.selectedOperationParameters, this.currentResource, resourceType);
+ // Null this out as soon as we're done with it, so it won't carry over to the next request.
+ this.selectedOperationParameters = null;
ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
String jobId = newOperationHistory.getJobId().toString();
try {
- resourceManager.invokeOperation(this.currentResource, operationDef, this.selectedOperationParameters, jobId);
- this.facesMessages.add("Operation invoked. See history below for results once the operation completes.");
+ resourceManager.invokeOperation(this.currentResource, operationDef, newOperationHistory.getParameters(),
+ jobId);
+ this.facesMessages.add("The #0 operation has been invoked. See the operation history below for the results once the operation has completed.", operationDef.getName());
}
catch (RuntimeException e) {
newOperationHistory.setStatus(OperationRequestStatus.FAILURE);
newOperationHistory.setErrorMessageFromThrowable(e);
this.facesMessages.add(FacesMessage.SEVERITY_FATAL, "Failed to invoke operation: #0", e);
}
- initHistory();
+ initHistories();
+ // Auto-select the operation history, so its results will be displayed in the
+ // "Selected Operation History Item" panel.
+ selectOperationHistory(newOperationHistory.getId());
return "success";
}
}
- // if later we want the error column to hold a link instead of
- // showing the message, which it does now.
- public String getHistoryError()
+ public void selectOperationHistory(int id)
{
- return selectedHistory.getErrorMessage();
+ this.selectedHistory = this.getOperationHistory(id);
}
/**
@@ -163,25 +164,20 @@
}
/**
- * Make the first row be bolded, so it needs a different style class
- * @param history the history of the Operations
- * @return name of the style class to return to add to the tag
+ * Return the CSS style class that should be used for the specified history item.
+ *
+ * @param history a history item
+ * @return name of the style class to return to add to the 'tr' tag
*/
- public String getResultsRowStyleClass(OperationHistory history)
+ public String getHistoriesTableRowStyleClass(OperationHistory history)
{
- String styleClass = "";
- if (history != null && operationHistory != null)
- {
- if (operationHistory.indexOf(history) == 0)
- {
- styleClass = "operation-first-row";
- }
- }
+ @SuppressWarnings({"UnnecessaryLocalVariable"})
+ String styleClass = (history.equals(this.selectedHistory)) ? "selectedRow" : "";
return styleClass;
}
- public ResourceOperationHistory getOperationHistory(int jobId) {
- return this.operationHistoryMap.get(jobId);
+ public ResourceOperationHistory getOperationHistory(int opHistoryId) {
+ return this.operationHistoryMap.get(opHistoryId);
}
private ResourceType getResourceType() {
@@ -197,20 +193,20 @@
operations = resourceManager.getOperationsForResource(currentResource);
}
- private void initHistory()
+ private void initHistories()
{
Collection<OperationHistory> opHistories = historyManager.getHistoryForResource(currentResource);
if (opHistories != null)
{
- operationHistory = new ArrayList<ResourceOperationHistory>();
+ this.operationHistories = new ArrayList<ResourceOperationHistory>();
for (OperationHistory opHistory : opHistories) {
ResourceOperationHistory resourceOpHistory = (ResourceOperationHistory)opHistory;
- this.operationHistory.add(resourceOpHistory);
+ this.operationHistories.add(resourceOpHistory);
this.operationHistoryMap.put(resourceOpHistory.getId(), resourceOpHistory);
}
- Collections.sort(operationHistory, new Comparator<OperationHistory>()
+ Collections.sort(operationHistories, new Comparator<OperationHistory>()
{
public int compare(OperationHistory a, OperationHistory b)
{
@@ -232,13 +228,12 @@
}
else
{
- operationHistory = null;
+ operationHistories = null;
}
}
public Map<Integer, ResourceOperationHistory> getOperationHistoryMap()
{
-
return operationHistoryMap;
}
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/SummaryAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/SummaryAction.java 2009-04-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/SummaryAction.java 2009-04-23 14:17:52 UTC (rev 321)
@@ -42,7 +42,6 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Outcome;
import org.jetbrains.annotations.NotNull;
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-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/content/AbstractFileUploadAction.java 2009-04-23 14:17:52 UTC (rev 321)
@@ -31,7 +31,7 @@
import org.jboss.seam.faces.FacesMessages;
import org.jboss.on.embedded.ui.NavigationAction;
-import org.jboss.on.embedded.BootstrapAction;
+import org.jboss.on.embedded.ui.BootstrapAction;
/**
* @author Ian Springer
Modified: trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
===================================================================
--- trunk/core/src/main/webapp/WEB-INF/classes/messages.properties 2009-04-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/webapp/WEB-INF/classes/messages.properties 2009-04-23 14:17:52 UTC (rev 321)
@@ -122,8 +122,8 @@
control.resourceInstance.error.noOperations=No control operations for this resource
control.resourceInstance.select=Select from the available control operations for this resource.
control.resourceInstance.button.execute=Execute
-control.resourceInstance.previous=Previous Operations
-control.resourceInstance.error.noPrevious=No previous operations for this resource
+control.resourceInstance.operationHistory=Operation History
+control.resourceInstance.error.noPrevious=No operations have been executed on this Resource since this JBoss AS instance was last started.
control.resourceInstance.previous.executedAt=Executed At
control.resourceInstance.previous.operation=Operation Name
control.resourceInstance.previous.status=Status
Modified: trunk/core/src/main/webapp/css/console-style.css
===================================================================
--- trunk/core/src/main/webapp/css/console-style.css 2009-04-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/webapp/css/console-style.css 2009-04-23 14:17:52 UTC (rev 321)
@@ -519,6 +519,11 @@
background-color: #d2e1ea;
}
+.selectedRow {
+ border: medium solid #FFF;
+ background-color: #777;
+}
+
.detailPanel {
border-top-width: 0;
border-bottom-width: 0;
Modified: trunk/core/src/main/webapp/secure/resourceInstanceOperation.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceInstanceOperation.xhtml 2009-04-22 17:25:09 UTC (rev 320)
+++ trunk/core/src/main/webapp/secure/resourceInstanceOperation.xhtml 2009-04-23 14:17:52 UTC (rev 321)
@@ -47,9 +47,11 @@
<div class="tabmenubox">
<ui:include src="../include/displayGlobalMessages.xhtml"/>
-<h:outputText value="#{messages['control.resourceInstance.error.noOperations']}" rendered="#{operations eq null}"/>
+<h:outputText value="#{messages['control.resourceInstance.error.noOperations']}"
+ rendered="#{empty operations}"/>
-<h:form id="operation_form" rendered="#{operations ne null}">
+<h:form id="operationsForm"
+ rendered="#{!empty operations}">
<div class="instructionalText">
#{messages['control.resourceInstance.select']}
</div>
@@ -82,135 +84,151 @@
</div>
</h:form>
-<h2>#{messages['control.resourceInstance.previous']}</h2>
+<rich:panel id="historiesPanel" rendered="#{!empty operationHistories}" style="margin-top: 12px;">
-<!-- NOTE: This is a workaround for JBMANCON-370. This can be removed once
- JBMANCON-370 is resolved. -->
-<div class="instructionalText">
- <h:outputText rendered="#{operationHistory ne null}">
- #{messages['control.resourceInstance.status.details1a']}
- <a id="refreshLink" href="javascript:window.location.reload(true)">#{messages['control.resourceInstance.status.details1b']}</a>
- </h:outputText>
-</div>
-
-<h:outputText value="#{messages['control.resourceInstance.error.noPrevious']}" rendered="#{operationHistory eq null}"/>
+ <f:facet name="header">
+ #{messages['control.resourceInstance.operationHistory']}
+ </f:facet>
-<h:form id="operationHistoryForm" rendered="#{operationHistory ne null}">
- <ui:remove>
- <!-- NOTE: The below causes the results/error toggle panels to not display properly. Uncomment when RichFaces
- fixes whatever the problem is. (ips, 08/20/08) -->
- <a4j:poll id="refreshId" reRender="dataTable" interval="15000"/>
- </ui:remove>
+ <h:outputText value="#{messages['control.resourceInstance.error.noPrevious']}" rendered="#{empty operationHistories}"/>
- <rich:dataTable
- styleClass="properties-table"
- id="dataTable"
- rows="#{tableManager.numRows}"
- rowClasses="DarkRow"
- var="selectedHistory"
- value="#{operationHistory}">
+ <h:form id="historiesForm" rendered="#{!empty operationHistories}">
+ <ui:remove>
+ <a4j:poll id="poller" reRender="poller, historiesForm, historyDetailsPanel" interval="10000" limitToList="true"/>
+ </ui:remove>
+
+ <rich:dataTable
+ styleClass="properties-table"
+ id="dataTable"
+ rows="#{tableManager.numRows}"
+ rowClasses="DarkRow"
+ var="operationHistory"
+ value="#{operationHistories}">
- <f:facet name="header">
- <rich:columnGroup>
- <rich:column styleClass="properties-table-header-cell">
- <h:outputText value="#{messages['control.resourceInstance.previous.executedAt']}"/>
+ <f:facet name="header">
+ <rich:columnGroup>
+ <rich:column styleClass="properties-table-header-cell">
+ <h:outputText value="#{messages['control.resourceInstance.previous.executedAt']}"/>
+ </rich:column>
+ <rich:column styleClass="properties-table-header-cell">
+ <h:outputText value="#{messages['control.resourceInstance.previous.operation']}"/>
+ </rich:column>
+ <rich:column styleClass="properties-table-header-cell">
+ <h:outputText value="#{messages['control.resourceInstance.previous.status']}"/>
+ </rich:column>
+ <rich:column styleClass="properties-table-header-cell">
+ <h:outputText value="Actions"/>
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+ <rich:columnGroup styleClass="#{operationAction.getHistoriesTableRowStyleClass(operationHistory)}">
+
+ <rich:column styleClass="operationTimeColumn">
+ <h:outputText value="#{operationHistory.createdTime}">
+ <s:convertDateTime type="both" pattern="MMMMM d, yyyy '-' h:mm a"/>
+ </h:outputText>
</rich:column>
- <rich:column styleClass="properties-table-header-cell">
- <h:outputText value="#{messages['control.resourceInstance.previous.operation']}"/>
+
+ <rich:column styleClass="operationNameColumn">
+ <h:outputText value="#{operationHistory.operationDefinition.displayName}"/>
</rich:column>
- <rich:column styleClass="properties-table-header-cell">
- <h:outputText value="#{messages['control.resourceInstance.previous.status']}"/>
+
+ <rich:column styleClass="operationStatusColumn">
+ <h:panelGroup>
+ <h:outputText value="#{messages['control.resourceInstance.previous.success']}"
+ rendered="#{operationHistory.status eq 'SUCCESS'}" styleClass="operationSuccess"/>
+ <h:outputText value="#{messages['control.resourceInstance.previous.inProgress']}"
+ rendered="#{operationHistory.status eq 'INPROGRESS'}" styleClass="operationInProgress"/>
+ <h:outputText value="#{messages['control.resourceInstance.previous.failure']}"
+ rendered="#{operationHistory.status eq 'FAILURE'}" styleClass="operationFailure"/>
+ <h:outputLabel value=" "/>
+ </h:panelGroup>
</rich:column>
+
+ <rich:column styleClass="actionsColumn">
+ <a4j:commandButton value="Show Details Below..."
+ action="#{operationAction.selectOperationHistory(operationHistory.id)}"
+ reRender="historiesPanel, historyDetailsPanel"
+ styleClass="buttonsmall"/>
+ </rich:column>
+
</rich:columnGroup>
- </f:facet>
+ </rich:dataTable>
- <rich:columnGroup styleClass="#{operationAction.getResultsRowStyleClass(selectedHistory)}">
- <rich:column styleClass="operationTimeColumn">
- <h:outputText value="#{selectedHistory.createdTime}">
- <s:convertDateTime type="both" pattern="MMMMM d, yyyy '-' h:mm a"/>
- </h:outputText>
- </rich:column>
- <rich:column styleClass="operationNameColumn">
- <h:outputText value="#{selectedHistory.operationDefinition.displayName}"/>
- </rich:column>
- <rich:column styleClass="operationStatusColumn">
- <h:panelGroup>
- <h:outputText value="#{messages['control.resourceInstance.previous.success']}"
- rendered="#{selectedHistory.status eq 'SUCCESS'}" styleClass="operationSuccess"/>
- <h:outputText value="#{messages['control.resourceInstance.previous.inProgress']}"
- rendered="#{selectedHistory.status eq 'INPROGRESS'}" styleClass="operationInProgress"/>
- <h:outputText value="#{messages['control.resourceInstance.previous.failure']}"
- rendered="#{selectedHistory.status eq 'FAILURE'}" styleClass="operationFailure"/>
- <h:outputLabel value=" "/>
- <rich:toggleControl for="history_details"
- value="#{messages['control.resourceInstance.previous.showHideDetails']}"
- rendered="#{selectedHistory.status ne 'INPROGRESS'}"/>
- </h:panelGroup>
- </rich:column>
- <rich:column colspan="3" breakBefore="true" styleClass="detailPanel" style="padding-left: 20px; padding-right: 20px;">
- <h:outputLabel value=""/>
- <rich:togglePanel id="history_details" switchType="client" stateOrder="empty, b"
- rendered="#{selectedHistory.status ne 'INPROGRESS'}">
- <f:facet name="empty">
- <h:panelGroup>
- <h:outputLabel value=""/> <!--styleClass="historyErrorEmpty"/-->
- </h:panelGroup>
- </f:facet>
- <f:facet name="b">
- <h:panelGroup layout="block" style="margin-top: 6px; margin-bottom: 6px">
- <!-- Parameters -->
- <h3>#{messages['control.resourceInstance.previous.parameters']}</h3>
- <h:panelGroup rendered="#{selectedHistory.parameters ne null}">
- <onc:config configurationDefinition="#{selectedHistory.operationDefinition.parametersConfigurationDefinition}"
- configuration="#{selectedHistory.parameters}"
- readOnly="true"
- nullConfigurationDefinitionMessage="null config def!"
- nullConfigurationMessage="null config!"
- nullConfigurationStyle="InfoBlock"/>
- </h:panelGroup>
- <h:panelGroup id="noParameters" rendered="#{selectedHistory.parameters eq null}">
- <i>None</i>
- </h:panelGroup>
+ <ui:include src="../include/resourceDataScroller.xhtml">
+ <ui:param name="paginationDataModel" value="#{operationHistories}"/>
+ <ui:param name="paginationDataTableName" value="dataTable"/>
+ </ui:include>
- <!-- Results -->
- <h:panelGroup layout="block" rendered="#{selectedHistory.status eq 'SUCCESS'}">
- <h3>#{messages['control.resourceInstance.previous.results']}</h3>
- <h:panelGroup id="operationResults" rendered="#{selectedHistory.results ne null and selectedHistory.operationDefinition.resultsConfigurationDefinition ne null}">
- <onc:config configurationDefinition="#{selectedHistory.operationDefinition.resultsConfigurationDefinition}"
- configuration="#{selectedHistory.results}"
- readOnly="true"
- nullConfigurationDefinitionMessage="null config def!"
- nullConfigurationMessage="null config!"
- nullConfigurationStyle="InfoBlock"/>
- </h:panelGroup>
- <h:panelGroup id="noResults" rendered="#{selectedHistory.results eq null or selectedHistory.operationDefinition.resultsConfigurationDefinition eq null}">
- <i>None</i>
- </h:panelGroup>
- </h:panelGroup>
+ </h:form>
+</rich:panel>
- <!-- Error -->
- <h:panelGroup layout="block" rendered="#{selectedHistory.status eq 'FAILURE'}">
- <h3>#{messages['control.resourceInstance.previous.error']}</h3>
- <h:inputTextarea value="#{selectedHistory.errorMessage}" readonly="true"
- rendered="#{selectedHistory.errorMessage ne null}"
- style="width: 100%;" rows="7"/>
- <h:panelGroup rendered="#{selectedHistory.errorMessage eq null}">
- <i>Unknown</i>
- </h:panelGroup>
- </h:panelGroup>
- </h:panelGroup>
- </f:facet>
- </rich:togglePanel>
- </rich:column>
- </rich:columnGroup>
- </rich:dataTable>
+<rich:panel id="historyDetailsPanel" rendered="#{!empty operationHistories}" style="margin-top: 12px;">
- <ui:include src="../include/resourceDataScroller.xhtml">
- <ui:param name="paginationDataModel" value="#{operationHistory}"/>
- <ui:param name="paginationDataTableName" value="dataTable"/>
- </ui:include>
-</h:form>
+ <f:facet name="header">
+ <h:outputText value="Selected Operation History Item"/>
+ </f:facet>
+ <h:panelGroup layout="block" rendered="#{empty selectedHistory}"
+ style="margin-top: 6px; margin-bottom: 6px">
+ No operation history is selected. Please select one above.
+ </h:panelGroup>
+
+ <!-- TODO: Enclose params and results in separate forms, so that drilling down on a list of maps is possible. -->
+
+ <h:panelGroup layout="block" rendered="#{!empty selectedHistory}"
+ style="margin-top: 6px; margin-bottom: 6px">
+ <!-- Parameters -->
+ <h3>#{messages['control.resourceInstance.previous.parameters']}</h3>
+ <h:panelGroup rendered="#{selectedHistory.parameters ne null}">
+ <onc:config configurationDefinition="#{selectedHistory.operationDefinition.parametersConfigurationDefinition}"
+ configuration="#{selectedHistory.parameters}"
+ readOnly="true"
+ nullConfigurationDefinitionMessage="null config def!"
+ nullConfigurationMessage="null config!"
+ nullConfigurationStyle="InfoBlock"/>
+ </h:panelGroup>
+ <h:panelGroup id="noParameters" rendered="#{selectedHistory.parameters eq null or empty selectedHistory.parameters.map}">
+ <i>This operation does not take any parameters.</i>
+ </h:panelGroup>
+
+ <!-- Results -->
+ <h:panelGroup layout="block" rendered="#{selectedHistory.status eq 'INPROGRESS' or selectedHistory.status eq 'SUCCESS'}">
+ <h3>#{messages['control.resourceInstance.previous.results']}</h3>
+ <h:panelGroup layout="block"
+ rendered="#{selectedHistory.status eq 'INPROGRESS'}">
+ <i>The operation has not completed yet.</i>
+ </h:panelGroup>
+ <h:panelGroup layout="block"
+ rendered="#{selectedHistory.status eq 'SUCCESS' and selectedHistory.results ne null and selectedHistory.operationDefinition.resultsConfigurationDefinition ne null}">
+ <onc:config configurationDefinition="#{selectedHistory.operationDefinition.resultsConfigurationDefinition}"
+ configuration="#{selectedHistory.results}"
+ readOnly="true"
+ nullConfigurationDefinitionMessage="null config def!"
+ nullConfigurationMessage="null config!"
+ nullConfigurationStyle="InfoBlock"/>
+ </h:panelGroup>
+ <h:panelGroup layout="block"
+ rendered="#{selectedHistory.status eq 'SUCCESS' and (selectedHistory.results eq null or empty selectedHistory.results.map)}">
+ <i>The operation did not return any results.</i>
+ </h:panelGroup>
+ </h:panelGroup>
+
+ <!-- Error -->
+ <h:panelGroup layout="block" rendered="#{operationHistory.status eq 'FAILURE'}">
+ <h3>#{messages['control.resourceInstance.previous.error']}</h3>
+ <h:inputTextarea value="#{operationHistory.errorMessage}" readonly="true"
+ rendered="#{operationHistory.errorMessage ne null}"
+ style="width: 100%;" rows="7"/>
+ <h:panelGroup rendered="#{operationHistory.errorMessage eq null}">
+ <i>The operation failed for an unknown reason.</i>
+ </h:panelGroup>
+ </h:panelGroup>
+ </h:panelGroup>
+
+</rich:panel>
+
</div>
</ui:define>
15 years, 8 months
EMBJOPR SVN: r320 - trunk/core/src/main/java/org/jboss/on/embedded/ui.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2009-04-22 13:25:09 -0400 (Wed, 22 Apr 2009)
New Revision: 320
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java
Log:
disable Control tab for the platform Resource (https://jira.jboss.org/jira/browse/EMBJOPR-157); misc. cosmetic cleanup
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-22 16:35:50 UTC (rev 319)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java 2009-04-22 17:25:09 UTC (rev 320)
@@ -35,6 +35,7 @@
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCreationDataType;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.ResourceCategory;
import org.richfaces.component.UITree;
import org.jboss.seam.ScopeType;
@@ -258,58 +259,44 @@
// probably move there too or just move it to a Tab related class
public List<String> getEnabledTabs()
{
- List<String> enabledTabs = new ArrayList<String>();
-
+ List<String> enabledTabs = new ArrayList<String>(4);
JONTreeNode currentNode = getSelectedNode();
if (currentNode instanceof TreeNodeWithResource)
{
Resource resource = ((TreeNodeWithResource) currentNode).getResource();
if (hasConfiguration(resource))
- {
enabledTabs.add(Constants.TAB_CONFIGURATION);
- }
if (hasMetrics(resource))
- {
enabledTabs.add(Constants.TAB_METRIC);
- }
- if (hasOperations(resource))
- {
+ if (resource.getResourceType().getCategory() != ResourceCategory.PLATFORM && hasOperations(resource))
enabledTabs.add(Constants.TAB_OPERATION);
- }
- if (hasContent(resource))
- {
+ if (isContentBacked(resource))
enabledTabs.add(Constants.TAB_CONTENT);
- }
}
-
return enabledTabs;
}
- private boolean hasContent(Resource resource)
+ private boolean isContentBacked(Resource resource)
{
- return resource.getResourceType().getCreationDataType().equals(ResourceCreationDataType.CONTENT);
+ return (resource.getResourceType().getCreationDataType().equals(ResourceCreationDataType.CONTENT));
}
private boolean hasOperations(Resource resource)
{
List operations = getManager().getOperationsForResource(resource);
- return operations != null && operations.size() > 0;
+ return (!operations.isEmpty());
}
private boolean hasMetrics(Resource resource)
{
Set metrics = resource.getResourceType().getMetricDefinitions();
- return metrics != null && metrics.size() > 0;
+ return (metrics != null && !metrics.isEmpty());
}
private boolean hasConfiguration(Resource resource)
{
- boolean hasConfiguration = false;
- ConfigurationDefinition resourceConfigurationDef =
- resource.getResourceType().getResourceConfigurationDefinition();
- if (resourceConfigurationDef != null)
- hasConfiguration = resourceConfigurationDef.getPropertyDefinitions().size() > 0;
- return hasConfiguration;
+ ConfigurationDefinition resourceConfigDef = resource.getResourceType().getResourceConfigurationDefinition();
+ return (resourceConfigDef != null && !resourceConfigDef.getPropertyDefinitions().isEmpty());
}
// @TODO Another method that we should move to CommonActionUtil. I also think there should be a way
15 years, 8 months
EMBJOPR SVN: r319 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5 and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-04-22 12:35:50 -0400 (Wed, 22 Apr 2009)
New Revision: 319
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.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
Log:
test[W|E]arConfigurationTab(Cancel)? tests disabled because of EMBJOPR-156.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-04-22 15:00:41 UTC (rev 318)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-04-22 16:35:50 UTC (rev 319)
@@ -46,6 +46,7 @@
import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException;
import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit;
@@ -374,6 +375,12 @@
public HtmlInput enableOrDisableFormInput(String propertyName, Boolean enableInput) {
HtmlForm form = (HtmlForm)client.getElement("resourceConfigurationForm");
+ if( null == form ){
+ // Wrapped. Don't want to add "throws Html..." all over the project.
+ throw new RuntimeException(new HtmlElementNotFoundException(
+ "Element #resourceConfigurationForm not found. Page dumped.", this));
+ }
+
HtmlInput input = (HtmlInput)form.getFirstByXPath(".//input[@ondblclick='//"
+ propertyName + "']");
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-22 15:00:41 UTC (rev 318)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-04-22 16:35:50 UTC (rev 319)
@@ -395,9 +395,8 @@
/**
* Changes EAR configuration, and checks whether the changes were saved.
*
- * FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void testEarConfigurationTab() throws IOException, EmbJoprTestException {
+ public void DISABLEDtestEarConfigurationTab() throws IOException, EmbJoprTestException {
// Deploy the EAR.
String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
@@ -452,9 +451,8 @@
/**
* Changes EAR configuration, and verifies that the changes were NOT saved.
*
- * FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void testEarConfigurationTabCancel() throws IOException, EmbJoprTestException {
+ public void DISABLEDtestEarConfigurationTabCancel() throws IOException, EmbJoprTestException {
// Deploy the EAR.
String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
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-22 15:00:41 UTC (rev 318)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-22 16:35:50 UTC (rev 319)
@@ -388,9 +388,8 @@
/**
* Changes WAR configuration, and checks whether the changes were saved.
*
- * FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void testWarConfigurationTab() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
+ public void DISABLEDtestWarConfigurationTab() throws IOException, EmbJoprTestException, HtmlElementNotFoundException, Exception {
final String DEPLOYABLE_NAME = BASIC_WAR_04;
@@ -406,7 +405,9 @@
// Navigate to the Configuration tab
ContentTableRow appRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(DEPLOYABLE_NAME);
appRow.getLinkByLabel(DEPLOYABLE_NAME).click();
+ DebugUtils.writeFile("target/A1.html", client.getPageAsText());
ejtt.tabMenu.clickConfigurationTab();
+ DebugUtils.writeFile("target/A2.html", client.getPageAsText());
// Read properties.
Properties props = new Properties();
@@ -447,7 +448,7 @@
*
* FAILS because some of the values are read-only. EMBJOPR-96
*/
- public void testWarConfigurationTabCancel() throws IOException, EmbJoprTestException {
+ public void DISABLEDtestWarConfigurationTabCancel() throws IOException, EmbJoprTestException {
final String DEPLOYABLE_NAME = BASIC_WAR_05;
15 years, 8 months