EMBJOPR SVN: r74 - in trunk: core/src/main/webapp/secure and 2 other directories.
by embjopr-commits@lists.jboss.org
Author: fjuma
Date: 2008-12-16 15:13:35 -0500 (Tue, 16 Dec 2008)
New Revision: 74
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
Modified:
trunk/core/src/main/webapp/include/tabMenu.xhtml
trunk/core/src/main/webapp/secure/categorySummary.xhtml
trunk/core/src/main/webapp/secure/resourceCreatePage1.xhtml
trunk/core/src/main/webapp/secure/resourceInstanceConfig.xhtml
trunk/core/src/main/webapp/secure/resourceInstanceMetrics.xhtml
trunk/jsfunit/pom.xml
Log:
Added a base test class for Embedded Jopr JSFUnit tests and added a test class that currently contains some preliminary datasource creation tests.
Added ID attributes to tags in some xhtml files.
Modified: trunk/core/src/main/webapp/include/tabMenu.xhtml
===================================================================
--- trunk/core/src/main/webapp/include/tabMenu.xhtml 2008-12-16 20:10:13 UTC (rev 73)
+++ trunk/core/src/main/webapp/include/tabMenu.xhtml 2008-12-16 20:13:35 UTC (rev 74)
@@ -72,7 +72,7 @@
<h:panelGroup layout="block"
rendered="#{activeTab ne 'configuration' and navigationAction.enabledTabs.contains('configuration')}">
<li>
- <s:link styleClass="" action="#{resourceConfigurationUIBean.resourceConfiguration()}" propagation="end">
+ <s:link id="configurationTab" styleClass="" action="#{resourceConfigurationUIBean.resourceConfiguration()}" propagation="end">
#{messages['tab.menu.configuration']}
</s:link>
</li>
@@ -97,7 +97,7 @@
<h:panelGroup layout="block"
rendered="#{activeTab ne 'metric' and navigationAction.enabledTabs.contains('metric')}">
<li>
- <s:link styleClass="" view="/secure/resourceInstanceMetrics.xhtml" propagation="end">
+ <s:link id="metricsTab" styleClass="" view="/secure/resourceInstanceMetrics.xhtml" propagation="end">
#{messages['tab.menu.metrics']}
</s:link>
</li>
Modified: trunk/core/src/main/webapp/secure/categorySummary.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/categorySummary.xhtml 2008-12-16 20:10:13 UTC (rev 73)
+++ trunk/core/src/main/webapp/secure/categorySummary.xhtml 2008-12-16 20:13:35 UTC (rev 74)
@@ -71,7 +71,7 @@
</h:selectOneMenu>
</h:form>
</div>
- <h:form>
+ <h:form id="categorySummaryForm">
<rich:dataTable
id="dataTable"
rows="#{tableManager.numRows}"
@@ -117,7 +117,8 @@
<h:outputText value="#{resourceItem.availability}"/>
</rich:column>
<rich:column>
- <s:button action="#{resourceCRUDAction.removeResourceAction()}" value="Delete"
+ <s:button id="removeButton"
+ action="#{resourceCRUDAction.removeResourceAction()}" value="Delete"
styleClass="buttonsmall"
rendered="#{resourceItem.resource.resourceType.deletable}">
<f:param name="resourceId" value="#{resourceItem.resource.id}"/>
Modified: trunk/core/src/main/webapp/secure/resourceCreatePage1.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceCreatePage1.xhtml 2008-12-16 20:10:13 UTC (rev 73)
+++ trunk/core/src/main/webapp/secure/resourceCreatePage1.xhtml 2008-12-16 20:13:35 UTC (rev 74)
@@ -36,7 +36,7 @@
<ui:include src="../include/displayGlobalMessages.xhtml"/>
<hr/>
- <h:form>
+ <h:form id="resourceCreateForm">
<h:panelGrid styleClass="formstyle">
<ui:include src="/include/formDropDownComponent.xhtml">
@@ -50,9 +50,10 @@
</ui:include>
</h:panelGrid>
<h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell">
- <h:commandButton value="#{messages['resource.add.button.continue']}"
- action="#{templateDropDownPopulator.populateFromTemplate()}"
- styleClass="buttonmed"/>
+ <h:commandButton id="addButton"
+ value="#{messages['resource.add.button.continue']}"
+ action="#{templateDropDownPopulator.populateFromTemplate()}"
+ styleClass="buttonmed"/>
<s:button value="#{messages['resource.add.button.cancel']}"
view="/secure/summary.xhtml"
styleClass="buttonmed"
Modified: trunk/core/src/main/webapp/secure/resourceInstanceConfig.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceInstanceConfig.xhtml 2008-12-16 20:10:13 UTC (rev 73)
+++ trunk/core/src/main/webapp/secure/resourceInstanceConfig.xhtml 2008-12-16 20:13:35 UTC (rev 74)
@@ -71,12 +71,14 @@
nullConfigurationStyle="infoBlock"/>
<h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell">
- <h:commandButton type="submit"
+ <h:commandButton id="saveButton"
+ type="submit"
action="#{resourceConfigurationUIBean.saveConfiguration()}"
value="Save"
alt="Click to Save Changes"
styleClass="buttonmed"/>
- <s:button value="#{messages['resource.add.button.cancel']}"
+ <s:button id="cancelButton"
+ value="#{messages['resource.add.button.cancel']}"
view="/secure/summary.xhtml"
styleClass="buttonmed"
propagation="end"/>
Modified: trunk/core/src/main/webapp/secure/resourceInstanceMetrics.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceInstanceMetrics.xhtml 2008-12-16 20:10:13 UTC (rev 73)
+++ trunk/core/src/main/webapp/secure/resourceInstanceMetrics.xhtml 2008-12-16 20:13:35 UTC (rev 74)
@@ -72,6 +72,7 @@
<h2>#{messages['metrics.resourceInstance.numericMetricValues']}</h2>
<rich:dataTable
+ id="dataTable"
value="#{measurementCategoryList}" var="category"
rendered="#{measurementCategoryList ne null}"
styleClass="controlTable"
@@ -91,7 +92,7 @@
rowClasses="oddRow,evenRow"
columnClasses="rich-table-cell, rich-table-cell, rich-table-cell-action">
<rich:column>#{measurementDefinitionMap[md.measurementData.name].displayName}</rich:column>
- <rich:column>#{md.measurementValueAndUnits}</rich:column>
+ <rich:column id="measurementValue">#{md.measurementValueAndUnits}</rich:column>
<rich:column>#{measurementDefinitionMap[md.measurementData.name].description}</rich:column>
</rich:subTable>
<f:facet name="footer"><h:graphicImage value="images/spacer.gif"/>
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2008-12-16 20:10:13 UTC (rev 73)
+++ trunk/jsfunit/pom.xml 2008-12-16 20:13:35 UTC (rev 74)
@@ -72,6 +72,11 @@
<scope>provided</scope>
<version>2.8.1</version>
</dependency>
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ </dependency>
</dependencies>
<profiles>
<profile>
@@ -102,6 +107,7 @@
result is in server.log
<jsfunit.htmlunitsnooper>enabled</jsfunit.htmlunitsnooper> -->
<jsfunit.testdata>${basedir}/testdata</jsfunit.testdata>
+ <jsfunit.deploy.dir>${basedir}/target/jboss42x/deploy</jsfunit.deploy.dir>
</systemProperties>
</container>
</configuration>
@@ -185,6 +191,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.deploy.dir>${basedir}/target/jboss5x/deploy</jsfunit.deploy.dir>
</systemProperties>
</container>
</configuration>
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTest.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTest.java 2008-12-16 20:13:35 UTC (rev 74)
@@ -0,0 +1,394 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit;
+
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlButtonInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlImage;
+import com.gargoylesoftware.htmlunit.html.HtmlSelect;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import java.io.IOException;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.mx.util.MBeanServerLocator;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import java.util.Set;
+import java.util.Iterator;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.jdom.JDOMException;
+import java.io.File;
+import java.util.Map;
+import java.util.HashMap;
+import javax.naming.InitialContext;
+import java.sql.Connection;
+import javax.sql.DataSource;
+import javax.naming.Context;
+import java.sql.SQLException;
+import org.jboss.jopr.jsfunit.EmbjoprTestCase;
+
+/**
+ * When complete, this class will contain tests for creating,
+ * configuring, and deleting various types of datasources. This
+ * test class should be run against JBAS 5.x.
+ *
+ * @author Farah Juma
+ *
+ */
+public class DatasourceTest extends EmbjoprTestCase {
+
+ // Datasource types, as they appear in the left nav
+ private final String LOCAL_TX_DATASOURCE="Local TX Datasources";
+ private final String NO_TX_DATASOURCE="No TX Datasources";
+ private final String XA_DATASOURCE="XA Datasources";
+
+ /**
+ * Create a new datasource using the given type, template, and properties.
+ *
+ * @param datasourceType must be the name of a datasource type, as it
+ * appears in the left nav (eg. "Local TX Datasources")
+ */
+ private void createDatasource(String datasourceType,
+ String datasourceTemplate,
+ Map<String, String> propertiesMap) throws IOException {
+
+ // Expand the "Datasources" tree node
+ HtmlImage resourceNodeImage = getNavTreeArrow("Datasources");
+ resourceNodeImage.click();
+
+ HtmlAnchor datasourceLink = getNavTreeLink(datasourceType);
+ datasourceLink.click();
+
+ // Add a new datasource
+ client.click("actionHeaderForm:addNewNotContent");
+ HtmlSelect menu = (HtmlSelect)client.getElement("selectedTemplate");
+ menu.setSelectedAttribute(datasourceTemplate, Boolean.TRUE);
+ client.click("resourceCreateForm:addButton");
+
+ // Configure the properties associated with this datasource
+ fillOutForm(propertiesMap);
+ }
+
+ /**
+ * Delete the datasource given by datasourceName.
+ */
+ private void deleteDatasource(String datasourceName) throws IOException {
+ HtmlAnchor datasourceLink = getNavTreeLink("Datasources");
+ datasourceLink.click();
+ HtmlButtonInput deleteButton = getDeleteButton("categorySummaryForm",
+ datasourceName);
+ deleteButton.click();
+ }
+
+ /**
+ * Use JMX to check if the datasource given by datasourceName is
+ * deployed.
+ */
+ private boolean isDatasourceDeployed(String jndiName,
+ String datasourceType) {
+ try {
+
+ ObjectName deploymentMBean;
+ ObjectName objName;
+ Object state;
+ Set dsMBeans;
+ String service;
+
+ // One of the MBeans we will need to inspect depends on
+ // the type of datasource
+ if(datasourceType.equals(LOCAL_TX_DATASOURCE)) {
+ service="LocalTxCM";
+ } else if(datasourceType.equals(NO_TX_DATASOURCE)) {
+ service="NoTxCM";
+ } else {
+ service="XATxCM";
+ }
+
+ String[] dsMBeanServices = {"DataSourceBinding",
+ "ManagedConnectionPool",
+ "ManagedConnectionFactory",
+ service};
+
+ // Query the MBean server to check if the datasource is deployed
+ MBeanServer jmxServer = MBeanServerLocator.locateJBoss();
+
+ // Inspect the following MBeans and make sure that the "State" attribute
+ // is "DEPLOYED":
+ // 1) "jboss.jca:name=TestDS,service=DataSourceBinding",type=Component
+ // 2) "jboss.jca:name=TestDS,service=ManagedConnectionPool",type=Component
+ // 3) "jboss.jca:name=TestDS,service=ManagedConnectionFactory",type=Component
+ // 4) The fourth MBean inspected depends on the type of datasource
+ for(int i = 0; i < dsMBeanServices.length; i++) {
+
+ objName = new ObjectName("jboss.deployment:id=\"jboss.jca:name="
+ + jndiName + ",service="
+ + dsMBeanServices[i] + "\",type=Component");
+
+ dsMBeans = jmxServer.queryNames(objName, null);
+ if (dsMBeans.size() != 1) return false;
+
+ deploymentMBean = (ObjectName)dsMBeans.iterator().next();
+ state = jmxServer.getAttribute(deploymentMBean, "State");
+ if(!("DEPLOYED".equals(state.toString()))) return false;
+ }
+
+ return true;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ /**
+ * checkProperties reads the *-ds.xml file corresponding to the datasource
+ * given by jndiName and compares the property values in this file to the
+ * given expected values. checkProperties returns true if all the given
+ * properties are correctly set in the *-ds.xml file and false otherwise.
+ */
+ private boolean checkProperties(String jndiName,
+ String datasourceType,
+ Map<String, String> expectedValuesMap) {
+
+ Map<String, String> actualValuesMap = new HashMap<String, String>();
+ String datasourceElementName;
+
+ try {
+
+ // Parse the *-ds.xml file
+ File file = new File(System.getProperty("jsfunit.deploy.dir")
+ + "/" + jndiName + "-ds.xml");
+
+ SAXBuilder builder = new SAXBuilder();
+ Document doc = builder.build(file);
+
+ Element root = doc.getRootElement();
+ assertTrue(root.getName().equals("datasources"));
+
+ // Get the datasource element
+ if(datasourceType.equals(LOCAL_TX_DATASOURCE)) {
+ datasourceElementName="local-tx-datasource";
+ } else if(datasourceType.equals(NO_TX_DATASOURCE)) {
+ datasourceElementName="no-tx-datasource";
+ } else {
+ datasourceElementName="xa-datasource";
+ }
+ Element datasource = root.getChild(datasourceElementName);
+
+ // Create actualValuesMap by mapping property names to
+ // property values
+ Iterator itr = (datasource.getChildren()).iterator();
+ while(itr.hasNext()) {
+ Element property = (Element)itr.next();
+ actualValuesMap.put(property.getName(), property.getValue());
+ }
+
+ // Compare the actual values to the expected ones
+ itr = expectedValuesMap.keySet().iterator();
+ while(itr.hasNext()) {
+ String key = (String)itr.next();
+ if(actualValuesMap.containsKey(key)) {
+ if(!expectedValuesMap.get(key).equals(actualValuesMap.get(key))) {
+ return false; // incorrect value
+ }
+ } else {
+ return false; // value was not set
+ }
+ }
+
+ return true;
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Connect to the database identified by the given JNDI name,
+ * using the given username and password. Return the Connection
+ * object.
+ */
+ public Connection connectDB(String jndiName, String username,
+ String password) throws Exception{
+ Context ctx = new InitialContext();
+ DataSource ds = (DataSource)ctx.lookup(jndiName);
+ return ds.getConnection(username, password);
+ }
+
+ /**
+ * Disconnect from the database.
+ */
+ public void disconnectDB(Connection con) throws SQLException {
+ if(con != null) {
+ con.close();
+ }
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite(DatasourceTest.class);
+ }
+
+ /*
+ * Some preliminary creation tests
+ */
+
+ /**
+ * Create a new datasource. Leave some property values that aren't
+ * required unset.
+ */
+ public void testCreateDatasource() throws IOException {
+ Map<String, String> propertiesMap = new HashMap<String, String>();
+
+ // The properties we want to configure
+ propertiesMap.put("jndi-name", "TestDS");
+ propertiesMap.put("user-name", "testUser");
+ propertiesMap.put("password", "password");
+ propertiesMap.put("min-pool-size", "5");
+ propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
+ propertiesMap.put("connection-url", "jdbc:hsqldb:.");
+ propertiesMap.put("idle-timeout-minutes", "20");
+ propertiesMap.put("query-timeout", "180");
+ propertiesMap.put("prepared-statement-cache-size", "2");
+ propertiesMap.put("valid-connection-checker-class-name",
+ "org.jboss.resource.adapter.jdbc.CheckValidConnectionSQL");
+ propertiesMap.put("stale-connection-checker-class-name",
+ "org.jboss.resource.adapter.jdbc.StaleConnectionChecker");
+ propertiesMap.put("exception-sorter-class-name",
+ "org.jboss.resource.adapter.jdbc.ExceptionSorter");
+ propertiesMap.put("allocation-retry", "10000");
+ propertiesMap.put("allocation-retry-wait-millis", "10000");
+ propertiesMap.put("background-validation-millis", "15000");
+ propertiesMap.put("use-try-lock", "61000");
+ propertiesMap.put("prefill", "true");
+ propertiesMap.put("share-prepared-statements", "false");
+
+ createDatasource(LOCAL_TX_DATASOURCE,
+ "default__Local TX Datasource",
+ propertiesMap);
+ client.click("resourceConfigurationForm:saveButton");
+
+ // Check for the appropriate success messages
+ String expectedMessage = "Successfully added new Local TX Datasource";
+ checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
+ assertTrue(isDatasourceDeployed(propertiesMap.get("jndi-name"),
+ LOCAL_TX_DATASOURCE));
+ assertTrue(checkProperties(propertiesMap.get("jndi-name"),
+ LOCAL_TX_DATASOURCE,
+ propertiesMap));
+
+ // TODO: need to verify that appropriate default values were
+ // set for properties that were not specified above
+
+ // Clean up
+ deleteDatasource(propertiesMap.get("jndi-name"));
+ expectedMessage = "Successfully deleted Local TX Datasource '"
+ + propertiesMap.get("jndi-name") + "'";
+ checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+ }
+
+ /**
+ * Attempt to create a new datasource but leave at least one required
+ * value unset. An error should occur.
+ */
+ public void testCreateDatasourceMissingRequiredValues() throws IOException {
+
+ // Leave jndi-name and connection-url unset
+ Map<String, String> propertiesMap = new HashMap<String, String>();
+ propertiesMap.put("user-name", "testUser");
+ propertiesMap.put("max-pool-size", "10");
+ propertiesMap.put("prefill", "true");
+ propertiesMap.put("idle-timeout-minutes", "20");
+ propertiesMap.put("set-tx-query-timeout", "true");
+ propertiesMap.put("query-timeout", "1800");
+
+ createDatasource(NO_TX_DATASOURCE, "default__No TX Datasource",
+ propertiesMap);
+ client.click("resourceConfigurationForm:saveButton");
+
+ // Check for the appropriate error messages
+ checkClientAndServerMessages("An invalid value was specified for one "
+ + "or more properties",
+ "Value is required",
+ true);
+ }
+
+ /**
+ * Attempt to create a new datasource but set a property value
+ * beyond its expected range of values. An error should occur.
+ */
+ public void testCreateDatasourcePropertyOutOfRange() throws IOException {
+ Map<String, String> propertiesMap = new HashMap<String, String>();
+ propertiesMap.put("jndi-name", "InvalidDS");
+ propertiesMap.put("user-name", "testUser");
+ propertiesMap.put("password", "password");
+ propertiesMap.put("xa-datasource-class", "org.postgresql.xa.PGXADataSource");
+ propertiesMap.put("xa-resource-timeout", "36000");
+
+ // This number is too big
+ propertiesMap.put("max-pool-size", "100000000000000");
+
+ createDatasource(XA_DATASOURCE, "default__XA Datasource",
+ propertiesMap);
+ client.click("resourceConfigurationForm:saveButton");
+
+ // Check for the appropriate error messages
+ checkClientAndServerMessages("An invalid value was specified for one or more properties",
+ "Specified attribute is not between the expected values",
+ true);
+ }
+
+ /**
+ * Attempt to create a new datasource but set a property value
+ * to an invalid type. An error should occur.
+ */
+ public void testCreateDatasourceInvalidPropertyType() throws IOException {
+ Map<String, String> propertiesMap = new HashMap<String, String>();
+ propertiesMap.put("jndi-name", "InvalidDS");
+ propertiesMap.put("min-pool-size", "10");
+ propertiesMap.put("max-pool-size", "20");
+ propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
+ propertiesMap.put("connection-url", "jdbc:hsqldb:.");
+ propertiesMap.put("share-prepared-statements", "false");
+
+ // This property value is supposed to be an integer
+ propertiesMap.put("background-validation-millis", "abcde");
+
+ createDatasource(LOCAL_TX_DATASOURCE,
+ "default__Local TX Datasource",
+ propertiesMap);
+ client.click("resourceConfigurationForm:saveButton");
+
+ // Check for the appropriate error messages
+ checkClientAndServerMessages("An invalid value was specified for one or more properties",
+ "Value is not a valid integer",
+ true);
+ }
+}
+
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2008-12-16 20:13:35 UTC (rev 74)
@@ -0,0 +1,307 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.jopr.jsfunit;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlButtonInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlImage;
+import com.gargoylesoftware.htmlunit.html.HtmlTable;
+import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
+import com.gargoylesoftware.htmlunit.html.HtmlTableCell;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.cactus.ServletTestCase;
+import org.jboss.jsfunit.framework.WebClientSpec;
+import org.jboss.jsfunit.jsfsession.JSFClientSession;
+import org.jboss.jsfunit.jsfsession.JSFServerSession;
+import org.jboss.jsfunit.jsfsession.JSFSession;
+import javax.faces.application.FacesMessage;
+
+/**
+ * This is the base test class for Embedded Jopr test cases.
+ * It supplies access to a JSFClientSession object and a JSFServerSession
+ * object. It also provides methods that make it easier to access some
+ * commonly used UI components.
+ *
+ * @author Farah Juma
+ * @author Stan Silvert
+ */
+public class EmbjoprTestCase extends ServletTestCase {
+
+ protected boolean isJBoss4;
+
+ protected JSFClientSession client;
+ protected JSFServerSession server;
+
+ /**
+ * Start a JSFUnit session by logging in to the main page. Note that
+ * because setUp() is called before each test, a new HttpSession will be
+ * created each time a test is run.
+ */
+ public void setUp() throws IOException
+ {
+ isJBoss4 = Package.getPackage("org.jboss.system.server")
+ .getImplementationVersion()
+ .startsWith("4");
+
+ // Initial JSF request
+ WebClientSpec wcSpec = new WebClientSpec("/");
+
+ // This is temporary because embedded Jopr can't find /js/rhq.js
+ wcSpec.getWebClient().setThrowExceptionOnFailingStatusCode(false);
+
+ // Always press OK for confirm dialogs
+ wcSpec.getWebClient().setConfirmHandler(new SimpleConfirmHandler(true));
+
+ wcSpec.setInitialRequestStrategy(new JoprLoginStrategy()); // logs in
+
+ JSFSession jsfSession = new JSFSession(wcSpec);
+ this.client = jsfSession.getJSFClientSession();
+ this.server = jsfSession.getJSFServerSession();
+
+ }
+
+ /**
+ * Need a standard JSFUnit API to replace this code
+ */
+ public HtmlAnchor getNavTreeLink(String linkLabel)
+ {
+ return getLinkInsideForm("navTreeForm", linkLabel);
+ }
+
+ /**
+ * Get the "Delete" button in the resources data table that corresponds
+ * to the resource given by resourceName.
+ */
+ public HtmlButtonInput getDeleteButton(String formId, String resourceName)
+ {
+ HtmlAnchor link = getLinkInsideForm(formId, resourceName);
+ // The id will look like "resourceSummaryForm:dataTable:2:resourceName"
+ // I need the row number. (2 in the above example)
+ String id = link.getIdAttribute();
+ String[] idElements = id.split(":");
+ String row = idElements[idElements.length - 2];
+ return (HtmlButtonInput)client.getElement(row + ":removeButton");
+ }
+
+ /**
+ * Finds a <a> tag inside a form that has a particular label.
+ */
+ public HtmlAnchor getLinkInsideForm(String formId, String linkLabel)
+ {
+ HtmlForm form = (HtmlForm)client.getElement(formId);
+ List links = form.getByXPath(".//a"); // get all <a> tags inside form
+
+ for (Iterator i = links.iterator(); i.hasNext();)
+ {
+ HtmlAnchor link = (HtmlAnchor)i.next();
+ String linkText = link.getTextContent();
+ if (linkText.contains(linkLabel)) return link;
+ }
+
+ throw new IllegalStateException("Nav Tree link for '"
+ + linkLabel
+ + "' not found.");
+ }
+
+ /**
+ * Finds the arrow icon in the nav tree that corresponds to the resource
+ * given by resourceName. This method is used to expand tree nodes
+ * (eg. "Web Applications (WAR)", "Datasources", etc.) in the
+ * navigation tree.
+ */
+ public HtmlImage getNavTreeArrow(String resourceName) {
+ HtmlAnchor link = getNavTreeLink(resourceName);
+ String id = link.getIdAttribute();
+
+ // An example id is: "navTreeForm:navTree:81:82:83:84::typeSummaryLink"
+ // The icon's id would be: "81:82:83:84::typeSummary:handle:img:collapsed"
+ int index = id.lastIndexOf("Link");
+ id = id.substring("navTreeForm:navTree:".length(), index)
+ + ":handle:img:collapsed";
+ return (HtmlImage)client.getElement(id);
+ }
+
+ /**
+ * Finds the value of the given metric in the given metrics
+ * data table.
+ */
+ public String getMetricValueFromTable(String metricName,
+ String tableId) {
+
+ // Get the metrics data table
+ HtmlTable metricsTable = (HtmlTable)client.getElement(tableId);
+ List<HtmlTableRow> rows = metricsTable.getRows();
+
+ // Find the appropriate metric and return its value
+ for(Iterator i = rows.iterator(); i.hasNext();) {
+
+ HtmlTableRow row = (HtmlTableRow)i.next();
+ HtmlTableCell metric = row.getCell(0);
+
+ if(metric.asText().equals(metricName)) {
+ String id = metric.getIdAttribute();
+
+ // An example id is: dataTable:0:j_id118:2:j_id119
+ String[] idElements = id.split(":");
+ String rowNum = idElements[idElements.length - 2];
+ return ((HtmlTableCell)client.getElement(rowNum
+ + ":measurementValue")).asText();
+
+ }
+ }
+
+ throw new IllegalStateException("Value of '" + metricName
+ + "' not found.");
+ }
+
+ /**
+ * fillOutForm sets the values of input boxes and "Yes/No" radio
+ * buttons on a resource configuration page using the given values.
+ *
+ * @param properties maps property names (eg. "jndi-name",
+ * "min-pool-size", etc.) to property values
+ */
+ public void fillOutForm(Map<String, String> properties) {
+ Iterator itr = properties.keySet().iterator();
+
+ // Set each property
+ while(itr.hasNext()) {
+ String propertyName = (String)itr.next();
+
+ // Enable the input if it is currently disabled
+ HtmlInput input = enableFormInput(propertyName);
+ assertFalse(input.isDisabled());
+
+ setFormInput(input, properties.get(propertyName));
+ }
+ }
+
+ /**
+ * Enable the given input box or "Yes/No" radio button that corresponds
+ * to the given property name on a resource configuration page. If the
+ * input box/radio button is already enabled, do nothing.
+ *
+ * @return the enabled input element
+ */
+ public HtmlInput enableFormInput(String propertyName) {
+ HtmlForm form = (HtmlForm)client.getElement("resourceConfigurationForm");
+ HtmlInput input = (HtmlInput)form.getFirstByXPath(".//input[@ondblclick='//"
+ + propertyName + "']");
+
+ boolean isRadioButton = input.getTypeAttribute().equals("radio");
+ String id = input.getId();
+ String xpath;
+
+ if(input.isDisabled()) {
+
+ // Find the enable/disable checkbox corresponding to this
+ // input element.
+ if(isRadioButton) {
+
+ xpath = ".//input[@onchange=\"setInputUnset(document.getElementById('"
+ + id
+ + "'), this.checked);setInputUnset(document.getElementById('"
+ + id.substring(0, id.lastIndexOf(":")) + ":1'), this.checked);\"]";
+ } else {
+ xpath = ".//input[@onchange=\"setInputUnset(document.getElementById('"
+ + id + "'), this.checked);\"]";
+ }
+
+ HtmlInput checkBox = (HtmlInput)form.getFirstByXPath(xpath);
+ checkBox.setChecked(Boolean.FALSE);
+ input = (HtmlInput)form.getFirstByXPath(".//input[@ondblclick='//"
+ + propertyName + "']");
+ }
+
+ return input;
+ }
+
+ /**
+ * Set the given input box or "Yes/No" radio button to the given value.
+ */
+ public void setFormInput(HtmlInput input, String propertyValue) {
+ boolean isRadioButton = input.getTypeAttribute().equals("radio");
+ String id = input.getId();
+
+ if(isRadioButton) {
+
+ // Check the appropriate button
+ if(propertyValue.equals("false")) {
+
+ // Get the "No" radio button
+ input = (HtmlInput)client.getElement(id.substring(0,
+ id.lastIndexOf(":"))
+ + ":1");
+ }
+
+ input.setChecked(Boolean.TRUE);
+ } else {
+ input.setValueAttribute(propertyValue);
+ }
+ }
+
+
+ /**
+ * Check that the given messages occur on the client side
+ * and server side.
+ */
+ public void checkClientAndServerMessages(String expectedClientMsg,
+ String expectedServerMsg,
+ boolean isErrorMsg) {
+ assertTrue(client.getPageAsText().contains(expectedClientMsg));
+
+ assertTrue(server.getFacesMessages().hasNext());
+ FacesMessage message = server.getFacesMessages().next();
+
+ if(isErrorMsg) {
+ assertTrue(FacesMessage.SEVERITY_ERROR.equals(message.getSeverity()));
+ } else {
+ assertTrue(FacesMessage.SEVERITY_INFO.equals(message.getSeverity()));
+ }
+
+ assertTrue(message.getDetail().contains(expectedServerMsg));
+ }
+
+ /**
+ * This just checks that the JSFServerSession object was created.
+ */
+ public void testServerSessionCreated() {
+ assertTrue(server != null);
+ }
+
+ /**
+ * This just checks that the JSFClientSession object was created.
+ */
+ public void testClientSessionCreated() {
+ assertTrue(client != null);
+ }
+}
+
16 years
EMBJOPR SVN: r72 - in trunk/core/src/main/java/org/jboss/on/embedded: manager and 3 other directories.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2008-12-15 15:13:29 -0500 (Mon, 15 Dec 2008)
New Revision: 72
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java
trunk/core/src/main/java/org/jboss/on/embedded/EmbeddedInventoryEventListener.java
trunk/core/src/main/java/org/jboss/on/embedded/manager/ResourceManager.java
trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/NonSingletonResourceTypeTreeNode.java
Log:
Rebuild content behind navigation nodes using InventoryEventListener (https://jira.jboss.org/jira/browse/EMBJOPR-55)
Modified: trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java 2008-12-12 20:11:31 UTC (rev 71)
+++ trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java 2008-12-15 20:13:29 UTC (rev 72)
@@ -76,6 +76,9 @@
@In(value = "contentHistoryManager", create = true)
private ContentHistoryManagerBean contentHistoryManager;
+ @In(value = "inventoryEventListener", create = true)
+ private EmbeddedInventoryEventListener inventoryEventListener;
+
private File tempDir;
@Create
@@ -118,7 +121,7 @@
pluginContainer.initialize();
logLoadedPlugins(pluginContainer);
// Add our inventory listener BEFORE initiating Resource discovery.
- pluginContainer.getInventoryManager().addInventoryEventListener(new EmbeddedInventoryEventListener());
+ pluginContainer.getInventoryManager().addInventoryEventListener(this.inventoryEventListener);
ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
resourceManager.discoverResources();
LOG.info("Done bootstrapping Administration Console.");
Modified: trunk/core/src/main/java/org/jboss/on/embedded/EmbeddedInventoryEventListener.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/EmbeddedInventoryEventListener.java 2008-12-12 20:11:31 UTC (rev 71)
+++ trunk/core/src/main/java/org/jboss/on/embedded/EmbeddedInventoryEventListener.java 2008-12-15 20:13:29 UTC (rev 72)
@@ -32,17 +32,32 @@
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.clientapi.agent.PluginContainerException;
+import org.jboss.seam.core.Events;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Observer;
+import org.jboss.seam.ScopeType;
+
+import org.jboss.on.embedded.manager.ResourceManager;
+
/**
* @author Ian Springer
*/
+@Name("inventoryEventListener")
+(a)Scope(ScopeType.APPLICATION)
public class EmbeddedInventoryEventListener implements InventoryEventListener
{
private final Log log = LogFactory.getLog(this.getClass());
+ private boolean navTreeInitialized;
+
public void resourcesAdded(Set<Resource> resources)
{
for (Resource resource : resources)
{
+ if (this.navTreeInitialized)
+ Events.instance().raiseEvent(ResourceManager.RESOURCE_CREATED_EVENT, resource.getResourceType(),
+ resource.getParentResource());
ResourceType resourceType = resource.getResourceType();
if (isContentBacked(resourceType))
{
@@ -66,7 +81,10 @@
public void resourcesRemoved(Set<Resource> resources)
{
- return;
+ if (this.navTreeInitialized)
+ for (Resource resource : resources)
+ Events.instance().raiseEvent(ResourceManager.RESOURCE_DELETED_EVENT, resource.getResourceType(),
+ resource.getParentResource());
}
public void resourceActivated(Resource resource)
@@ -74,6 +92,11 @@
return;
}
+ @Observer(ResourceManager.NAV_TREE_INITIALIZED)
+ public void navTreeInitialized() {
+ this.navTreeInitialized = true;
+ }
+
private static boolean isContentBacked(ResourceType resourceType)
{
return resourceType.isCreatable() && resourceType.getCreationDataType() == ResourceCreationDataType.CONTENT;
Modified: trunk/core/src/main/java/org/jboss/on/embedded/manager/ResourceManager.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/manager/ResourceManager.java 2008-12-12 20:11:31 UTC (rev 71)
+++ trunk/core/src/main/java/org/jboss/on/embedded/manager/ResourceManager.java 2008-12-15 20:13:29 UTC (rev 72)
@@ -42,6 +42,14 @@
*/
public interface ResourceManager
{
+ String RESOURCE_CREATED_EVENT = "resourceCreated";
+
+ String RESOURCE_UPDATED_EVENT = "resourceUpdated";
+
+ String RESOURCE_DELETED_EVENT = "resourceDeleted";
+
+ String NAV_TREE_INITIALIZED = "navTreeInitialized";
+
/**
* Tells this instance to discover all resources. Calls to methods in this interface will return empty data until
* resources have been discovered. This is a blocking method.
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 2008-12-12 20:11:31 UTC (rev 71)
+++ trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java 2008-12-15 20:13:29 UTC (rev 72)
@@ -253,7 +253,7 @@
if (response.getStatus() == DeleteResourceStatus.SUCCESS)
{
discoverServicesSync();
- Events.instance().raiseEvent("resourceDeleted", resource);
+ //Events.instance().raiseEvent(ResourceManager.RESOURCE_DELETED_EVENT, resource);
}
}
catch (PluginContainerException e)
@@ -291,7 +291,7 @@
if (response.getStatus() == CreateResourceStatus.SUCCESS)
{
discoverServicesSync();
- Events.instance().raiseEvent("resourceCreated", resourceType, parentResource);
+ Events.instance().raiseEvent(ResourceManager.RESOURCE_CREATED_EVENT, resourceType, parentResource);
}
}
catch (PluginContainerException e)
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 2008-12-12 20:11:31 UTC (rev 71)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/NavigationAction.java 2008-12-15 20:13:29 UTC (rev 72)
@@ -40,6 +40,7 @@
import org.jboss.on.embedded.ui.nav.ResourceTypeTreeNode;
import org.jboss.on.embedded.ui.nav.TreeNodeWithResource;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.core.Events;
import org.jboss.seam.annotations.Factory;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
@@ -56,15 +57,14 @@
import org.richfaces.component.html.HtmlTree;
/**
- * NavigationAction creates the navigation objects.
- * <p/>
- * TODO go through this class and try to ensure the minimum amount of things
- * are public. Most actions should be dealing with CommonActionUtil for getting hold of resources etc
+ * NavigationAction creates the navigation objects.
*
* @author Jessica Sant
* @author Charles Crouch
* @author Ian Springer
*/
+// TODO: Go through this class and try to ensure the minimum amount of things are public.
+// Most actions should be dealing with CommonActionUtil for getting hold of resources etc.
@Name("navigationAction")
@Scope(ScopeType.SESSION)
public class NavigationAction
@@ -139,6 +139,7 @@
DummyTreeNode dummy = new DummyTreeNode();
PlatformResourceTreeNode platform = new PlatformResourceTreeNode(ResourceManagerFactory.resourceManager().getPlatform());
dummy.addChild(platform);
+ Events.instance().raiseEvent(ResourceManager.NAV_TREE_INITIALIZED);
return dummy;
}
@@ -397,15 +398,15 @@
// TODO could consider renaming this getCurrentNavigationNode()
public JONTreeNode getSelectedNode()
{
+ log.debug("Finding node for path [" + getCurrentPath() + "]...");
JONTreeNode selectedNode = getRootNode().findNode(getCurrentPath());
- if (selectedNode == null)
- {
- // I'm seeing this on login now?
+ ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
+ if (selectedNode == null) {
+ log.debug("Unable to find node with path [" + this.currentPath + "]; defaulting to platform node...");
+ // TODO (ccrouch): I'm seeing this on login now. Comment out for now.
// String errorMsg = "Unable to find node with path [" + this.currentPath + "]; defaulting to platform node...";
// LOG.error(errorMsg);
// this.facesMessages.add(FacesMessage.SEVERITY_ERROR, errorMsg);
- log.debug("Unable to find node with path [" + this.currentPath + "]; defaulting to platform node...");
- ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
this.currentPath = getResourcePath(resourceManager.getPlatform());
selectedNode = getRootNode().findNode(this.currentPath);
}
@@ -440,7 +441,7 @@
return getResourcePath(resource.getId());
}
- @Observer("resourceCreated")
+ @Observer(ResourceManager.RESOURCE_CREATED_EVENT)
public void updateNavWithNewResource(ResourceType typeOfNewResource, Resource parentResource)
{
log.info("Resource of type [" + typeOfNewResource + "] added beneath Resource [" + parentResource + "].");
@@ -449,7 +450,7 @@
node.reInitializeChildrenMap();
}
- @Observer("resourceDeleted")
+ @Observer(ResourceManager.RESOURCE_DELETED_EVENT)
public void updateNavWithDeletedResource(Resource deletedResource)
{
log.info("Resource [" + deletedResource + "] deleted.");
@@ -465,7 +466,7 @@
parent.reInitializeChildrenMap();
}
- @Observer("resourceUpdated")
+ @Observer(ResourceManager.RESOURCE_UPDATED_EVENT)
public void updateNavWithUpdatedResource(Resource updatedResource)
{
// doesn't do anything right now, but in the future this could
@@ -509,8 +510,8 @@
public void changeExpandListener(org.richfaces.event.NodeExpandedEvent event) {
UIComponent comp = event.getComponent();
UITree tree = (UITree) comp;
- JONTreeNode data = (JONTreeNode) (tree.getTreeNode().getData());
- data.reInitializeChildrenMap();
+ JONTreeNode jonTreeNode = (JONTreeNode) (tree.getTreeNode().getData());
+ jonTreeNode.reInitializeChildrenMap();
}
// /**
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/NonSingletonResourceTypeTreeNode.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/NonSingletonResourceTypeTreeNode.java 2008-12-12 20:11:31 UTC (rev 71)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/nav/NonSingletonResourceTypeTreeNode.java 2008-12-15 20:13:29 UTC (rev 72)
@@ -61,8 +61,9 @@
public String getPath()
{
- return getParent() == null ? getName() :
- getParent().getPath() + "/" + getName();
+ String resourceTypeName = getResourceType().getName();
+ return getParent() == null ? resourceTypeName :
+ getParent().getPath() + "/" + resourceTypeName;
}
public String getName()
16 years
EMBJOPR SVN: r70 - trunk/core/src/main/webapp/secure.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2008-12-12 13:54:50 -0500 (Fri, 12 Dec 2008)
New Revision: 70
Modified:
trunk/core/src/main/webapp/secure/addMap.xhtml
trunk/core/src/main/webapp/secure/addSimple.xhtml
trunk/core/src/main/webapp/secure/editMap.xhtml
Log:
fix some incorrect viewIds
Modified: trunk/core/src/main/webapp/secure/addMap.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/addMap.xhtml 2008-12-11 21:50:09 UTC (rev 69)
+++ trunk/core/src/main/webapp/secure/addMap.xhtml 2008-12-12 18:54:50 UTC (rev 70)
@@ -40,7 +40,7 @@
<ui:define name="body">
<div class="instructionalText">
- Any values added here will not be persisted until you hit the Save button on the resource's main Edit
+ Any values added here will not be persisted until you hit the Save button on the Resource's main Edit
Configuration page.
</div>
Modified: trunk/core/src/main/webapp/secure/addSimple.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/addSimple.xhtml 2008-12-11 21:50:09 UTC (rev 69)
+++ trunk/core/src/main/webapp/secure/addSimple.xhtml 2008-12-12 18:54:50 UTC (rev 70)
@@ -46,7 +46,7 @@
</div>
<div class="instructionalText">
- Any values added here will not be persisted until you hit the Save button on the resource's main Edit
+ Any values added here will not be persisted until you hit the Save button on the Resource's main Edit
Configuration page.
</div>
@@ -68,7 +68,7 @@
action="#{addNewOpenMap.addProperty()}"
alt="Click to Add Property" styleClass="buttonmed"/>
<s:button value="#{messages['resource.configuration.map.button.cancel']}"
- view="/secure/resourceView.xhtml"
+ view="/secure/resourceInstanceConfig.xhtml"
styleClass="buttonmed"/>
</h:panelGrid>
Modified: trunk/core/src/main/webapp/secure/editMap.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/editMap.xhtml 2008-12-11 21:50:09 UTC (rev 69)
+++ trunk/core/src/main/webapp/secure/editMap.xhtml 2008-12-12 18:54:50 UTC (rev 70)
@@ -41,7 +41,7 @@
<ui:define name="body">
<p>
- Any values changed here will not be persisted until you hit the Save button on the resource's main Edit
+ Any values changed here will not be persisted until you hit the Save button on the Resource's main Edit
Configuration page.
</p>
<h:form id="resourceConfigurationForm" onsubmit="prepareInputsForSubmission(this)">
@@ -56,7 +56,7 @@
action="#{resourceConfigurationUIBean.editMap()}"
styleClass="buttonmed"/>
<s:button value="#{messages['resource.configuration.map.button.cancel']}"
- view="/secure/resourceView.xhtml"
+ view="/secure/resourceInstanceConfig.xhtml"
styleClass="buttonmed"/>
</h:panelGrid>
</h:form>
16 years
EMBJOPR SVN: r69 - in trunk: jbas5/src/main/webapp/WEB-INF and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2008-12-11 16:50:09 -0500 (Thu, 11 Dec 2008)
New Revision: 69
Modified:
trunk/jbas4/src/main/webapp/WEB-INF/jboss-web.xml
trunk/jbas5/src/main/webapp/WEB-INF/jboss-web.xml
Log:
fix DOCTYPE and element ordering in jboss-web.xml files
Modified: trunk/jbas4/src/main/webapp/WEB-INF/jboss-web.xml
===================================================================
--- trunk/jbas4/src/main/webapp/WEB-INF/jboss-web.xml 2008-12-09 21:06:12 UTC (rev 68)
+++ trunk/jbas4/src/main/webapp/WEB-INF/jboss-web.xml 2008-12-11 21:50:09 UTC (rev 69)
@@ -1,6 +1,8 @@
<?xml version="1.0"?>
-<!DOCTYPE jboss-web>
+<!DOCTYPE jboss-web PUBLIC
+ "-//JBoss//DTD Web Application 4.2//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
<!--
~ Embedded Jopr Project
@@ -21,9 +23,8 @@
~ License along with this program; if not, write to the Free Software
~ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-->
-<jboss-web>
- <context-root>${contextRoot}</context-root>
-
+<jboss-web>
+
<class-loading>
<loader-repository>
org.jboss.on:loader=embedded
@@ -32,4 +33,7 @@
</class-loading>
<security-domain>java:/jaas/jmx-console</security-domain>
+
+ <context-root>admin-console</context-root>
+
</jboss-web>
Modified: trunk/jbas5/src/main/webapp/WEB-INF/jboss-web.xml
===================================================================
--- trunk/jbas5/src/main/webapp/WEB-INF/jboss-web.xml 2008-12-09 21:06:12 UTC (rev 68)
+++ trunk/jbas5/src/main/webapp/WEB-INF/jboss-web.xml 2008-12-11 21:50:09 UTC (rev 69)
@@ -1,6 +1,8 @@
<?xml version="1.0"?>
-<!DOCTYPE jboss-web>
+<!DOCTYPE jboss-web PUBLIC
+ "-//JBoss//DTD Web Application 5.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<!--
~ Embedded Jopr Project
@@ -21,9 +23,8 @@
~ License along with this program; if not, write to the Free Software
~ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-->
-<jboss-web>
- <context-root>${contextRoot}</context-root>
-
+<jboss-web>
+
<class-loading>
<loader-repository>
org.jboss.on:loader=embedded
@@ -32,4 +33,7 @@
</class-loading>
<security-domain>java:/jaas/jmx-console</security-domain>
+
+ <context-root>admin-console</context-root>
+
</jboss-web>
16 years
EMBJOPR SVN: r68 - in trunk: core and 9 other directories.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2008-12-09 16:06:12 -0500 (Tue, 09 Dec 2008)
New Revision: 68
Added:
trunk/jbas4/src/
trunk/jbas4/src/main/
trunk/jbas4/src/main/webapp/
trunk/jbas4/src/main/webapp/WEB-INF/
trunk/jbas4/src/main/webapp/WEB-INF/jboss-web.xml
trunk/jbas5/src/main/webapp/WEB-INF/
trunk/jbas5/src/main/webapp/WEB-INF/jboss-web.xml
Modified:
trunk/core/pom.xml
trunk/core/src/main/webapp/WEB-INF/jboss-web.xml
trunk/jbas4/pom.xml
trunk/jbas5/pom.xml
trunk/pom.xml
Log:
specify context-root in jboss-web.xml (https://jira.jboss.org/jira/browse/EMBJOPR-32)
Modified: trunk/core/pom.xml
===================================================================
--- trunk/core/pom.xml 2008-12-09 05:28:56 UTC (rev 67)
+++ trunk/core/pom.xml 2008-12-09 21:06:12 UTC (rev 68)
@@ -275,12 +275,6 @@
${basedir}/src/main/webapp
</directory>
</resource>
- <!-- Enabling this will include any plugins in the main/plugins/plugins directory to be included
- in the WAR.
- <resource>
- <directory>${basedir}/src/main/plugins</directory>
- </resource>
- -->
<resource>
<directory>
${basedir}/src/main/webappBinary
Modified: trunk/core/src/main/webapp/WEB-INF/jboss-web.xml
===================================================================
--- trunk/core/src/main/webapp/WEB-INF/jboss-web.xml 2008-12-09 05:28:56 UTC (rev 67)
+++ trunk/core/src/main/webapp/WEB-INF/jboss-web.xml 2008-12-09 21:06:12 UTC (rev 68)
@@ -1,3 +1,7 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE jboss-web>
+
<!--
~ Embedded Jopr Project
~ Copyright (C) 2006-2008 Red Hat, Inc.
@@ -26,4 +30,4 @@
</class-loading>
<security-domain>java:/jaas/jmx-console</security-domain>
-</jboss-web>
\ No newline at end of file
+</jboss-web>
Modified: trunk/jbas4/pom.xml
===================================================================
--- trunk/jbas4/pom.xml 2008-12-09 05:28:56 UTC (rev 67)
+++ trunk/jbas4/pom.xml 2008-12-09 21:06:12 UTC (rev 68)
@@ -29,6 +29,7 @@
<jopr-embedded-core.version>1.1.0-SNAPSHOT</jopr-embedded-core.version>
<warDir>${basedir}/target/${project.build.finalName}</warDir>
<warFile>${warDir}.war</warFile>
+ <contextRoot>admin-console</contextRoot>
</properties>
<dependencies>
@@ -94,21 +95,23 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
- <useCache>false</useCache>
- <archive>
- <manifest>
- <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- </manifest>
- </archive>
+ <webResources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>
+ ${basedir}/src/main/webapp
+ </directory>
+ </resource>
+ </webResources>
<overlays>
<overlay>
+ <!-- empty groupId/artifactId detected as the current build.
+ earlier overlays win over later overlays, so put ourselves first. -->
+ </overlay>
+ <overlay>
<groupId>org.jboss.jopr</groupId>
<artifactId>jopr-embedded-core</artifactId>
</overlay>
- <overlay>
- <!-- empty groupId/artifactId detected as the current build -->
- </overlay>
</overlays>
</configuration>
</plugin>
Added: trunk/jbas4/src/main/webapp/WEB-INF/jboss-web.xml
===================================================================
--- trunk/jbas4/src/main/webapp/WEB-INF/jboss-web.xml (rev 0)
+++ trunk/jbas4/src/main/webapp/WEB-INF/jboss-web.xml 2008-12-09 21:06:12 UTC (rev 68)
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE jboss-web>
+
+<!--
+ ~ 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.
+ -->
+<jboss-web>
+ <context-root>${contextRoot}</context-root>
+
+ <class-loading>
+ <loader-repository>
+ org.jboss.on:loader=embedded
+ <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
+ </loader-repository>
+ </class-loading>
+
+ <security-domain>java:/jaas/jmx-console</security-domain>
+</jboss-web>
Property changes on: trunk/jbas4/src/main/webapp/WEB-INF/jboss-web.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ Date Author Id Revision HeadURL
Name: svn:eol-style
+ LF
Modified: trunk/jbas5/pom.xml
===================================================================
--- trunk/jbas5/pom.xml 2008-12-09 05:28:56 UTC (rev 67)
+++ trunk/jbas5/pom.xml 2008-12-09 21:06:12 UTC (rev 68)
@@ -29,6 +29,7 @@
<jopr-embedded-core.version>1.1.0-SNAPSHOT</jopr-embedded-core.version>
<warDir>${basedir}/target/${project.build.finalName}</warDir>
<warFile>${warDir}.war</warFile>
+ <contextRoot>admin-console</contextRoot>
</properties>
<dependencies>
@@ -72,21 +73,23 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
- <useCache>false</useCache>
- <archive>
- <manifest>
- <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- </manifest>
- </archive>
+ <webResources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>
+ ${basedir}/src/main/webapp
+ </directory>
+ </resource>
+ </webResources>
<overlays>
<overlay>
+ <!-- empty groupId/artifactId detected as the current build.
+ earlier overlays win over later overlays, so put ourselves first. -->
+ </overlay>
+ <overlay>
<groupId>org.jboss.jopr</groupId>
<artifactId>jopr-embedded-core</artifactId>
</overlay>
- <overlay>
- <!-- empty groupId/artifactId detected as the current build -->
- </overlay>
</overlays>
</configuration>
</plugin>
Added: trunk/jbas5/src/main/webapp/WEB-INF/jboss-web.xml
===================================================================
--- trunk/jbas5/src/main/webapp/WEB-INF/jboss-web.xml (rev 0)
+++ trunk/jbas5/src/main/webapp/WEB-INF/jboss-web.xml 2008-12-09 21:06:12 UTC (rev 68)
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE jboss-web>
+
+<!--
+ ~ 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.
+ -->
+<jboss-web>
+ <context-root>${contextRoot}</context-root>
+
+ <class-loading>
+ <loader-repository>
+ org.jboss.on:loader=embedded
+ <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
+ </loader-repository>
+ </class-loading>
+
+ <security-domain>java:/jaas/jmx-console</security-domain>
+</jboss-web>
Property changes on: trunk/jbas5/src/main/webapp/WEB-INF/jboss-web.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ Date Author Id Revision HeadURL
Name: svn:eol-style
+ LF
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-12-09 05:28:56 UTC (rev 67)
+++ trunk/pom.xml 2008-12-09 21:06:12 UTC (rev 68)
@@ -52,8 +52,8 @@
</issueManagement>
<properties>
- <jbas4.finalName>admin-console</jbas4.finalName>
- <jbas5.finalName>admin-console</jbas5.finalName>
+ <jbas4.finalName>jbas4-admin-console</jbas4.finalName>
+ <jbas5.finalName>jbas5-admin-console</jbas5.finalName>
<!-- dependency groupIds -->
<rhq.groupId>org.rhq</rhq.groupId>
@@ -82,7 +82,8 @@
<artifactId>maven-war-plugin</artifactId>
<configuration>
<useCache>false</useCache>
- <archive>
+
+ <archive>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
@@ -92,7 +93,7 @@
at the time the buildNumber prop below is resolved. -->
<Build-Number>${buildNumber}</Build-Number>
</manifestEntries>
- </archive>
+ </archive>
</configuration>
</plugin>
16 years
EMBJOPR SVN: r67 - trunk/core/src/main/webapp/secure.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2008-12-09 00:28:56 -0500 (Tue, 09 Dec 2008)
New Revision: 67
Modified:
trunk/core/src/main/webapp/secure/addMap.xhtml
trunk/core/src/main/webapp/secure/addSimple.xhtml
trunk/core/src/main/webapp/secure/viewResultsMap.xhtml
Log:
some css tweaks
Modified: trunk/core/src/main/webapp/secure/addMap.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/addMap.xhtml 2008-12-09 05:13:32 UTC (rev 66)
+++ trunk/core/src/main/webapp/secure/addMap.xhtml 2008-12-09 05:28:56 UTC (rev 67)
@@ -39,10 +39,11 @@
<ui:param name="pageTitle" value="#{resource.resource.name} - Add Map To List '#{param.listName}']"/>
<ui:define name="body">
- <p>
+ <div class="instructionalText">
Any values added here will not be persisted until you hit the Save button on the resource's main Edit
Configuration page.
- </p>
+ </div>
+
<h:form id="editResourceConfigurationForm" onsubmit="prepareInputsForSubmission(this)">
<onc:config configurationDefinition="#{resourceConfigurationUIBean.configurationDefinition}"
Modified: trunk/core/src/main/webapp/secure/addSimple.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/addSimple.xhtml 2008-12-09 05:13:32 UTC (rev 66)
+++ trunk/core/src/main/webapp/secure/addSimple.xhtml 2008-12-09 05:28:56 UTC (rev 67)
@@ -40,15 +40,16 @@
<ui:define name="body">
- <p>
+ <div class="instructionalText">
Enter a name and a value for the property to be added to the map '#{param.mapName}',
then click OK to return to the '#{resource.resource.name}' resource's main Edit Configuration page.
- </p>
+ </div>
- <p>
+ <div class="instructionalText">
Any values added here will not be persisted until you hit the Save button on the resource's main Edit
Configuration page.
- </p>
+ </div>
+
<h:form id="addNewOpenMapMemberPropertyForm">
<input type="hidden" name="mapName" value="#{param.mapName}"/>
Modified: trunk/core/src/main/webapp/secure/viewResultsMap.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/viewResultsMap.xhtml 2008-12-09 05:13:32 UTC (rev 66)
+++ trunk/core/src/main/webapp/secure/viewResultsMap.xhtml 2008-12-09 05:28:56 UTC (rev 67)
@@ -43,14 +43,12 @@
<ui:define name="body">
- <p>
+ <div class="instructionalText">
Below is the #{param.listName}[#{param.listIndex}] item from the results of the
execution of the #{operationAction.getOperationHistory(param.configId).operationDefinition.displayName}
operation.
- </p>
+ </div>
- <p/>
-
<h:form id="resourceConfigurationForm" onsubmit="prepareInputsForSubmission(this)">
<onc:config configurationDefinition="#{operationAction.getOperationHistory(param.configId).operationDefinition.resultsConfigurationDefinition}"
16 years
EMBJOPR SVN: r66 - in trunk/core/src/main: java/org/jboss/on/embedded/manager/history and 4 other directories.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2008-12-09 00:13:32 -0500 (Tue, 09 Dec 2008)
New Revision: 66
Added:
trunk/core/src/main/webapp/secure/viewResultsMap.xhtml
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/OperationServerServiceImpl.java
trunk/core/src/main/java/org/jboss/on/embedded/manager/history/AbstractHistoryManager.java
trunk/core/src/main/java/org/jboss/on/embedded/manager/history/HistoryManager.java
trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceOperationAction.java
trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
trunk/core/src/main/webapp/WEB-INF/pages.xml
Log:
maps inside operation results can now be viewed (https://jira.jboss.org/jira/browse/EMBJOPR-52)
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 2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationHistoryManagerBean.java 2008-12-09 05:13:32 UTC (rev 66)
@@ -54,7 +54,7 @@
if (operationDefinition != null)
{
- String jobName = "" + jobNameId.incrementAndGet();
+ String jobName = String.valueOf(jobNameId.incrementAndGet());
operationHistory =
new ResourceOperationHistory(jobName,
"",
@@ -63,13 +63,14 @@
parameters,
resource,
null); //GroupOperationHistory
+ operationHistory.setId(operationHistory.getJobId().hashCode());
addToMaps(operationHistory, resource, resourceType);
}
return operationHistory;
}
- private OperationDefinition getOperationDefinition(String operationName, ResourceType resourceType)
+ private static OperationDefinition getOperationDefinition(String operationName, ResourceType resourceType)
{
Set<OperationDefinition> operationDefinitions = resourceType.getOperationDefinitions();
OperationDefinition operationDefinition = null;
@@ -82,6 +83,7 @@
}
return operationDefinition;
}
+
protected String getJobId(OperationHistory history)
{
return history.getJobId().toString();
Modified: trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationServerServiceImpl.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationServerServiceImpl.java 2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/java/org/jboss/on/embedded/bean/history/operation/OperationServerServiceImpl.java 2008-12-09 05:13:32 UTC (rev 66)
@@ -53,6 +53,7 @@
history.setStatus(OperationRequestStatus.SUCCESS);
if (history instanceof ResourceOperationHistory)
{
+ results.setId(history.getId());
((ResourceOperationHistory)history).setResults(results);
}
}
Modified: trunk/core/src/main/java/org/jboss/on/embedded/manager/history/AbstractHistoryManager.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/manager/history/AbstractHistoryManager.java 2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/java/org/jboss/on/embedded/manager/history/AbstractHistoryManager.java 2008-12-09 05:13:32 UTC (rev 66)
@@ -21,7 +21,6 @@
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
-import org.jboss.on.embedded.manager.history.HistoryManager;
import java.util.ArrayList;
import java.util.Collection;
Modified: trunk/core/src/main/java/org/jboss/on/embedded/manager/history/HistoryManager.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/manager/history/HistoryManager.java 2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/java/org/jboss/on/embedded/manager/history/HistoryManager.java 2008-12-09 05:13:32 UTC (rev 66)
@@ -26,7 +26,6 @@
public interface HistoryManager<T>
{
-
public T getHistory(String historyId);
public Collection<T> getAllHistory();
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 2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceOperationAction.java 2008-12-09 05:13:32 UTC (rev 66)
@@ -47,6 +47,8 @@
import java.util.Comparator;
import java.util.List;
import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
import javax.faces.application.FacesMessage;
@@ -79,6 +81,8 @@
@Out(required = false)
private List<ResourceOperationHistory> operationHistory;
+ Map<Integer, ResourceOperationHistory> operationHistoryMap = new HashMap<Integer, ResourceOperationHistory>();
+
@Out(required = false)
private OperationDefinition selectedOperation;
@@ -112,7 +116,8 @@
initSelectedOperationInfo();
return "missingParams";
} else {
- OperationHistory newOperationHistory = this.historyManager.addOperationHistory(operationDef.getName(), null, this.currentResource, resourceType);
+ OperationHistory newOperationHistory = this.historyManager.addOperationHistory(operationDef.getName(), null,
+ this.currentResource, resourceType);
newOperationHistory.setParameters(this.selectedOperationParameters);
ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
String jobId = newOperationHistory.getJobId().toString();
@@ -174,6 +179,10 @@
return styleClass;
}
+ public ResourceOperationHistory getOperationHistory(int jobId) {
+ return this.operationHistoryMap.get(jobId);
+ }
+
private ResourceType getResourceType() {
currentResource = commonActionUtil.getCurrentResource();
//noinspection UnnecessaryLocalVariable
@@ -194,9 +203,10 @@
if (opHistories != null)
{
operationHistory = new ArrayList<ResourceOperationHistory>();
- for (OperationHistory opHistory : opHistories)
- {
- this.operationHistory.add((ResourceOperationHistory)opHistory);
+ for (OperationHistory opHistory : opHistories) {
+ ResourceOperationHistory resourceOpHistory = (ResourceOperationHistory)opHistory;
+ this.operationHistory.add(resourceOpHistory);
+ this.operationHistoryMap.put(resourceOpHistory.getId(), resourceOpHistory);
}
Collections.sort(operationHistory, new Comparator<OperationHistory>()
@@ -225,6 +235,12 @@
}
}
+ public Map<Integer, ResourceOperationHistory> getOperationHistoryMap()
+ {
+
+ return operationHistoryMap;
+ }
+
private void initSelectedOperationInfo()
{
ResourceType resourceType = getResourceType();
Modified: trunk/core/src/main/webapp/WEB-INF/classes/messages.properties
===================================================================
--- trunk/core/src/main/webapp/WEB-INF/classes/messages.properties 2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/webapp/WEB-INF/classes/messages.properties 2008-12-09 05:13:32 UTC (rev 66)
@@ -137,6 +137,8 @@
control.resourceInstance.previous.parameters=Parameters
control.resourceInstance.previous.results=Results
control.resourceInstance.previous.error=Error
+control.resourceInstance.previous.map.button.ok=OK
+control.resourceInstance.previous.map.buttonLabel.ok=Return to Control Tab
#This is a workaround for JBMANCON-370. This can be deleted once
#JBMANCON-370 is resolved.
Modified: trunk/core/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- trunk/core/src/main/webapp/WEB-INF/pages.xml 2008-12-03 22:40:33 UTC (rev 65)
+++ trunk/core/src/main/webapp/WEB-INF/pages.xml 2008-12-09 05:13:32 UTC (rev 66)
@@ -140,7 +140,11 @@
<!-- Run this method before rendering the page. -->
<action execute="#{operationAction.initOperationsAndHistory()}"/>
-
+
+ <navigation from-action="#{ConfigHelperUIBean.accessMap}">
+ <render view-id="/secure/viewResultsMap.xhtml"/>
+ </navigation>
+
<navigation from-action="#{operationAction.invokeOperation()}">
<rule if-outcome="missingParams">
<render view-id="/secure/operationParameters.xhtml"/>
Added: trunk/core/src/main/webapp/secure/viewResultsMap.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/viewResultsMap.xhtml (rev 0)
+++ trunk/core/src/main/webapp/secure/viewResultsMap.xhtml 2008-12-09 05:13:32 UTC (rev 66)
@@ -0,0 +1,80 @@
+<?xml version="1.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.
+ -->
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:onc="http://jboss.org/on/component">
+
+THIS TEXT WILL BE REMOVED.
+
+<ui:composition template="/layout.xhtml">
+
+ THIS TEXT WILL BE REMOVED AS WELL.
+
+ <ui:define name="pagetitle">
+ '#{operationAction.getOperationHistory(param.configId).operationDefinition.displayName}' Operation -
+ Results Item: #{param.listName}[#{param.listIndex}]
+ </ui:define>
+
+ <ui:define name="body">
+
+ <p>
+ Below is the #{param.listName}[#{param.listIndex}] item from the results of the
+ execution of the #{operationAction.getOperationHistory(param.configId).operationDefinition.displayName}
+ operation.
+ </p>
+
+ <p/>
+
+ <h:form id="resourceConfigurationForm" onsubmit="prepareInputsForSubmission(this)">
+
+ <onc:config configurationDefinition="#{operationAction.getOperationHistory(param.configId).operationDefinition.resultsConfigurationDefinition}"
+ configuration="#{operationAction.getOperationHistory(param.configId).results}"
+ listName="#{param.listName}"
+ listIndex="#{param.listIndex}"
+ readOnly="true"/>
+
+ <h:panelGrid columns="1" styleClass="buttons-table" columnClasses="button-cell">
+ <h:panelGroup layout="block">
+ <div title="#{messages['control.resourceInstance.previous.map.buttonLabel.ok']}"
+ onclick="history.back()" class="buttonmed">
+ #{messages['control.resourceInstance.previous.map.button.ok']}
+ </div>
+ </h:panelGroup>
+ </h:panelGrid>
+
+ </h:form>
+
+ </ui:define>
+
+</ui:composition>
+
+THIS TEXT WILL BE REMOVED AS WELL.
+
+</html>
+
\ No newline at end of file
Property changes on: trunk/core/src/main/webapp/secure/viewResultsMap.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:keywords
+ Date Author Id Revision HeadURL
Name: svn:eol-style
+ LF
16 years
EMBJOPR SVN: r65 - trunk/core/src/main/webapp/secure.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2008-12-03 17:40:33 -0500 (Wed, 03 Dec 2008)
New Revision: 65
Modified:
trunk/core/src/main/webapp/secure/resourceInstanceConfig.xhtml
Log:
for config-based resource creates, even read-only props should be editable, even when they are not unset (https://jira.jboss.org/jira/browse/EMBJOPR-47)
Modified: trunk/core/src/main/webapp/secure/resourceInstanceConfig.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceInstanceConfig.xhtml 2008-12-03 22:36:59 UTC (rev 64)
+++ trunk/core/src/main/webapp/secure/resourceInstanceConfig.xhtml 2008-12-03 22:40:33 UTC (rev 65)
@@ -65,6 +65,7 @@
<onc:config configurationDefinition="#{resourceConfigurationUIBean.configurationDefinition}"
configuration="#{resourceConfigurationUIBean.configuration}"
+ fullyEditable="#{resourceConfigurationUIBean.actionType eq 'CREATE'}"
nullConfigurationDefinitionMessage="#{resourceConfigurationUIBean.nullConfigurationDefinitionMessage}"
nullConfigurationMessage="#{resourceConfigurationUIBean.nullConfigurationMessage}"
nullConfigurationStyle="infoBlock"/>
16 years
EMBJOPR SVN: r64 - trunk/core/src/main/java/org/jboss/on/embedded/ui/configuration/resource.
by embjopr-commits@lists.jboss.org
Author: ips
Date: 2008-12-03 17:36:59 -0500 (Wed, 03 Dec 2008)
New Revision: 64
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/ui/configuration/resource/ResourceConfigurationUIBean.java
Log:
for config-based resource create and update, the Seam conversation should only be ended on "success" or "cancel" outcomes (https://jira.jboss.org/jira/browse/EMBJOPR-46)
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 2008-12-03 22:12:24 UTC (rev 63)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/configuration/resource/ResourceConfigurationUIBean.java 2008-12-03 22:36:59 UTC (rev 64)
@@ -20,7 +20,6 @@
package org.jboss.on.embedded.ui.configuration.resource;
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
@@ -42,7 +41,6 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.core.Events;
import org.jboss.seam.faces.FacesMessages;
import javax.faces.application.FacesMessage;
@@ -159,7 +157,7 @@
*
* @return String Results of the save success or failure.
*/
- @End
+ @End(ifOutcome={"success, cancel"}, beforeRedirect = true)
public String saveConfiguration()
{
String result = Constants.OUTCOME_FAILURE;
@@ -181,32 +179,36 @@
private String updateConfiguration()
{
- String result = Constants.OUTCOME_FAILURE;
- Configuration configuration = getConfiguration();
+ String result;
+ Configuration resourceConfig = getConfiguration();
ConfigurationUpdateResponse updateResponse = configurationManager.updateResource(this.listItem.getResource(),
- configuration);
+ resourceConfig);
- if (updateResponse.getStatus() == ConfigurationUpdateStatus.FAILURE)
- {
- String baseMessage = this.messages.getString("resource.status.update.failure");
- addActionFailureMessageToFacesMessages(baseMessage, updateResponse.getErrorMessage());
- addPropertyErrorsToFacesMessages(updateResponse.getConfiguration());
+ switch (updateResponse.getStatus()) {
+ case SUCCESS:
+ {
+ facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO, "resource.status.update.success",
+ this.listItem.getResource().getResourceType().getName(), this.listItem.getResource().getName());
+ result = Constants.OUTCOME_SUCCESS;
+ break;
+ }
+ default:
+ {
+ String baseMessage = this.messages.getString("resource.status.update.failure");
+ addActionFailureMessageToFacesMessages(baseMessage, updateResponse.getErrorMessage());
+ addPropertyErrorsToFacesMessages(updateResponse.getConfiguration());
+ result = Constants.OUTCOME_FAILURE;
+ }
}
- else
- {
- facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO, "resource.status.update.success",
- this.listItem.getResource().getResourceType().getName(), this.listItem.getResource().getName());
- result = Constants.OUTCOME_SUCCESS;
- }
return result;
}
private String createConfiguration()
{
- String result = Constants.OUTCOME_CANCEL;
- Configuration configuration = getConfiguration();
+ String result;
+ Configuration resourceConfig = getConfiguration();
Configuration pluginConfig = null;
if (serviceType != null)
@@ -217,21 +219,23 @@
pluginConfig = configDef.getDefaultTemplate().getConfiguration();
}
}
- CreateResourceResponse response = configurationManager.createResource("newResource", serviceType, ancestorResource, pluginConfig, configuration);
+ CreateResourceResponse response = configurationManager.createResource("newResource", serviceType,
+ ancestorResource, pluginConfig, resourceConfig);
switch (response.getStatus())
{
case SUCCESS:
{
- facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO, "resource.status.create.success", serviceType.getName());
+ facesMessages.addFromResourceBundle(FacesMessage.SEVERITY_INFO, "resource.status.create.success",
+ serviceType.getName());
result = Constants.OUTCOME_SUCCESS;
break;
}
- case TIMED_OUT:
- case FAILURE:
+ default:
{
String baseMessage = this.messages.getString("resource.status.create.failure");
addActionFailureMessageToFacesMessages(baseMessage, response.getErrorMessage());
addPropertyErrorsToFacesMessages(response.getResourceConfiguration());
+ result = Constants.OUTCOME_FAILURE;
break;
}
}
16 years