[jboss-cvs] JBossAS SVN: r59866 - in projects/admin-console/trunk: docs/Jms and 11 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 19 18:38:07 EST 2007
Author: chilin
Date: 2007-01-19 18:38:07 -0500 (Fri, 19 Jan 2007)
New Revision: 59866
Added:
projects/admin-console/trunk/docs/Jms/
projects/admin-console/trunk/docs/Jms/destination_use_cases.doc
projects/admin-console/trunk/docs/Jms/jms_elements.xls
projects/admin-console/trunk/docs/Jms/jms_use_cases.doc
projects/admin-console/trunk/docs/Jms/pdf/
projects/admin-console/trunk/docs/Jms/pdf/destination_use_cases.pdf
projects/admin-console/trunk/docs/Jms/pdf/jms_elements.pdf
projects/admin-console/trunk/docs/Jms/pdf/jms_use_cases.pdf
projects/admin-console/trunk/docs/Jms/pdf/queue_elements.pdf
projects/admin-console/trunk/docs/Jms/pdf/topic_elements.pdf
projects/admin-console/trunk/docs/Jms/queue_elements.xls
projects/admin-console/trunk/docs/Jms/topic_elements.xls
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/persistenceSql.properties
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/struts-config.xml
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/tiles-defs.xml
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/validation.xml
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailDestination.jsp
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailDestination2.jsp
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms.jsp
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms2.jsp
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms3.jsp
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms4.jsp
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/listDestinations.jsp
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/viewMessages.jsp
projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/viewSubscriptions.jsp
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/CreateDestinationActionTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ListDestinationsActionTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/MockStrutsDestinationTestCase.java
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/MockStrutsJmsTestCase.java
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/RemoveDestinationActionTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/RemoveMessagesActionTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/SaveDestinationActionTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/SaveJmsActionTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ViewDestinationActionTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ViewJmsActionTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/
projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationIdentifierTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationMessageTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/JmsTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/QueueTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/TopicTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/
projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/DeploymentServiceDestinationHelperTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/DeploymentServiceJmsHelperTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/MBeanServerDestinationHelperTest.java
projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/MBeanServerJmsHelperTest.java
Log:
More JBoss Messaging check-in.
Added: projects/admin-console/trunk/docs/Jms/destination_use_cases.doc
===================================================================
(Binary files differ)
Property changes on: projects/admin-console/trunk/docs/Jms/destination_use_cases.doc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/admin-console/trunk/docs/Jms/jms_elements.xls
===================================================================
(Binary files differ)
Property changes on: projects/admin-console/trunk/docs/Jms/jms_elements.xls
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/admin-console/trunk/docs/Jms/jms_use_cases.doc
===================================================================
(Binary files differ)
Property changes on: projects/admin-console/trunk/docs/Jms/jms_use_cases.doc
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/admin-console/trunk/docs/Jms/pdf/destination_use_cases.pdf
===================================================================
(Binary files differ)
Property changes on: projects/admin-console/trunk/docs/Jms/pdf/destination_use_cases.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/admin-console/trunk/docs/Jms/pdf/jms_elements.pdf
===================================================================
(Binary files differ)
Property changes on: projects/admin-console/trunk/docs/Jms/pdf/jms_elements.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/admin-console/trunk/docs/Jms/pdf/jms_use_cases.pdf
===================================================================
(Binary files differ)
Property changes on: projects/admin-console/trunk/docs/Jms/pdf/jms_use_cases.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/admin-console/trunk/docs/Jms/pdf/queue_elements.pdf
===================================================================
(Binary files differ)
Property changes on: projects/admin-console/trunk/docs/Jms/pdf/queue_elements.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/admin-console/trunk/docs/Jms/pdf/topic_elements.pdf
===================================================================
(Binary files differ)
Property changes on: projects/admin-console/trunk/docs/Jms/pdf/topic_elements.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/admin-console/trunk/docs/Jms/queue_elements.xls
===================================================================
(Binary files differ)
Property changes on: projects/admin-console/trunk/docs/Jms/queue_elements.xls
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/admin-console/trunk/docs/Jms/topic_elements.xls
===================================================================
(Binary files differ)
Property changes on: projects/admin-console/trunk/docs/Jms/topic_elements.xls
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/persistenceSql.properties
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/persistenceSql.properties (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/persistenceSql.properties 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,165 @@
+#####################################################################
+#
+# File: persistenceSql.properties
+#
+# This file holds the message and user persistence SQL properties
+# for various types of databases. This file will be used by the
+# admin console to load the sql properties for the appropriate
+# database when the user selects a different dataSource.
+# If the user selects a database that is not defined in this
+# file, or the properties for the selected database is not
+# available in this file, then the default properties (defined
+# under default.msg.* and default.user.*) will be loaded.
+#
+# To add sql properties for another type of database, perform the
+# following steps:
+# 1. Define the jdbc driver class and the associated database type
+# at the top of the file. e.g.:
+# org.hsqldb.jdbcDriver = hsqldb
+# where "org.hsqldb.jdbcDriver" is the driver class specified
+# in the dataSource, and "hsqldb" is the database type
+# (dbType) used in this file to locate the properties.
+# 2. Define the sql properties for message persistence if they
+# are different from the defaults. Use "<dbType>.msg." as
+# the prefix for each property. e.g.:
+# hsqldb.msg.BLOB_TYPE = OBJECT_BLOB
+# 3. Define the sql properties for user persistence if they
+# are different from the defaults. Use "<dbType>.user." as
+# the prefix for each property. e.g.:
+# hsqldb.user.CREATE_TABLES_ON_STARTUP = TRUE
+#
+#####################################################################
+
+
+##########################################################
+# JDBC driver class and the database type.
+# These definitions must appear at the beginning of this
+# file.
+##########################################################
+org.hsqldb.jdbcDriver = hsqldb
+org.postgresql.Driver = postgresql
+
+##########################################################
+# Hypersonic SQL properties for message persistence
+##########################################################
+hsqldb.msg.BLOB_TYPE = OBJECT_BLOB
+hsqldb.msg.INSERT_TX = INSERT INTO JMS_TRANSACTIONS (TXID) values(?)
+hsqldb.msg.INSERT_MESSAGE = INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)
+hsqldb.msg.SELECT_ALL_UNCOMMITED_TXS = SELECT TXID FROM JMS_TRANSACTIONS
+hsqldb.msg.SELECT_MAX_TX = SELECT MAX(TXID) TXID FROM (SELECT MAX(TXID) AS TXID FROM JMS_TRANSACTIONS UNION SELECT MAX(TXID) AS TXID FROM JMS_MESSAGES)
+hsqldb.msg.DELETE_ALL_TX = DELETE FROM JMS_TRANSACTIONS
+hsqldb.msg.SELECT_MESSAGES_IN_DEST = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE DESTINATION=?
+hsqldb.msg.SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
+hsqldb.msg.MARK_MESSAGE = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE MESSAGEID=? AND DESTINATION=?
+hsqldb.msg.UPDATE_MESSAGE = UPDATE JMS_MESSAGES SET MESSAGEBLOB=? WHERE MESSAGEID=? AND DESTINATION=?
+hsqldb.msg.UPDATE_MARKED_MESSAGES = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=?
+hsqldb.msg.UPDATE_MARKED_MESSAGES_WITH_TX = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID=?
+hsqldb.msg.DELETE_MARKED_MESSAGES_WITH_TX = DELETE FROM JMS_MESSAGES WHERE TXOP=? AND JMS_MESSAGES.TXID IN (SELECT TXID FROM JMS_TRANSACTIONS)
+hsqldb.msg.DELETE_TX = DELETE FROM JMS_TRANSACTIONS WHERE TXID = ?
+hsqldb.msg.DELETE_MARKED_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=?
+hsqldb.msg.DELETE_TEMPORARY_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXOP='T'
+hsqldb.msg.DELETE_MESSAGE = DELETE FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
+hsqldb.msg.CREATE_MESSAGE_TABLE =CREATE CACHED TABLE JMS_MESSAGES ( MESSAGEID INTEGER NOT NULL, DESTINATION VARCHAR(255) NOT NULL, TXID INTEGER, TXOP CHAR(1), MESSAGEBLOB OBJECT, PRIMARY KEY (MESSAGEID, DESTINATION) )
+hsqldb.msg.CREATE_IDX_MESSAGE_TXOP_TXID = CREATE INDEX JMS_MESSAGES_TXOP_TXID ON JMS_MESSAGES (TXOP, TXID)
+hsqldb.msg.CREATE_IDX_MESSAGE_DESTINATION = CREATE INDEX JMS_MESSAGES_DESTINATION ON JMS_MESSAGES (DESTINATION)
+hsqldb.msg.CREATE_TX_TABLE = CREATE CACHED TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )
+hsqldb.msg.CREATE_TABLES_ON_STARTUP = TRUE
+
+##########################################################
+# Hypersonic SQL properties for user persistence
+##########################################################
+hsqldb.user.CREATE_TABLES_ON_STARTUP = TRUE
+hsqldb.user.CREATE_USER_TABLE = CREATE TABLE JMS_USERS (USERID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, CLIENTID VARCHAR(128), PRIMARY KEY(USERID))
+hsqldb.user.CREATE_ROLE_TABLE = CREATE TABLE JMS_ROLES (ROLEID VARCHAR(32) NOT NULL, USERID VARCHAR(32) NOT NULL, PRIMARY KEY(USERID, ROLEID))
+hsqldb.user.CREATE_SUBSCRIPTION_TABLE =CREATE TABLE JMS_SUBSCRIPTIONS (CLIENTID VARCHAR(128) NOT NULL, SUBNAME VARCHAR(128) NOT NULL, TOPIC VARCHAR(255) NOT NULL, SELECTOR VARCHAR(255), PRIMARY KEY(CLIENTID, SUBNAME))
+hsqldb.user.GET_SUBSCRIPTION = SELECT TOPIC, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=?
+hsqldb.user.LOCK_SUBSCRIPTION = SELECT TOPIC, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=?
+hsqldb.user.GET_SUBSCRIPTIONS_FOR_TOPIC = SELECT CLIENTID, SUBNAME, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE TOPIC=?
+hsqldb.user.INSERT_SUBSCRIPTION = INSERT INTO JMS_SUBSCRIPTIONS (CLIENTID, SUBNAME, TOPIC, SELECTOR) VALUES(?,?,?,?)
+hsqldb.user.UPDATE_SUBSCRIPTION = UPDATE JMS_SUBSCRIPTIONS SET TOPIC=?, SELECTOR=? WHERE CLIENTID=? AND SUBNAME=?
+hsqldb.user.REMOVE_SUBSCRIPTION = DELETE FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=?
+hsqldb.user.GET_USER_BY_CLIENTID = SELECT USERID, PASSWD, CLIENTID FROM JMS_USERS WHERE CLIENTID=?
+hsqldb.user.GET_USER = SELECT PASSWD, CLIENTID FROM JMS_USERS WHERE USERID=?
+
+##########################################################
+# Postgre SQL properties for message persistence
+##########################################################
+postgresql.msg.CREATE_MESSAGE_REF=CREATE TABLE JMS_MESSAGE_REFERENCE (CHANNELID BIGINT, MESSAGEID BIGINT, TRANSACTIONID BIGINT, STATE CHAR(1), ORD BIGINT, DELIVERYCOUNT INTEGER, RELIABLE CHAR(1), LOADED CHAR(1), PRIMARY KEY(CHANNELID, MESSAGEID))
+postgresql.msg.CREATE_IDX_MESSAGE_REF_TX=CREATE INDEX JMS_MESSAGE_REF_TX ON JMS_MESSAGE_REFERENCE (TRANSACTIONID)
+postgresql.msg.CREATE_IDX_MESSAGE_REF_ORD=CREATE INDEX JMS_MESSAGE_REF_ORD ON JMS_MESSAGE_REFERENCE (ORD)
+postgresql.msg.CREATE_IDX_MESSAGE_REF_MESSAGEID=CREATE INDEX JMS_MESSAGE_REF_MESSAGEID ON JMS_MESSAGE_REFERENCE (MESSAGEID)
+postgresql.msg.CREATE_IDX_MESSAGE_REF_LOADED=CREATE INDEX JMS_MESSAGE_REF_LOADED ON JMS_MESSAGE_REFERENCE (LOADED)
+postgresql.msg.CREATE_IDX_MESSAGE_REF_RELIABLE=CREATE INDEX JMS_MESSAGE_REF_RELIABLE ON JMS_MESSAGE_REFERENCE (RELIABLE)
+postgresql.msg.INSERT_MESSAGE_REF=INSERT INTO JMS_MESSAGE_REFERENCE (CHANNELID, MESSAGEID, TRANSACTIONID, STATE, ORD, DELIVERYCOUNT, RELIABLE, LOADED) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
+postgresql.msg.DELETE_MESSAGE_REF=DELETE FROM JMS_MESSAGE_REFERENCE WHERE MESSAGEID=? AND CHANNELID=? AND STATE='C'
+postgresql.msg.UPDATE_MESSAGE_REF=UPDATE JMS_MESSAGE_REFERENCE SET TRANSACTIONID=?, STATE='-' WHERE MESSAGEID=? AND CHANNELID=? AND STATE='C'
+postgresql.msg.UPDATE_MESSAGE_REF_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE MESSAGEID=? AND CHANNELID=?
+postgresql.msg.COMMIT_MESSAGE_REF1=UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='+'
+postgresql.msg.COMMIT_MESSAGE_REF2=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='-'
+postgresql.msg.ROLLBACK_MESSAGE_REF1=DELETE FROM JMS_MESSAGE_REFERENCE WHERE TRANSACTIONID=? AND STATE='+'
+postgresql.msg.ROLLBACK_MESSAGE_REF2=UPDATE JMS_MESSAGE_REFERENCE SET STATE='C', TRANSACTIONID = NULL WHERE TRANSACTIONID=? AND STATE='-'
+postgresql.msg.LOAD_REF_INFO=SELECT MESSAGEID, ORD, DELIVERYCOUNT, RELIABLE FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N' AND ORD BETWEEN ? AND ? ORDER BY ORD
+postgresql.msg.SELECT_COUNT_REFS=SELECT COUNT(MESSAGEID) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED='N'
+postgresql.msg.UPDATE_RELIABLE_REFS=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='Y' WHERE ORD BETWEEN ? AND ? AND CHANNELID=? AND RELIABLE='Y' AND STATE <> '+'
+postgresql.msg.UPDATE_RELIABLE_REFS_NOT_LOADED=UPDATE JMS_MESSAGE_REFERENCE SET LOADED='N' WHERE CHANNELID=?
+postgresql.msg.SELECT_MIN_ORDERING=SELECT MIN(ORD) FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND STATE <> '+' AND LOADED = 'N'
+postgresql.msg.DELETE_UNRELIABLE_REFS=DELETE FROM JMS_MESSAGE_REFERENCE WHERE RELIABLE = 'N'
+postgresql.msg.CREATE_MESSAGE=CREATE TABLE JMS_MESSAGE (MESSAGEID BIGINT, RELIABLE CHAR(1), EXPIRATION BIGINT, TIMESTAMP BIGINT, PRIORITY int2, COREHEADERS BYTEA, PAYLOAD BYTEA, CHANNELCOUNT INTEGER, TYPE int2, JMSTYPE VARCHAR(255), CORRELATIONID VARCHAR(255), CORRELATIONID_BYTES BYTEA, DESTINATION_ID BIGINT, REPLYTO_ID BIGINT, JMSPROPERTIES BYTEA, PRIMARY KEY (MESSAGEID))
+postgresql.msg.LOAD_MESSAGES=SELECT MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES FROM JMS_MESSAGE
+postgresql.msg.INSERT_MESSAGE=INSERT INTO JMS_MESSAGE (MESSAGEID, RELIABLE, EXPIRATION, TIMESTAMP, PRIORITY, COREHEADERS, PAYLOAD, CHANNELCOUNT, TYPE, JMSTYPE, CORRELATIONID, CORRELATIONID_BYTES, DESTINATION_ID, REPLYTO_ID, JMSPROPERTIES) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+postgresql.msg.UPDATE_MESSAGE_CHANNELCOUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT=? WHERE MESSAGEID=?
+postgresql.msg.DELETE_MESSAGE=DELETE FROM JMS_MESSAGE WHERE MESSAGEID=?
+postgresql.msg.MESSAGEID_COLUMN=MESSAGEID
+postgresql.msg.UPDATE_UNRELIABLE_CHANNELCOUNT=UPDATE JMS_MESSAGE SET CHANNELCOUNT = CHANNELCOUNT - 1 WHERE MESSAGEID IN (SELECT MR.MESSAGEID FROM JMS_MESSAGE_REFERENCE MR WHERE MR.RELIABLE = 'N' AND MR.CHANNELID = ?)
+postgresql.msg.DELETE_UNREFFED_MESSAGES=DELETE FROM JMS_MESSAGE WHERE CHANNELCOUNT = 0
+postgresql.msg.CREATE_TRANSACTION=CREATE TABLE JMS_TRANSACTION (TRANSACTIONID BIGINT, BRANCH_QUAL BYTEA, FORMAT_ID INTEGER, GLOBAL_TXID BYTEA, PRIMARY KEY (TRANSACTIONID))
+postgresql.msg.INSERT_TRANSACTION=INSERT INTO JMS_TRANSACTION (TRANSACTIONID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID) VALUES(?, ?, ?, ?)
+postgresql.msg.DELETE_TRANSACTION=DELETE FROM JMS_TRANSACTION WHERE TRANSACTIONID = ?
+postgresql.msg.SELECT_PREPARED_TRANSACTIONS=SELECT TRANSACTIONID, BRANCH_QUAL, FORMAT_ID, GLOBAL_TXID FROM JMS_TRANSACTION
+postgresql.msg.DELETE_ALL_TRANSACTIONS=DELETE FROM JMS_TRANSACTION
+postgresql.msg.CREATE_COUNTER=CREATE TABLE JMS_COUNTER (NAME VARCHAR(255), NEXT_ID BIGINT, PRIMARY KEY(NAME))
+postgresql.msg.UPDATE_COUNTER=UPDATE JMS_COUNTER SET NEXT_ID = ? WHERE NAME=?
+postgresql.msg.SELECT_COUNTER=SELECT NEXT_ID FROM JMS_COUNTER WHERE NAME=?
+postgresql.msg.INSERT_COUNTER=INSERT INTO JMS_COUNTER (NAME, NEXT_ID) VALUES (?, ?)
+postgresql.msg.DELETE_ALL_COUNTERS=DELETE FROM JMS_COUNTER
+postgresql.msg.SELECT_ALL_CHANNELS=SELECT DISTINCT(CHANNELID) FROM JMS_MESSAGE_REFERENCE
+
+##########################################################
+# Default SQL properties for message persistence
+##########################################################
+default.msg.BLOB_TYPE = OBJECT_BLOB
+default.msg.INSERT_TX = INSERT INTO JMS_TRANSACTIONS (TXID) values(?)
+default.msg.INSERT_MESSAGE = INSERT INTO JMS_MESSAGES (MESSAGEID, DESTINATION, MESSAGEBLOB, TXID, TXOP) VALUES(?,?,?,?,?)
+default.msg.SELECT_ALL_UNCOMMITED_TXS = SELECT TXID FROM JMS_TRANSACTIONS
+default.msg.SELECT_MAX_TX = SELECT MAX(TXID) TXID FROM (SELECT MAX(TXID) AS TXID FROM JMS_TRANSACTIONS UNION SELECT MAX(TXID) AS TXID FROM JMS_MESSAGES)
+default.msg.DELETE_ALL_TX = DELETE FROM JMS_TRANSACTIONS
+default.msg.SELECT_MESSAGES_IN_DEST = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGES WHERE DESTINATION=?
+default.msg.SELECT_MESSAGE = SELECT MESSAGEID, MESSAGEBLOB FROM JMS_MESSAGESSTINATION=?
+default.msg.UPDATE_MARKED_MESSAGES = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=?
+default.msg.UPDATE_MARKED_MESSAGES_WITH_TX = UPDATE JMS_MESSAGES SET TXID=?, TXOP=? WHERE TXOP=? AND TXID=?
+default.msg.DELETE_MARKED_MESSAGES_WITH_TX = DELETE FROM JMS_MESSAGES WHERE TXOP=? AND JMS_MESSAGES.TXID IN (SELECT TXID FROM JMS_TRANSACTIONS)
+default.msg.DELETE_TX = DELETE FROM JMS_TRANSACTIONS WHERE TXID = ?
+default.msg.DELETE_MARKED_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXID=? AND TXOP=?
+default.msg.DELETE_TEMPORARY_MESSAGES = DELETE FROM JMS_MESSAGES WHERE TXOP='T'
+default.msg.DELETE_MESSAGE = DELETE FROM JMS_MESSAGES WHERE MESSAGEID=? AND DESTINATION=?
+default.msg.CREATE_MESSAGE_TABLE = CREATE CACHED TABLE JMS_MESSAGES ( MESSAGEID INTEGER NOT NULL, DESTINATION VARCHAR(255) NOT NULL, TXID INTEGER, TXOP CHAR(1), MESSAGEBLOB OBJECT, PRIMARY KEY (MESSAGEID, DESTINATION) )
+default.msg.CREATE_IDX_MESSAGE_TXOP_TXID = CREATE INDEX JMS_MESSAGES_TXOP_TXID ON JMS_MESSAGES (TXOP, TXID)
+default.msg.CREATE_IDX_MESSAGE_DESTINATION = CREATE INDEX JMS_MESSAGES_DESTINATION ON JMS_MESSAGES (DESTINATION)
+default.msg.CREATE_TX_TABLE = CREATE CACHED TABLE JMS_TRANSACTIONS ( TXID INTEGER, PRIMARY KEY (TXID) )
+default.msg.CREATE_TABLES_ON_STARTUP = TRUE
+
+##########################################################
+# Default SQL properties for user persistence
+##########################################################
+default.user.CREATE_TABLES_ON_STARTUP = TRUE
+default.user.CREATE_USER_TABLE = CREATE TABLE JMS_USERS (USERID VARCHAR(32) NOT NULL, PASSWD VARCHAR(32) NOT NULL, CLIENTID VARCHAR(128), PRIMARY KEY(USERID))
+default.user.CREATE_ROLE_TABLE = CREATE TABLE JMS_ROLES (ROLEID VARCHAR(32) NOT NULL, USERID VARCHAR(32) NOT NULL, PRIMARY KEY(USERID, ROLEID))
+default.user.CREATE_SUBSCRIPTION_TABLE = CREATE TABLE JMS_SUBSCRIPTIONS (CLIENTID VARCHAR(128) NOT NULL, SUBNAME VARCHAR(128) NOT NULL, TOPIC VARCHAR(255) NOT NULL, SELECTOR VARCHAR(255), PRIMARY KEY(CLIENTID, SUBNAME))
+default.user.GET_SUBSCRIPTION = SELECT TOPIC, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=?
+default.user.LOCK_SUBSCRIPTION = SELECT TOPIC, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=?
+default.user.GET_SUBSCRIPTIONS_FOR_TOPIC = SELECT CLIENTID, SUBNAME, SELECTOR FROM JMS_SUBSCRIPTIONS WHERE TOPIC=?
+default.user.INSERT_SUBSCRIPTION = INSERT INTO JMS_SUBSCRIPTIONS (CLIENTID, SUBNAME, TOPIC, SELECTOR) VALUES(?,?,?,?)
+default.user.UPDATE_SUBSCRIPTION = UPDATE JMS_SUBSCRIPTIONS SET TOPIC=?, SELECTOR=? WHERE CLIENTID=? AND SUBNAME=?
+default.user.REMOVE_SUBSCRIPTION = DELETE FROM JMS_SUBSCRIPTIONS WHERE CLIENTID=? AND SUBNAME=?
+default.user.GET_USER_BY_CLIENTID = SELECT USERID, PASSWD, CLIENTID FROM JMS_USERS WHERE CLIENTID=?
+default.user.GET_USER = SELECT PASSWD, CLIENTID FROM JMS_USERS WHERE USERID=?
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/struts-config.xml
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/struts-config.xml (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/struts-config.xml 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE struts-config PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
+ "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
+
+<!--
+ This Struts configuration file contains JBoss Messaging related information
+-->
+<struts-config>
+ <form-beans>
+ <form-bean name="jms"
+ type="org.jboss.admin.console.web.struts.jms.JmsForm"/>
+ <form-bean name="destination"
+ type="org.jboss.admin.console.web.struts.jms.DestinationForm"/>
+ <form-bean name="destinationIdentifier"
+ type="org.jboss.admin.console.web.struts.jms.DestinationIdentifierForm"/>
+ </form-beans>
+
+ <global-forwards>
+ <forward name="destination.list.queue"
+ path="/destination/list.html?type=queue"
+ redirect="false"/>
+ <forward name="destination.list.topic"
+ path="/destination/list.html?type=topic"
+ redirect="false"/>
+ </global-forwards>
+
+ <action-mappings>
+ <!--
+ JBoss Messaging related action mappings
+ -->
+ <action path="/list"
+ type="org.jboss.admin.console.web.struts.jms.ViewJmsAction"
+ name="jms"
+ validate="false"
+ scope="request">
+ <forward name="showpage"
+ path="jms.detail.tile"/>
+ </action>
+ <action path="/jms/save"
+ name="jms"
+ validate="true"
+ scope="session"
+ type="org.jboss.admin.console.web.struts.jms.SaveJmsAction"
+ input="jms.detail.tile">
+ <forward name="page1"
+ path="jms.detail.tile"
+ redirect="false"/>
+ <forward name="page2"
+ path="jms.detail2.tile"
+ redirect="false"/>
+ <forward name="page3"
+ path="jms.detail3.tile"
+ redirect="false"/>
+ <forward name="page4"
+ path="jms.detail4.tile"
+ redirect="false"/>
+ </action>
+
+ <!--
+ JBoss Messaging queue and topic related action mappings
+ -->
+ <action path="/destination/list"
+ type="org.jboss.admin.console.web.struts.jms.ListDestinationsAction"
+ name="destinationIdentifier"
+ validate="false"
+ scope="request">
+ <forward name="showpage"
+ path="destination.list.tile"/>
+ </action>
+ <action path="/destination/save"
+ name="destination"
+ validate="true"
+ scope="session"
+ type="org.jboss.admin.console.web.struts.jms.SaveDestinationAction"
+ input="destination.detail.tile">
+ <forward name="page1"
+ path="destination.detail.tile"
+ redirect="false"/>
+ <forward name="page2"
+ path="destination.detail2.tile"
+ redirect="false"/>
+ </action>
+ <action path="/destination/create"
+ type="org.jboss.admin.console.web.struts.jms.CreateDestinationAction"
+ name="destinationIdentifier"
+ validate="false"
+ scope="request">
+ <forward name="showpage"
+ redirect="false"
+ path="destination.detail.tile"/>
+ </action>
+ <action path="/destination/remove"
+ type="org.jboss.admin.console.web.struts.jms.RemoveDestinationAction"
+ name="destinationIdentifier"
+ validate="false"
+ scope="request"/>
+ <action path="/destination/view"
+ type="org.jboss.admin.console.web.struts.jms.ViewDestinationAction"
+ name="destinationIdentifier"
+ scope="request"
+ validate="false">
+ <forward name="showpage"
+ path="destination.detail.tile"
+ redirect="false"/>
+ </action>
+ <action path="/destination/manage"
+ type="org.jboss.admin.console.web.struts.RelayAction"
+ name="destinationIdentifier"
+ validate="false"
+ scope="request">
+ <forward name="view"
+ path="/destination/view.html"
+ redirect="false"/>
+ <forward name="remove"
+ path="/destination/remove.html"
+ redirect="false"/>
+ <forward name="viewMessages"
+ path="/destination/viewMessages.html"
+ redirect="false"/>
+ </action>
+ <action path="/destination/manageMessage"
+ type="org.jboss.admin.console.web.struts.RelayAction"
+ name="destinationIdentifier"
+ validate="false"
+ scope="request">
+ <forward name="viewMessages"
+ path="/destination/viewMessages.html"
+ redirect="false"/>
+ <forward name="viewSubscriptions"
+ path="/destination/viewSubscriptions.html"
+ redirect="false"/>
+ <forward name="removeMessages"
+ path="/destination/removeMessages.html"
+ redirect="false"/>
+ </action>
+ <action path="/destination/viewMessages"
+ type="org.jboss.admin.console.web.struts.jms.ViewMessagesAction"
+ name="destinationIdentifier"
+ validate="false"
+ scope="request">
+ <forward name="showpage"
+ path="destination.viewMessages.tile"
+ redirect="false"/>
+ </action>
+ <action path="/destination/viewSubscriptions"
+ type="org.jboss.admin.console.web.struts.jms.ViewSubscriptionsAction"
+ name="destinationIdentifier"
+ validate="false"
+ scope="request">
+ <forward name="showpage"
+ path="destination.viewSubscriptions.tile"
+ redirect="false"/>
+ </action>
+ <action path="/destination/removeMessages"
+ type="org.jboss.admin.console.web.struts.jms.RemoveMessagesAction"
+ name="destinationIdentifier"
+ validate="false"
+ scope="request">
+ <forward name="showpage"
+ path="destination.viewMessages.tile"
+ redirect="false"/>
+ </action>
+
+ </action-mappings>
+
+ <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
+
+ <!--
+ All JMS-related text is placed in a separate message resource file.
+ -->
+ <message-resources parameter="messages.jmsmessages" />
+
+ <plug-in className="org.apache.struts.tiles.TilesPlugin">
+ <set-property property="definitions-config"
+ value="/WEB-INF/conf/common/layout-tiles-defs.xml,/WEB-INF/conf/jms/tiles-defs.xml"/>
+ <set-property property="moduleAware"
+ value="true"/>
+ </plug-in>
+
+ <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
+ <set-property property="pathnames"
+ value="/WEB-INF/conf/common/validator-rules.xml,/WEB-INF/conf/jms/validation.xml"/>
+ </plug-in>
+
+</struts-config>
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/tiles-defs.xml
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/tiles-defs.xml (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/tiles-defs.xml 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE tiles-definitions PUBLIC
+ "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
+ "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
+
+<tiles-definitions>
+
+ <definition name="jms.portal.layout"
+ extends="main.portal.layout">
+ <put name="module.title"
+ value="JBoss Messaging"/>
+ </definition>
+
+ <definition name="destination.portal.layout"
+ extends="main.portal.layout">
+ <put name="module.title"
+ value="JBoss Messaging Destinations"/>
+ </definition>
+
+ <!--
+ JBoss Messaging related pages.
+ -->
+ <definition name="jms.detail.tile"
+ extends="jms.portal.layout">
+ <put name="body"
+ value="/WEB-INF/jsp/jms/detailJms.jsp"/>
+ </definition>
+
+ <definition name="jms.detail2.tile"
+ extends="jms.portal.layout">
+ <put name="body"
+ value="/WEB-INF/jsp/jms/detailJms2.jsp"/>
+ </definition>
+
+ <definition name="jms.detail3.tile"
+ extends="jms.portal.layout">
+ <put name="body"
+ value="/WEB-INF/jsp/jms/detailJms3.jsp"/>
+ </definition>
+
+ <definition name="jms.detail4.tile"
+ extends="jms.portal.layout">
+ <put name="body"
+ value="/WEB-INF/jsp/jms/detailJms4.jsp"/>
+ </definition>
+
+ <!--
+ JBoss Messaging destination related pages.
+ -->
+ <definition name="destination.list.tile"
+ extends="destination.portal.layout">
+ <put name="body"
+ value="/WEB-INF/jsp/jms/listDestinations.jsp"/>
+ </definition>
+
+ <definition name="destination.detail.tile"
+ extends="destination.portal.layout">
+ <put name="body"
+ value="/WEB-INF/jsp/jms/detailDestination.jsp"/>
+ </definition>
+
+ <definition name="destination.detail2.tile"
+ extends="destination.portal.layout">
+ <put name="body"
+ value="/WEB-INF/jsp/jms/detailDestination2.jsp"/>
+ </definition>
+
+ <definition name="destination.viewMessages.tile"
+ extends="destination.portal.layout">
+ <put name="body"
+ value="/WEB-INF/jsp/jms/viewMessages.jsp"/>
+ </definition>
+
+ <definition name="destination.viewSubscriptions.tile"
+ extends="destination.portal.layout">
+ <put name="body"
+ value="/WEB-INF/jsp/jms/viewSubscriptions.jsp"/>
+ </definition>
+
+</tiles-definitions>
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/validation.xml
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/validation.xml (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/conf/jms/validation.xml 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE form-validation PUBLIC
+ "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
+ "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
+
+<form-validation>
+ <global/>
+ <formset>
+ <form name="jms">
+ <field property="defaultTempQueueDownCacheSize" depends="integer">
+ <arg0 key="jms.view.defaultTempQueueDownCacheSize"/>
+ </field>
+
+ <field property="defaultTempQueueFullSize" depends="integer">
+ <arg0 key="jms.view.defaultTempQueueFullSize"/>
+ </field>
+
+ <field property="defaultTempQueuePageSize" depends="integer">
+ <arg0 key="jms.view.defaultTempQueuePageSize"/>
+ </field>
+
+ <field property="prefetchSize" depends="integer">
+ <arg0 key="jms.view.prefetchSize"/>
+ </field>
+
+ <field property="queuedExecutorPoolSize" depends="integer">
+ <arg0 key="jms.view.queuedExecutorPoolSize"/>
+ </field>
+
+ <field property="maxParams" depends="integer">
+ <arg0 key="jms.view.maxParams"/>
+ </field>
+ </form>
+ <form name="destination">
+ <field property="name" depends="required">
+ <arg0 key="destination.view.name"/>
+ </field>
+
+ <field property="downCacheSize" depends="integer">
+ <arg0 key="destination.view.downCacheSize"/>
+ </field>
+
+ <field property="fullSize" depends="integer">
+ <arg0 key="destination.view.fullSize"/>
+ </field>
+
+ <field property="pageSize" depends="integer">
+ <arg0 key="destination.view.pageSize"/>
+ </field>
+ </form>
+ </formset>
+</form-validation>
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailDestination.jsp
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailDestination.jsp (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailDestination.jsp 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,129 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.
+ -->
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ include file="/WEB-INF/jsp/common/taglibs.inc.jsp" %>
+<html:xhtml/>
+ <fmt:setBundle basename="messages.jmsmessages" var="jms" scope="page"/>
+ <div id="main">
+ <script>
+ function setPageAndSubmit(target){
+ document.forms["destination"].destinationProp.value=target;
+ document.forms["destination"].submit();
+ }
+ function setDispatch(target) {
+ document.forms["destination"].dispatch.value=target;
+ }
+ </script>
+
+ <ul class="navigation">
+ <c:if test='${operation != "create"}'>
+ <li>
+ <a class="active">
+ <fmt:message key="destination.section.heading.settings.page" bundle="${jms}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page2'))">
+ <fmt:message key="destination.section.heading.more.page" bundle="${jms}" />
+ </a>
+ </li>
+ </c:if>
+ </ul>
+
+ <p class="sectionHeading">
+ <span class="sectionHeadingText">
+ <c:choose>
+ <c:when test='${operation == "create"}'>
+ <fmt:message key="destination.section.heading.create" bundle="${jms}" />
+ </c:when>
+ <c:otherwise>
+ <fmt:message key="destination.section.heading.view" bundle="${jms}" />
+ </c:otherwise>
+ </c:choose>
+
+ <c:choose>
+ <c:when test='${destination.type == "queue"}'>
+ <fmt:message key="destination.section.heading.queue" bundle="${jms}" />
+ </c:when>
+ <c:otherwise>
+ <fmt:message key="destination.section.heading.topic" bundle="${jms}" />
+ </c:otherwise>
+ </c:choose>
+
+ <fmt:message key="destination.section.heading.configurable" bundle="${jms}" />
+ </span>
+ </p>
+
+ <logic:messagesPresent message="false">
+ <p class="error">
+ <html:errors /><br/>
+ </p>
+ </logic:messagesPresent >
+ <logic:messagesPresent message="true">
+ <p class="error">
+ <html:messages id="theMessage" message="true">
+ <%= theMessage %>
+ </html:messages>
+ </p>
+ </logic:messagesPresent >
+
+ <bean:define id="destinationForm" name="destination" type="org.jboss.admin.console.web.struts.jms.DestinationForm"/>
+ <html:form action="destination/save">
+ <div class="caseDetail">
+ <html:hidden property="dispatch" value="navigation"/>
+ <html:hidden property="destinationProp" value="error"/>
+ <html:hidden property="type" name="destination"/>
+ <ul>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="destination.view.name" bundle="${jms}" /></span>
+ <html:text property="name" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="destination.view.jndiName" bundle="${jms}" /></span>
+ <html:text property="jndiName" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="destination.view.downCacheSize" bundle="${jms}" /></span>
+ <html:text property="downCacheSize" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="destination.view.fullSize" bundle="${jms}" /></span>
+ <html:text property="fullSize" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="destination.view.pageSize" bundle="${jms}" /></span>
+ <html:text property="pageSize" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="destination.view.securityRoles" bundle="${jms}" /></span>
+ <br/>
+ <html:textarea cols="40" rows="3" property="securityRoles" />
+ </li>
+ </ul>
+
+ <html:submit onclick="setDispatch('save');"><fmt:message key="destination.button.save" bundle="${jms}" /></html:submit>
+ <html:cancel onclick="setDispatch('cancel');"><fmt:message key="destination.button.cancel" bundle="${jms}" /></html:cancel>
+
+ </div>
+ </html:form>
+ </div>
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailDestination2.jsp
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailDestination2.jsp (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailDestination2.jsp 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,115 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.
+ -->
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ include file="/WEB-INF/jsp/common/taglibs.inc.jsp" %>
+<html:xhtml/>
+ <fmt:setBundle basename="messages.jmsmessages" var="jms" scope="page"/>
+ <div id="main">
+ <script>
+ function setPageAndSubmit(target){
+ document.forms["destination"].destinationProp.value=target;
+ document.forms["destination"].submit();
+ }
+ function setDispatch(target) {
+ document.forms["destination"].dispatch.value=target;
+ }
+ </script>
+
+ <ul class="navigation">
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page1'))">
+ <fmt:message key="destination.section.heading.settings.page" bundle="${jms}" />
+ </a>
+ </li>
+ <li>
+ <a class="active">
+ <fmt:message key="destination.section.heading.more.page" bundle="${jms}" />
+ </a>
+ </li>
+ </ul>
+
+ <p class="sectionHeading">
+ <span class="sectionHeadingText">
+ <fmt:message key="destination.section.heading.view" bundle="${jms}" />
+ <c:choose>
+ <c:when test='${destination.type == "queue"}' >
+ <fmt:message key="destination.section.heading.queue" bundle="${jms}" />
+ </c:when>
+ <c:otherwise>
+ <fmt:message key="destination.section.heading.topic" bundle="${jms}" />
+ </c:otherwise>
+ </c:choose>
+ <fmt:message key="destination.section.heading.readonly" bundle="${jms}"/>
+ </span>
+ </p>
+
+ <logic:messagesPresent message="false">
+ <p class="error">
+ <html:errors />
+ </p>
+ </logic:messagesPresent >
+ <logic:messagesPresent message="true">
+ <p class="error">
+ <html:messages id="theMessage" message="true">
+ <%= theMessage %>
+ </html:messages>
+ </p>
+ </logic:messagesPresent >
+
+ <bean:define id="destinationForm" name="destination" type="org.jboss.admin.console.web.struts.jms.DestinationForm"/>
+ <html:form action="destination/save">
+ <div class="caseDetail">
+ <html:hidden property="dispatch" value="navigation"/>
+ <html:hidden property="destinationProp" value="error"/>
+ <html:hidden property="type" name="destination"/>
+ <table id="destTable">
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="destination.view.createdProgrammatically" bundle="${jms}" /> </td>
+ <td><bean:write name="destination" property="createdProgrammatically"/></td>
+ </tr>
+ <c:choose>
+ <c:when test='${destination.type == "queue"}' >
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="destination.view.messageCount" bundle="${jms}" /> </td>
+ <td><bean:write name="destination" property="messageCount"/></td>
+ </tr>
+ </c:when>
+ <c:otherwise>
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="destination.view.durableSubCount" bundle="${jms}" /> </td>
+ <td><bean:write name="destination" property="durableSubCount"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="destination.view.nonDurableSubCount" bundle="${jms}" /> </td>
+ <td><bean:write name="destination" property="nonDurableSubCount"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="destination.view.allSubCount" bundle="${jms}" /> </td>
+ <td><bean:write name="destination" property="allSubCount"/></td>
+ </tr>
+ </c:otherwise>
+ </c:choose>
+ </table>
+ </div>
+ </html:form>
+ </div>
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms.jsp
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms.jsp (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms.jsp 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,146 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.
+ -->
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ include file="/WEB-INF/jsp/common/taglibs.inc.jsp" %>
+<html:xhtml/>
+<fmt:setBundle basename="messages.jmsmessages" var="jmsmsg" scope="page"/>
+<div id="main">
+ <script>
+ function setPageAndSubmit(target){
+ document.forms["jms"].destination.value=target;
+ document.forms["jms"].submit();
+ }
+ function setDispatch(target) {
+ document.forms["jms"].dispatch.value=target;
+ }
+ </script>
+
+ <ul class="navigation">
+ <li>
+ <a class="active">
+ <fmt:message key="jms.section.heading.settings.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page2'))">
+ <fmt:message key="jms.section.heading.more.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page3'))">
+ <fmt:message key="jms.section.heading.msgSql.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page4'))">
+ <fmt:message key="jms.section.heading.userSql.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ </ul>
+
+ <p class="sectionHeading">
+ <span class="sectionHeadingText">
+ <fmt:message key="jms.section.heading.manage" bundle="${jmsmsg}" />
+ <fmt:message key="jms.section.heading.configurable" bundle="${jmsmsg}" />
+ </span>
+ </p>
+
+ <logic:messagesPresent message="false">
+ <p class="error">
+ <html:errors /><br/>
+ </p>
+ </logic:messagesPresent >
+ <logic:messagesPresent message="true">
+ <p class="infoMessage">
+ <html:messages id="theMessage" message="true">
+ <%= theMessage %>
+ </html:messages>
+ </p>
+ </logic:messagesPresent >
+
+ <bean:define id="jmsForm" name="jms" type="org.jboss.admin.console.web.struts.jms.JmsForm"/>
+ <html:form action="jms/save">
+ <div class="caseDetail">
+ <html:hidden property="dispatch" value="navigation"/>
+ <html:hidden property="destination" value="error"/>
+ <ul>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.defaultTempQueueDownCacheSize" bundle="${jmsmsg}" /></span>
+ <html:text property="defaultTempQueueDownCacheSize" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.defaultTempQueueFullSize" bundle="${jmsmsg}" /></span>
+ <html:text property="defaultTempQueueFullSize" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.defaultTempQueuePageSize" bundle="${jmsmsg}" /></span>
+ <html:text property="defaultTempQueuePageSize" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.prefetchSize" bundle="${jmsmsg}" /></span>
+ <html:text property="prefetchSize" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.queuedExecutorPoolSize" bundle="${jmsmsg}" /></span>
+ <html:text property="queuedExecutorPoolSize" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.securityDomain" bundle="${jmsmsg}" /></span>
+ <html:text property="securityDomain" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.defaultSecurityRoles" bundle="${jmsmsg}" /></span>
+ <br/>
+ <html:textarea cols="30" rows="2" property="defaultSecurityRoles" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.createMsgTablesOnStartup" bundle="${jmsmsg}" /></span>
+ <html:checkbox property="createMsgTablesOnStartup" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.msgDataSource" bundle="${jmsmsg}" /></span>
+ <html:select property="msgDataSourceName" >
+ <html:options property="dataSourceOptions" />
+ </html:select>
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.usingBatchUpdates" bundle="${jmsmsg}" /></span>
+ <html:checkbox property="usingBatchUpdates" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.createUserTablesOnStartup" bundle="${jmsmsg}" /></span>
+ <html:checkbox property="createUserTablesOnStartup" />
+ </li>
+ <li>
+ <span class="caseDetailFieldHeader"><fmt:message key="jms.view.userDataSource" bundle="${jmsmsg}" /></span>
+ <html:select property="userDataSourceName" >
+ <html:options property="dataSourceOptions" />
+ </html:select>
+ </li>
+ </ul>
+
+ <html:submit onclick="setDispatch('save');"><fmt:message key="destination.button.save" bundle="${jmsmsg}" /></html:submit>
+ <html:cancel onclick="setDispatch('cancel');"><fmt:message key="destination.button.cancel" bundle="${jmsmsg}" /></html:cancel>
+ </div>
+ </html:form>
+</div>
\ No newline at end of file
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms2.jsp
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms2.jsp (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms2.jsp 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,125 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.
+ -->
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ include file="/WEB-INF/jsp/common/taglibs.inc.jsp" %>
+<html:xhtml/>
+<fmt:setBundle basename="messages.jmsmessages" var="jmsmsg" scope="page"/>
+<div id="main">
+ <script>
+ function setPageAndSubmit(target){
+ document.forms["jms"].destination.value=target;
+ document.forms["jms"].submit();
+ }
+ function setDispatch(target) {
+ document.forms["jms"].dispatch.value=target;
+ }
+ </script>
+
+ <ul class="navigation">
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page1'))">
+ <fmt:message key="jms.section.heading.settings.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a class="active">
+ <fmt:message key="jms.section.heading.more.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page3'))">
+ <fmt:message key="jms.section.heading.msgSql.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page4'))">
+ <fmt:message key="jms.section.heading.userSql.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ </ul>
+
+ <p class="sectionHeading">
+ <span class="sectionHeadingText">
+ <fmt:message key="jms.section.heading.manage" bundle="${jmsmsg}" />
+ <fmt:message key="jms.section.heading.readonly" bundle="${jmsmsg}" />
+ </span>
+ </p>
+
+ <logic:messagesPresent message="false">
+ <p class="error">
+ <html:errors /><br/>
+ </p>
+ </logic:messagesPresent >
+ <logic:messagesPresent message="true">
+ <p class="infoMessage">
+ <html:messages id="theMessage" message="true">
+ <%= theMessage %>
+ </html:messages>
+ </p>
+ </logic:messagesPresent >
+
+ <bean:define id="jmsForm" name="jms" type="org.jboss.admin.console.web.struts.jms.JmsForm"/>
+ <html:form action="jms/save">
+ <div class="caseDetail">
+ <html:hidden property="dispatch" value="navigation"/>
+ <html:hidden property="destination" value="error"/>
+ <table id="jmsTable">
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="jms.view.defaultQueueJNDIContext" bundle="${jmsmsg}" /> </td>
+ <td><bean:write name="jms" property="defaultQueueJNDIContext"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="jms.view.defaultTopicJNDIContext" bundle="${jmsmsg}" /> </td>
+ <td><bean:write name="jms" property="defaultTopicJNDIContext"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="jms.view.jmsVersion" bundle="${jmsmsg}" /> </td>
+ <td><bean:write name="jms" property="jmsVersion"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="jms.view.jmsProviderName" bundle="${jmsmsg}" /> </td>
+ <td><bean:write name="jms" property="jmsProviderName"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="jms.view.providerVersion" bundle="${jmsmsg}" /> </td>
+ <td><bean:write name="jms" property="providerVersion"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader"><fmt:message key="jms.view.serverPeerID" bundle="${jmsmsg}" /> </td>
+ <td><bean:write name="jms" property="serverPeerID"/></td>
+ </tr>
+ </table>
+
+ <% // include hidden values for checked checkboxes specified on other pages %>
+ <logic:equal name="jms" property="createMsgTablesOnStartup" value="true">
+ <html:hidden property="createMsgTablesOnStartup" value="on"/>
+ </logic:equal>
+ <logic:equal name="jms" property="createUserTablesOnStartup" value="true">
+ <html:hidden property="createUserTablesOnStartup" value="on"/>
+ </logic:equal>
+ <logic:equal name="jms" property="usingBatchUpdates" value="true">
+ <html:hidden property="usingBatchUpdates" value="on"/>
+ </logic:equal>
+ </div>
+ </html:form>
+</div>
\ No newline at end of file
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms3.jsp
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms3.jsp (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms3.jsp 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,118 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.
+ -->
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ include file="/WEB-INF/jsp/common/taglibs.inc.jsp" %>
+
+<html:xhtml/>
+<fmt:setBundle basename="messages.jmsmessages" var="jmsmsg" scope="page"/>
+<div id="main">
+ <script>
+ function setPageAndSubmit(target){
+ document.forms["jms"].destination.value=target;
+ document.forms["jms"].submit();
+ }
+ function setDispatch(target) {
+ document.forms["jms"].dispatch.value=target;
+ }
+ </script>
+
+ <ul class="navigation">
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page1'))">
+ <fmt:message key="jms.section.heading.settings.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page2'))">
+ <fmt:message key="jms.section.heading.more.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a class="active">
+ <fmt:message key="jms.section.heading.msgSql.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page4'))">
+ <fmt:message key="jms.section.heading.userSql.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ </ul>
+
+ <p class="sectionHeading">
+ <span class="sectionHeadingText">
+ <fmt:message key="jms.section.heading.manage" bundle="${jmsmsg}" />
+ <fmt:message key="jms.section.heading.msgSql" bundle="${jmsmsg}" />
+ </span>
+ </p>
+
+ <logic:messagesPresent message="false">
+ <p class="error">
+ <html:errors /><br/>
+ </p>
+ </logic:messagesPresent >
+ <logic:messagesPresent message="true">
+ <p class="infoMessage">
+ <html:messages id="theMessage" message="true">
+ <%= theMessage %>
+ </html:messages>
+ </p>
+ </logic:messagesPresent >
+
+ <script>
+ function updateMap(key, value){
+ jms.setMsgSqlMap(key, value);
+ }
+ </script>
+
+ <bean:define id="jmsForm" name="jms" type="org.jboss.admin.console.web.struts.jms.JmsForm"/>
+ <html:form action="jms/save">
+ <div class="caseDetail">
+ <html:hidden property="dispatch" value="navigation"/>
+ <html:hidden property="destination" value="error"/>
+ <ul>
+ <logic:iterate id="element" name="jms" property="msgSqlMap">
+ <bean:define id="sqlKey" name="element" property="key" />
+ <% String name = "msgSqlMap(" + sqlKey + ")"; %>
+ <li>
+ <span class="caseDetailFieldHeader">
+ <bean:write name="sqlKey"/>=
+ </span>
+ <html:text property="<%= name %>" size="60" />
+ </li>
+ </logic:iterate>
+ </ul>
+
+ <% // include hidden values for checked checkboxes specified on other pages %>
+ <logic:equal name="jms" property="createMsgTablesOnStartup" value="true">
+ <html:hidden property="createMsgTablesOnStartup" value="on"/>
+ </logic:equal>
+ <logic:equal name="jms" property="createUserTablesOnStartup" value="true">
+ <html:hidden property="createUserTablesOnStartup" value="on"/>
+ </logic:equal>
+ <logic:equal name="jms" property="usingBatchUpdates" value="true">
+ <html:hidden property="usingBatchUpdates" value="on"/>
+ </logic:equal>
+ </div>
+ </html:form>
+</div>
\ No newline at end of file
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms4.jsp
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms4.jsp (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/detailJms4.jsp 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,111 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.
+ -->
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ include file="/WEB-INF/jsp/common/taglibs.inc.jsp" %>
+<html:xhtml/>
+<fmt:setBundle basename="messages.jmsmessages" var="jmsmsg" scope="page"/>
+<div id="main">
+ <script>
+ function setPageAndSubmit(target){
+ document.forms["jms"].destination.value=target;
+ document.forms["jms"].submit();
+ }
+ function setDispatch(target) {
+ document.forms["jms"].dispatch.value=target;
+ }
+ </script>
+
+ <ul class="navigation">
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page1'))">
+ <fmt:message key="jms.section.heading.settings.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page2'))">
+ <fmt:message key="jms.section.heading.more.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setPageAndSubmit('page3'))">
+ <fmt:message key="jms.section.heading.msgSql.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ <li>
+ <a class="active">
+ <fmt:message key="jms.section.heading.userSql.page" bundle="${jmsmsg}" />
+ </a>
+ </li>
+ </ul>
+
+ <p class="sectionHeading">
+ <span class="sectionHeadingText">
+ <fmt:message key="jms.section.heading.manage" bundle="${jmsmsg}" />
+ <fmt:message key="jms.section.heading.userSql" bundle="${jmsmsg}" />
+ </span>
+ </p>
+
+ <logic:messagesPresent message="false">
+ <p class="error">
+ <html:errors /><br/>
+ </p>
+ </logic:messagesPresent >
+ <logic:messagesPresent message="true">
+ <p class="infoMessage">
+ <html:messages id="theMessage" message="true">
+ <%= theMessage %>
+ </html:messages>
+ </p>
+ </logic:messagesPresent >
+
+ <bean:define id="jmsForm" name="jms" type="org.jboss.admin.console.web.struts.jms.JmsForm"/>
+ <html:form action="jms/save">
+ <div class="caseDetail">
+ <html:hidden property="dispatch" value="navigation"/>
+ <html:hidden property="destination" value="error"/>
+ <ul>
+ <logic:iterate id="element" name="jms" property="userSqlMap">
+ <bean:define id="sqlKey" name="element" property="key" />
+ <% String name = "iserSqlMap(" + sqlKey + ")"; %>
+ <li>
+ <span class="caseDetailFieldHeader">
+ <bean:write name="sqlKey"/>=
+ </span>
+ <html:text property="<%= name %>" size="60" />
+ </li>
+ </logic:iterate>
+ </ul>
+
+ <% // include hidden values for checked checkboxes specified on other pages %>
+ <logic:equal name="jms" property="createMsgTablesOnStartup" value="true">
+ <html:hidden property="createMsgTablesOnStartup" value="on"/>
+ </logic:equal>
+ <logic:equal name="jms" property="createUserTablesOnStartup" value="true">
+ <html:hidden property="createUserTablesOnStartup" value="on"/>
+ </logic:equal>
+ <logic:equal name="jms" property="usingBatchUpdates" value="true">
+ <html:hidden property="usingBatchUpdates" value="on"/>
+ </logic:equal>
+ </div>
+ </html:form>
+</div>
\ No newline at end of file
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/listDestinations.jsp
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/listDestinations.jsp (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/listDestinations.jsp 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,102 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.
+ -->
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ include file="/WEB-INF/jsp/common/taglibs.inc.jsp" %>
+<html:xhtml/>
+ <fmt:setBundle basename="messages.jmsmessages" var="jms" scope="page" />
+ <div id="main">
+ <p class="sectionHeading">
+ <span class="sectionHeadingText"><fmt:message key="destination.list.destinations.page.header" bundle="${jms}" /></span>
+ </p>
+
+ <logic:messagesPresent message="true">
+ <p class="infoMessage">
+ <html:messages id="message" message="true">
+ <bean:write name="message" /><br/>
+ </html:messages>
+ </p>
+ </logic:messagesPresent>
+
+ <div class="globalButtons">
+ <div class="globalButton">
+ <html:form action="/destination/create" styleClass="globalButton">
+ <html:hidden property="type"/>
+ <html:submit><fmt:message key="destination.button.create" bundle="${jms}" /></html:submit>
+ </html:form>
+ </div>
+ <div class="globalButton">
+ <html:form action="/destination/list" styleClass="globalButton">
+ <html:hidden property="type"/>
+ <html:submit><fmt:message key="destination.button.refresh" bundle="${jms}" /></html:submit>
+ </html:form>
+ </div>
+ </div>
+
+ <logic:notEmpty name="destinations">
+ <table id="destTable" class="dataTable">
+ <thead>
+ <tr>
+ <th><fmt:message key="destination.list.header.name" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.list.header.jndiname" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.list.header.deploymentStatus" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.list.header.view" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.list.header.remove" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.list.header.viewMessage" bundle="${jms}" /></th>
+ </tr>
+ </thead>
+ <script>
+ function set(target,formName){document.getElementById(formName).dispatch.value=target;}
+ function validateSubmission(formName, destType, destName) {
+ if (document.getElementById(formName).dispatch.value=="remove") {
+ return confirm('<fmt:message key="destination.remove.confirm" bundle="${jms}" ><fmt:param value="' + destType + '"/><fmt:param value="' + destName + '"/></fmt:message>');
+ }
+ }
+ </script>
+
+ <bean:define id="strType" name="identifierForm" property="type"/>
+
+ <logic:iterate id="destination" name="destinations" indexId="index">
+ <bean:define id="destInfo" name="destination" type="org.jboss.admin.model.jms.Destination"/>
+ <%
+ String strName = destInfo.getName();
+ %>
+ <html:form action="destination/manage" styleId="<%= "form_" + index %>" onsubmit="<%= "return validateSubmission('form_" + index + "', '" + strType + "', '" + strName + "');"%>">
+ <html:hidden property="dispatch" value="error"/>
+ <html:hidden property="type"/>
+ <html:hidden name="destination" property="name"/>
+ <html:hidden name="destination" property="identifier" />
+ <tbody>
+ <tr>
+ <td><bean:write name="destination" property="name" /></td>
+ <td><bean:write name="destination" property="jndiName" /></td>
+ <td><bean:write name="destination" property="state.deploymentStatus" /></td>
+ <td><html:submit onclick="<%= "set('view','form_" + index +"');" %>"><fmt:message key="destination.button.view" bundle="${jms}" /></html:submit></td>
+ <td><html:submit onclick="<%= "set('remove','form_" + index +"');" %>"><fmt:message key="destination.button.remove" bundle="${jms}" /></html:submit></td>
+ <td><html:submit onclick="<%= "set('viewMessages','form_" + index +"');" %>"><fmt:message key="destination.button.viewData" bundle="${jms}" /></html:submit></td>
+ </tr>
+ </tbody>
+ </html:form>
+ </logic:iterate>
+ </table>
+ </logic:notEmpty>
+ </div>
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/viewMessages.jsp
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/viewMessages.jsp (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/viewMessages.jsp 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,158 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.
+ -->
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.HashMap, org.jboss.jms.message.JBossMessage" %>
+<%@ include file="/WEB-INF/jsp/common/taglibs.inc.jsp" %>
+<html:xhtml/>
+<fmt:setBundle basename="messages.jmsmessages" var="jms" scope="page"/>
+<div id="main">
+ <script>
+ function setDispatchAndSubmit(target){
+ document.forms["destinationIdentifier"].dispatch.value=target;
+ document.forms["destinationIdentifier"].submit();
+ }
+ function setDispatch(target) {
+ document.forms["destinationIdentifier"].dispatch.value=target;
+ }
+ </script>
+
+ <logic:equal name="destinationIdentifier" property="type" value="topic">
+ <ul class="navigation">
+ <li>
+ <a class="active">
+ <fmt:message key="destination.section.heading.messages.page" bundle="${jms}" />
+ </a>
+ </li>
+ <li>
+ <a href="javascript:void(setDispatchAndSubmit('viewMessageSubscriptions'))">
+ <fmt:message key="destination.section.heading.subscriptions.page" bundle="${jms}" />
+ </a>
+ </li>
+ </ul>
+ </logic:equal>
+
+ <p class="sectionHeading">
+ <span class="sectionHeadingText">
+ <fmt:message key="destination.msg.view.messages.page.header" bundle="${jms}" >
+ <fmt:param value="${destinationIdentifier.type}"/>
+ <fmt:param value="${destinationIdentifier.name}"/>
+ </fmt:message>
+ </span>
+ </p>
+
+ <logic:messagesPresent message="true">
+ <p class="infoMessage">
+ <html:messages id="message" message="true">
+ <bean:write name="message" /><br/>
+ </html:messages>
+ </p>
+ </logic:messagesPresent>
+
+ <html:form action="/destination/manageMessage">
+ <html:hidden property="dispatch" value="error"/>
+ <html:hidden property="identifier"/>
+ <html:hidden property="name"/>
+ <html:hidden property="type"/>
+
+ <logic:empty name="destinationMessages">
+ <span class="infoMessage">
+ <c:choose>
+ <c:when test='${destinationIdentifier.type == "queue"}' >
+ <fmt:message key="destination.msg.view.queueMessages.empty" bundle="${jms}" />
+ </c:when>
+ <c:otherwise>
+ <fmt:message key="destination.msg.view.topicMessages.empty" bundle="${jms}" />
+ </c:otherwise>
+ </c:choose>
+ </span>
+ </logic:empty>
+
+ <logic:notEmpty name="destinationMessages">
+ <div class="globalButton">
+ <html:submit onclick="setDispatch('removeMessages');">
+ <fmt:message key="destination.button.removeMessages" bundle="${jms}" />
+ </html:submit>
+ </div>
+ <br/>
+ <hr/>
+ <div class="caseDetail">
+ <logic:iterate id="destMessage" name="destinationMessages" indexId="index">
+ <bean:define id="destMsg" name="destMessage" type="org.jboss.admin.model.jms.DestinationMessage"/>
+ <bean:define id="jmsMsg" name="destMsg" property="jmsMessage" type="org.jboss.jms.message.JBossMessage"/>
+ <%
+ //HashMap jmsProperties = jmsMsg.header.jmsProperties;
+ //boolean jmsPropReadWrite = jmsMsg.header.jmsPropertiesReadWrite;
+ //boolean msgReadOnly = jmsMsg.header.msgReadOnly;
+ //String producerClientId = jmsMsg.header.producerClientId;
+ %>
+ <bean:write name="destMsg" property="msgType"/>
+ <hr/>
+ <table>
+ <tr>
+ <td class="caseDetailFieldHeader" align="right"><fmt:message key="destination.msg.view.header.jmsDeliveryMode" bundle="${jms}" />: </td>
+ <td><bean:write name="jmsMsg" property="deliveryCount"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader" align="right"><fmt:message key="destination.msg.view.header.jmsExpiration" bundle="${jms}" />: </td>
+ <td><bean:write name="jmsMsg" property="expiration"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader" align="right"><fmt:message key="destination.msg.view.header.jmsPriority" bundle="${jms}" />: </td>
+ <td><bean:write name="jmsMsg" property="priority"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader" align="right"><fmt:message key="destination.msg.view.header.jmsMessageID" bundle="${jms}" />: </td>
+ <td><bean:write name="jmsMsg" property="messageID"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader" align="right"><fmt:message key="destination.msg.view.header.jmsTimeStamp" bundle="${jms}" />: </td>
+ <td><bean:write name="jmsMsg" property="timestamp"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader" align="right"><fmt:message key="destination.msg.view.header.jmsReplyTo" bundle="${jms}" />: </td>
+ <td><bean:write name="jmsMsg" property="replyToDestination"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader" align="right"><fmt:message key="destination.msg.view.header.jmsType" bundle="${jms}" />: </td>
+ <td><bean:write name="jmsMsg" property="jmsType"/></td>
+ </tr>
+ <tr>
+ <td class="caseDetailFieldHeader" align="right"><fmt:message key="destination.msg.view.header.jmsRedelivered" bundle="${jms}" />: </td>
+ <td><bean:write name="jmsMsg" property="redelivered"/></td>
+ </tr>
+ <logic:notEmpty name="destMsg" property="msgBody">
+ <tr>
+ <td class="caseDetailFieldHeader" align="right"><fmt:message key="destination.msg.view.body" bundle="${jms}" />: </td>
+ <td><bean:write name="destMsg" property="msgBody"/></td>
+ </tr>
+ </logic:notEmpty>
+ <tr>
+ <td> </td>
+ <td> </td>
+ </tr>
+ </table>
+ <hr/>
+ </logic:iterate>
+ </div>
+ </logic:notEmpty>
+ </html:form>
+</div>
\ No newline at end of file
Added: projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/viewSubscriptions.jsp
===================================================================
--- projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/viewSubscriptions.jsp (rev 0)
+++ projects/admin-console/trunk/src/resources/admin-console.war/WEB-INF/jsp/jms/viewSubscriptions.jsp 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,205 @@
+<!--
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.
+ -->
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ include file="/WEB-INF/jsp/common/taglibs.inc.jsp" %>
+<html:xhtml/>
+<fmt:setBundle basename="messages.jmsmessages" var="jms" scope="page" />
+<div id="main">
+ <script>
+ function setDispatchAndSubmit(target){
+ document.getElementById("destinationIdentifier").dispatch.value=target;
+ document.getElementById("destinationIdentifier").submit();
+ }
+ function set(target, formName, id){
+ document.getElementById(formName).dispatch.value=target;
+ document.getElementById(formName).subscriptionID.value=id;
+ }
+ </script>
+
+ <ul class="navigation">
+ <li>
+ <a href="javascript:void(setDispatchAndSubmit('viewMessages'))">
+ <fmt:message key="destination.section.heading.messages.page" bundle="${jms}" />
+ </a>
+ </li>
+ <li>
+ <a class="active">
+ <fmt:message key="destination.section.heading.subscriptions.page" bundle="${jms}" />
+ </a>
+ </li>
+ </ul>
+
+ <p class="sectionHeading">
+ <span class="sectionHeadingText">
+ <fmt:message key="destination.msg.view.subscriptions.page.header" bundle="${jms}" >
+ <fmt:param value="${destinationIdentifier.type}"/>
+ <fmt:param value="${destinationIdentifier.name}"/>
+ </fmt:message>
+ </span>
+ </p>
+
+ <logic:messagesPresent message="true">
+ <p class="infoMessage">
+ <html:messages id="message" message="true">
+ <bean:write name="message" /><br/>
+ </html:messages>
+ </p>
+ </logic:messagesPresent>
+
+ <p class="sectionHeading">
+ <span class="sectionHeadingText">
+ <fmt:message key="destination.msg.view.durableSubscriptions.page.header" bundle="${jms}" />
+ </span>
+ </p>
+
+ <logic:empty name="durableSubscriptions">
+ <html:form action="/destination/manageMessage">
+ <html:hidden property="dispatch" value="navigation"/>
+ <html:hidden property="identifier"/>
+ <html:hidden property="name"/>
+ <html:hidden property="type"/>
+ <span class="infoMessage">
+ <fmt:message key="destination.msg.view.durableSubscriptions.empty" bundle="${jms}" >
+ <fmt:param value="${destinationIdentifier.name}"/>
+ </fmt:message>
+ </span>
+ </html:form>
+ </logic:empty>
+
+ <logic:notEmpty name="durableSubscriptions">
+ <table id="durableTable" class="destinationList">
+ <thead>
+ <tr>
+ <th><fmt:message key="destination.subs.view.header.clientID" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.subs.view.header.subName" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.subs.view.header.selector" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.subs.view.header.message" bundle="${jms}" /></th>
+ </tr>
+ </thead>
+
+ <logic:iterate id="subscription" name="durableSubscriptions" indexId="index">
+ <html:form action="/destination/manageMessage" styleId="<%= "form1_" + index %>">
+ <html:hidden property="dispatch" value="error"/>
+ <html:hidden property="subscriptionID" value="error"/>
+ <html:hidden property="identifier"/>
+ <html:hidden property="name"/>
+ <html:hidden property="type"/>
+ <bean:define id="topicName" name="destinationIdentifier" property="name"/>
+ <bean:define id="subs" name="subscription" type="org.jboss.mq.DurableSubscriptionID"/>
+ <%
+ String selector = subs.getSelector();
+ String subscriptionID = "TOPIC."
+ + topicName
+ + ".DurableSubscription["
+ + "clientId=" + subs.getClientID()
+ + " name=" + subs.getSubscriptionName()
+ + " selector=" + selector + "]";
+ %>
+ <tbody>
+ <tr>
+ <td><bean:write name="subs" property="clientID" /></td>
+ <td><bean:write name="subs" property="subscriptionName" /></td>
+ <td><%= selector %></td>
+ <td><html:submit onclick="<%= "set('viewMessages', 'form1_" + index +"', '" + subscriptionID + "');" %>"><fmt:message key="destination.button.viewMessages" bundle="${jms}" /></html:submit></td>
+ </tr>
+ </tbody>
+ </html:form>
+ </logic:iterate>
+ </table>
+ </logic:notEmpty>
+
+ <br/>
+ <p class="sectionHeading">
+ <span class="sectionHeadingText"><fmt:message key="destination.msg.view.nonDurableSubscriptions.page.header" bundle="${jms}" /></span>
+ </p>
+
+ <logic:empty name="nonDurableSubscriptions">
+ <html:form action="/destination/manageMessage">
+ <html:hidden property="dispatch" value="navigation"/>
+ <html:hidden property="identifier"/>
+ <html:hidden property="name"/>
+ <html:hidden property="type"/>
+ <span class="infoMessage">
+ <fmt:bundle basename="messages.jmsmessages">
+ <fmt:message key="destination.msg.view.nonDurableSubscriptions.empty" bundle="${jms}" >
+ <fmt:param value="${destinationIdentifier.name}"/>
+ </fmt:message>
+ </fmt:bundle>
+ </span>
+ </html:form>
+ </logic:empty>
+
+ <logic:notEmpty name="nonDurableSubscriptions">
+ <table id="nonDurableTable" class="destinationList">
+ <thead>
+ <tr>
+ <th><fmt:message key="destination.subs.view.header.clientID" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.subs.view.header.subID" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.subs.view.header.sessionID" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.subs.view.header.msgSelector" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.subs.view.header.noLocal" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.subs.view.header.destroyDurableSub" bundle="${jms}" /></th>
+ <th><fmt:message key="destination.subs.view.header.message" bundle="${jms}" /></th>
+ </tr>
+ </thead>
+
+ <logic:iterate id="subscription" name="nonDurableSubscriptions" indexId="index">
+ <html:form action="/destination/manageMessage" styleId="<%= "form2_" + index %>">
+ <html:hidden property="dispatch" value="error"/>
+ <html:hidden property="subscriptionID" value="error"/>
+ <html:hidden property="identifier"/>
+ <html:hidden property="name"/>
+ <html:hidden property="type"/>
+ <bean:define id="topicName" name="destinationIdentifier" property="name"/>
+ <bean:define id="subs" name="subscription" type="org.jboss.mq.Subscription"/>
+ <%
+ String clientID = subs.connectionToken.getClientID();
+ String sessionID = subs.connectionToken.getSessionId();
+ String subID = Integer.toString(subs.subscriptionId);
+ String selector = subs.messageSelector;
+ boolean noLocal = subs.noLocal;
+ boolean destroyDurableSub = subs.destroyDurableSubscription;
+ String subscriptionID = "TOPIC."
+ + topicName + "."
+ + clientID + "."
+ + subID;
+ if (selector != "" && selector != null) {
+ subscriptionID = subscriptionID + "." + selector;
+ }
+ %>
+ <tbody>
+ <tr>
+ <td><%= clientID %></td>
+ <td><%= subID %></td>
+ <td><%= sessionID %></td>
+ <td><%= selector %></td>
+ <td><%= noLocal %></td>
+ <td><%= destroyDurableSub %></td>
+ <td><html:submit onclick="<%= "set('viewMessages', 'form2_" + index +"', '" + subscriptionID + "');" %>"><fmt:message key="destination.button.viewMessages" bundle="${jms}" /></html:submit></td>
+ </tr>
+ </tbody>
+ </html:form>
+ </logic:iterate>
+ </table>
+ </logic:notEmpty>
+</div>
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/CreateDestinationActionTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/CreateDestinationActionTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/CreateDestinationActionTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.console.web.struts.jms;
+
+import org.jboss.admin.console.web.struts.jms.BaseDestinationAction;
+import org.jboss.admin.console.web.struts.jms.Constants;
+import org.jboss.admin.console.web.struts.jms.DestinationForm;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.model.jms.Queue;
+import org.jboss.admin.model.jms.Topic;
+
+/**
+ * Tests CreateDestinationAction class.
+ *
+ * @author <a href="robert.walker at unisys.com">Bob Walker </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class CreateDestinationActionTest extends MockStrutsDestinationTestCase {
+
+ protected DestinationIdentifier destId = new DestinationIdentifier(DFLT_ID);
+
+ /**
+ * @see MockStrutsTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see MockStrutsTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Invoke the action to create a Queue.
+ *
+ * @throws Exception
+ */
+ public void testCreateQueue() throws Exception {
+
+ /*
+ * tell the mock what methods to expect to be called...
+ */
+ mockDS.getDefaultQueue();
+ /*
+ * and what values to return
+ */
+ Queue testQueue = new Queue(destId);
+ testQueue.setJndiName(DFLT_JNDI);
+ control.setReturnValue(testQueue);
+
+ /*
+ * put the mock somewhere the Actions will be able to retrieve it from
+ */
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+ /*
+ * initialize request
+ */
+ addRequestParameter("type", Constants.DestinationTypes.QUEUE);
+ addRequestParameter("identifier", DFLT_ID);
+ setRequestPathInfo(MODULE_JMS, "/destination/create");
+ DestinationForm form = new DestinationForm();
+ form.setIdentifier(destId);
+ setActionForm(form);
+
+ actionPerform();
+ /*
+ * check struts/tiles result
+ */
+ verifyTilesForward("showpage", "destination.detail.tile");
+ verifyNoActionErrors();
+ verifyNoActionMessages();
+
+ /*
+ * check request
+ */
+ String opString = (String) getRequest().getAttribute("operation");
+ assertEquals("wrong operation. Should be 'create'.", opString, "create");
+
+ /*
+ * check all the mock methods were called correctly
+ */
+ control.verify();
+
+ }
+
+ /**
+ * Invoke the "create destination" action to create a Topic.
+ *
+ * @throws Exception
+ */
+ public void testCreateTopic() throws Exception {
+ /*
+ * tell the mock what methods to expect to be called...
+ */
+ mockDS.getDefaultTopic();
+ /*
+ * and what values to return
+ */
+ Topic testTopic = new Topic(destId);
+ testTopic.setJndiName("testCreatedTopicJndi");
+ control.setReturnValue(testTopic);
+
+ /*
+ * put the mock somewhere the Actions will be able to retrieve it from
+ */
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+ /*
+ * prepare request
+ */
+ addRequestParameter("type", Constants.DestinationTypes.TOPIC);
+ addRequestParameter("identifier", DFLT_ID);
+ DestinationForm form = new DestinationForm();
+ setRequestPathInfo(MODULE_JMS, "/destination/create");
+ form.setIdentifier(destId);
+ setActionForm(form);
+
+ actionPerform();
+ /*
+ * check struts/tiles result
+ */
+ verifyTilesForward("showpage", "destination.detail.tile");
+ verifyNoActionErrors();
+ verifyNoActionMessages();
+
+ /*
+ * check request
+ */
+ String opString = (String) getRequest().getAttribute("operation");
+ assertEquals("wrong operation. Should be 'create'.", opString, "create");
+
+ /*
+ * check all the mock methods were called correctly
+ */
+ control.verify();
+
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ListDestinationsActionTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ListDestinationsActionTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ListDestinationsActionTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,178 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.console.web.struts.jms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.admin.console.web.struts.jms.BaseDestinationAction;
+import org.jboss.admin.console.web.struts.jms.Constants;
+import org.jboss.admin.console.web.struts.jms.DestinationIdentifierForm;
+import org.jboss.admin.model.jms.Destination;
+import org.jboss.admin.model.jms.Queue;
+import org.jboss.admin.model.jms.Topic;
+
+/**
+ * Tests ListDestinationsAction.
+ *
+ * @author <a href="robert.walker at unisys.com">Bob Walker </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+
+public class ListDestinationsActionTest extends MockStrutsDestinationTestCase {
+
+ /**
+ * @see MockStrutsTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see MockStrutsTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Invoke the action to list Queues.
+ */
+ public void testListOneQueue() {
+ /*
+ * tell the mock what methods to expect to be called...
+ */
+ mockDS.getQueues();
+ /*
+ * and what values to return
+ */
+ List queues = new ArrayList();
+ Queue testQueue = new Queue();
+ testQueue.setJndiName("testListQueue");
+ queues.add(testQueue);
+ control.setReturnValue(queues);
+
+ /*
+ * put the mock somewhere the Actions will be able to retrieve it from
+ */
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+
+ /*
+ * Set up the request
+ */
+ addRequestParameter("type", Constants.DestinationTypes.QUEUE);
+ setRequestPathInfo(MODULE_JMS, "/destination/list");
+ actionPerform();
+ /*
+ * prepare action form
+ */
+ DestinationIdentifierForm form = new DestinationIdentifierForm();
+ form.setIdentifier(DFLT_ID);
+ setActionForm(form);
+ /*
+ * check struts/tiles result
+ */
+ verifyTilesForward("showpage", "destination.list.tile");
+ verifyNoActionErrors();
+ verifyActionMessages(new String[] { "destination.list.destinations.queue.header" });
+
+ /*
+ * check request
+ */
+ List destinationsFromRequest = (List) getRequest().getAttribute(
+ "destinations");
+ assertNotNull(destinationsFromRequest);
+ assertEquals("wrong number of destinations returned", 1,
+ destinationsFromRequest.size());
+ assertEquals("bad queue name on first destination", "testListQueue",
+ ((Destination) destinationsFromRequest.get(0)).getJndiName());
+
+ /*
+ * check all the mock methods were called correctly
+ */
+ control.verify();
+ }
+
+ public void testListOneTopic() {
+ /*
+ * tell the mock what methods to expect to be called...
+ */
+ mockDS.getTopics();
+ /*
+ * and what values to return
+ */
+ List topics = new ArrayList();
+ Topic testTopic = new Topic();
+ testTopic.setJndiName("testListTopic");
+ topics.add(testTopic);
+ control.setReturnValue(topics);
+
+ /*
+ * put the mock somewhere the Actions will be able to retrieve it from
+ */
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+
+ /*
+ * Set up the request
+ */
+ addRequestParameter("type", Constants.DestinationTypes.TOPIC);
+ setRequestPathInfo(MODULE_JMS, "/destination/list");
+ actionPerform();
+ /*
+ * prepare action form
+ */
+ DestinationIdentifierForm form = new DestinationIdentifierForm();
+ form.setIdentifier(DFLT_ID);
+ setActionForm(form);
+ /*
+ * check struts/tiles result
+ */
+ verifyTilesForward("showpage", "destination.list.tile");
+ verifyNoActionErrors();
+ verifyActionMessages(new String[] { "destination.list.destinations.topic.header" });
+
+ /*
+ * check request
+ */
+ List destinationsFromRequest = (List) getRequest().getAttribute(
+ "destinations");
+ assertNotNull(destinationsFromRequest);
+ assertEquals("wrong number of destinations returned", 1,
+ destinationsFromRequest.size());
+ assertEquals("bad Topic name on first destination", "testListTopic",
+ ((Destination) destinationsFromRequest.get(0)).getJndiName());
+
+ /*
+ * check all the mock methods were called correctly
+ */
+ control.verify();
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/MockStrutsDestinationTestCase.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/MockStrutsDestinationTestCase.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/MockStrutsDestinationTestCase.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.console.web.struts.jms;
+
+import java.io.File;
+
+import org.easymock.MockControl;
+import org.jboss.admin.service.jms.DestinationService;
+
+import servletunit.struts.MockStrutsTestCase;
+
+/**
+ * Base class for jsm test cases.
+ *
+ * @author <a href="robert.walker at unisys.com">Bob Walker </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public abstract class MockStrutsDestinationTestCase extends MockStrutsTestCase {
+
+ public MockControl control;
+
+ public DestinationService mockDS;
+
+ public static final String WEB_XML = "/WEB-INF/web.xml";
+
+ public static final String MODULE_JMS = "jms";
+
+ public static final String STRUTS_CONFIG = "/WEB-INF/conf/common/struts-config.xml";
+
+ public static final String STRUTS_CONFIG_JMS = "/WEB-INF/conf/jms/struts-config.xml";
+
+ public static final String ADMIN_CONSOLE_WAR = "src/resources/admin-console.war";
+
+ public static final String DFLT_ID = "test|id";
+
+ public static final String DFLT_JNDI = "testJmsStrutsJndi";
+
+ public static final String DFLT_NAME = "testName";
+
+ /**
+ * setup for the STRUTS tests in the package
+ * org.jboss.console.web.struts.jms
+ *
+ * Most of the tests use a mock DestinationService object, and all of the
+ * tests need to have the "module" (i.e. STRUTS sub-program) initialized
+ * with the correct struts-config file.
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ setInitParameter("validating", "false");
+ setContextDirectory(new File(ADMIN_CONSOLE_WAR));
+ setInitParameter("config", STRUTS_CONFIG);
+ setInitParameter("config/jms", STRUTS_CONFIG_JMS);
+
+ /*
+ * setup the mock service
+ */
+ control = MockControl.createControl(DestinationService.class);
+ control.setDefaultMatcher(MockControl.ALWAYS_MATCHER);
+ mockDS = (DestinationService) control.getMock();
+ }
+
+ /**
+ * Invoked from JUnit framework.
+ */
+ public MockStrutsDestinationTestCase() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ * Name of the test.
+ */
+ public MockStrutsDestinationTestCase(String arg0) {
+ super(arg0);
+
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/MockStrutsJmsTestCase.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/MockStrutsJmsTestCase.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/MockStrutsJmsTestCase.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.console.web.struts.jms;
+
+import java.io.File;
+
+import org.easymock.MockControl;
+import org.jboss.admin.console.web.struts.jms.BaseJmsAction;
+import org.jboss.admin.service.jms.JmsService;
+
+import servletunit.struts.MockStrutsTestCase;
+
+/**
+ * Base class for jsm test cases.
+ *
+ * @author <a href="robert.walker at unisys.com">Bob Walker </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public abstract class MockStrutsJmsTestCase extends MockStrutsTestCase {
+
+ protected MockControl control;
+
+ protected JmsService mockJms;
+
+ protected static final String WEB_XML = "/WEB-INF/web.xml";
+
+ protected static final String MODULE_JMS = "jms";
+
+ protected static final String STRUTS_CONFIG = "/WEB-INF/conf/common/struts-config.xml";
+
+ protected static final String STRUTS_CONFIG_JMS = "/WEB-INF/conf/jms/struts-config.xml";
+
+ protected static final String ADMIN_CONSOLE_WAR = "src/resources/admin-console.war";
+
+ protected static final String NL = System.getProperty("line.separator");
+
+ /**
+ * setup for the STRUTS tests in the package
+ * org.jboss.console.web.struts.jms
+ *
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ setInitParameter("validating", "true");
+ setContextDirectory(new File(ADMIN_CONSOLE_WAR));
+ setInitParameter("config", STRUTS_CONFIG);
+ setInitParameter("config/jms", STRUTS_CONFIG_JMS);
+
+ /*
+ * setup the mock service
+ */
+ control = MockControl.createControl(JmsService.class);
+ control.setDefaultMatcher(MockControl.ALWAYS_MATCHER);
+ mockJms = (JmsService) control.getMock();
+ }
+
+ /**
+ * Invoked from JUnit framework.
+ */
+ public MockStrutsJmsTestCase() {
+ super();
+ }
+
+ /**
+ * @param arg0
+ * Name of the test.
+ */
+ public MockStrutsJmsTestCase(String arg0) {
+ super(arg0);
+
+ }
+ /**
+ * put the mock control into replay mode so it can accept method calls. put
+ * the mock somewhere from where the Actions will be able to retrieve it.
+ */
+ protected void startAndStoreMockControl() throws Exception {
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseJmsAction.SERVLET_CONTEXT_JMS_SERVICE_KEY, mockJms);
+ }
+
+ /**
+ * perform the action class method specified in the request block.
+ */
+ protected void doActionPerform() throws Exception {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Calling Action.perform().");
+ }
+ actionPerform();
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/RemoveDestinationActionTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/RemoveDestinationActionTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/RemoveDestinationActionTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.console.web.struts.jms;
+
+import org.jboss.admin.console.web.struts.jms.BaseDestinationAction;
+import org.jboss.admin.console.web.struts.jms.Constants;
+import org.jboss.admin.console.web.struts.jms.DestinationIdentifierForm;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+
+/**
+ * Test class RemoveDestinationAction class.
+ *
+ * @author <a href="robert.walker at unisys.com">Bob Walker </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class RemoveDestinationActionTest extends MockStrutsDestinationTestCase {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Invoke the action to remove a queue.
+ *
+ * @throws Exception
+ */
+ public void testRemoveQueue() throws Exception {
+ /*
+ * create an identifier for the Destination
+ */
+ DestinationIdentifier destID = new DestinationIdentifier(DFLT_ID);
+ /*
+ * tell the mock what methods to expect to be called...
+ */
+ mockDS.removeDestination(destID);
+
+ /*
+ * put the mock somewhere the Actions will be able to retrieve it from
+ */
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+ /*
+ * prepare request
+ */
+ addRequestParameter("type", Constants.DestinationTypes.QUEUE);
+ addRequestParameter("identifier", DFLT_ID);
+ addRequestParameter("name", "testQueue");
+ setRequestPathInfo(MODULE_JMS, "/destination/remove");
+
+ /*
+ * prepare action form
+ */
+ DestinationIdentifierForm form = new DestinationIdentifierForm();
+ form.setIdentifier(DFLT_ID);
+ setActionForm(form);
+
+ actionPerform();
+
+ /*
+ * check results
+ */
+ verifyActionMessages(new String[] { "destination.remove.success" });
+ verifyNoActionErrors();
+
+ }
+
+ /**
+ * Invoke the action to create a topic.
+ *
+ * @throws Exception
+ */
+ public void testRemoveTopic() throws Exception {
+ /*
+ * create an identifier for the Destination
+ */
+ DestinationIdentifier destID = new DestinationIdentifier(DFLT_ID);
+ /*
+ * tell the mock what methods to expect to be called...
+ */
+ mockDS.removeDestination(destID);
+
+ /*
+ * put the mock somewhere the Actions will be able to retrieve it from
+ */
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+
+ addRequestParameter("type", Constants.DestinationTypes.TOPIC);
+ addRequestParameter("identifier", DFLT_ID);
+ addRequestParameter("name", "testTopic");
+ setRequestPathInfo(MODULE_JMS, "/destination/remove");
+
+ /*
+ * prepare action form
+ */
+ DestinationIdentifierForm form = new DestinationIdentifierForm();
+ form.setIdentifier(DFLT_ID);
+ setActionForm(form);
+
+ actionPerform();
+
+ /*
+ * check results
+ */
+ verifyActionMessages(new String[] { "destination.remove.success" });
+ verifyNoActionErrors();
+
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/RemoveMessagesActionTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/RemoveMessagesActionTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/RemoveMessagesActionTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.console.web.struts.jms;
+
+import org.jboss.admin.console.web.struts.jms.BaseDestinationAction;
+import org.jboss.admin.console.web.struts.jms.DestinationIdentifierForm;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+
+/**
+ * Tests actions used for removing messages.
+ *
+ * @author <a href="robert.walker at unisys.com">Bob Walker </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class RemoveMessagesActionTest extends MockStrutsDestinationTestCase {
+
+ /**
+ * @see MockStrutsTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see MockStrutsTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Invoke the action to remove messages.
+ */
+ public final void testRemoveMessages() {
+ /*
+ * tell the mock what methods to expect to be called...
+ */
+ DestinationIdentifier destID = new DestinationIdentifier(DFLT_ID);
+ mockDS.removeMessages(destID);
+
+ /*
+ * setup the request
+ */
+ setRequestPathInfo(MODULE_JMS, "/destination/removeMessages");
+ DestinationIdentifierForm form = new DestinationIdentifierForm();
+ form.setIdentifier(destID.toString());
+ setActionForm(form);
+ control.replay();
+
+ /*
+ * put the mock somewhere the Actions will be able to retrieve it from
+ */
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+
+ /*
+ * run
+ */
+ actionPerform();
+
+ /*
+ * check struts/tiles result
+ */
+ verifyNoActionErrors();
+ verifyActionMessages(new String[] { "destination.msg.removeMessage.success" });
+ verifyTilesForward("showpage", "destination.viewMessages.tile");
+
+ /*
+ * check all the mock methods were called correctly
+ */
+ control.verify();
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/SaveDestinationActionTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/SaveDestinationActionTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/SaveDestinationActionTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,185 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.console.web.struts.jms;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.admin.console.web.struts.jms.BaseDestinationAction;
+import org.jboss.admin.console.web.struts.jms.Constants;
+import org.jboss.admin.console.web.struts.jms.DestinationForm;
+import org.jboss.admin.model.jms.Destination;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.model.jms.Queue;
+
+/**
+ * Tests actions used for managing a single Destination.
+ *
+ * @author <a href="robert.walker at unisys.com">Bob Walker </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class SaveDestinationActionTest extends MockStrutsDestinationTestCase {
+
+ private static final String SAVE_DEST_ID = "test|save";
+
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(SaveDestinationActionTest.class);
+
+ protected DestinationIdentifier destId = new DestinationIdentifier(
+ SAVE_DEST_ID);
+
+ /*
+ * @see MockStrutsTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ }
+
+ /*
+ * @see MockStrutsTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Initialize parameters common to most tests in this class.
+ *
+ * @param destType
+ * @throws Exception
+ */
+ public void setUpRequest(String destType) throws Exception {
+ addRequestParameter("type", destType);
+ setRequestPathInfo(MODULE_JMS, "/destination/save");
+ addRequestParameter("name", DFLT_NAME);
+ addRequestParameter("jndiName", DFLT_JNDI);
+ addRequestParameter("destinationProp", "page1");
+ }
+
+ /**
+ * Verify the results from a good destination creation.
+ */
+ public void checkGoodResponse() {
+ verifyInputTilesForward("destination.detail.tile");
+ verifyTilesForward("page1", "destination.detail.tile");
+ DestinationForm destinationForm = (DestinationForm) getRequest()
+ .getSession().getAttribute("destination");
+ assertNotNull(destinationForm);
+ verifyNoActionErrors();
+ verifyActionMessages(new String[] { "destination.create.success" });
+ }
+
+ /**
+ *
+ * Verify the tiles and forward are set as required,
+ *
+ * Verify all calls were made to the service.
+ */
+ public final void testSaveTopic() throws Exception {
+
+ setUpRequest(Constants.DestinationTypes.TOPIC);
+
+ /*
+ * tell the mockDS what methods to expect to be called and put the mock
+ * somewhere the Actions will be able to retrieve it from.
+ */
+ mockDS.saveDestination(new Destination());
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+ // do the work, and check the results.
+ actionPerform();
+ checkGoodResponse();
+ }
+
+ /**
+ *
+ * Verify the tiles and forward are set as required,
+ *
+ * Verify all calls were made to the service.
+ */
+ public final void testSaveQueue() throws Exception {
+
+ Queue qTest = new Queue(destId);
+ qTest.setName(DFLT_NAME);
+ qTest.setJndiName(DFLT_JNDI);
+
+ setUpRequest(Constants.DestinationTypes.QUEUE);
+ /*
+ * tell the mockDS what methods to expect to be called, store mockDS
+ * where Actions can retrieve it.
+ */
+ mockDS.saveDestination(new Queue());
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+
+ /*
+ * perform the action and check the results.
+ */
+ actionPerform();
+ checkGoodResponse();
+ }
+
+ /**
+ * Test setting Page Size to a value that is greater than the Down Cache
+ * Size (valid)
+ */
+ public final void testSetPageSizeGreaterThanDownCacheSize() throws Exception {
+ setUpRequest(Constants.DestinationTypes.QUEUE);
+ addRequestParameter("pageSize", "3000");
+ addRequestParameter("downCacheSize", "2000");
+ mockDS.saveDestination(new Destination());
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+
+ actionPerform();
+ checkGoodResponse();
+ }
+
+ /**
+ * Test setting Page Size to a value that is smaller than the Down Cache
+ * Size (invalid)
+ */
+ public final void testSetPageSizeSmallerThanDownCacheSize() throws Exception {
+ setUpRequest(Constants.DestinationTypes.QUEUE);
+ addRequestParameter("pageSize", "2000");
+ addRequestParameter("downCacheSize", "3000");
+ mockDS.saveDestination(new Destination());
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+
+ actionPerform();
+ verifyActionErrors(new String[] { "destination.error.pageSizeTooSmall" });
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/SaveJmsActionTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/SaveJmsActionTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/SaveJmsActionTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,196 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.console.web.struts.jms;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.admin.console.web.struts.jms.JmsForm;
+import org.jboss.admin.model.jms.Jms;
+
+/**
+ * Tests actions used for managing JbossMQ general settings.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class SaveJmsActionTest extends MockStrutsJmsTestCase {
+ /**
+ * Logger for this class
+ */
+ private static final Log logger = LogFactory
+ .getLog(SaveJmsActionTest.class);
+
+ /*
+ * @see MockStrutsTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ }
+
+ /*
+ * @see MockStrutsTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Verify the results from a good jms attributes update.
+ */
+ public void checkGoodResponse() {
+ verifyInputTilesForward("jms.detail.tile");
+ verifyTilesForward("page1", "jms.detail.tile");
+ JmsForm jmsForm = (JmsForm) getRequest().getSession().getAttribute(
+ "jms");
+ assertNotNull(jmsForm);
+ verifyNoActionErrors();
+ verifyActionMessages(new String[] { "jms.update.success" });
+ }
+
+ /**
+ * Verify the tiles and forward are set as required,
+ *
+ * Verify all calls were made to the service.
+ */
+ public final void testSaveJmsAttributes() throws Exception {
+ /*
+ * Setup the request:
+ */
+ setRequestPathInfo(MODULE_JMS, "/jms/save");
+
+ /*
+ * Tell the mockJms what methods to expect to be called and put the mock
+ * somewhere the Actions will be able to retrieve it from:
+ */
+ mockJms.saveJmsAttributes(new Jms());
+ startAndStoreMockControl();
+
+ /*
+ * Perform the action and check the results:
+ */
+ actionPerform();
+ checkGoodResponse();
+ }
+
+ /**
+ * Change DataSource and verify the new SQL properties are loaded after a
+ * tab switching.
+ *
+ * Verify the tiles and forward are set as required.
+ */
+ public final void testLoadNewSqlPropertiesAfterTabSwitching()
+ throws Exception {
+ /*
+ * Setup test data:
+ */
+ JmsForm jmsForm = new JmsForm();
+ Map dataSources = new HashMap();
+ dataSources.put("TestDS1", "org.hsqldb.jdbcDriver");
+ dataSources.put("TestDS2", "org.postgresql.Driver");
+ jmsForm.setDataSources(dataSources);
+
+ // Changing persistence database from hsqldb to postgresql:
+ jmsForm.setMsgDataSourceName("TestDS2");
+ jmsForm.setSavedMsgDataSourceName("TestDS1");
+
+ // Keep user database the same:
+ jmsForm.setUserDataSourceName("TestDS1");
+ jmsForm.setSavedUserDataSourceName("TestDS1");
+
+ // Load the new sql properties from the test directory:
+ System.setProperty("jboss.server.data.dir",
+ "./src/etc/test/server/default/data");
+
+ setRequestPathInfo(MODULE_JMS, "/jms/save");
+ addRequestParameter("dispatch", "navigation");
+ addRequestParameter("destination", "page3");
+ setActionForm(jmsForm);
+
+ /*
+ * Perform the action:
+ */
+ actionPerform();
+
+ /*
+ * Check the results:
+ */
+ verifyInputTilesForward("jms.detail.tile");
+ verifyTilesForward("page3", "jms.detail3.tile");
+ JmsForm outForm = (JmsForm) getRequest().getSession().getAttribute(
+ "jms");
+ assertNotNull(outForm);
+ verifyNoActionErrors();
+ String value = (String) outForm.getMsgSqlEntry("BLOB_TYPE");
+ assertEquals("BYTES_BLOB", value);
+ }
+
+ /**
+ * Set prefetchSize to an integer and verify that it passes the validation.
+ */
+ public final void testSetPrefetchSizeToInteger() throws Exception {
+ /*
+ * Setup test data:
+ */
+ JmsForm jmsForm = new JmsForm();
+ jmsForm.setPrefetchSize("20");
+ setRequestPathInfo(MODULE_JMS, "/jms/save");
+ setActionForm(jmsForm);
+
+ /*
+ * Tell mock what calls to expect, store the mock:
+ */
+ mockJms.saveJmsAttributes(new Jms());
+ startAndStoreMockControl();
+
+ /*
+ * Perform the action and check the results:
+ */
+ actionPerform();
+ checkGoodResponse();
+ }
+
+ /**
+ * Set prefetchSize to a non-integer and verify that it fails the validation.
+ */
+ public final void testSetPrefetchSizeToNonInteger() throws Exception {
+ /*
+ * Setup test data:
+ */
+ JmsForm jmsForm = new JmsForm();
+ jmsForm.setPrefetchSize("abc");
+ setRequestPathInfo(MODULE_JMS, "/jms/save");
+ setActionForm(jmsForm);
+
+ /*
+ * Perform the action and check the result:
+ */
+ startAndStoreMockControl();
+ actionPerform();
+ verifyActionErrors(new String[] { "errors.integer" });
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ViewDestinationActionTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ViewDestinationActionTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ViewDestinationActionTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.console.web.struts.jms;
+
+import org.jboss.admin.console.web.struts.jms.BaseDestinationAction;
+import org.jboss.admin.console.web.struts.jms.DestinationForm;
+import org.jboss.admin.console.web.struts.jms.DestinationIdentifierForm;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.model.jms.Queue;
+import org.jboss.admin.model.jms.Topic;
+
+/**
+ * Tests actions used for viewing a Destination.
+ *
+ * @author <a href="robert.walker at unisys.com">Bob Walker </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class ViewDestinationActionTest extends MockStrutsDestinationTestCase {
+
+ /**
+ * @see MockStrutsTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see MockStrutsTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * test the action to view a topic's state.
+ */
+ public final void testViewTopic() {
+
+ DestinationIdentifier destID = new DestinationIdentifier(DFLT_ID);
+ Topic tTest = new Topic(destID);
+ /*
+ * tell the mock what methods to expect to be called...
+ */
+ mockDS.getDestination(destID);
+
+ final String NAME = "testName";
+ final String JNDI_NAME = "jndiName";
+
+ /*
+ * and what values to return
+ */
+ control.setReturnValue(tTest);
+
+ /*
+ * put the mock somewhere the Actions will be able to retrieve it from
+ */
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+
+ /*
+ * set the topic's attributes
+ */
+ tTest.setName(NAME);
+ tTest.setJndiName(JNDI_NAME);
+
+ /*
+ * setup the request
+ */
+ setRequestPathInfo(MODULE_JMS, "/destination/view");
+ DestinationIdentifierForm form = new DestinationIdentifierForm();
+ form.setIdentifier(DFLT_ID);
+ setActionForm(form);
+
+ /*
+ * run
+ */
+ actionPerform();
+
+ /*
+ * check struts/tiles result
+ */
+ verifyTilesForward("showpage", "destination.detail.tile");
+ verifyNoActionErrors();
+ verifyNoActionMessages();
+
+ /*
+ * check request
+ */
+ DestinationForm destinationForm = (DestinationForm) getRequest()
+ .getSession().getAttribute("destination");
+ assertNotNull(destinationForm);
+
+ /*
+ * check all the mock methods were called correctly
+ */
+ control.verify();
+ }
+
+ /**
+ * test the action to view a queue.
+ */
+ public final void testViewQueue() {
+ DestinationIdentifier destID = new DestinationIdentifier(DFLT_ID);
+ /*
+ * tell the mock what methods to expect to be called...
+ */
+ mockDS.getDestination(destID);
+ final String JNDI_NAME = "testJndiName";
+ final String NAME = "testName";
+
+ /*
+ * and what values to return
+ */
+ Queue qTest = new Queue();
+ qTest.setJndiName(JNDI_NAME);
+ qTest.setName(NAME);
+ control.setReturnValue(qTest);
+
+ /*
+ * put the mock somewhere the Actions will be able to retrieve it from
+ */
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseDestinationAction.SERVLET_CONTEXT_DESTINATION_SERVICE_KEY,
+ mockDS);
+
+ /*
+ * setup the request
+ */
+ setRequestPathInfo(MODULE_JMS, "/destination/view");
+ DestinationIdentifierForm form = new DestinationIdentifierForm();
+ form.setIdentifier(DFLT_ID);
+ setActionForm(form);
+
+ /*
+ * run
+ */
+ actionPerform();
+
+ /*
+ * check struts/tiles result
+ */
+ verifyTilesForward("showpage", "destination.detail.tile");
+ verifyNoActionErrors();
+ verifyNoActionMessages();
+
+ /*
+ * check request
+ */
+ DestinationForm destinationForm = (DestinationForm) getRequest()
+ .getSession().getAttribute("destination");
+ assertNotNull(destinationForm);
+
+ /*
+ * check all the mock methods were called correctly
+ */
+ control.verify();
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ViewJmsActionTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ViewJmsActionTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/console/web/struts/jms/ViewJmsActionTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,117 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.console.web.struts.jms;
+
+import org.jboss.admin.console.web.struts.jms.BaseJmsAction;
+import org.jboss.admin.console.web.struts.jms.JmsForm;
+import org.jboss.admin.model.jms.Jms;
+
+/**
+ * Tests actions used for viewing JBossMQ general settings.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class ViewJmsActionTest extends MockStrutsJmsTestCase {
+
+ /**
+ * @see MockStrutsTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see MockStrutsTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test the action to view JBossMQ general settings.
+ */
+ public final void testViewJms() {
+ /*
+ * Tell the mock what methods to expect to be called...
+ */
+ mockJms.getJmsAttributes();
+
+ /*
+ * and what values to return:
+ */
+ String sqlProp = "prop1=some string" + "\r\n"
+ + "prop2=some other string" + "\r\n" + "prop3=more string";
+ Jms jms = new Jms();
+ jms.setDefaultTempQueueFullSize(70000);
+ jms.setDefaultQueueJNDIContext("/queue");
+ jms.setMsgSqlProperties(sqlProp);
+ jms.setCreateUserTablesOnStartup(true);
+ //TODO: Add an attribute from PostOffice
+
+ control.setReturnValue(jms);
+
+ /*
+ * Put the mock somewhere the Actions will be able to retrieve it from:
+ */
+ control.replay();
+ getActionServlet().getServletContext().setAttribute(
+ BaseJmsAction.SERVLET_CONTEXT_JMS_SERVICE_KEY, mockJms);
+
+ /*
+ * Setup the request:
+ */
+ setRequestPathInfo(MODULE_JMS, "/list");
+ JmsForm dummyForm = new JmsForm();
+ setActionForm(dummyForm);
+
+ /*
+ * Run:
+ */
+ actionPerform();
+
+ /*
+ * Check struts/tiles result:
+ */
+ verifyTilesForward("showpage", "jms.detail.tile");
+ verifyNoActionErrors();
+ verifyNoActionMessages();
+
+ /*
+ * Check request:
+ */
+ JmsForm jmsForm = (JmsForm) getRequest().getSession().getAttribute(
+ "jms");
+ assertNotNull(jmsForm);
+ assertEquals("70000", jmsForm.getDefaultTempQueueFullSize());
+ assertEquals("/queue", jmsForm.getDefaultQueueJNDIContext());
+ assertEquals("some other string", jmsForm.getMsgSqlEntry("prop2"));
+ assertEquals(true, jmsForm.isCreateUserTablesOnStartup());
+ //TODO: Check attribute from PostOffice
+
+ /*
+ * Check all the mock methods were called correctly:
+ */
+ control.verify();
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationIdentifierTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationIdentifierTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationIdentifierTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.model.jms;
+
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.service.jms.JmsServiceRuntimeException;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for DestinationIdentifier
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DestinationIdentifierTest extends TestCase {
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public final void testTwoPartID() {
+ DestinationIdentifier id = new DestinationIdentifier("abc|def");
+ assertEquals("abc", id.getMBeanName());
+ assertEquals("def", id.getModuleName());
+ }
+
+ public final void testFirstPartID() {
+ DestinationIdentifier id = new DestinationIdentifier("abc|");
+ assertEquals("abc", id.getMBeanName());
+ assertEquals("", id.getModuleName());
+ }
+
+ public final void testSecondPartID() {
+ DestinationIdentifier id = new DestinationIdentifier("|def");
+ assertEquals("", id.getMBeanName());
+ assertEquals("def", id.getModuleName());
+ }
+
+ public final void testEmptyID() {
+ DestinationIdentifier id = new DestinationIdentifier("|");
+ assertEquals("", id.getMBeanName());
+ assertEquals("", id.getModuleName());
+ }
+
+ public final void testNoArgConstructor() {
+ DestinationIdentifier id = new DestinationIdentifier();
+ assertEquals("", id.getMBeanName());
+ assertEquals("", id.getModuleName());
+ }
+
+ public final void testBadArgConstructor() {
+ try {
+ DestinationIdentifier id = new DestinationIdentifier("rubbish");
+ fail();
+ } catch (JmsServiceRuntimeException e) {
+ }
+
+ }
+
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationMessageTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationMessageTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationMessageTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.model.jms;
+
+import junit.framework.TestCase;
+
+import org.jboss.admin.model.jms.DestinationMessage;
+import org.jboss.mq.SpyTextMessage;
+import org.jboss.mq.SpyBytesMessage;
+
+/**
+ * Test for DestinationMessage
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DestinationMessageTest extends TestCase {
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * This method tests the behavior of the constructor.
+ */
+ public void testDestinationMessageCreation() throws Exception {
+ SpyTextMessage msg = new SpyTextMessage();
+ msg.setText("This is a text message");
+ DestinationMessage destMsg = new DestinationMessage(msg);
+ assertNotNull(destMsg);
+ assertEquals("This is a text message", ((SpyTextMessage) destMsg
+ .getJmsMessage()).getText());
+ }
+
+ public void testGetterSetter() {
+ SpyBytesMessage msg1 = new SpyBytesMessage();
+ DestinationMessage destMsg = new DestinationMessage(msg1);
+
+ SpyTextMessage msg2 = new SpyTextMessage();
+ destMsg.setJmsMessage(msg2);
+ assertEquals(msg2, destMsg.getJmsMessage());
+
+ destMsg.setMsgType("textMessage");
+ assertEquals("textMessage", destMsg.getMsgType());
+
+ destMsg.setMsgBody("This is a text message");
+ assertEquals("This is a text message", destMsg.getMsgBody());
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/DestinationTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.model.jms;
+
+import org.jboss.admin.model.jms.Destination;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for Destination
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DestinationTest extends TestCase {
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * This method tests the behavior of the constructor.
+ */
+ public void testDestinationCreation() {
+ Destination dest1 = new Destination();
+ assertNotNull(dest1);
+
+ Destination dest2 = new Destination(
+ new DestinationIdentifier("abc|def"));
+ assertNotNull(dest2);
+ }
+
+ /**
+ * This method tests the behavior of the getters and setters.
+ */
+ public void testGetterSetter() throws Exception {
+ Destination dest = new Destination();
+ assertNotNull(dest);
+
+ dest.setIdentifier(new DestinationIdentifier("xxx|yyy"));
+ assertEquals("xxx|yyy", dest.getIdentifier().toString());
+
+ dest.setName("testQ");
+ assertEquals("testQ", dest.getName());
+
+ dest.setJndiName("queue/testQ");
+ assertEquals("queue/testQ", dest.getJndiName());
+
+ dest.setCreatedProgrammatically(true);
+ assertTrue(dest.isCreatedProgrammatically());
+
+ dest.setDownCacheSize(1000);
+ assertEquals(1000, dest.getDownCacheSize());
+
+ dest.setFullSize(50000);
+ assertEquals(50000, dest.getFullSize());
+
+ dest.setPageSize(3000);
+ assertEquals(3000, dest.getPageSize());
+
+ dest.setSecurityRoles("admin:read:write:create");
+ assertEquals("admin:read:write:create", dest.getSecurityRoles());
+
+ dest.setServerPeerName("JBoss.Messaging:service=ServerPeer");
+ assertEquals("JBoss.Messaging:service=ServerPeer", dest.getServerPeerName());
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/JmsTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/JmsTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/JmsTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.model.jms;
+
+import org.jboss.admin.model.jms.Jms;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for Jms class.
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class JmsTest extends TestCase {
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * This method tests the behavior of the getters and setters.
+ */
+ public void testGetterSetter() throws Exception {
+ Jms jms = new Jms();
+ assertNotNull(jms);
+
+ /*
+ * ******* Test attributes from the ConnectionFactory MBean *******
+ */
+ jms.setConnectorName("testConnectorName");
+ assertEquals("testConnectorName", jms.getConnectorName());
+
+ jms.setDefaultTempQueueDownCacheSize(3000);
+ assertEquals(3000, jms.getDefaultTempQueueDownCacheSize());
+
+ jms.setDefaultTempQueueFullSize(75000);
+ assertEquals(75000, jms.getDefaultTempQueueFullSize());
+
+ jms.setDefaultTempQueuePageSize(3000);
+ assertEquals(3000, jms.getDefaultTempQueuePageSize());
+
+ jms.setPrefetchSize(150);
+ assertEquals(150, jms.getPrefetchSize());
+
+ jms.setServerPeerName("testServerPeerName");
+ assertEquals("testServerPeerName", jms.getServerPeerName());
+
+ /*
+ * ******* Test attributes from the ServerPeer MBean *******
+ */
+ jms.setDefaultQueueJNDIContext("/queue");
+ assertEquals("/queue", jms.getDefaultQueueJNDIContext());
+
+ jms.setDefaultSecurityRoles("admin:read:write:create");
+ assertEquals("admin:read:write:create", jms.getDefaultSecurityRoles());
+
+ jms.setDefaultTopicJNDIContext("/topic");
+ assertEquals("/topic", jms.getDefaultTopicJNDIContext());
+
+ jms.setJmsProviderName("JBoss Messaging");
+ assertEquals("JBoss Messaging", jms.getJmsProviderName());
+
+ jms.setJmsVersion("1.1");
+ assertEquals("1.1", jms.getJmsVersion());
+
+ jms.setPersistenceManagerName("testPersistenceManagerName");
+ assertEquals("testPersistenceManagerName", jms
+ .getPersistenceManagerName());
+
+ jms.setProviderVersion("1.2.GA");
+ assertEquals("1.2.GA", jms.getProviderVersion());
+
+ jms.setQueuedExecutorPoolSize(200);
+ assertEquals(200, jms.getQueuedExecutorPoolSize());
+
+ jms.setSecurityDomain("security domain");
+ assertEquals("security domain", jms.getSecurityDomain());
+
+ jms.setServerPeerID("server.0");
+ assertEquals("server.0", jms.getServerPeerID());
+
+ /*
+ * ******* Test attributes from the PersistenceManager MBean *******
+ */
+ jms.setCreateMsgTablesOnStartup(true);
+ assertTrue(jms.isCreateMsgTablesOnStartup());
+
+ jms.setMaxParams(100);
+ assertEquals(100, jms.getMaxParams());
+
+ jms.setMsgDataSource("java:/DefaultDS");
+ assertEquals("java:/DefaultDS", jms.getMsgDataSource());
+
+ jms.setMsgDataSourceName("DefaultDS");
+ assertEquals("DefaultDS", jms.getMsgDataSourceName());
+
+ String msgSql = "prop1=some string" + "\r\n"
+ + "prop2=some other string" + "\r\n" + "prop3=more string";
+ jms.setMsgSqlProperties(msgSql);
+ assertEquals(msgSql, jms.getMsgSqlProperties());
+
+ jms.setTransactionManagerName("jboss:service=TransactionManager");
+ assertEquals("jboss:service=TransactionManager", jms
+ .getTransactionManagerName());
+
+ jms.setUsingBatchUpdates(true);
+ assertTrue(jms.isUsingBatchUpdates());
+
+ /*
+ * ******* Test attributes from the JMSUserManager MBean *******
+ */
+ jms.setCreateUserTablesOnStartup(true);
+ assertTrue(jms.isCreateUserTablesOnStartup());
+
+ jms.setUserDataSource("java:/DefaultDS");
+ assertEquals("java:/DefaultDS", jms.getUserDataSource());
+
+ jms.setUserDataSourceName("DefaultDS");
+ assertEquals("DefaultDS", jms.getUserDataSourceName());
+
+ String userSql = "prop1=value1" + "\r\n"
+ + "prop2=some other value" + "\r\n" + "prop3=yet another string";
+ jms.setUserSqlProperties(userSql);
+ assertEquals(userSql, jms.getUserSqlProperties());
+
+ /*
+ * ******* Test attributes from the PostOffice MBean *******
+ */
+
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/QueueTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/QueueTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/QueueTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.model.jms;
+
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.model.jms.Queue;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for Queue
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class QueueTest extends TestCase {
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * This method tests the behavior of the Queue constructor.
+ */
+ public void testQueueCreation() {
+ Queue q1 = new Queue();
+ assertNotNull(q1);
+
+ Queue q2 = new Queue(new DestinationIdentifier("abc|def"));
+ assertNotNull(q2);
+ }
+
+ /**
+ * This method tests the behavior of the getters and setters.
+ */
+ public void testGetterSetter() throws Exception {
+ Queue q1 = new Queue();
+ assertNotNull(q1);
+
+ q1.setMessageCount(8);
+ assertEquals(8, q1.getMessageCount());
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/TopicTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/TopicTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/model/jms/TopicTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.model.jms;
+
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.model.jms.Topic;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for Topic
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class TopicTest extends TestCase {
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * This method tests the behavior of the constructor.
+ */
+ public void testTopicCreation() {
+ Topic t1 = new Topic();
+ assertNotNull(t1);
+
+ Topic t2 = new Topic(new DestinationIdentifier("abc|def"));
+ assertNotNull(t2);
+ }
+
+ /**
+ * This method tests the behavior of the getters and setters.
+ */
+ public void testGetterSetter() {
+ Topic t1 = new Topic();
+ assertNotNull(t1);
+
+ t1.setDurableSubCount(10);
+ assertEquals(10, t1.getDurableSubCount());
+
+ t1.setNonDurableSubCount(20);
+ assertEquals(20, t1.getNonDurableSubCount());
+
+ t1.setAllSubCount(100);
+ assertEquals(100, t1.getAllSubCount());
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/DeploymentServiceDestinationHelperTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/DeploymentServiceDestinationHelperTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/DeploymentServiceDestinationHelperTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,312 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.service.jms;
+
+import java.io.File;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
+
+import junit.framework.TestCase;
+
+import org.easymock.MockControl;
+import org.easymock.classextension.MockClassControl;
+import org.jboss.admin.model.jms.Destination;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.model.jms.Queue;
+import org.jboss.admin.service.MBeanServerHelper;
+import org.jboss.admin.service.ServiceTestHelper;
+import org.jboss.admin.service.jms.Constants;
+import org.jboss.admin.service.jms.DeploymentServiceDestinationHelper;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.services.deployment.DeploymentServiceMBean;
+
+/**
+ * Tests for DeploymentServiceDestinationHelper
+ *
+ * @author <a href="jack.chang at unisys.com">Jack Chang </a>
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DeploymentServiceDestinationHelperTest extends TestCase {
+ private MockControl control;
+
+ private MBeanServer mockMBeanServer;
+
+ private MBeanServerHelper mbeanServerHelper;
+
+ private DeploymentServiceDestinationHelper service;
+
+ private ServiceTestHelper hService;
+
+ private MockControl deploymentServiceControl;
+
+ private DeploymentServiceMBean mockDeploymentService;
+
+ private MockControl invocationHandlerControl;
+
+ private MBeanServerInvocationHandler mockInvocationHandler;
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ control = MockClassControl.createControl(MBeanServer.class);
+ mockMBeanServer = (MBeanServer) control.getMock();
+
+ mbeanServerHelper = new MBeanServerHelper(mockMBeanServer);
+ service = new DeploymentServiceDestinationHelper(mbeanServerHelper);
+ hService = new ServiceTestHelper(service);
+
+ deploymentServiceControl = MockClassControl
+ .createControl(DeploymentServiceMBean.class);
+ mockDeploymentService = (DeploymentServiceMBean) deploymentServiceControl
+ .getMock();
+
+ mbeanServerHelper.setDeploymentServiceProxy(mockDeploymentService);
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Tests action to create a destination.
+ *
+ * @throws Exception
+ */
+ public void testCreateDestination() throws Exception {
+
+ /*
+ * Setup test data:
+ */
+ Queue queue = new Queue();
+ queue.setName("testQueue");
+ String moduleName = "testQueue";
+ String templateName = "jms-queue";
+ Map attributes = new HashMap();
+ attributes.put("testKey", "testData");
+
+ /*
+ * Tell the mock what method to expect to be called and what value to
+ * return:
+ */
+ mockDeploymentService.createModule(moduleName, templateName,
+ (HashMap) attributes);
+ deploymentServiceControl.setMatcher(MockControl.ALWAYS_MATCHER);
+ deploymentServiceControl.setReturnValue("testQueue-service.xml");
+ String moduleToBeDeployed = "testQueue-service.xml";
+ mockDeploymentService.deployModuleAsynch(moduleToBeDeployed);
+ deploymentServiceControl.setVoidCallable();
+
+ /*
+ * Finish off test setup:
+ */
+ deploymentServiceControl.replay();
+
+ /*
+ * Run the method under test:
+ */
+ service.createDestination(queue);
+
+ /*
+ * Check all the mock methods were called correctly:
+ */
+ deploymentServiceControl.verify();
+ }
+
+ /**
+ * Tests action to put security role attributes into a map.
+ */
+ public void testPutSecurityRolesAttribute() {
+ Map map = new HashMap();
+ StringBuffer roles = new StringBuffer();
+ roles.append("admin:read:write:create\r\n");
+ roles.append("quest:read\r\n");
+ String key = Constants.CommonAttributes.SECURITY_ROLES;
+
+ service.putSecurityRolesAttribute(roles.toString(), map);
+ String[] roleArray = (String[]) map.get(key);
+
+ assertEquals(roleArray.length, 2);
+ assertEquals(roleArray[0], "admin:read:write:create");
+ assertEquals(roleArray[1], "quest:read");
+ }
+
+ /**
+ * Tests action to put a string attribute into a map.
+ */
+ public void testPutNotNullStringAttribute() {
+ Map map = new HashMap();
+ hService.putAttribute("keyNotNull", "textString", map);
+ assertEquals(map.get("keyNotNull"), "textString");
+ }
+
+ /**
+ * Tests action to put a null string attribute into a map.
+ */
+ public void testPutNullStringAttribute() {
+ Map map = new HashMap();
+ hService.putAttribute("keyNull", (String) null, map);
+ assertTrue(map.isEmpty());
+ }
+
+ /**
+ * Tests action to put an empty string attribute into a map.
+ */
+ public void testPutEmptyStringAttribute() {
+ Map map = new HashMap();
+ hService.putAttribute("keyEmpty", "", map);
+ assertTrue(map.isEmpty());
+ }
+
+ /**
+ * Tests action to put a class attribute into a map.
+ */
+ public void testPutClassTypeAttribute() {
+ Map map = new HashMap();
+ hService.putAttribute("keyClass", "java.lang.String", map);
+ assertEquals(map.get("keyClass"), "java.lang.String");
+ }
+
+ /**
+ * Tests action to get common destination attributes from a given
+ * destination.
+ *
+ * @throws Exception
+ */
+ public void testGetCommonDestinationAttributes() throws Exception {
+ Destination dest = new Destination();
+ dest.setName("testQueue");
+ dest.setJndiName("/queue/testQueue");
+ dest.setDownCacheSize(1000);
+ dest.setFullSize(80000);
+ dest.setPageSize(3000);
+ dest.setSecurityRoles("user:read:write");
+
+ Map map = service.getCommonDestinationAttributes(dest);
+ assertEquals( "testQueue", map.get(Constants.CommonAttributes.NAME));
+ assertEquals(map.get(Constants.CommonAttributes.JNDI_NAME),
+ "/queue/testQueue");
+ assertEquals(
+ ((Integer) map
+ .get(Constants.CommonAttributes.DOWN_CACHE_SIZE))
+ .intValue(), 1000);
+ assertEquals(
+ ((Integer) map
+ .get(Constants.CommonAttributes.FULL_SIZE))
+ .intValue(), 80000);
+ assertEquals(
+ ((Integer) map
+ .get(Constants.CommonAttributes.PAGE_SIZE))
+ .intValue(), 3000);
+ String[] securityRole = (String[]) map
+ .get(Constants.CommonAttributes.SECURITY_ROLES);
+ assertEquals(securityRole.length, 1);
+ }
+
+ /**
+ * Tests action to check whether a destination was created by the
+ * DeploymentService.
+ *
+ * @throws Exception
+ */
+ public void testWasDestinationCreatedViaDeploymentService()
+ throws Exception {
+ final String DEPLOYMENT_SERVICE_OBJECT_NAME = "jboss:service=DeploymentService";
+
+ /*
+ * Setup the test data:
+ */
+ DestinationIdentifier id = new DestinationIdentifier("abc|def");
+
+ /*
+ * Tell the mock what method to expect to be called and what value to
+ * return:
+ */
+ mockMBeanServer.invoke(new ObjectName(DEPLOYMENT_SERVICE_OBJECT_NAME),
+ "getDeployedURL", new Object[] { id.getModuleName() },
+ new String[] { "java.lang.String" });
+ control.setMatcher(MockControl.ALWAYS_MATCHER);
+ control.setReturnValue(new String("an object"));
+
+ /*
+ * Finish off test setup:
+ */
+ control.replay();
+
+ /*
+ * Run the method method under test:
+ */
+ boolean returnValue = service
+ .wasDestinationCreatedViaDeploymentService(id);
+
+ /*
+ * Check returned data:
+ */
+ assertTrue(returnValue);
+
+ /*
+ * Check all the mock methods were called correctly:
+ */
+ control.verify();
+ }
+
+ /**
+ * Tests action to check whether a destination was created by the
+ * DeploymentService.
+ *
+ * @throws Exception
+ */
+ public void testWasDestinationCreatedViaDeploymentService2()
+ throws Exception {
+ /*
+ * Set test data:
+ */
+ File f = new File(
+ "src/etc/test/server/default/deploy/deployment-service/");
+ String fs = "file://" + f.getAbsolutePath() + "/";
+ fs = fs.replace('\\', '/');
+ URL url = new URL(fs);
+ DeploymentInfo deploymentInfo = new DeploymentInfo(url, null, null);
+
+ /*
+ * Run the method under test:
+ */
+ boolean returnValue = service
+ .wasDestinationCreatedViaDeploymentService(deploymentInfo);
+
+ /*
+ * Check the return data:
+ */
+ assertTrue(returnValue);
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/DeploymentServiceJmsHelperTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/DeploymentServiceJmsHelperTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/DeploymentServiceJmsHelperTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,247 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.service.jms;
+
+import java.util.Properties;
+
+import javax.management.MBeanServer;
+
+import junit.framework.TestCase;
+
+import org.easymock.MockControl;
+import org.easymock.classextension.MockClassControl;
+import org.jboss.admin.TestAdminConstants;
+import org.jboss.admin.model.jms.Jms;
+import org.jboss.admin.service.MBeanServerHelper;
+import org.jboss.admin.service.jms.Constants;
+import org.jboss.admin.service.jms.DeploymentServiceJmsHelper;
+import org.jboss.services.deployment.DeploymentServiceMBean;
+import org.jboss.services.deployment.MBeanData;
+
+/**
+ * Tests for DeploymentServiceJmsHelper
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class DeploymentServiceJmsHelperTest extends TestCase {
+ private MockControl control;
+
+ private MBeanServer mockMBeanServer;
+
+ private MBeanServerHelper mbeanServerHelper;
+
+ private DeploymentServiceJmsHelper service;
+
+ // private ServiceTestHelper hService;
+
+ private MockControl deploymentServiceControl;
+
+ private DeploymentServiceMBean mockDeploymentService;
+
+ private String NL = TestAdminConstants.LINE_SEPARATOR;
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ control = MockClassControl.createControl(MBeanServer.class);
+ mockMBeanServer = (MBeanServer) control.getMock();
+
+ mbeanServerHelper = new MBeanServerHelper(mockMBeanServer);
+ service = new DeploymentServiceJmsHelper(mbeanServerHelper);
+
+ deploymentServiceControl = MockClassControl
+ .createControl(DeploymentServiceMBean.class);
+ mockDeploymentService = (DeploymentServiceMBean) deploymentServiceControl
+ .getMock();
+ service.setDeploymentService(mockDeploymentService);
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Tests action to update jms attributes.
+ *
+ * @throws Exception
+ */
+ public void testUpdateJmsAttributes() throws Exception {
+ /*
+ * Setup test data (Updatable JMS attributes only):
+ */
+ Jms jms = new Jms();
+ jms
+ .setConnectorName("jboss.messaging:service=Connector,transport=socket");
+ jms.setDefaultTempQueueDownCacheSize(1000);
+ jms.setDefaultTempQueueFullSize(50000);
+ jms.setDefaultTempQueuePageSize(1000);
+ jms.setPrefetchSize(100);
+ jms.setServerPeerName("jboss.messaging:service=ServerPeer");
+
+ jms.setDefaultSecurityRoles("guest:read:write" + NL
+ + "admin:read:write:create");
+ jms.setQueuedExecutorPoolSize(100);
+ jms.setSecurityDomain("java:/jaas/messaging");
+ jms.setPersistenceManagerName("jboss.messaging:service=PersistenceManager");
+
+ jms.setCreateMsgTablesOnStartup(true);
+ jms.setMaxParams(120);
+ jms.setMsgDataSource("java:/DefaultDS");
+ String msgSql = "prop1=value1" + NL + "prop2=value 2";
+ jms.setMsgSqlProperties(msgSql);
+ jms.setUsingBatchUpdates(false);
+ jms.setTransactionManagerName("jboss:service=TransactionManager");
+
+ jms.setCreateUserTablesOnStartup(false);
+ jms.setUserDataSource("java:/TestDS");
+ String userSql = "p1=v1" + NL + "p2=value 2" + NL + "p3=v3";
+ jms.setUserSqlProperties(userSql);
+
+ /*
+ * Setup test data (parameters to update ConnectionFactory mbean) :
+ */
+ Properties attrs1 = new Properties();
+ attrs1.put(Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_DOWN_CACHE_SIZE,
+ Integer.toString(jms.getDefaultTempQueueDownCacheSize()));
+ attrs1.put(Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_FULL_SIZE,
+ Integer.toString(jms.getDefaultTempQueueFullSize()));
+ attrs1.put(Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_PAGE_SIZE,
+ Integer.toString(jms.getDefaultTempQueuePageSize()));
+ attrs1.put(Constants.JmsAttributes.PREFETCH_SIZE, Integer.toString(jms
+ .getPrefetchSize()));
+
+ Properties depends1 = new Properties();
+ depends1.put(Constants.JmsAttributes.CONNECTOR, jms.getConnectorName());
+ depends1.put(Constants.JmsAttributes.SERVER_PEER, jms
+ .getServerPeerName());
+
+ MBeanData mbeanData1 = new MBeanData();
+ mbeanData1.setName(Constants.JmsAttributes.CONNECTION_FACTORY_NAME);
+ mbeanData1.setTemplateName("mbean-update");
+ mbeanData1.setAttributes(attrs1);
+ mbeanData1.setDepends(depends1);
+
+ /*
+ * Setup test data (parameters to update ServerPeer mbean) :
+ */
+ Properties attrs2 = new Properties();
+ String secConfig = "<security>"
+ + "<role name='guest' read='true' write='true' create='false'/>"
+ + "<role name='admin' read='true' write='true' create='true'/>"
+ + "</security>";
+ attrs2.put(Constants.JmsAttributes.DEFAULT_SECURITY_CONFIG, secConfig);
+ attrs2.put(Constants.JmsAttributes.QUEUED_EXECUTOR_POOL_SIZE, Integer.toString(jms.getQueuedExecutorPoolSize()));
+ attrs2.put(Constants.JmsAttributes.SECURITY_DOMAIN, jms
+ .getSecurityDomain());
+
+ Properties depends2 = new Properties();
+ depends2.put(Constants.JmsAttributes.PERSISTENCE_MANAGER, jms.getPersistenceManagerName());
+
+ MBeanData mbeanData2 = new MBeanData();
+ mbeanData2.setName(Constants.JmsAttributes.SERVER_PEER_NAME);
+ mbeanData2.setTemplateName("mbean-update");
+ mbeanData2.setAttributes(attrs2);
+ mbeanData2.setDepends(depends2);
+
+ /*
+ * Setup test data (parameters to update PersistenceManager mbean) :
+ */
+ Properties attrs3 = new Properties();
+ attrs3.put(Constants.JmsAttributes.CREATE_TABLES_ON_STARTUP, Boolean
+ .toString(jms.isCreateMsgTablesOnStartup()));
+ attrs3.put(Constants.JmsAttributes.DATA_SOURCE, jms.getMsgDataSource());
+ attrs3.put(Constants.JmsAttributes.MAX_PARAMS, Integer
+ .toString(jms.getMaxParams()));
+ attrs3.put(Constants.JmsAttributes.SQL_PROPERTIES, jms
+ .getMsgSqlProperties());
+ attrs3.put(Constants.JmsAttributes.USING_BATCH_UPDATES, Boolean
+ .toString(jms.isUsingBatchUpdates()));
+
+ Properties depends3 = new Properties();
+ depends3.put(Constants.JmsAttributes.TRANSACTION_MANAGER,
+ jms.getTransactionManagerName());
+
+ MBeanData mbeanData3 = new MBeanData();
+ mbeanData3.setName(Constants.JmsAttributes.PERSISTENCE_MANAGER_NAME);
+ mbeanData3.setTemplateName("mbean-update");
+ mbeanData3.setAttributes(attrs3);
+ mbeanData3.setDepends(depends3);
+
+ /*
+ * Setup test data (parameters to update JMSUserManager mbean) :
+ */
+ Properties attrs4 = new Properties();
+ attrs4.put(Constants.JmsAttributes.CREATE_TABLES_ON_STARTUP, Boolean
+ .toString(jms.isCreateUserTablesOnStartup()));
+ attrs4.put(Constants.JmsAttributes.DATA_SOURCE, jms.getUserDataSource());
+ attrs4.put(Constants.JmsAttributes.SQL_PROPERTIES, jms
+ .getUserSqlProperties());
+
+ MBeanData mbeanData4 = new MBeanData();
+ mbeanData4.setName(Constants.JmsAttributes.JMS_USER_MANAGER_NAME);
+ mbeanData4.setTemplateName("mbean-update");
+ mbeanData4.setAttributes(attrs4);
+ // Use the same depends as PersistenceManager:
+ mbeanData4.setDepends(depends3);
+
+ /*
+ * Setup test data (parameters to update PostOffice mbean) :
+ */
+ //TODO:
+
+ /*
+ * Tell the mock what method to expect to be called and what value to
+ * return:
+ */
+ mockDeploymentService.updateMBean(mbeanData1);
+ deploymentServiceControl.setMatcher(MockControl.ALWAYS_MATCHER);
+ deploymentServiceControl.setReturnValue(true);
+ mockDeploymentService.updateMBean(mbeanData2);
+ deploymentServiceControl.setReturnValue(true);
+ mockDeploymentService.updateMBean(mbeanData3);
+ deploymentServiceControl.setReturnValue(true);
+ mockDeploymentService.updateMBean(mbeanData4);
+ deploymentServiceControl.setReturnValue(true);
+
+ /*
+ * Finish off test setup:
+ */
+ deploymentServiceControl.replay();
+
+ /*
+ * Run the method under test:
+ */
+ service.updateJmsAttributes(jms);
+
+ /*
+ * Check all the mock methods were called correctly:
+ */
+ deploymentServiceControl.verify();
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/MBeanServerDestinationHelperTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/MBeanServerDestinationHelperTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/MBeanServerDestinationHelperTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,495 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.service.jms;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.jms.BytesMessage;
+import javax.jms.TextMessage;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.xpath.XPathAPI;
+import org.easymock.MockControl;
+import org.easymock.classextension.MockClassControl;
+
+import org.jboss.admin.TestAdminConstants;
+import org.jboss.admin.model.jms.DestinationIdentifier;
+import org.jboss.admin.model.jms.DestinationMessage;
+import org.jboss.admin.model.jms.Queue;
+import org.jboss.admin.model.jms.Topic;
+import org.jboss.admin.service.jms.JmsServiceRuntimeException;
+import org.jboss.admin.service.jms.MBeanServerDestinationHelper;
+import org.jboss.mq.SpyBytesMessage;
+import org.jboss.mq.SpyTextMessage;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+/**
+ * Tests for MBeanServerDestinationHelper
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class MBeanServerDestinationHelperTest extends TestCase {
+ private static Log logger = LogFactory
+ .getLog(MBeanServerDestinationHelperTest.class);
+
+ private MockControl control;
+
+ private MBeanServer mockMBeanServer;
+
+ private MBeanServerDestinationHelper service;
+
+ private String NL = TestAdminConstants.LINE_SEPARATOR;
+
+ /**
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ /*
+ * Setup the mock service:
+ */
+ control = MockClassControl.createControl(MBeanServer.class);
+ mockMBeanServer = (MBeanServer) control.getMock();
+ service = new MBeanServerDestinationHelper(mockMBeanServer);
+ service
+ .setConfigPathForTestingUse(TestAdminConstants.PATH_TO_QUEUE_CONFIGFILE_FOR_TESTING);
+ logger
+ .info("[setup()]Instantiated a new MBeanServerDestinationHelper to test ..."
+ + NL
+ + " ... mbeanServer="
+ + mockMBeanServer
+ + " ... path to test configuration file="
+ + service.getConfigPathForTestingUse() + " .");
+
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Tests action to get the objectNames of a queues.
+ *
+ * @throws Exception
+ */
+ public void testGetObjectNamesOfQueue() throws Exception {
+ /*
+ * Setup test data:
+ */
+ String type = Queue.class.getName();
+ ObjectName q1 = new ObjectName(
+ "jboss.messaging.destination:name=q1,service=Queue");
+ Set queues = new HashSet();
+ queues.add(q1);
+
+ /*
+ * Tell the mock what methods to expect to be called:
+ */
+ ObjectName queueFilter = new ObjectName(
+ "jboss.messaging.destination:service=Queue,*");
+ mockMBeanServer.queryNames(queueFilter, null);
+
+ /*
+ * ... and what values to return:
+ */
+ control.setReturnValue(queues);
+
+ /*
+ * Finish off test setup:
+ */
+ control.replay();
+
+ /*
+ * Run the method under test:
+ */
+ Set returnedQueues = service.getAllDestinationObjectNamesByType(type);
+
+ /*
+ * Check all the mock methods were called correctly:
+ */
+ control.verify();
+
+ /*
+ * Check returned data:
+ */
+ assertNotNull(returnedQueues);
+ assertEquals(1, returnedQueues.size());
+ }
+
+ /**
+ * Tests action to get the objectNames of topics.
+ *
+ * @throws Exception
+ */
+ public void testGetObjectNamesOfTopic() throws Exception {
+ /*
+ * Setup test data:
+ */
+ String type = Topic.class.getName();
+ ObjectName t1 = new ObjectName(
+ "jboss.messaging.destination:name=q1,service=Topic");
+ Set topics = new HashSet();
+ topics.add(t1);
+
+ /*
+ * Tell the mock what methods to expect to be called:
+ */
+ ObjectName topicFilter = new ObjectName(
+ "jboss.messaging.destination:service=Topic,*");
+ mockMBeanServer.queryNames(topicFilter, null);
+
+ /*
+ * ... and what values to return:
+ */
+ control.setReturnValue(topics);
+
+ /*
+ * Finish off test setup:
+ */
+ control.replay();
+
+ /*
+ * Run the method under test:
+ */
+ Set returnedTopics = service.getAllDestinationObjectNamesByType(type);
+
+ /*
+ * Check all the mock methods were called correctly:
+ */
+ control.verify();
+
+ /*
+ * Check returned data:
+ */
+ assertNotNull(returnedTopics);
+ assertEquals(1, returnedTopics.size());
+ }
+
+ /**
+ * Tests action to get the objectNames of a destination of invalid type.
+ *
+ * @throws Exception
+ */
+ public void testGetObjectNamesOfInvalidType() throws Exception {
+ String type = "BadType";
+ try {
+ Set result = service.getAllDestinationObjectNamesByType(type);
+ fail();
+ } catch (JmsServiceRuntimeException e) {
+ }
+ }
+
+ /**
+ * Tests action to get a destination type name.
+ *
+ * @throws Exception
+ */
+ public void testGetDestinationTypeName() throws Exception {
+ ObjectName q1 = new ObjectName(
+ "jboss.messaging.destination:name=q1,service=Queue");
+ ObjectName t1 = new ObjectName(
+ "jboss.messaging.destination:name=t1,service=Topic");
+ ObjectName junk = new ObjectName(
+ "some.domain:name=someName,service=someService");
+ String destType;
+
+ destType = service.getDestinationTypeName(q1);
+ assertEquals(Queue.class.getName(), destType);
+
+ destType = service.getDestinationTypeName(t1);
+ assertEquals(Topic.class.getName(), destType);
+
+ try {
+ destType = service.getDestinationTypeName(junk);
+ fail();
+ } catch (JmsServiceRuntimeException e) {
+ }
+ }
+
+ /**
+ * Tests action to populate a destination data.
+ *
+ * @throws Exception
+ */
+ public void testPopulateDestinationData() throws Exception {
+ /*
+ * Setup test data:
+ */
+ ObjectName objName = new ObjectName(
+ "jboss.messaging.destination:name=q1,service=Queue");
+ String serverPeerName = "jboss.messaging:service=ServerPeer";
+ ObjectName serverPeer = new ObjectName(serverPeerName);
+
+ /*
+ * Obtain a DOM element from the test xml file:
+ */
+ String fileName = TestAdminConstants.PATH_TO_QUEUE_CONFIGFILE_FOR_TESTING;
+ String xpath = "//mbean//attribute[@name='SecurityConf']";
+ Document doc = parseXmlFile(fileName, false);
+ Element secConfigElem = (Element) XPathAPI.selectSingleNode(doc, xpath);
+
+ /*
+ * Tell the mock what methods to expect to be called and what values to
+ * return:
+ */
+ mockMBeanServer.getAttribute(objName, "Name");
+ control.setReturnValue("q1");
+ mockMBeanServer.getAttribute(objName, "JNDIName");
+ control.setReturnValue("/queue/q1");
+ mockMBeanServer.getAttribute(objName, "CreatedProgrammatically");
+ control.setReturnValue(Boolean.valueOf(false));
+ mockMBeanServer.getAttribute(objName, "DownCacheSize");
+ control.setReturnValue(Integer.valueOf("2000"));
+ mockMBeanServer.getAttribute(objName, "FullSize");
+ control.setReturnValue(Integer.valueOf("75000"));
+ mockMBeanServer.getAttribute(objName, "PageSize");
+ control.setReturnValue(Integer.valueOf("2000"));
+ mockMBeanServer.getAttribute(objName, "SecurityConfig");
+ control.setReturnValue(secConfigElem);
+ mockMBeanServer.getAttribute(objName, "ServerPeer");
+ control.setReturnValue(serverPeer);
+ mockMBeanServer.getAttribute(objName, "MessageCount");
+ control.setReturnValue(Integer.valueOf("4"));
+
+ /*
+ * The following calls to the MBeanServer are not executed during the
+ * test because we circumvented the call to listAllDeployedModules() in
+ * the MBeanServerHelper Class. If we have time to extend the test to
+ * execute this code, then we will probably have to uncomment the next
+ * two mock control operations.
+ */
+ // mockMBeanServer.invoke(new ObjectName(
+ // "jboss.system:service=MainDeployer"), "listDeployed", null,
+ // null);
+ // control.setReturnValue(allDeployedModules);
+ /*
+ * Finish off test setup:
+ */
+ control.replay();
+
+ /*
+ * Run the method under test:
+ */
+ Queue q1 = new Queue();
+ DestinationIdentifier id = new DestinationIdentifier(
+ "jboss.messaging.destination:name=q1,service=Queue|jbossmq-destinations-service.xml");
+ q1.setIdentifier(id);
+ service.populateDestinationData(objName, q1);
+
+ /*
+ * Check all the mock methods were called correctly:
+ */
+ control.verify();
+
+ /*
+ * Check returned data:
+ */
+ assertEquals("q1", q1.getName());
+ assertEquals("/queue/q1", q1.getJndiName());
+ assertFalse(q1.isCreatedProgrammatically());
+ assertEquals(2000, q1.getDownCacheSize());
+ assertEquals(75000, q1.getFullSize());
+ assertEquals(2000, q1.getPageSize());
+ assertEquals(serverPeerName, q1.getServerPeerName());
+ String secRoles = "guest:read:write" + NL + "admin:read:write:create"
+ + NL;
+ assertEquals(secRoles, q1.getSecurityRoles());
+ }
+
+ /**
+ * Tests action to get queue messages.
+ *
+ * @throws Exception
+ */
+ public void testGetQueueMessages() throws Exception {
+ /*
+ * Setup test data:
+ */
+ ObjectName objName = new ObjectName(
+ "jboss.messaging.destination:name=q1,service=Queue");
+ Object[] params = { "" };
+ String[] signature = { "java.lang.String" };
+ List messages = new ArrayList();
+ SpyTextMessage msg = new SpyTextMessage();
+ msg.setText("testing");
+ messages.add(msg);
+
+ /*
+ * Tell the mock what methods to expect to be called:
+ */
+ mockMBeanServer.invoke(objName, "listMessages", params, signature);
+
+ /*
+ * ... and what values to return:
+ */
+ control.setReturnValue(messages);
+
+ /*
+ * Finish off test setup:
+ */
+ control.replay();
+
+ /*
+ * Run the method under test:
+ */
+ List returnedMessages = service.getQueueMessages(objName);
+
+ /*
+ * Check all the mock methods were called correctly:
+ */
+ control.verify();
+
+ /*
+ * Check returned data:
+ */
+ assertNotNull(returnedMessages);
+ assertEquals(1, returnedMessages.size());
+ DestinationMessage destMsg = (DestinationMessage) returnedMessages
+ .get(0);
+ assertEquals(TextMessage.class.getName(), destMsg.getMsgType());
+ assertEquals("testing", destMsg.getMsgBody());
+ }
+
+ /**
+ * Tests action to get topic messages.
+ *
+ * @throws Exception
+ */
+ public void testGetTopicMessages() throws Exception {
+ /*
+ * Setup test data:
+ */
+ ObjectName objName = new ObjectName(
+ "jboss.messaging.destination:name=t1,service=Topic");
+ Object[] params = { "" };
+ String[] signature = { "java.lang.String" };
+ List messages = new ArrayList();
+ SpyTextMessage msg1 = new SpyTextMessage();
+ msg1.setText("testing");
+ SpyBytesMessage msg2 = new SpyBytesMessage();
+ msg2.writeInt(9999);
+ messages.add(msg1);
+ messages.add(msg2);
+
+ /*
+ * Tell the mock what methods to expect to be called:
+ */
+ mockMBeanServer.invoke(objName, "listMessages", params, signature);
+
+ /*
+ * Set matcher so Object arguments compare correctly:
+ */
+ control.setMatcher(MockControl.ARRAY_MATCHER);
+
+ /*
+ * Tell the mock what values to return:
+ */
+ control.setReturnValue(messages);
+
+ /*
+ * Finish off test setup:
+ */
+ control.replay();
+
+ /*
+ * Run the method under test:
+ */
+ List returnedMessages = service.getTopicMessages(objName,
+ "subscriptionID");
+
+ /*
+ * Check all the mock methods were called correctly:
+ */
+ control.verify();
+
+ /*
+ * Check returned data:
+ */
+ assertNotNull(returnedMessages);
+ assertEquals(2, returnedMessages.size());
+ DestinationMessage destMsg1 = (DestinationMessage) returnedMessages
+ .get(0);
+ DestinationMessage destMsg2 = (DestinationMessage) returnedMessages
+ .get(1);
+ assertEquals(TextMessage.class.getName(), destMsg1.getMsgType());
+ assertEquals("testing", destMsg1.getMsgBody());
+ assertEquals(BytesMessage.class.getName(), destMsg2.getMsgType());
+ }
+
+ /**
+ * Parses an XML file and returns a DOM document.
+ *
+ * @param filename
+ * The XML file to be parsed.
+ * @param validating
+ * If validating is true, the contents is validated against the
+ * DTD specified in the file.
+ * @return a DOM document
+ */
+ private Document parseXmlFile(String filename, boolean validating) {
+ Document doc = null;
+ try {
+ /*
+ * Create a builder factory:
+ */
+ DocumentBuilderFactory factory = DocumentBuilderFactory
+ .newInstance();
+ factory.setValidating(validating);
+
+ /*
+ * Create the builder and parse the file:
+ */
+ doc = factory.newDocumentBuilder().parse(new File(filename));
+ } catch (SAXException e) {
+ // A parsing error occurred; the xml input is not valid
+ logger.debug("SAXException occurred while parsing the xml file.");
+ } catch (ParserConfigurationException e) {
+ logger
+ .debug("ParserConfigurationException occurred while parsing the xml file.");
+ } catch (IOException e) {
+ logger.debug("IOException occurred while parsing the xml file.");
+ }
+
+ return doc;
+ }
+}
\ No newline at end of file
Added: projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/MBeanServerJmsHelperTest.java
===================================================================
--- projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/MBeanServerJmsHelperTest.java (rev 0)
+++ projects/admin-console/trunk/src/test/org/jboss/admin/service/jms/MBeanServerJmsHelperTest.java 2007-01-19 23:38:07 UTC (rev 59866)
@@ -0,0 +1,403 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.admin.service.jms;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.xpath.XPathAPI;
+import org.easymock.MockControl;
+import org.jboss.admin.TestAdminConstants;
+import org.jboss.admin.model.datasource.DataSourceIdentifier;
+import org.jboss.admin.model.datasource.LocalTxDataSource;
+import org.jboss.admin.model.datasource.NoTxDataSource;
+import org.jboss.admin.model.jms.Jms;
+import org.jboss.admin.service.datasource.DataSourceService;
+import org.jboss.admin.service.jms.Constants;
+import org.jboss.admin.service.jms.MBeanServerJmsHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+/**
+ * Tests for MBeanServerJmsHelper
+ *
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision: 56034 $
+ */
+public class MBeanServerJmsHelperTest extends TestCase {
+ private static Log logger = LogFactory
+ .getLog(MBeanServerJmsHelperTest.class);
+
+ private MockControl control;
+
+ private MockControl dsControl;
+
+ private MBeanServer mockMBeanServer;
+
+ private DataSourceService mockDataSourceService;
+
+ private MBeanServerJmsHelper service;
+
+ private String NL = TestAdminConstants.LINE_SEPARATOR;
+
+ /*
+ * Setup two mock services, an MBeanServer and a DataSourceService.
+ *
+ * One, the MBeanServerHelper, is passed to the constructor of the object
+ * under test.
+ *
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ control = MockControl.createControl(MBeanServer.class);
+ dsControl = MockControl.createControl(DataSourceService.class);
+ mockMBeanServer = (MBeanServer) control.getMock();
+ mockDataSourceService = (DataSourceService) dsControl.getMock();
+ // Create 'service', the object to be tested.
+ service = new MBeanServerJmsHelper(mockMBeanServer);
+ service.setDataSource(mockDataSourceService);
+ logger
+ .info("[setup()]Instantiated a new MBeanServerJmsHelper to test ..."
+ + NL
+ + " ... DataSourceServiceMock="
+ + mockDataSourceService
+ + NL
+ + " ... mbeanServer="
+ + mockMBeanServer
+ + " .");
+ }
+
+ /**
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ /*
+ * prevent resource leak:
+ */
+ service.setDataSource(null);
+
+ super.tearDown();
+ }
+
+ /**
+ * Tests action to populate the jms data.
+ *
+ * @throws Exception
+ */
+ public void testPopulateJmsData() throws Exception {
+ /*
+ * Setup test data:
+ */
+ logger.debug("Setup test data:");
+ String connectionFactoryName = Constants.JmsAttributes.CONNECTION_FACTORY_NAME;
+ String serverPeerName = Constants.JmsAttributes.SERVER_PEER_NAME;
+ String persistenceManagerName = Constants.JmsAttributes.PERSISTENCE_MANAGER_NAME;
+ String userManagerName = Constants.JmsAttributes.JMS_USER_MANAGER_NAME;
+ String connectorName = "jboss.messaging:service=Connector,transport=socket";
+ String transactionManagerName = "jboss:service=TransactionManager";
+ String sqlProperties = "prop1=value1" + NL + "prop2=value 2";
+
+ ObjectName connectionFactory = new ObjectName(connectionFactoryName);
+ ObjectName serverPeer = new ObjectName(serverPeerName);
+ ObjectName persistenceManager = new ObjectName(persistenceManagerName);
+ ObjectName userManager = new ObjectName(userManagerName);
+ ObjectName connector = new ObjectName(connectorName);
+ ObjectName transactionManager = new ObjectName(transactionManagerName);
+
+
+ /*
+ * Obtain a DOM element from the test xml file:
+ */
+ String fileName = TestAdminConstants.PATH_TO_QUEUE_CONFIGFILE_FOR_TESTING;
+ String xpath = "//mbean//attribute[@name='SecurityConf']";
+ Document doc = parseXmlFile(fileName, false);
+ Element elem = (Element) XPathAPI.selectSingleNode(doc, xpath);
+
+ /*
+ * Tell the mock what methods to expect to be called and what values to
+ * return.
+ *
+ * First get attributes from the ConnectionFactory mbean:
+ */
+ logger.debug("Get attributes from the ConnectionFactory mbean");
+ mockMBeanServer.getAttribute(connectionFactory,
+ Constants.JmsAttributes.CONNECTOR);
+ control.setReturnValue(connector);
+ mockMBeanServer.getAttribute(connectionFactory,
+ Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_DOWN_CACHE_SIZE);
+ control.setReturnValue(Integer.valueOf("2000"));
+ mockMBeanServer.getAttribute(connectionFactory,
+ Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_FULL_SIZE);
+ control.setReturnValue(Integer.valueOf("75000"));
+ mockMBeanServer.getAttribute(connectionFactory,
+ Constants.JmsAttributes.DEFAULT_TEMP_QUEUE_PAGE_SIZE);
+ control.setReturnValue(Integer.valueOf("2000"));
+ mockMBeanServer.getAttribute(connectionFactory,
+ Constants.JmsAttributes.PREFETCH_SIZE);
+ control.setReturnValue(Integer.valueOf("150"));
+ mockMBeanServer.getAttribute(connectionFactory,
+ Constants.JmsAttributes.SERVER_PEER);
+ control.setReturnValue(serverPeer);
+
+ /*
+ * Get attributes from the ServerPeer mbean:
+ */
+ logger.debug("Get attributes from the ServerPeer mbean");
+ mockMBeanServer.getAttribute(serverPeer,
+ Constants.JmsAttributes.DEFAULT_QUEUE_JNDI_CONTEXT);
+ control.setReturnValue("/queue");
+ mockMBeanServer.getAttribute(serverPeer,
+ Constants.JmsAttributes.DEFAULT_SECURITY_CONFIG);
+ control.setReturnValue(elem);
+ mockMBeanServer.getAttribute(serverPeer,
+ Constants.JmsAttributes.DEFAULT_TOPIC_JNDI_CONTEXT);
+ control.setReturnValue("/topic");
+ mockMBeanServer.getAttribute(serverPeer,
+ Constants.JmsAttributes.JMS_PROVIDER_NAME);
+ control.setReturnValue("JBoss Messaging");
+ mockMBeanServer.getAttribute(serverPeer,
+ Constants.JmsAttributes.JMS_VERSION);
+ control.setReturnValue("1.1");
+ mockMBeanServer.getAttribute(serverPeer,
+ Constants.JmsAttributes.PERSISTENCE_MANAGER);
+ control.setReturnValue(persistenceManager);
+ mockMBeanServer.getAttribute(serverPeer,
+ Constants.JmsAttributes.PROVIDER_VERSION);
+ control.setReturnValue("1.2.0.GA");
+ mockMBeanServer.getAttribute(serverPeer,
+ Constants.JmsAttributes.QUEUED_EXECUTOR_POOL_SIZE);
+ control.setReturnValue(Integer.valueOf("200"));
+ mockMBeanServer.getAttribute(serverPeer,
+ Constants.JmsAttributes.SECURITY_DOMAIN);
+ control.setReturnValue("java:/jaas/messaging");
+ mockMBeanServer.getAttribute(serverPeer,
+ Constants.JmsAttributes.SERVER_PEER_ID);
+ control.setReturnValue("server.0");
+
+ /*
+ * Get attributes from the PersistenceManager mbean:
+ */
+ logger.debug("Get attributes from the PersistenceManager mbean");
+ mockMBeanServer.getAttribute(persistenceManager,
+ Constants.JmsAttributes.CREATE_TABLES_ON_STARTUP);
+ control.setReturnValue(Boolean.valueOf(true));
+ mockMBeanServer.getAttribute(persistenceManager,
+ Constants.JmsAttributes.DATA_SOURCE);
+ control.setReturnValue("java:/DefaultDS");
+ mockMBeanServer.getAttribute(persistenceManager,
+ Constants.JmsAttributes.MAX_PARAMS);
+ control.setReturnValue(Integer.valueOf("100"));
+ mockMBeanServer.getAttribute(persistenceManager,
+ Constants.JmsAttributes.SQL_PROPERTIES);
+ control.setReturnValue(sqlProperties);
+ mockMBeanServer.getAttribute(persistenceManager,
+ Constants.JmsAttributes.TRANSACTION_MANAGER);
+ control.setReturnValue(transactionManager);
+ mockMBeanServer.getAttribute(persistenceManager,
+ Constants.JmsAttributes.USING_BATCH_UPDATES);
+ control.setReturnValue(Boolean.valueOf(true));
+
+ /*
+ * Get attributes from the JMSUserManager mbean:
+ */
+// logger.debug("Get attributes from the JMSUserManager mbean");
+// mockMBeanServer.getAttribute(userManager,
+// Constants.JmsAttributes.CREATE_TABLES_ON_STARTUP);
+// control.setReturnValue(Boolean.valueOf(false));
+// mockMBeanServer.getAttribute(userManager,
+// Constants.JmsAttributes.DATA_SOURCE);
+// control.setReturnValue("java:/TestDS");
+// mockMBeanServer.getAttribute(userManager,
+// Constants.JmsAttributes.SQL_PROPERTIES);
+// control.setReturnValue(sqlProperties);
+
+ /*
+ * Get attributes from the PostOffice mbean:
+ */
+ logger.debug("Get attributes from the PostOffice mbean");
+ //TODO: add code here
+
+ /*
+ * Build dataSource map:
+ */
+ logger.debug("Build datasource map.");
+ List noTxDataSources = new ArrayList();
+ DataSourceIdentifier id1 = new DataSourceIdentifier("ds1|module1");
+ NoTxDataSource ds1 = new NoTxDataSource(id1);
+ ds1.setJNDIname("ds1");
+ ds1.setDriverClassName("org.hsqldb.jdbcDriver");
+ noTxDataSources.add(ds1);
+
+ List localTxDataSources = new ArrayList();
+ DataSourceIdentifier id2 = new DataSourceIdentifier("ds2|module2");
+ LocalTxDataSource ds2 = new LocalTxDataSource(id2);
+ ds2.setJNDIname("ds2");
+ ds2.setDriverClassName("org.postgresql.Driver");
+ localTxDataSources.add(ds2);
+
+ List xaTxDataSources = new ArrayList();
+
+ mockDataSourceService.getNoTxDataSources();
+ dsControl.setReturnValue(noTxDataSources);
+ mockDataSourceService.getDataSource(id1);
+ dsControl.setReturnValue(ds1);
+ mockDataSourceService.getLocalTxDataSources();
+ dsControl.setReturnValue(localTxDataSources);
+ mockDataSourceService.getDataSource(id2);
+ dsControl.setReturnValue(ds2);
+ mockDataSourceService.getXATxDataSources();
+ dsControl.setReturnValue(xaTxDataSources);
+
+ /*
+ * Finish off test setup:
+ */
+ logger.debug("Replay the controls.");
+ control.replay();
+ dsControl.replay();
+
+ /*
+ * Run the method under test:
+ */
+ Jms jms = new Jms();
+ logger.debug("Call the method under test.");
+ service.populateJmsData(jms);
+
+ /*
+ * Check all the mock methods were called correctly:
+ */
+ logger.debug("verify control.");
+ control.verify();
+
+ /*
+ * Check returned data:
+ *
+ * First check attributes from the connectionFactory:
+ */
+ logger.debug("check returned values.");
+ assertEquals(connectorName, jms.getConnectorName());
+ assertEquals(2000, jms.getDefaultTempQueueDownCacheSize());
+ assertEquals(75000, jms.getDefaultTempQueueFullSize());
+ assertEquals(2000, jms.getDefaultTempQueuePageSize());
+ assertEquals(150, jms.getPrefetchSize());
+ assertEquals(serverPeerName, jms.getServerPeerName());
+
+ /*
+ * Check attributes from the ServerPeer:
+ */
+ assertEquals("/queue", jms.getDefaultQueueJNDIContext());
+ String secRoles = "guest:read:write" + NL + "admin:read:write:create"
+ + NL;
+ assertEquals(secRoles, jms.getDefaultSecurityRoles());
+ assertEquals("/topic", jms.getDefaultTopicJNDIContext());
+ assertEquals("JBoss Messaging", jms.getJmsProviderName());
+ assertEquals("1.1", jms.getJmsVersion());
+ assertEquals(persistenceManagerName, jms.getPersistenceManagerName());
+ assertEquals("1.2.0.GA", jms.getProviderVersion());
+ assertEquals(200, jms.getQueuedExecutorPoolSize());
+ assertEquals("java:/jaas/messaging", jms.getSecurityDomain());
+ assertEquals("server.0", jms.getServerPeerID());
+
+ /*
+ * Check attributes from the PersistenceManager:
+ */
+ assertTrue(jms.isCreateMsgTablesOnStartup());
+ assertEquals(100, jms.getMaxParams());
+ assertEquals("java:/DefaultDS", jms.getMsgDataSource());
+ assertEquals("DefaultDS", jms.getMsgDataSourceName());
+ assertEquals(sqlProperties, jms.getMsgSqlProperties());
+ assertEquals(transactionManagerName, jms.getTransactionManagerName());
+ assertTrue(jms.isUsingBatchUpdates());
+
+ /*
+ * Check attributes from the JMSUserManager:
+ */
+// assertFalse(jms.isCreateUserTablesOnStartup());
+// assertEquals("java:/DefaultDS", jms.getUserDataSource());
+// assertEquals("DefaultDS", jms.getUserDataSourceName());
+// assertEquals(sqlProperties, jms.getUserSqlProperties());
+
+ /*
+ * Check attributes from the JMSUserManager:
+ */
+ //TODO:
+
+ /*
+ * Check dataSources map:
+ */
+ assertEquals(2, jms.getDataSources().size());
+ assertEquals("org.hsqldb.jdbcDriver", jms.getDataSources().get("ds1"));
+ assertEquals("org.postgresql.Driver", jms.getDataSources().get("ds2"));
+ logger.debug("end of test method.");
+ }
+
+ /**
+ * Parses an XML file and returns a DOM document.
+ *
+ * @param filename
+ * The XML file to be parsed.
+ * @param validating
+ * If validating is true, the contents is validated against the
+ * DTD specified in the file.
+ * @return a DOM document
+ */
+ private Document parseXmlFile(String filename, boolean validating) {
+ Document doc = null;
+ try {
+ /*
+ * Create a builder factory:
+ */
+ DocumentBuilderFactory factory = DocumentBuilderFactory
+ .newInstance();
+ factory.setValidating(validating);
+
+ /*
+ * Create the builder and parse the file:
+ */
+ doc = factory.newDocumentBuilder().parse(new File(filename));
+ } catch (SAXException e) {
+ // A parsing error occurred; the xml input is not valid
+ logger.debug("SAXException occurred while parsing the xml file.");
+ } catch (ParserConfigurationException e) {
+ logger
+ .debug("ParserConfigurationException occurred while parsing the xml file.");
+ } catch (IOException e) {
+ logger.debug("IOException occurred while parsing the xml file.");
+ }
+
+ return doc;
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list