Index: cluster/src/main/resources/cluster/clusterNew.jsf =================================================================== --- cluster/src/main/resources/cluster/clusterNew.jsf (revision 51937) +++ cluster/src/main/resources/cluster/clusterNew.jsf (working copy) @@ -2,7 +2,7 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. The contents of this file are subject to the terms of either the GNU General Public License Version 2 only ("GPL") or the Common Development @@ -45,7 +45,8 @@ setResourceBundle(key="i18ncs" bundle="org.glassfish.cluster.admingui.Strings") setResourceBundle(key="help_cluster" bundle="org.glassfish.cluster.admingui.Helplinks"); /> - + #include "/cluster/shared/handlers.inc" +#include "/jms/jmsHandlers.inc" #include "/common/shared/alertMsg.inc" @@ -83,52 +86,9 @@ gf.createEntity( endpoint="#{sessionScope.REST_URL}/clusters/cluster" attrs="#{requestScope.ct}") if ('#{pageSession.jmsConfigType}=Custom') { - createMap(result="#{requestScope.jmsAttrs}"); - mapPut(map="#{requestScope.jmsAttrs}" key="clustertype" value="$pageSession{clusterType}"); - 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}"); - } - - // 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}") - } - } - - gf.restRequest(endpoint="#{sessionScope.REST_URL}/clusters/cluster/#{pageSession.name}/configure-jms-cluster", - attrs="#{requestScope.jmsAttrs}", - method="post", - result="#{pageSession.resultMap}", - throwException="#{false}"); - - if ("#{pageSession.resultMap.data.exit_code}=FAILURE") { - prepareAlertMsg(summary="$resource{i18ncs.cluster.jms.ConfigureJmsClusterFailure}", - detail="#{pageSession.resultMap.data.message}" - type="error"); - gf.restRequest(endpoint="#{sessionScope.REST_URL}/clusters/cluster/#{pageSession.name}", method="delete"); - gf.redirect(page="#{request.contextPath}/cluster/cluster/clusterNew.jsf?alertType=${alertType}&alertSummary=${alertSummary}&alertDetail=${alertDetail}"); - } + setPageSessionAttribute(key="selfPage" value="#{request.contextPath}/cluster/cluster/clusterNew.jsf?configName=#{pageSession.config}"); + setPageSessionAttribute(key="deleteClusterOnFailure" value="#{true}"); + gf.configureJmsCluster(); } gf.createClusterInstances(clusterName="#{pageSession.name}", instanceRow="#{instances}"); Index: cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties =================================================================== --- cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties (revision 51937) +++ cluster/src/main/resources/org/glassfish/cluster/admingui/Strings.properties (working copy) @@ -1,7 +1,7 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # -# Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. # # The contents of this file are subject to the terms of either the GNU # General Public License Version 2 only ("GPL") or the Common Development @@ -367,9 +367,9 @@ cluster.jms.mqClusterTypeConventional=Conventional cluster.jms.mqClusterTypeEnhanced=Enhanced (HA) -cluster.jms.dbUserPasswordSelect=User Authentication +cluster.jms.dbUserPasswordSelect=Database Authentication cluster.jms.dbUserPasswordSelectHelp=Select how the user is authenticated when connecting to the datastore. -cluster.jms.dbUserPassword=User Password +cluster.jms.dbUserPassword=Database 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. Index: jms-plugin/src/main/java/org/glassfish/admingui/plugin/jms/JmsHandlers.java =================================================================== --- jms-plugin/src/main/java/org/glassfish/admingui/plugin/jms/JmsHandlers.java (revision 51937) +++ jms-plugin/src/main/java/org/glassfish/admingui/plugin/jms/JmsHandlers.java (working copy) @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2009-2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -52,11 +52,7 @@ import com.sun.jsftemplating.annotation.HandlerOutput; import com.sun.jsftemplating.layout.descriptors.handler.HandlerContext; import java.lang.management.ManagementFactory; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.ResourceBundle; +import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.management.Attribute; @@ -396,6 +392,27 @@ GuiUtil.prepareAlert("error", GuiUtil.getMessage("msg.Error"), ex.getMessage()); } } + + @Handler(id="gf.determineJmsAuthType", + input={ + @HandlerInput(name="text", type=String.class) + }, + output={ + @HandlerOutput(name="password", type=String.class), + @HandlerOutput(name="alias", type=String.class), + @HandlerOutput(name="type", type=String.class) + } + ) + public static void determineJmsAuthType(HandlerContext handlerCtx) { + String text = (String) handlerCtx.getInputValue("text"); + if ((text == null) || (!text.contains("${ALIAS"))) { + handlerCtx.setOutputValue("password", text); + handlerCtx.setOutputValue("type", "password"); + } else { + handlerCtx.setOutputValue("alias", text.substring(8, text.length()-1)); + handlerCtx.setOutputValue("type", "alias"); + } + } public static void getDestinations(HandlerContext handlerCtx) { //String result = (String)JMXUtil.invoke(JMS_OBJECT_NAME, OP_LIST_DESTINATIONS, null, null); Index: jms-plugin/src/main/resources/jmsHandlers.inc =================================================================== --- jms-plugin/src/main/resources/jmsHandlers.inc (revision 0) +++ jms-plugin/src/main/resources/jmsHandlers.inc (revision 0) @@ -0,0 +1,118 @@ + + + createMap(result="#{requestScope.jmsAttrs}"); + println("***** #{pageSession}\n\n\n\n\n\n"); + mapPut(map="#{requestScope.jmsAttrs}" key="clustertype" value="$pageSession{clusterType}"); + mapPut(map="#{requestScope.jmsAttrs}" key="property" value="$pageSession{properties}"); + mapPut(map="#{requestScope.jmsAttrs}" key="availabilityEnabled" value="#{true}"); + if ('$pageSession{clusterType}=conventional') { + mapPut(map="#{requestScope.jmsAttrs}" key="configStoreType" value="$pageSession{configStoreType}"); + mapPut(map="#{requestScope.jmsAttrs}" key="messageStoreType" value="$pageSession{messageStoreType}"); + mapPut(map="#{requestScope.jmsAttrs}" key="availabilityEnabled" value="#{false}"); + } + + // Save JMS integration type + createMap(result="#{requestScope.jmsSvcAttrs}"); + + mapPut(map="#{requestScope.jmsSvcAttrs}" key="type" value="#{empty pageSession.jmsType ? pageSession.jmsTypeOptionGrp : pageSession.jmsType}"); + gf.restRequest(endpoint="#{sessionScope.REST_URL}/configs/config/#{pageSession.config}/jms-service", + method="POST", attrs="#{requestScope.jmsSvcAttrs}", result="#{pageSession.resultMap}"); + println("\n\n\n\n\n**************1needsDB = #{needsDB}\n\n\n\n\n\n\n\n\n"); + + setAttribute(key="needsDB", value="#{false}"); + + println("\n\n\n\n\n**************2needsDB = #{needsDB}\n\n\n\n\n\n\n\n\n"); + + if ('($pageSession{clusterType}=enhanced)') { + setAttribute(key="needsDB" value="#{true}"); + } + println("\n\n\n\n\n**************3needsDB = #{needsDB}\n\n\n\n\n\n\n\n\n"); + if ('($pageSession{messageStoreType}=jdbc)') { + setAttribute(key="needsDB" value="#{true}"); + } + println("\n\n\n\n\n**************4needsDB = #{needsDB}\n\n\n\n\n\n\n\n\n"); + if ('($pageSession{configStoreType}=shareddb)') { + setAttribute(key="needsDB" value="#{true}"); + } + println("\n\n\n\n\n**************5needsDB = #{needsDB}\n\n\n\n\n\n\n\n\n"); + if ('(#{needsDB})') { + 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 ('($pageSession{jmsType}=LOCAL) || ($pageSession{jmsType}=EMBEDDED)') { + gf.restRequest(endpoint="#{sessionScope.REST_URL}/clusters/cluster/#{pageSession.name}/configure-jms-cluster", + attrs="#{requestScope.jmsAttrs}", + method="post", + result="#{pageSession.resultMap}", + throwException="#{false}"); + + if ("#{pageSession.resultMap.data.exit_code}=FAILURE") { + if (#{pageSession.deleteClusterOnFailure}) { + prepareAlertMsg(summary="$resource{i18ncs.cluster.jms.ConfigureJmsClusterFailure}", + detail="#{pageSession.resultMap.data.message}" + type="error"); + gf.restRequest(endpoint="#{sessionScope.REST_URL}/clusters/cluster/#{pageSession.name}", method="delete"); + gf.redirect(page="#{pageSession.selfPage}?alertType=${alertType}&alertSummary=${alertSummary}&alertDetail=${alertDetail}"); + } + if (!#{pageSession.deleteClusterOnFailure}) { + prepareAlertMsg(summary="#{pageSession.resultMap.data.message}", type="error"); + gf.redirect(page="#{pageSession.selfPage}?alertType=${alertType}&alertSummary=${alertSummary}&alertDetail=${alertDetail}"); + } + } + } + \ No newline at end of file Index: jms-plugin/src/main/resources/configureJmsClusterDropDown.inc =================================================================== --- jms-plugin/src/main/resources/configureJmsClusterDropDown.inc (revision 51937) +++ jms-plugin/src/main/resources/configureJmsClusterDropDown.inc (working copy) @@ -2,7 +2,7 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2011-2012 Oracle and/or its affiliates. All rights reserved. The contents of this file are subject to the terms of either the GNU General Public License Version 2 only ("GPL") or the Common Development @@ -54,7 +54,6 @@ Index: jms-plugin/src/main/resources/jmsAvailabilityService.jsf =================================================================== --- jms-plugin/src/main/resources/jmsAvailabilityService.jsf (revision 51937) +++ jms-plugin/src/main/resources/jmsAvailabilityService.jsf (working copy) @@ -2,7 +2,7 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 2009-2011 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved. The contents of this file are subject to the terms of either the GNU General Public License Version 2 only ("GPL") or the Common Development @@ -51,67 +51,88 @@ $page{configName} default="server-config"); + getRequestValue(key="configName" value=>$page{config} default="server-config"); + setPageSessionAttribute(key="childType" value="jms-availability"); setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/configs/config/#{pageSession.configName}/availability-service"); setPageSessionAttribute(key="selfUrl", value="#{pageSession.parentUrl}/#{pageSession.childType}"); - setPageSessionAttribute(key="rest-api" value="true"); + gf.checkIfEndPointExist(endpoint="#{pageSession.selfUrl}/property" exists="#{pageSession.edit}"); if(!#{edit}) { gf.restRequest(endpoint="#{pageSession.selfUrl}" method="POST"); } - gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}.json", valueMap="#{pageSession.valueMap}"); - gf.restRequest(endpoint="#{pageSession.selfUrl}/property.json" method="GET" result="#{requestScope.propTable}"); + + gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}", valueMap="#{pageSession.valueMap}"); + gf.getEntityAttrs(endpoint="#{sessionScope.REST_URL}/configs/config/#{pageSession.configName}/jms-service", valueMap="#{pageSession.serviceMap}"); + gf.restRequest(endpoint="#{pageSession.selfUrl}/property" method="GET" result="#{requestScope.propTable}", throwException="#{false}", quiet="#{true}"); + setPageSessionAttribute(key="tableList" value="#{requestScope.propTable.data.extraProperties.properties}"); setPageSessionAttribute(key="selfPage" value="#{request.contextPath}/jms/jmsAvailabilityService.jsf?configName=#{pageSession.configName}"); setPageSessionAttribute(key="convertToFalseList" value={"availabilityEnabled"}); - //set the following for including buttons.inc - setPageSessionAttribute(key="edit" value="#{true}" ); - setPageSessionAttribute(key="showDefaultButton" value="#{true}" ); - setPageSessionAttribute(key="showCancelButton" value="#{false}" ); - setPageSessionAttribute(key="hasPropertySheet" value="#{true}" ); - setPageSessionAttribute(key="hasPropertyTable" value="#{true}" ); + + setPageSessionAttribute(key="jmsTypeOptionGrp" value="#{pageSession.serviceMap['type']}"); + setPageSessionAttribute(key="jmsType" value="#{jmsTypeOptionGrp}"); + setPageSessionAttribute(key="deleteClusterOnFailure" value="#{false}"); + + setPageSessionAttribute(key="clusterType" value="#{pageSession.valueMap.availabilityEnabled ? 'enhanced' : 'conventional'}"); + setPageSessionAttribute(key="clusterTypeOptionGrp" value="#{pageSession.valueMap.availabilityEnabled ? 'enhanced' : 'conventional'}"); + setAttribute(key="jmsTypeOptionGrp" value="#{pageSession.serviceMap.type}"); + setPageSessionAttribute(key="configStoreType" value="#{pageSession.valueMap.configStoreType}"); + setPageSessionAttribute(key="messageStoreType" value="#{pageSession.valueMap.messageStoreType}"); + setPageSessionAttribute(key="dbUser" value="#{pageSession.valueMap.dbUsername}"); + setPageSessionAttribute(key="dbVendor" value="#{pageSession.valueMap.dbVendor}"); + setPageSessionAttribute(key="dbUrl" value="#{pageSession.valueMap.dbUrl}"); + + gf.determineJmsAuthType(text="#{pageSession.valueMap.dbPassword}", password="#{pageSession.pswdText}", + alias="#{pageSession.pswdAlias}",type="#{pageSession.authType}"); + setPageSessionAttribute(key="needPropField" value="#{false}"); + + gf.listInstances(optionKeys={"id"} optionValues={"$pageSession{configName}"}, statusMap="#{requestScope.statusMap}"); + gf.getClusterStatusSummary(statusMap ="#{requestScope.statusMap}" , + numRunning="#{pageSession.numRunning}"); + setPageSessionAttribute(key="instancesRunning" value="#{!empty pageSession.numRunning}"); /> #include "/cluster/availability/availabilityTabs.inc" #include "/common/shared/alertMsg.inc" - -#include "/common/shared/editPageButtons.inc" - - -#include "/common/shared/configNameSection.inc" - - - - - - - - - - - - - - - - - - - - - - - "

-
-
+ + +#include "/jms/jmsHandlers.inc" + + +#include "jmsAvailbilityButtons.inc" + + + +#include "configureJmsClusterSheet.inc" #include "/common/shared/propertyDescTable.inc" - -#include "/common/shared/editPageButtons_2.inc" - + + + +#include "jmsAvailbilityButtons.inc" + + +
#include "/common/shared/changeButtonsJS.inc" + + + Index: jms-plugin/src/main/resources/org/glassfish/jms/admingui/Strings.properties =================================================================== --- jms-plugin/src/main/resources/org/glassfish/jms/admingui/Strings.properties (revision 51937) +++ jms-plugin/src/main/resources/org/glassfish/jms/admingui/Strings.properties (working copy) @@ -1,7 +1,7 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # -# Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. # # The contents of this file are subject to the terms of either the GNU # General Public License Version 2 only ("GPL") or the Common Development @@ -65,7 +65,8 @@ # jms.ResourcesPageTitle=JMS Resources jms.Title=Java Message Service -jms.PageHelp=General properties for the Java Message Service (JMS) service apply only to the application server's default JMS provider, GlassFish Message Queue. All other messaging providers that are plugged into the application server via resource adapters can be configured through the Connector Resources screens. +jms.PageHelp=General properties for the Java Message Service (JMS) service apply only to the application server's default JMS provider, GlassFish Message Queue. All other messaging providers that are plugged into the application server via resource adapters can be configured through the Connector Resources screens. +jms.AvailabilityLink=Click here to configure JMS Availability. jms.Type=Type: jms.TypeHelp=Whether JMS Service is on local or remote system jms.Timeout=Startup Timeout: @@ -335,7 +336,7 @@ # JMS Availability Service availability.jmsAvailability=JMS Availability -availability.jmsAvailabilityInfo=Availability for JMS +availability.jmsAvailabilityInfo=Availability for JMS. Click here to configure the JMS Service. availability.jmsAvailabilityInfoHelp=Enable JMS Availability Service. If true, the MQ cluster pointed to by the jms-service element is a HA (enhanced). If false, then the MQ cluster pointed to by the jms-service element is considered non-HA (Conventional MQ cluster) cluster. availability.configStoreType=Configuration Store Type: availability.configStoreTypeHelp=Type of data store for configuration data in a conventional cluster.The value masterbroker specifies the use of a master broker to store and manage the configuration data. The value shareddb specifies the use of a shared database to store the configuration data. This option is ignored if availability enabled is set to true. @@ -349,4 +350,4 @@ availability.dbPasswordHelp=The database password of the JDBC database to use when Availability Service is enabled or Configuration Store Type is set to 'shareddb' or Message Store Type is set to 'jdbc'. availability.dbUrl=Database Acess URL: availability.dbUrlHelp=The database access URL of the JDBC database to use when Availability Service is enabled or Configuration Store Type is set to 'shareddb' or Message Store Type is set to 'jdbc'. - +availability.instancesRunning=All instances using this configuration must be stopped when changing these settings! Index: jms-plugin/src/main/resources/jmsService.jsf =================================================================== --- jms-plugin/src/main/resources/jmsService.jsf (revision 51937) +++ jms-plugin/src/main/resources/jmsService.jsf (working copy) @@ -2,7 +2,7 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. The contents of this file are subject to the terms of either the GNU General Public License Version 2 only ("GPL") or the Common Development @@ -81,10 +81,19 @@ - + #include "/common/shared/alertMsg.inc" - - + + + + + #include "/common/shared/commonHandlers.inc" - - - - - - + + + + + + + selected="#{jmsTypeOptionGrp}" selectedValue="EMBEDDED" onChange="updateUI();"/> + selected="#{jmsTypeOptionGrp}" selectedValue="LOCAL" onChange="updateUI();"/> + selected="#{jmsTypeOptionGrp}" selectedValue="REMOTE" onChange="updateUI();"/> + + - + + + + + + + + + + + + values={"masterbroker" "shareddb"} onChange="updateUI();"/> - + values={"file" "jdbc"} onChange="updateUI();"/> + label="$resource{i18ncs.cluster.jms.dbvendor}" styleClass="__database"> + + + + + label="$resource{i18ncs.cluster.jms.dbUser}" styleClass="__database"> - - - - - - - + - + label="$resource{i18ncs.cluster.jms.properties}" helpText="$resource{i18ncs.cluster.jms.propertiesHelp}" + rendered="#{pageSession.needPropField}"> + + + Index: jms-plugin/src/main/resources/configureJmsCluster.js =================================================================== --- jms-plugin/src/main/resources/configureJmsCluster.js (revision 51937) +++ jms-plugin/src/main/resources/configureJmsCluster.js (working copy) @@ -1,66 +1,163 @@ -function updateUI() { - function getDisplay(elem) { - return document.getElementById(elem).style.display; +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can + * obtain a copy of the License at + * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html + * or packager/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at packager/legal/LICENSE.txt. + * + * GPL Classpath Exception: + * Oracle designates this particular file as subject to the "Classpath" + * exception as provided by Oracle in the GPL Version 2 section of the License + * file that accompanied this code. + * + * Modifications: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + * + * Contributor(s): + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ +function getDisplay(elem) { + return document.getElementById(elem).style.display; +} + +function setDisplay(elem, value) { + if (typeof(elem) == 'string') { + elem = document.getElementById(elem); } + return elem.style.display = value; +} - function setDisplay(elem, value) { - return document.getElementById(elem).style.display = value; +function updateUI() { + try { + var jmsBasicConfig = document.getElementById('propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:optBasic').checked; + var jmsCustomConfig = document.getElementById('propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:optCustom').checked; + } catch (e) { + jmsBasicConfig = false; + jmsCustomConfig = true; } - - - 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; + updateJmsPropertySheet(!jmsBasicConfig); +} + +function updateJmsPropertySheet(customConfig) { + if (!customConfig) { + setDisplay(jmsTypeSheet, 'none'); + setDisplay(jmsPropsheet, 'none'); + return; + } + + var jmsTypeSheet = 'propertyForm:jmsTypePropertySheet'; + var jmsPropsheet = 'propertyForm:jmsPropertySheet'; + var baseId = jmsPropsheet + ':configureJmsClusterSection'; + var configStoreType = document.getElementById(baseId+':ConfigStoreTypeProp:configStoreType').value; var messageStoreType = document.getElementById(baseId+':MessageStoreTypeProp:messageStoreType').value; var pwdSel = document.getElementById(baseId+':PswdSelProp:pwdSel').value; + + var conventional = document.getElementById(baseId + ':ClusterTypeProp:optConventional').checked; + var enhanced = document.getElementById(baseId + ':ClusterTypeProp:optEnhanced').checked; + + var embedded = document.getElementById(jmsTypeSheet + ':jmsTypeSection:jmsTypeProp:optEmbedded').checked; + var local = document.getElementById(jmsTypeSheet + ':jmsTypeSection:jmsTypeProp:optLocal').checked; + var remote = document.getElementById(jmsTypeSheet + ':jmsTypeSection:jmsTypeProp:optRemote').checked; - if (jmsBasicConfig) { - setDisplay(sheet, 'none'); - } else { - setDisplay(sheet, 'block'); - } + setDisplay(jmsTypeSheet, 'block'); + setDisplay(jmsPropsheet, '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; + // Update hidden field for type + document.getElementById(jmsTypeSheet + ':jmsTypeSection:jmsTypeProp:jmsType').value = + (embedded ? "EMBEDDED" : (local ? "LOCAL" : "REMOTE")); + + if (remote) { + setDisplay(jmsPropsheet, 'none'); + } else { + setDisplay(jmsPropsheet, 'block'); + + if (embedded) { + setDisplay(baseId + ':ClusterTypeProp:optEnhanced_span', 'none'); + document.getElementById(baseId + ':ClusterTypeProp:optConventional').checked = true; + conventional = true; + enhanced = false; + } else { + setDisplay(baseId + ':ClusterTypeProp:optEnhanced_span', 'block'); } - } else { - setDisplay(baseId+':jmsTypeProp:optEmbedded_span', 'inline'); - setDisplay(baseId+':ConfigStoreTypeProp', 'table-row'); - setDisplay(baseId+':MessageStoreTypeProp', 'table-row'); + document.getElementById(baseId+':ClusterTypeProp:clusterType').value = (conventional ? "conventional" : "enhanced"); + + if (enhanced) { + setDisplay(baseId+':ConfigStoreTypeProp', 'none'); + setDisplay(baseId+':MessageStoreTypeProp', 'none'); + var elems = getByClass("__database"); + for (var i=0; i < elems.length; i++) { + setDisplay(elems[i], 'table-row'); + } + if (embedded) { + document.getElementById(jmsTypeSheet + ':jmsTypeSection:jmsTypeProp:optLocal').checked = true; + document.getElementById(jmsTypeSheet + ':jmsTypeSection:jmsTypeProp:jmsType').value = 'LOCAL'; + local = true; + embedded = false; + } + fixPasswordFields(baseId, pwdSel); + } + + if (conventional) { + setDisplay(baseId+':ConfigStoreTypeProp', 'table-row'); + setDisplay(baseId+':MessageStoreTypeProp', 'table-row'); + + if ((messageStoreType == 'file') && (configStoreType == 'masterbroker')) { //} && (getDisplay(baseId+':MessageStoreTypeProp') != 'none')) { + var elems = getByClass("__database"); + for (var i=0; i < elems.length; i++) { + setDisplay(elems[i], 'none'); + } + } else { + var elems = getByClass("__database"); + for (var i=0; i < elems.length; i++) { + setDisplay(elems[i], 'table-row'); + } + + fixPasswordFields(baseId, pwdSel); + } + } } +} - 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'); +function fixPasswordFields(baseId, pwdSel) { + if (pwdSel == 'password') { + setDisplay(baseId+':PswdTextProp', 'table-row'); 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+':PswdTextProp', 'none'); 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 +function getByClass (className, parent) { + parent || (parent=document); + var descendants=parent.getElementsByTagName('*'), i=-1, e, result=[]; + while (e = descendants[++i]) { + ((' '+(e['class']||e.className)+' ').indexOf(' '+className+' ') > -1) && result.push(e); + } + return result; +} Index: jms-plugin/src/main/resources/jmsAvailbilityButtons.inc =================================================================== --- jms-plugin/src/main/resources/jmsAvailbilityButtons.inc (revision 0) +++ jms-plugin/src/main/resources/jmsAvailbilityButtons.inc (revision 0) @@ -0,0 +1,55 @@ + + + + Index: common/src/main/java/org/glassfish/admingui/common/util/RestUtil.java =================================================================== --- common/src/main/java/org/glassfish/admingui/common/util/RestUtil.java (revision 51937) +++ common/src/main/java/org/glassfish/admingui/common/util/RestUtil.java (working copy) @@ -306,7 +306,8 @@ return (message==null)? "" : message; } - public static Map parseResponse(RestResponse response, HandlerContext handlerCtx, String endpoint, Object attrs, boolean quiet, boolean throwException) { + public static Map parseResponse(RestResponse response, HandlerContext handlerCtx, String endpoint, + Object attrs, boolean quiet, boolean throwException) { // Parse the response String message = ""; ExitCode exitCode = ExitCode.FAILURE; Index: devtests/src/test/java/org/glassfish/admingui/devtests/BaseSeleniumTestClass.java =================================================================== --- devtests/src/test/java/org/glassfish/admingui/devtests/BaseSeleniumTestClass.java (revision 51937) +++ devtests/src/test/java/org/glassfish/admingui/devtests/BaseSeleniumTestClass.java (working copy) @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -54,7 +54,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.glassfish.admingui.common.util.RestUtil; -import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.support.ui.ExpectedCondition; import org.openqa.selenium.support.ui.WebDriverWait; @@ -253,6 +252,10 @@ return selenium.isElementPresent(elem); } + protected String captureScreenshot() { + return SeleniumHelper.captureScreenshot(); + } + /** * Select the option requested in the given select element * @@ -264,11 +267,15 @@ label = resolveTriggerText(label); selenium.select(id, "label=" + label); } catch (SeleniumException se) { - logger.log(Level.INFO, "An invalid option was requested. Here are the valid options:"); - for (String option : selenium.getSelectOptions(id)) { - logger.log(Level.INFO, "\t{0}", option); + try { + selenium.select(id, "value=" + label); + } catch (SeleniumException se1) { + logger.log(Level.INFO, "An invalid option was requested. Here are the valid options:"); + for (String option : selenium.getSelectOptions(id)) { + logger.log(Level.INFO, "\t{0}", option); + } + throw se1; } - throw se; } } @@ -501,7 +508,7 @@ protected void waitForLoginPageLoad(int timeoutInSeconds) { for (int seconds = 0;; seconds++) { if (seconds >= (30)) { - Assert.fail("The operation timed out waiting for the login page to load."); + Assert.fail("The operation timed out waiting for the page to load"); } boolean loginFormIsDisplayed = false; @@ -653,7 +660,7 @@ } if (iterations >= 50) { - throw new RuntimeException("Timed out wait for row in " + rowId + " to be selected."); + Assert.fail("Timed out wait for row in " + rowId + " to be selected"); } } @@ -1028,7 +1035,8 @@ } if (!textShouldBeMissing) { boolean visible = false; - final List elements = driver.findElements(By.xpath("//*[contains(text(), '" + triggerText + "')]")); + final List elements = driver.findElements(By.xpath("//*[contains(text(), \"" + + triggerText.replace("\"", "\\\"") + "\")]")); if (!elements.isEmpty()) { for (WebElement e : elements) { if (e.isDisplayed()) { @@ -1048,13 +1056,13 @@ } else { if (isTextPresent("RuntimeException")) { - throw new RuntimeException("Exception detected on page. Please check the logs for details"); + Assert.fail("Exception detected on page. Please check the logs for details"); } } } catch (SeleniumException se) { String message = se.getMessage(); - if (!"ERROR: Couldn't access document.body. Is this HTML page fully loaded?".equals(se.getMessage())) { - throw new RuntimeException(se); + if (!"ERROR: Couldn't access document.body. Is this HTML page fully loaded?".equals(message)) { + Assert.fail(message); } } Index: devtests/src/test/java/org/glassfish/admingui/devtests/SpecificTestRule.java =================================================================== --- devtests/src/test/java/org/glassfish/admingui/devtests/SpecificTestRule.java (revision 51937) +++ devtests/src/test/java/org/glassfish/admingui/devtests/SpecificTestRule.java (working copy) @@ -56,7 +56,9 @@ * @author jasonlee */ public class SpecificTestRule implements MethodRule { + protected static boolean debug; + public SpecificTestRule() { debug = Boolean.parseBoolean(SeleniumHelper.getParameter("debug", "false")); } @@ -64,6 +66,7 @@ @Override public Statement apply(final Statement statement, final FrameworkMethod frameworkMethod, final Object o) { return new Statement() { + @Override public void evaluate() throws Throwable { boolean runMethod = false; @@ -95,8 +98,12 @@ } try { statement.evaluate(); - } catch (Exception e) { - statement.evaluate(); // try again. Ugly hack, but if it works... + } catch (Throwable t) { + SeleniumHelper.captureScreenshot(frameworkMethod.getName()); + throw t; // rethrow + // No explanation as to why this was done, so we'll disable + // it and see what happens + //statement.evaluate(); // try again. Ugly hack, but if it works... } } else { logger.log(Level.INFO, "\tSkipping."); Index: devtests/src/test/java/org/glassfish/admingui/devtests/SeleniumHelper.java =================================================================== --- devtests/src/test/java/org/glassfish/admingui/devtests/SeleniumHelper.java (revision 51937) +++ devtests/src/test/java/org/glassfish/admingui/devtests/SeleniumHelper.java (working copy) @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011-2012 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -40,10 +40,15 @@ package org.glassfish.admingui.devtests; import com.thoughtworks.selenium.Selenium; +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; +import java.util.Random; import java.util.logging.Level; import java.util.logging.LogManager; import java.util.logging.Logger; +import org.openqa.selenium.OutputType; +import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriverBackedSelenium; import org.openqa.selenium.chrome.ChromeDriver; @@ -51,6 +56,8 @@ import org.openqa.selenium.firefox.FirefoxProfile; import org.openqa.selenium.firefox.internal.ProfilesIni; import org.openqa.selenium.ie.InternetExplorerDriver; +import org.openqa.selenium.remote.Augmenter; +import org.openqa.selenium.remote.CapabilityType; /** * @@ -83,9 +90,7 @@ String browser = getParameter("browser", "firefox"); if ("firefox".equals(browser)) { - final FirefoxDriver firefoxDriver = new FirefoxDriver(); - firefoxDriver.executeScript("window.resizeTo(screen.availWidth, screen.availHeight);", new Object[]{}); - driver = firefoxDriver; + driver = new FirefoxDriver(); } else if ("chrome".equals(browser)) { driver = new ChromeDriver(); } else if ("ie".contains(browser)) { @@ -137,4 +142,21 @@ return value != null ? value : defaultValue; } + + public static String captureScreenshot() { + return captureScreenshot("" + (Math.abs(new Random().nextInt()) + 1)); + } + + public static String captureScreenshot(String fileName) { + try { + new File("target/surefire-reports/").mkdirs(); // Insure directory is there + FileOutputStream out = new FileOutputStream("target/surefire-reports/screenshot-" + fileName + ".png"); + out.write(((TakesScreenshot)getInstance().getDriver()).getScreenshotAs(OutputType.BYTES)); + out.close(); + } catch (Exception e) { + // No need to crash the tests if the screenshot fails + } + + return fileName; + } } Index: devtests/src/test/java/org/glassfish/admingui/devtests/AvailabilityServiceTest.java =================================================================== --- devtests/src/test/java/org/glassfish/admingui/devtests/AvailabilityServiceTest.java (revision 51937) +++ devtests/src/test/java/org/glassfish/admingui/devtests/AvailabilityServiceTest.java (working copy) @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -40,10 +40,11 @@ package org.glassfish.admingui.devtests; +import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import org.junit.Test; -import static org.junit.Assert.assertEquals; - public class AvailabilityServiceTest extends BaseSeleniumTestClass { public static final String ID_AVAILABILITY_SERVICE_TREE_NODE = "treeForm:tree:configurations:default-config:availabilityService:availabilityService_link"; private static final String ID_DEFAULT_CONFIG_TURNER = "treeForm:tree:configurations:default-config:default-config_turner:default-config_turner_image"; @@ -64,8 +65,8 @@ int count = addTableRow("propertyForm:basicTable", "propertyForm:basicTable:topActionsGroup1:addSharedTableButton"); setFieldValue("propertyForm:basicTable:rowGroup1:0:col2:col1St", generateRandomString()); - setFieldValue("propertyForm:basicTable:rowGroup1:0:col3:col1St", "b"); - setFieldValue("propertyForm:basicTable:rowGroup1:0:col4:col1St", "c"); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col3:col1St", generateRandomString()); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col4:col1St", generateRandomString()); clickAndWait("propertyForm:propertyContentPage:topButtons:saveButton", TRIGGER_NEW_VALUES_SAVED); assertTableRowCount("propertyForm:basicTable", count); } @@ -80,8 +81,8 @@ int count = addTableRow("propertyForm:basicTable", "propertyForm:basicTable:topActionsGroup1:addSharedTableButton"); setFieldValue("propertyForm:basicTable:rowGroup1:0:col2:col1St", generateRandomString()); - setFieldValue("propertyForm:basicTable:rowGroup1:0:col3:col1St", "b"); - setFieldValue("propertyForm:basicTable:rowGroup1:0:col4:col1St", "c"); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col3:col1St", generateRandomString()); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col4:col1St", generateRandomString()); clickAndWait("propertyForm:propertyContentPage:topButtons:saveButton", TRIGGER_NEW_VALUES_SAVED); assertTableRowCount("propertyForm:basicTable", count); } @@ -96,52 +97,56 @@ int count = addTableRow("propertyForm:basicTable", "propertyForm:basicTable:topActionsGroup1:addSharedTableButton"); setFieldValue("propertyForm:basicTable:rowGroup1:0:col2:col1St", generateRandomString()); - setFieldValue("propertyForm:basicTable:rowGroup1:0:col3:col1St", "b"); - setFieldValue("propertyForm:basicTable:rowGroup1:0:col4:col1St", "c"); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col3:col1St", generateRandomString()); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col4:col1St", generateRandomString()); clickAndWait("propertyForm:propertyContentPage:topButtons:saveButton", TRIGGER_NEW_VALUES_SAVED); assertTableRowCount("propertyForm:basicTable", count); } @Test public void testJMSAvailability() { - final String configName = "Config-" + generateRandomString(); - MsgSecurityTest msgS = new MsgSecurityTest(); - msgS.copyConfig("default-config", configName); + final String clusterName = "cluster" + generateRandomString(); + final String CLUSTER_TYPE = "enhanced"; + final String DB_VENDOR = "mysql"; + final String DB_USER = generateRandomString(); + final String DB_URL = "jdbc:mysql://hostname:portno/dbname?password=" + generateRandomString(); + final String DB_PASSWORD = generateRandomString(); -// if (!isTextPresent(TRIGGER_AVAILABILTY_SERVICE_NODE)) { -// clickAndWait(ID_DEFAULT_CONFIG_TURNER, TRIGGER_AVAILABILTY_SERVICE_NODE); -// } + ClusterTest ct = new ClusterTest(); + ct.createCluster(clusterName); - clickAndWait(getAvailabilityLink(configName), TRIGGER_AVAILABILTY_SERVICE_PAGE); - clickAndWait("propertyForm:availabilityTabs:jmsAvailabilityTab", TRIGGER_JMS_AVAILABILTY); - markCheckbox("propertyForm:propertySheet:propertSectionTextField:AvailabilityEnabledProp:avail"); - selectDropdownOption("propertyForm:propertySheet:propertSectionTextField:ConfigStoreTypeProp:ConfigStoreType", "shareddb"); - selectDropdownOption("propertyForm:propertySheet:propertSectionTextField:MessageStoreTypeProp:MessageStoreType", "file"); - setFieldValue("propertyForm:propertySheet:propertSectionTextField:DbVendorProp:DbVendor", "Vendor"); - setFieldValue("propertyForm:propertySheet:propertSectionTextField:DbUserNameProp:DbUserName", "USERNAME"); - setFieldValue("propertyForm:propertySheet:propertSectionTextField:DbPasswordProp:DbPassword", "PSWD"); - setFieldValue("propertyForm:propertySheet:propertSectionTextField:DbUrlProp:DbUrl", "URL"); - clickAndWait("propertyForm:propertyContentPage:topButtons:saveButton", TRIGGER_NEW_VALUES_SAVED); + try { + clickAndWait("treeForm:tree:configurations:" + clusterName + "-config:availabilityService:availabilityService_link", TRIGGER_AVAILABILTY_SERVICE_PAGE); + clickAndWait("propertyForm:availabilityTabs:jmsAvailabilityTab", TRIGGER_JMS_AVAILABILTY); - clickAndWait("propertyForm:availabilityTabs:availabilityTab", TRIGGER_AVAILABILTY_SERVICE_PAGE); - clickAndWait("propertyForm:availabilityTabs:jmsAvailabilityTab", TRIGGER_JMS_AVAILABILTY); + clickAndWait("propertyForm:jmsTypePropertySheet:jmsTypeSection:jmsTypeProp:optLocal", "i18ncs.cluster.jms.mqClusterTypeEnhanced"); + selenium.check("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:optEnhanced"); +// selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:clusterType", CLUSTER_TYPE); + + setFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:DbVendorProp:dbVendor", DB_VENDOR); + setFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:DbUserProp:dbUser", DB_USER); + setFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:DbUrlProp:dbUrl", DB_URL); + setFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:PswdTextProp:NewPassword", DB_PASSWORD); - assertEquals(getSelectedValue("propertyForm:propertySheet:propertSectionTextField:ConfigStoreTypeProp:ConfigStoreType"), "shareddb"); - assertEquals(getSelectedValue("propertyForm:propertySheet:propertSectionTextField:MessageStoreTypeProp:MessageStoreType"), "file"); - assertEquals("Vendor", getFieldValue("propertyForm:propertySheet:propertSectionTextField:DbVendorProp:DbVendor")); - assertEquals("USERNAME", getFieldValue("propertyForm:propertySheet:propertSectionTextField:DbUserNameProp:DbUserName")); - assertEquals( "PSWD", getFieldValue("propertyForm:propertySheet:propertSectionTextField:DbPasswordProp:DbPassword")); - assertEquals( "URL", getFieldValue("propertyForm:propertySheet:propertSectionTextField:DbUrlProp:DbUrl")); + clickAndWait("propertyForm:propertyContentPage:topButtons:saveButton", TRIGGER_NEW_VALUES_SAVED); - int count = addTableRow("propertyForm:basicTable", "propertyForm:basicTable:topActionsGroup1:addSharedTableButton"); - setFieldValue("propertyForm:basicTable:rowGroup1:0:col2:col1St", generateRandomString()); - setFieldValue("propertyForm:basicTable:rowGroup1:0:col3:col1St", "b"); - setFieldValue("propertyForm:basicTable:rowGroup1:0:col4:col1St", "c"); - clickAndWait("propertyForm:propertyContentPage:topButtons:saveButton", TRIGGER_NEW_VALUES_SAVED); - assertTableRowCount("propertyForm:basicTable", count); - } + clickAndWait("propertyForm:availabilityTabs:availabilityTab", TRIGGER_AVAILABILTY_SERVICE_PAGE); + clickAndWait("propertyForm:availabilityTabs:jmsAvailabilityTab", TRIGGER_JMS_AVAILABILTY); - private static String getAvailabilityLink(String configName){ - return "treeForm:tree:configurations:" + configName + ":availabilityService:availabilityService_link"; + assertTrue(selenium.isChecked("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:optEnhanced")); + assertEquals(DB_VENDOR, getFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:DbVendorProp:dbVendor")); + assertEquals(DB_USER, getFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:DbUserProp:dbUser")); + assertEquals(DB_PASSWORD, getFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:PswdTextProp:NewPassword")); + assertEquals(DB_URL, getFieldValue("propertyForm:jmsPropertySheet:configureJmsClusterSection:DbUrlProp:dbUrl")); + + int count = addTableRow("propertyForm:basicTable", "propertyForm:basicTable:topActionsGroup1:addSharedTableButton"); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col2:col1St", generateRandomString()); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col3:col1St", generateRandomString()); + setFieldValue("propertyForm:basicTable:rowGroup1:0:col4:col1St", generateRandomString()); + clickAndWait("propertyForm:propertyContentPage:topButtons:saveButton", TRIGGER_NEW_VALUES_SAVED); + assertTableRowCount("propertyForm:basicTable", count); + } finally { + ct.deleteAllClusters(); + } } } Index: devtests/src/test/java/org/glassfish/admingui/devtests/ClusterTest.java =================================================================== --- devtests/src/test/java/org/glassfish/admingui/devtests/ClusterTest.java (revision 51937) +++ devtests/src/test/java/org/glassfish/admingui/devtests/ClusterTest.java (working copy) @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -67,7 +67,7 @@ public static final String TRIGGER_CLUSTER_RESOURCES_PAGE = "i18ncs.cluster.ResourcesTitleHelp"; public static final String TRIGGER_CLUSTER_SYSTEM_PROPERTIES = "i18ncs.cluster.ClusterSystemProperties"; - @Test +// @Test public void testStartAndStopClusterWithOneInstance() { String clusterName = "clusterName" + generateRandomString(); String instanceName1 = "instanceName" + generateRandomString(); @@ -93,7 +93,7 @@ deleteCluster(clusterName); } - @Test +// @Test public void testMigrateEjbTimers() { String clusterName = "clusterName" + generateRandomString(); String instanceName1 = "instanceName" + generateRandomString(); @@ -118,7 +118,7 @@ deleteCluster(clusterName); } - @Test +// @Test public void verifyClusterGeneralInformationPage() { String clusterName = "clusterName" + generateRandomString(); String instanceName1 = "instanceName" + generateRandomString(); @@ -155,7 +155,7 @@ deleteCluster(clusterName); } - @Test +// @Test public void testClusterInstancesTab() { String clusterName = "clusterName" + generateRandomString(); String instanceName1 = "instanceName" + generateRandomString(); @@ -174,7 +174,7 @@ deleteCluster(clusterName); } - @Test +// @Test public void testProperties() { String clusterName = "clusterName" + generateRandomString(); String instanceName1 = "instanceName" + generateRandomString(); @@ -209,7 +209,7 @@ deleteCluster(clusterName); } - @Test +// @Test public void testMultiDeleteClusters() { String clusterName1 = "cluster" + generateRandomString(); String clusterName2 = "cluster" + generateRandomString(); @@ -225,52 +225,66 @@ @Test public void testClusterWithJmsOptions() { String clusterName = "cluster" + generateRandomString(); - gotoClusterPage(); - clickAndWait("propertyForm:clustersTable:topActionsGroup1:newButton", TRIGGER_NEW_CLUSTER_PAGE); - setFieldValue("propertyForm:propertySheet:propertySectionTextField:NameTextProp:NameText", clusterName); + try { + 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"); + markCheckbox("propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:optCustom:optCustom_label"); - waitForPageLoad("i18ncs.cluster.jms.ClusterTypeName", TIMEOUT); + 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"); + clickAndWait("propertyForm:jmsTypePropertySheet:jmsTypeSection:jmsTypeProp:optLocal", "i18ncs.cluster.jms.mqClusterTypeEnhanced"); + selenium.check("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:optConventional"); + // selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:clusterType", "Conventional"); - 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"); + 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"); - clickAndWait("propertyForm:propertyContentPage:topButtons:newButton", TRIGGER_CLUSTER_PAGE); - assertTrue(isTextPresent(clusterName)); + 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)); + } finally { + deleteCluster(clusterName); + } } @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); + try { + 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"); + clickAndWait("propertyForm:jmsTypePropertySheet:jmsTypeSection:jmsTypeProp:optLocal", "i18ncs.cluster.jms.mqClusterTypeEnhanced"); + selenium.check("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:optEnhanced"); - 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"); + 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"); - clickAndWait("propertyForm:propertyContentPage:topButtons:newButton", TRIGGER_CLUSTER_PAGE); - assertTrue(isTextPresent(clusterName)); + 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)); + } finally { + deleteCluster(clusterName); + } } @Test @@ -282,7 +296,10 @@ markCheckbox("propertyForm:propertySheet:propertySectionTextField:jmsConfigTypeProp:optCustom:optCustom_label"); waitForPageLoad("i18ncs.cluster.jms.ClusterTypeName", TIMEOUT); - selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:clusterType", "Conventional"); + clickAndWait("propertyForm:jmsTypePropertySheet:jmsTypeSection:jmsTypeProp:optLocal", "i18ncs.cluster.jms.mqClusterTypeEnhanced"); + selenium.check("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:optConventional"); +// selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:ClusterTypeProp:clusterType", "Conventional"); + selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:ConfigStoreTypeProp:configStoreType", "Master Broker"); selectDropdownOption("propertyForm:jmsPropertySheet:configureJmsClusterSection:MessageStoreTypeProp:messageStoreType", "JDBC"); Index: devtests/pom.xml =================================================================== --- devtests/pom.xml (revision 51937) +++ devtests/pom.xml (working copy) @@ -3,7 +3,7 @@ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - Copyright (c) 1997-2011 Oracle and/or its affiliates. All rights reserved. + Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. The contents of this file are subject to the terms of either the GNU General Public License Version 2 only ("GPL") or the Common Development @@ -63,7 +63,7 @@ - 2.14.0 + 2.16.0 UTF-8