Index: cluster/src/main/resources/cluster/clusterNew.jsf =================================================================== --- cluster/src/main/resources/cluster/clusterNew.jsf (revision 51696) +++ cluster/src/main/resources/cluster/clusterNew.jsf (working copy) @@ -81,21 +81,42 @@ mapPut(map="#{requestScope.ct}" key="config" value="$pageSession{config}"); mapPut(map="#{requestScope.ct}" key="id" value="#{pageSession.name}" ); gf.createEntity( endpoint="#{sessionScope.REST_URL}/clusters/cluster" attrs="#{requestScope.ct}") - - if (#{clusterType}) { + + if ('#{pageSession.jmsConfigType}=Custom') { createMap(result="#{requestScope.jmsAttrs}"); mapPut(map="#{requestScope.jmsAttrs}" key="clustertype" value="$pageSession{clusterType}"); - mapPut(map="#{requestScope.jmsAttrs}" key="configStoreType" value="$pageSession{configStoreType}"); - mapPut(map="#{requestScope.jmsAttrs}" key="messageStoreType" value="$pageSession{messageStoreType}"); - if (#{dbVendor}) { - mapPut(map="#{requestScope.jmsAttrs}" key="dbVendor" value="$pageSession{dbVendor}"); + mapPut(map="#{requestScope.jmsAttrs}" key="property" value="$pageSession{properties}"); + if ('$pageSession{clusterType}=conventional') { + mapPut(map="#{requestScope.jmsAttrs}" key="configStoreType" value="$pageSession{configStoreType}"); + mapPut(map="#{requestScope.jmsAttrs}" key="messageStoreType" value="$pageSession{messageStoreType}"); } - if (#{dbUser}) { - mapPut(map="#{requestScope.jmsAttrs}" key="dbUser" value="$pageSession{dbUser}"); + + // Save JMS integration type + createMap(result="#{requestScope.jmsSvcAttrs}"); + mapPut(map="#{requestScope.jmsSvcAttrs}" key="type" value="#{jmsTypeOptionGrp}"); + gf.createEntity(endpoint="#{sessionScope.REST_URL}/configs/config/#{pageSession.config}/jms-service" + attrs="#{requestScope.jmsSvcAttrs}"); + + if ('($pageSession{messageStoreType}=jdbc) || ($pageSession{clusterType}=enhanced)') { + if (#{dbVendor}) { + mapPut(map="#{requestScope.jmsAttrs}" key="dbVendor" value="$pageSession{dbVendor}"); + } + if (#{dbUser}) { + mapPut(map="#{requestScope.jmsAttrs}" key="dbUser" value="$pageSession{dbUser}"); + } + if (#{dbUrl}) { + mapPut(map="#{requestScope.jmsAttrs}" key="dbUrl" value="$pageSession{dbUrl}"); + } + if ('$pageSession{authType}=password') { + mapPut(map="#{requestScope.jmsAttrs}" key="jmsdbpassword" value="#{pageSession.pswdText}") + } + if ('$pageSession{authType}=alias') { + gf.convertToAlias(in="#{pageSession.pswdAlias}" out="#{requestScope.tmpv}"); + mapPut(map="#{requestScope.jmsAttrs}" key="jmsdbpassword" value="#{requestScope.tmpv}") + } } - if (#{dbUrl}) { - mapPut(map="#{requestScope.jmsAttrs}" key="dbUrl" value="$pageSession{dbUrl}"); - } + + println("**************** requestScope.jmsAttrs = #{requestScope.jmsAttrs}"); gf.restRequest(endpoint="#{sessionScope.REST_URL}/clusters/cluster/#{pageSession.name}/configure-jms-cluster", attrs="#{requestScope.jmsAttrs}", method="post", Index: cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties =================================================================== --- cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties (revision 51696) +++ cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties (working copy) @@ -341,15 +341,42 @@ cluster.jms.ClusterTypeName=JMS Cluster Type: cluster.jms.configStoreType=JMS Config Store Type: cluster.jms.configStoreTypeHelp=The type of data store for configuration data in a conventional cluster. +cluster.jms.configStoreTypeMasterBroker=Master Broker +cluster.jms.configStoreTypeSharedDb=Shared DB + cluster.jms.messageStoreType=JMS Message Store Type: cluster.jms.messageStoreTypeHelp=The type of data store for message data in brokers in a conventional cluster. +cluster.jms.messageStoreTypeFile=File +cluster.jms.messageStoreTypeJdbc=JDBC + cluster.jms.dbvendor=Database Vendor: cluster.jms.dbUser=Database User: cluster.jms.dbUrl=Database URL: + cluster.jms.ConfigureJmsClusterFailure=The server cluster has NOT been created. An error occurred while configuring the JMS cluster: -cluster.jms.ConfigType=Message Queue Cluster Config Type +cluster.jms.ConfigType=Message Queue Cluster Config Type: cluster.jms.ConfigTypeHelp=If the basic configuration is selected, the message queue cluster will be a conventional cluster with a master broker config store and a file-based message store. +cluster.jms.ConfigTypeBasic=Default: Embedded Conventional Cluster with Master Broker +cluster.jms.ConfigTypeCustom=Custom +cluster.jms.Type=JMS Service Type: +cluster.jms.jmsIntegrationTypeEmbedded=Embedded +cluster.jms.jmsIntegrationTypeLocal=Local +cluster.jms.jmsIntegrationTypeRemote=Remote + +cluster.jms.mqClusterTypeConventional=Conventional +cluster.jms.mqClusterTypeEnhanced=Enhanced (HA) + +cluster.jms.dbUserPasswordSelect=User Authentication +cluster.jms.dbUserPasswordSelectHelp=Select how the user is authenticated when connecting to the datastore. +cluster.jms.dbUserPassword=User Password +cluster.jms.dbUserPasswordHelp=Type the password that the user will use for logging in to the datastore. +cluster.jms.dbUserPasswordAlias=Password Alias +cluster.jms.dbUserPasswordAliasHelp=Select an existing password alias. Password Aliases page to create an alias. + +cluster.jms.properties=JMS Cluster Properties +cluster.jms.propertiesHelp=Properties for the JMS cluster, entered as colon-delimited key=value pairs (e.g., prop1=value1:prop2=value2\\:with\\:colons:prop3=value3) + button.listEjbTimers=List EJB Timers... clusters.ejbTimers.TableTitle=EJB Timers clusters.ejbTimers.PageTitle=EJB Timers Index: jms-plugin/src/main/resources/configureJmsClusterDropDown.inc =================================================================== --- jms-plugin/src/main/resources/configureJmsClusterDropDown.inc (revision 51696) +++ jms-plugin/src/main/resources/configureJmsClusterDropDown.inc (working copy) @@ -38,19 +38,23 @@ only if the new code is made subject to such option by the copyright holder. --> + - - $page{jmsPropertyDropDownId}); - /> - -" + label="$resource{i18ncs.cluster.jms.ConfigType}"> + + "
+ + "
+ + +
Index: jms-plugin/src/main/resources/configureJmsClusterSheet.inc =================================================================== --- jms-plugin/src/main/resources/configureJmsClusterSheet.inc (revision 51696) +++ jms-plugin/src/main/resources/configureJmsClusterSheet.inc (working copy) @@ -38,24 +38,47 @@ only if the new code is made subject to such option by the copyright holder. --> + +#include "/common/shared/commonHandlers.inc" - + label="$resource{i18ncs.cluster.jms.ClusterTypeName}"> + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + - $page{jmsPropertySheetId}); - /> - \ No newline at end of file + Index: jms-plugin/src/main/resources/configureJmsCluster.js =================================================================== --- jms-plugin/src/main/resources/configureJmsCluster.js (revision 0) +++ jms-plugin/src/main/resources/configureJmsCluster.js (revision 0) @@ -0,0 +1,66 @@ +function updateUI() { + function getDisplay(elem) { + return document.getElementById(elem).style.display; + } + + function setDisplay(elem, value) { + return document.getElementById(elem).style.display = value; + } + + + var sheet = 'propertyForm:jmsPropertySheet'; + var jmsBasicConfig = document.getElementById('propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:optBasic').checked; + var jmsCustomConfig = document.getElementById('propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:optCustom').checked; + if (!(jmsBasicConfig || jmsCustomConfig)) { + document.getElementById('propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:optBasic').checked = true; + jmsBasicConfig = true; + } + var baseId = sheet + ':configureJmsClusterSection'; + var clusterType = document.getElementById(baseId+':ClusterTypeProp:clusterType').value; + var messageStoreType = document.getElementById(baseId+':MessageStoreTypeProp:messageStoreType').value; + var pwdSel = document.getElementById(baseId+':PswdSelProp:pwdSel').value; + + if (jmsBasicConfig) { + setDisplay(sheet, 'none'); + } else { + setDisplay(sheet, 'block'); + } + + if (clusterType == 'enhanced') { + setDisplay(baseId+':jmsTypeProp:optEmbedded_span', 'none'); + setDisplay(baseId+':ConfigStoreTypeProp', 'none'); + setDisplay(baseId+':MessageStoreTypeProp', 'none'); + if (document.getElementById(baseId + ':jmsTypeProp:optEmbedded').checked) { + document.getElementById(baseId + ':jmsTypeProp:optLocal').checked = true; + } + } else { + setDisplay(baseId+':jmsTypeProp:optEmbedded_span', 'inline'); + setDisplay(baseId+':ConfigStoreTypeProp', 'table-row'); + setDisplay(baseId+':MessageStoreTypeProp', 'table-row'); + } + + if ((messageStoreType == 'file') && (getDisplay(baseId+':MessageStoreTypeProp') != 'none')) { + setDisplay(baseId+':DbVendorProp', 'none'); + setDisplay(baseId+':DbUserProp', 'none'); + setDisplay(baseId+':DbUrlProp', 'none'); + setDisplay(baseId+':PswdSelProp', 'none'); + setDisplay(baseId+':PswdTextProp', 'none'); + setDisplay(baseId+':PswdAliasProp', 'none'); + } else { + setDisplay(baseId+':DbVendorProp', 'table-row'); + setDisplay(baseId+':DbUserProp', 'table-row'); + setDisplay(baseId+':DbUrlProp', 'table-row'); + setDisplay(baseId+':PswdSelProp', 'table-row'); + setDisplay(baseId+':PswdTextProp', 'table-row'); + setDisplay(baseId+':PswdAliasProp', 'table-row'); + + if (pwdSel == 'password') { + setDisplay(baseId+':PswdTextProp', 'table-row'); + setDisplay(baseId+':PswdAliasProp', 'none'); + } else { + setDisplay(baseId+':PswdTextProp', 'none'); + setDisplay(baseId+':PswdAliasProp', 'table-row'); + } + } + +} \ No newline at end of file Index: common/src/main/resources/js/adminjsf.js =================================================================== --- common/src/main/resources/js/adminjsf.js (revision 51696) +++ common/src/main/resources/js/adminjsf.js (working copy) @@ -2158,7 +2158,7 @@ }, ajaxStart : function() { - admingui.ajax._setVisibility('ajaxIndicator', 'visible'); +// admingui.ajax._setVisibility('ajaxIndicator', 'visible'); admingui.ajax._clearAjaxTimer(); admingui.ajax.ajaxTimer = setTimeout("admingui.ajax._displayAjaxLoadingPanel()", 2000); }, @@ -2273,6 +2273,7 @@ }, defaultGetCallback: function(xmlReq, target, url) { + admingui.ajax.ajaxComplete(); if (window != top) { // May be inside a frame... return top.admingui.ajax.defaultGetCallback(xmlReq, target, url); @@ -2301,7 +2302,6 @@ document.body.style.cursor = 'auto'; admingui.nav.selectTreeNodeWithURL(url); - admingui.ajax.ajaxComplete(); }, /** @@ -2314,6 +2314,7 @@ * innerHTML. */ handleResponse : function () { + admingui.ajax.ajaxComplete(); admingui.ajax.fixQue(this.que); //admingui.ajax.updateCurrentPageLink(o.argument.url); <-- find a better way to get the viewId var contentNode = null; @@ -2385,7 +2386,6 @@ admingui.nav.selectTreeNodeById(node.parentNode.parentNode.id); } */ - admingui.ajax.ajaxComplete(); }, fixQue: function(que) { Index: devtests/src/test/java/org/glassfish/admingui/devtests/BaseSeleniumTestClass.java =================================================================== --- devtests/src/test/java/org/glassfish/admingui/devtests/BaseSeleniumTestClass.java (revision 51696) +++ devtests/src/test/java/org/glassfish/admingui/devtests/BaseSeleniumTestClass.java (working copy) @@ -120,17 +120,6 @@ public static void setUp() throws Exception { if (!DEBUG) { RestUtil.post(helper.getBaseUrl() + "/management/domain/rotate-log", new HashMap()); - /* - * URL rotateLogUrl = new URL(helper.getBaseUrl() + - * "/management/domain/rotate-log"); URLConnection conn = - * rotateLogUrl.openConnection(); conn.setDoOutput(true); - * OutputStreamWriter wr = new - * OutputStreamWriter(conn.getOutputStream()); wr.write(""); - * wr.flush(); BufferedReader rd = new BufferedReader(new - * InputStreamReader(conn.getInputStream())); String line = - * rd.readLine(); while (line != null) { line = rd.readLine(); } - * wr.close(); rd.close(); - */ } } @@ -194,6 +183,7 @@ * @param text */ public void setFieldValue(String elem, String text) { + selenium.focus(elem); selenium.type(elem, text); } @@ -231,9 +221,15 @@ selenium.uncheck(cb); } - public void pressButton(String button) { + public void pressButton(final String button) { waitForElement(button); - selenium.click(button); + new ExceptionSwallowingLoop() { + @Override + public Void operation() { + selenium.click(button); + return null; + } + }.get(); } /** @@ -587,9 +583,15 @@ * @param value * @return */ - protected String getLinkIdByLinkText(String baseId, String value) { - WebElement link = elementFinder.findElement(By.linkText(value), TIMEOUT); - return (link == null) ? null : (String) link.getAttribute("id"); + protected String getLinkIdByLinkText(final String baseId, final String value) { + final ExceptionSwallowingLoop loop = new ExceptionSwallowingLoop() { + @Override + public String operation() { + WebElement link = elementFinder.findElement(By.linkText(value), TIMEOUT); + return (link == null) ? null : (String) link.getAttribute("id"); + } + }; + return loop.get(); } protected boolean isTextPresent(String text) { @@ -1095,8 +1097,12 @@ @Override public boolean executeTest() { - int count = getTableRowCount(tableId); - return count > initialCount; + try { + int count = getTableRowCount(tableId); + return count > initialCount; + } catch (Exception e) { + return false; + } } }; @@ -1123,4 +1129,25 @@ } } } + + abstract class ExceptionSwallowingLoop { + public T get() { + T value = null; + boolean success = false; + int count = 0; + while (!success && (count < TIMEOUT /2 )) { + try { + value = operation(); + success = true; + } catch (Exception e) { + logger.log(Level.INFO, "Exception caught. Sleeping..."); + count++; + } + } + + return value; + } + + public abstract T operation(); + } } Index: devtests/src/test/java/org/glassfish/admingui/devtests/SeleniumHelper.java =================================================================== --- devtests/src/test/java/org/glassfish/admingui/devtests/SeleniumHelper.java (revision 51696) +++ devtests/src/test/java/org/glassfish/admingui/devtests/SeleniumHelper.java (working copy) @@ -40,7 +40,9 @@ package org.glassfish.admingui.devtests; import com.thoughtworks.selenium.Selenium; +import java.io.IOException; import java.util.logging.Level; +import java.util.logging.LogManager; import java.util.logging.Logger; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriverBackedSelenium; @@ -81,15 +83,9 @@ String browser = getParameter("browser", "firefox"); if ("firefox".equals(browser)) { - ProfilesIni allProfiles = new ProfilesIni(); - FirefoxProfile profile = allProfiles.getProfile("default"); - profile.setPreference("dom.disable_window_move_resize", false); - final FirefoxDriver firefoxDriver = new FirefoxDriver(profile); + final FirefoxDriver firefoxDriver = new FirefoxDriver(); + firefoxDriver.executeScript("window.resizeTo(screen.availWidth, screen.availHeight);", new Object[]{}); driver = firefoxDriver; - Object o = firefoxDriver.executeScript("window.resizeTo(screen.availWidth, screen.availHeight);", new Object[]{}); - if (o != null) { - System.out.println(o.toString()); - } } else if ("chrome".equals(browser)) { driver = new ChromeDriver(); } else if ("ie".contains(browser)) { @@ -98,14 +94,19 @@ elementFinder = new ElementFinder(driver); selenium = new WebDriverBackedSelenium(driver, getBaseUrl()); + selenium.setBrowserLogLevel("warn"); + try { + LogManager.getLogManager().readConfiguration(SeleniumHelper.class.getResourceAsStream("/logging.properties")); + } catch (Exception ex) { + Logger.getLogger(SeleniumHelper.class.getName()).log(Level.SEVERE, null, ex); + } + (new BaseSeleniumTestClass()).openAndWait("/", BaseSeleniumTestClass.TRIGGER_COMMON_TASKS, 480); // Make sure the server has started and the user logged in } selenium.windowFocus(); selenium.windowMaximize(); selenium.setTimeout("90000"); -// String eval = selenium.getEval("window.moveTo(0,0); window.resizeTo(screen.availWidth, screen.availHeight); "); -// System.out.println(eval); return selenium; } Index: devtests/src/test/java/org/glassfish/admingui/devtests/ClusterTest.java =================================================================== --- devtests/src/test/java/org/glassfish/admingui/devtests/ClusterTest.java (revision 51696) +++ devtests/src/test/java/org/glassfish/admingui/devtests/ClusterTest.java (working copy) @@ -228,12 +228,15 @@ gotoClusterPage(); clickAndWait("propertyForm:clustersTable:topActionsGroup1:newButton", TRIGGER_NEW_CLUSTER_PAGE); setFieldValue("propertyForm:propertySheet:propertySectionTextField:NameTextProp:NameText", clusterName); - selectDropdownOption("propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:configType", "Custom"); - waitForPageLoad("i18ncs.cluster.jms.configStoreTypeHelp", TIMEOUT); + markCheckbox("propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:optCustom:optCustom_label"); + + waitForPageLoad("i18ncs.cluster.jms.ClusterTypeName", TIMEOUT); + selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:clusterType", "Conventional"); selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:ConfigStoreTypeProp:configStoreType", "Master Broker"); selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:MessageStoreTypeProp:messageStoreType", "File"); + setFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:PropertiesProp:properties", "prop1=value1:prop2=value2\\:with\\:colons:prop3=value3"); addTableRow("propertyForm:basicTable", "propertyForm:basicTable:topActionsGroup1:addSharedTableButton", "Server Instances to Be Created"); @@ -247,13 +250,37 @@ } @Test + public void testClusterWithEnhancedJmsOptions() { + String clusterName = "cluster" + generateRandomString(); + gotoClusterPage(); + clickAndWait("propertyForm:clustersTable:topActionsGroup1:newButton", TRIGGER_NEW_CLUSTER_PAGE); + setFieldValue("propertyForm:propertySheet:propertySectionTextField:NameTextProp:NameText", clusterName); + markCheckbox("propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:optCustom:optCustom_label"); + waitForPageLoad("i18ncs.cluster.jms.ClusterTypeName", TIMEOUT); + + setFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:DbVendorProp:dbVendor", "mysql"); + setFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:DbUserProp:dbUser", "root"); + setFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:DbUrlProp:dbUrl", "jdbc:mysql://hostname:portno/dbname?password=xxx"); + + addTableRow("propertyForm:basicTable", "propertyForm:basicTable:topActionsGroup1:addSharedTableButton", + "Server Instances to Be Created"); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col2:name", clusterName + "in1"); + addTableRow("propertyForm:basicTable", "propertyForm:basicTable:topActionsGroup1:addSharedTableButton", + "Server Instances to Be Created"); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col2:name", clusterName + "in2"); + + clickAndWait("propertyForm:propertyContentPage:topButtons:newButton", TRIGGER_CLUSTER_PAGE); + assertTrue(isTextPresent(clusterName)); + } + + @Test public void testClusterWithBadJmsOptions() { String clusterName = "cluster" + generateRandomString(); gotoClusterPage(); clickAndWait("propertyForm:clustersTable:topActionsGroup1:newButton", TRIGGER_NEW_CLUSTER_PAGE); setFieldValue("propertyForm:propertySheet:propertySectionTextField:NameTextProp:NameText", clusterName); - selectDropdownOption("propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:configType", "Custom"); - waitForPageLoad("i18ncs.cluster.jms.configStoreTypeHelp", TIMEOUT); + markCheckbox("propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:optCustom:optCustom_label"); + waitForPageLoad("i18ncs.cluster.jms.ClusterTypeName", TIMEOUT); selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:clusterType", "Conventional"); selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:ConfigStoreTypeProp:configStoreType", "Master Broker");