[embjopr-commits] EMBJOPR SVN: r591 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache.
embjopr-commits at lists.jboss.org
embjopr-commits at lists.jboss.org
Mon Jul 27 17:33:27 EDT 2009
Author: ozizka at redhat.com
Date: 2009-07-27 17:33:27 -0400 (Mon, 27 Jul 2009)
New Revision: 591
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheCacheTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheInterceptorTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheTestBase.java
Removed:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheTest.java
Log:
* JBossCacheTest split to testcases by subnode.
Copied: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheCacheTest.java (from rev 590, trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheTest.java)
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheCacheTest.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheCacheTest.java 2009-07-27 21:33:27 UTC (rev 591)
@@ -0,0 +1,259 @@
+package org.jboss.jopr.jsfunit.as5.jbcache;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.jboss.qa.jbcache.testear.*;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.jboss.jopr.jsfunit.ApplicationTestBaseAS5;
+import org.jboss.jopr.jsfunit.exceptions.ActionOutOfSyncException;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+import org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.ContentTable;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.ContentTableRow;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.NavTreeNode;
+
+/**
+ *
+ * @author Ondrej Zizka
+ *
+ * JBoss Cache is only present in 'all' JBoss AS profile.
+ */
+public class JBossCacheCacheTest extends JBossCacheTestBase {
+
+
+
+ /**
+ * Test the navigation to JBoss Cache nodes.
+ */
+ public void testJBossCacheParentNode() throws HtmlElementNotFoundException, IOException, EmbJoprTestException {
+ if( isJBossConfigWithoutCache() ) return;
+
+ NavTreeNode cachesNode = ejtt.navTree.getNodeByLabel(NAV_JBCACHES);
+ assertTrue( "JBoss Caches node has no children.", cachesNode.hasChildren() );
+ cachesNode.click();
+
+ final String HA_PARTITION = "ha-partition";
+ assertTrue("JBoss Caches should list '"+HA_PARTITION+"'", client.getPageAsText().contains(HA_PARTITION) );
+
+ ContentTable table = ejtt.getTabMenu().getTabContentBox().getFirstTable();
+
+ // Rows 1+
+ List<ContentTableRow> rows = table.getRows();
+ assertTrue( "Caches list should contain at least one cache.", rows.size() > 0 );
+
+ // The ha-partition cache is active by default.
+ // Check that it's present.
+ boolean haparPresent = false;
+ // Check that all caches are UP.
+ for( ContentTableRow row : rows ){
+ String name = row.getCellByColumnName(COL_RESOURCE_NAME).getTextContent().trim();
+ String status = row.getCellByColumnName(COL_RESOURCE_STATUS).getTextContent().trim();
+ log.info("Cache '"+name+" - status '"+status+"'.");
+ if( ! "UP".equals( status ) )
+ fail("Cache '"+name+"' is not UP, but '"+status+"'.");
+ if( JBCACHE_HA_PARTITION.equals(name) )
+ haparPresent = true;
+ }
+ if( !haparPresent)
+ throw new EmbJoprTestException("The '"+JBCACHE_HA_PARTITION+"' cache is not present.");
+
+ // Click on the first row link.
+ rows.get(0).getFirstLinkFromColumn(COL_RESOURCE_NAME).click();
+
+ // Check that we got to the Summary page.
+ assertTrue("JB Cache's Summary doesn't contain '"+LABEL_GENERAL_PROPERTIES+"' - is the Summary page ok?", client.getPageAsText().contains(LABEL_GENERAL_PROPERTIES));
+
+ }
+
+
+
+ /**
+ * Test the navigation to JBoss Cache nodes.
+ */
+ public void testJBossCacheNavigation() throws HtmlElementNotFoundException, IOException, EmbJoprTestException {
+ if( isJBossConfigWithoutCache() ) return;
+
+ NavTreeNode haparNode = ejtt.getNavTree().getNodeByLabel(JBCACHE_HA_PARTITION);
+
+ // All expected subnodes:
+ String[] subnodesNames = new String[]{
+ SUBNODE_CACHE,
+ SUBNODE_INTERCEPTOR,
+ SUBNODE_DATA_CONTAINER,
+ SUBNODE_RPC_MANAGER,
+ SUBNODE_REGION_MANAGER,
+ SUBNODE_TRANSACTION_TABLE
+ };
+
+
+ // Check whether all expected child nodes are present.
+ List<String> names = new ArrayList();
+ CollectionUtils.addAll(names, subnodesNames);
+
+ // Remove the names which we find.
+ List<NavTreeNode> children = haparNode.getChildren();
+ for( NavTreeNode node : children ){
+ names.remove( node.getName() );
+ }
+ // The remaining names are missing.
+ if( names.size() > 0 ){
+ throw new EmbJoprTestException("These cache nodes are not present: "+StringUtils.join(names, ", "));
+ }
+
+
+ // Click through all the subnodes (exception could occur).
+ for( String name : subnodesNames ){
+ ejtt.getNavTree().getNodeByLabel(name).click();
+ }
+
+ }
+
+
+
+
+ /**
+ * JBoss Cache Summary tab.
+ */
+ public void testJBossCacheSummary() throws EmbJoprTestException, IOException {
+ if( isJBossConfigWithoutCache() ) return;
+
+ ejtt.navTree.getNodeByLabel(JBCACHE_HA_PARTITION).expand();
+ ejtt.navTree.getNodeByLabel(SUBNODE_CACHE).click();
+
+
+ /*
+ General Properties
+ Name:jboss.cache:config=ha-partition,service=Cache
+ Version:--
+ Description:JBoss Cache
+ */
+
+ /*ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_GENERAL_PROPERTIES);
+ ContentInfoTable traitsTable = ejtt.getTabMenu().getTabContentBox().getContentInfoTable( table.getElement() );
+ Properties props = traitsTable.getProperties();
+
+ assertEquals("Traits - Name", DEFAULT_JBCACHE, props.getProperty("Name"));/**/
+
+ Properties props = new Properties();
+ props.setProperty("Name", "Cache");
+ ejtt.getTabMenu().getTabContentBox().getTableUnformatted(LABEL_GENERAL_PROPERTIES).checkValues(props);
+
+
+
+ /*
+ Numeric Metrics
+ Name Value Description
+ Number of Nodes 1 Number of Nodes
+ */
+ props = new Properties();
+ props.setProperty("Number of Nodes", "1");
+ ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_NUMERIC_METRICS).checkValues(props);
+
+
+ }
+
+
+
+ /**
+ * JBoss Cache Metrics tab.
+ */
+ public void testJBossCacheMetrics() throws HtmlElementNotFoundException, IOException, EmbJoprTestException {
+ if( isJBossConfigWithoutCache() ) return;
+
+ ejtt.navTree.getNodeByLabel(JBCACHE_HA_PARTITION).expand();
+ ejtt.navTree.getNodeByLabel(SUBNODE_CACHE).click();
+
+ ejtt.tabMenu.clickMetricsTab();
+ assertTrue( "Metrics tab is not active", ejtt.tabMenu.isTabActive(TAB_NAME_METRICS) );
+
+ Properties props = new Properties();
+ props.setProperty("Node Locking Scheme", "PESSIMISTIC");
+ props.setProperty("Expose Management Statistics?", "true");
+ props.setProperty("Register JMX Resource?", "true");
+ props.setProperty("Multiplexer Stack", "udp");
+ props.setProperty("Cluster Name", "DefaultPartition-HAPartitionCache");
+ props.setProperty("Inactive on Startup?", "false");
+ props.setProperty("Cache Mode", "REPL_SYNC");
+ props.setProperty("Isolation Level", "REPEATABLE_READ");
+ props.setProperty("Replication Version", "3.1.0");
+ props.setProperty("Fetch In-Memory State?", "true");
+ props.setProperty("Use Replication Queue?", "false");
+ props.setProperty("Use Region-Based Marshalling?", "false");
+ props.setProperty("Sync Commit Phase?", "false");
+ props.setProperty("State", "3");
+ props.setProperty("Transaction Manager Lookup Class", "org.jboss.cache.transaction.BatchModeTransactionManagerLookup");
+ ejtt.getTabMenu().getTabContentBox().getTableUnformatted(LABEL_TRAITS).checkValues(props);
+
+
+ // Numeric metrics
+ props = new Properties();
+ props.setProperty("Replication Queue Max Elements", "1,000");
+ props.setProperty("Number of Attributes", "0");
+ props.setProperty("Initial State Retrieval Timeout", "60,000");
+ props.setProperty("Replication Queue Interval", "5,000");
+ props.setProperty("Lock Acquisition Timeout", "15,000");
+ props.setProperty("Number of Nodes", "1");
+ props.setProperty("Sync Replication Timeout", "17,500");
+ props.setProperty("State Retrieval Timeout", "60,000");
+ ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_NUMERIC_METRICS).checkValues(props);
+
+ }
+
+
+
+ /**
+ * JBoss Cache Control tab - test operations.
+ * Currently only testing whether the operations fails, because the print operations don't return usable information.
+ * @see JOPR-319.
+ */
+ public void testJBossCacheControl() throws HtmlElementNotFoundException, IOException, ActionOutOfSyncException, EmbJoprTestException {
+ if( isJBossConfigWithoutCache() ) return;
+
+
+ ejtt.navTree.getNodeByLabel(JBCACHE_HA_PARTITION).expand();
+ ejtt.navTree.getNodeByLabel(SUBNODE_CACHE).click();
+
+ ejtt.tabMenu.clickControlTab();
+ assertTrue( "Control tab is not active", ejtt.tabMenu.isTabActive(TAB_NAME_CONTROL) );
+
+
+ // Click some buttons - should not harm.
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Print cache details as HTML.").click();
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Print lock information.").click();
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Print lock info as HTML.").click();
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Print configuration as plain text.").click();
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Print configuration as HTML.").click();
+
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Stop this cache.").click();
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start this cache.").click();
+
+
+ // Now test the operations, one by one.
+ Map<String, String> operationsToTest = new HashMap();
+
+ //operationsToTest.put("Print cache details.", "See JOPR-319.");
+
+ operationsToTest.put("Print cache details.", null);
+ operationsToTest.put("Print cache details as HTML.", null);
+ operationsToTest.put("Print lock information.", null);
+ operationsToTest.put("Print lock info as HTML.", null);
+ operationsToTest.put("Print configuration as plain text.", null);
+ operationsToTest.put("Print configuration as HTML.", null);
+
+
+ for( String opName : operationsToTest.keySet() ){
+ ejtt.operations.testOperation( opName, operationsToTest.get(opName) );
+ }
+
+ }
+
+
+
+}// class
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheInterceptorTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheInterceptorTest.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheInterceptorTest.java 2009-07-27 21:33:27 UTC (rev 591)
@@ -0,0 +1,113 @@
+package org.jboss.jopr.jsfunit.as5.jbcache;
+
+import java.io.IOException;
+import java.util.Properties;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.jboss.qa.jbcache.testear.*;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
+
+/**
+ *
+ * @author Ondrej Zizka
+ *
+ * JBoss Cache is only present in 'all' JBoss AS profile.
+ */
+public class JBossCacheInterceptorTest extends JBossCacheTestBase {
+
+
+
+ /**
+ * Interceptor Summary tab.
+ */
+ public void testJBossCacheInterceptorSummary() throws IOException, EmbJoprTestException {
+ if( isJBossConfigWithoutCache() ) return;
+
+ ejtt.navTree.getNodeByLabel(JBCACHE_HA_PARTITION).expand();
+ ejtt.navTree.getNodeByLabel(SUBNODE_INTERCEPTOR).click();
+
+ // Gen Props - nothing useful.
+ Properties props = new Properties();
+ props.setProperty("Name", "Interceptor");
+ ejtt.getTabMenu().getTabContentBox().getTableUnformatted(LABEL_GENERAL_PROPERTIES).checkValues(props);
+
+
+ /*
+ Numeric Metrics
+ Hit/Miss Ratio 0 Hit/Miss Ratio
+ Read/Write Ratio 0 Read/Write Ratio
+ Number Of Attributes 0 the number of cache attributes
+ Average Write Time 0.0ms the average amount of time per write operation
+ Average Read Time 0.0ms the average amount of time per read operation
+ */
+ props = new Properties();
+ props.setProperty("Hit/Miss Ratio", "0");
+ props.setProperty("Read/Write Ratio", "0");
+ props.setProperty("Number Of Attributes", "0.0ms");
+ props.setProperty("Average Write Time", "0.0ms");
+ props.setProperty("Average Read Time", "0.0ms");
+ ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_NUMERIC_METRICS).checkValues(props);
+
+ }
+
+
+
+
+
+
+ /**
+ * Interceptor Summary tab after querying Hibernate.
+ */
+ public void testJBossCacheInterceptorSummary_AfterQuery() throws IOException, EmbJoprTestException, NamingException {
+ if( isJBossConfigWithoutCache() ) return;
+
+
+ final String BEAN_JNDI = "TestOperationBean/remote";
+
+ // Query the bean.
+ log.info("Looking up "+BEAN_JNDI+"...");
+ InitialContext ctx = new InitialContext();
+ TestOperation bean = (TestOperation) ctx.lookup(BEAN_JNDI);
+
+ log.info("Sending request...");
+ bean.test();
+
+
+
+
+ ejtt.navTree.getNodeByLabel(JBCACHE_HA_PARTITION).expand();
+ ejtt.navTree.getNodeByLabel(SUBNODE_INTERCEPTOR).click();
+
+ // Gen Props - nothing useful.
+ Properties props = new Properties();
+ props.setProperty("Name", "Interceptor");
+ ejtt.getTabMenu().getTabContentBox().getTableUnformatted(LABEL_GENERAL_PROPERTIES).checkValues(props);
+
+
+ /*
+ Numeric Metrics
+ Hit/Miss Ratio 0 Hit/Miss Ratio
+ Read/Write Ratio 0 Read/Write Ratio
+ Number Of Attributes 0 the number of cache attributes
+ Average Write Time 0.0ms the average amount of time per write operation
+ Average Read Time 0.0ms the average amount of time per read operation
+ */
+ props = new Properties();
+ props.setProperty("Hit/Miss Ratio", "0");
+ props.setProperty("Read/Write Ratio", "0");
+ props.setProperty("Number Of Attributes", "0.0ms");
+ props.setProperty("Average Write Time", "0.0ms");
+ props.setProperty("Average Read Time", "0.0ms");
+ ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_NUMERIC_METRICS).checkValues(props);
+
+ }
+
+
+
+
+
+
+
+
+
+}// class
Deleted: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheTest.java 2009-07-27 20:40:38 UTC (rev 590)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheTest.java 2009-07-27 21:33:27 UTC (rev 591)
@@ -1,383 +0,0 @@
-package org.jboss.jopr.jsfunit.as5.jbcache;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.jboss.qa.jbcache.testear.*;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
-import org.jboss.jopr.jsfunit.ApplicationTestBaseAS5;
-import org.jboss.jopr.jsfunit.exceptions.ActionOutOfSyncException;
-import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
-import org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.ContentTable;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.ContentTableRow;
-import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.NavTreeNode;
-
-/**
- *
- * @author Ondrej Zizka
- *
- * JBoss Cache is only present in 'all' JBoss AS profile.
- */
-public class JBossCacheTest extends ApplicationTestBaseAS5 {
-
-
- public final DeployableTypes APP_TYPE = DeployableTypes.JBCACHE;
-
- // Cache which is active by default.
- private static final String JBCACHE_HA_PARTITION = "jboss.cache:config=ha-partition,service=Cache";
- private static final String JBCACHE_MVCC_ENTITY = "jboss.cache:config=mvcc-entity,service=Cache";
- private static final String JBCACHE_PESSIMISTIC_SHARED = "jboss.cache:config=pessimistic-shared,service=Cache";
- private static final String JBCACHE_TIMESTAMPS = "jboss.cache:config=timestamps-cache,service=Cache";
-
-
- // Subnodes
- private static final String SUBNODE_CACHE = "Cache";
- private static final String SUBNODE_INTERCEPTOR = "Interceptor";
- private static final String SUBNODE_DATA_CONTAINER = "Data Container";
- private static final String SUBNODE_RPC_MANAGER = "RPC Manager";
- private static final String SUBNODE_REGION_MANAGER = "RegionManager";
- private static final String SUBNODE_TRANSACTION_TABLE = "Transaction Table";
-
-
-
-
- private boolean isJBossConfigWithoutCache(){
- boolean isJBossConfigWithoutCache = ! ejtt.getJBossConfig().equals("all");
- if( isJBossConfigWithoutCache )
- log.warn("JBoss instance is not running the 'all' configuration ('"+ejtt.getJBossConfig()+"' instead) - " +
- "thus, has no JBoss Cache. Set -Dcargo.jboss.configuration=all for maven.");
- return isJBossConfigWithoutCache;
- }
-
-
-
-
- /**
- * Test the navigation to JBoss Cache nodes.
- */
- public void testJBossCacheParentNode() throws HtmlElementNotFoundException, IOException, EmbJoprTestException {
- if( isJBossConfigWithoutCache() ) return;
-
- NavTreeNode cachesNode = ejtt.navTree.getNodeByLabel(NAV_JBCACHES);
- assertTrue( "JBoss Caches node has no children.", cachesNode.hasChildren() );
- cachesNode.click();
-
- final String HA_PARTITION = "ha-partition";
- assertTrue("JBoss Caches should list '"+HA_PARTITION+"'", client.getPageAsText().contains(HA_PARTITION) );
-
- ContentTable table = ejtt.getTabMenu().getTabContentBox().getFirstTable();
-
- // Rows 1+
- List<ContentTableRow> rows = table.getRows();
- assertTrue( "Caches list should contain at least one cache.", rows.size() > 0 );
-
- // The ha-partition cache is active by default.
- // Check that it's present.
- boolean haparPresent = false;
- // Check that all caches are UP.
- for( ContentTableRow row : rows ){
- String name = row.getCellByColumnName(COL_RESOURCE_NAME).getTextContent().trim();
- String status = row.getCellByColumnName(COL_RESOURCE_STATUS).getTextContent().trim();
- log.info("Cache '"+name+" - status '"+status+"'.");
- if( ! "UP".equals( status ) )
- fail("Cache '"+name+"' is not UP, but '"+status+"'.");
- if( JBCACHE_HA_PARTITION.equals(name) )
- haparPresent = true;
- }
- if( !haparPresent)
- throw new EmbJoprTestException("The '"+JBCACHE_HA_PARTITION+"' cache is not present.");
-
- // Click on the first row link.
- rows.get(0).getFirstLinkFromColumn(COL_RESOURCE_NAME).click();
-
- // Check that we got to the Summary page.
- assertTrue("JB Cache's Summary doesn't contain '"+LABEL_GENERAL_PROPERTIES+"' - is the Summary page ok?", client.getPageAsText().contains(LABEL_GENERAL_PROPERTIES));
-
- }
-
-
-
- /**
- * Test the navigation to JBoss Cache nodes.
- */
- public void testJBossCacheNavigation() throws HtmlElementNotFoundException, IOException, EmbJoprTestException {
- if( isJBossConfigWithoutCache() ) return;
-
- NavTreeNode haparNode = ejtt.getNavTree().getNodeByLabel(JBCACHE_HA_PARTITION);
-
- // All expected subnodes:
- String[] subnodesNames = new String[]{
- SUBNODE_CACHE,
- SUBNODE_INTERCEPTOR,
- SUBNODE_DATA_CONTAINER,
- SUBNODE_RPC_MANAGER,
- SUBNODE_REGION_MANAGER,
- SUBNODE_TRANSACTION_TABLE
- };
-
-
- // Check whether all expected child nodes are present.
- List<String> names = new ArrayList();
- CollectionUtils.addAll(names, subnodesNames);
-
- // Remove the names which we find.
- List<NavTreeNode> children = haparNode.getChildren();
- for( NavTreeNode node : children ){
- names.remove( node.getName() );
- }
- // The remaining names are missing.
- if( names.size() > 0 ){
- throw new EmbJoprTestException("These cache nodes are not present: "+StringUtils.join(names, ", "));
- }
-
-
- // Click through all the subnodes (exception could occur).
- for( String name : subnodesNames ){
- ejtt.getNavTree().getNodeByLabel(name).click();
- }
-
- }
-
-
-
-
- /**
- * JBoss Cache Summary tab.
- */
- public void testJBossCacheSummary() throws EmbJoprTestException, IOException {
- if( isJBossConfigWithoutCache() ) return;
-
- ejtt.navTree.getNodeByLabel(JBCACHE_HA_PARTITION).expand();
- ejtt.navTree.getNodeByLabel(SUBNODE_CACHE).click();
-
-
- /*
- General Properties
- Name:jboss.cache:config=ha-partition,service=Cache
- Version:--
- Description:JBoss Cache
- */
-
- /*ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_GENERAL_PROPERTIES);
- ContentInfoTable traitsTable = ejtt.getTabMenu().getTabContentBox().getContentInfoTable( table.getElement() );
- Properties props = traitsTable.getProperties();
-
- assertEquals("Traits - Name", DEFAULT_JBCACHE, props.getProperty("Name"));/**/
-
- Properties props = new Properties();
- props.setProperty("Name", "Cache");
- ejtt.getTabMenu().getTabContentBox().getTableUnformatted(LABEL_GENERAL_PROPERTIES).checkValues(props);
-
-
-
- /*
- Numeric Metrics
- Name Value Description
- Number of Nodes 1 Number of Nodes
- */
- props = new Properties();
- props.setProperty("Number of Nodes", "1");
- ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_NUMERIC_METRICS).checkValues(props);
-
-
- }
-
-
-
- /**
- * JBoss Cache Metrics tab.
- */
- public void testJBossCacheMetrics() throws HtmlElementNotFoundException, IOException, EmbJoprTestException {
- if( isJBossConfigWithoutCache() ) return;
-
- ejtt.navTree.getNodeByLabel(JBCACHE_HA_PARTITION).expand();
- ejtt.navTree.getNodeByLabel(SUBNODE_CACHE).click();
-
- ejtt.tabMenu.clickMetricsTab();
- assertTrue( "Metrics tab is not active", ejtt.tabMenu.isTabActive(TAB_NAME_METRICS) );
-
- Properties props = new Properties();
- props.setProperty("Node Locking Scheme", "PESSIMISTIC");
- props.setProperty("Expose Management Statistics?", "true");
- props.setProperty("Register JMX Resource?", "true");
- props.setProperty("Multiplexer Stack", "udp");
- props.setProperty("Cluster Name", "DefaultPartition-HAPartitionCache");
- props.setProperty("Inactive on Startup?", "false");
- props.setProperty("Cache Mode", "REPL_SYNC");
- props.setProperty("Isolation Level", "REPEATABLE_READ");
- props.setProperty("Replication Version", "3.1.0");
- props.setProperty("Fetch In-Memory State?", "true");
- props.setProperty("Use Replication Queue?", "false");
- props.setProperty("Use Region-Based Marshalling?", "false");
- props.setProperty("Sync Commit Phase?", "false");
- props.setProperty("State", "3");
- props.setProperty("Transaction Manager Lookup Class", "org.jboss.cache.transaction.BatchModeTransactionManagerLookup");
- ejtt.getTabMenu().getTabContentBox().getTableUnformatted(LABEL_TRAITS).checkValues(props);
-
-
- // Numeric metrics
- props = new Properties();
- props.setProperty("Replication Queue Max Elements", "1,000");
- props.setProperty("Number of Attributes", "0");
- props.setProperty("Initial State Retrieval Timeout", "60,000");
- props.setProperty("Replication Queue Interval", "5,000");
- props.setProperty("Lock Acquisition Timeout", "15,000");
- props.setProperty("Number of Nodes", "1");
- props.setProperty("Sync Replication Timeout", "17,500");
- props.setProperty("State Retrieval Timeout", "60,000");
- ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_NUMERIC_METRICS).checkValues(props);
-
- }
-
-
-
- /**
- * JBoss Cache Control tab - test operations.
- * Currently only testing whether the operations fails, because the print operations don't return usable information.
- * @see JOPR-319.
- */
- public void testJBossCacheControl() throws HtmlElementNotFoundException, IOException, ActionOutOfSyncException, EmbJoprTestException {
- if( isJBossConfigWithoutCache() ) return;
-
- ejtt.navTree.getNodeByLabel(JBCACHE_HA_PARTITION).expand();
- ejtt.navTree.getNodeByLabel(SUBNODE_CACHE).click();
-
- ejtt.tabMenu.clickControlTab();
- assertTrue( "Control tab is not active", ejtt.tabMenu.isTabActive(TAB_NAME_CONTROL) );
-
-
- // Click some buttons - should not harm.
- ejtt.tabMenu.getTabContentBox().getButtonByLabel("Print cache details as HTML.").click();
- ejtt.tabMenu.getTabContentBox().getButtonByLabel("Print lock information.").click();
- ejtt.tabMenu.getTabContentBox().getButtonByLabel("Print lock info as HTML.").click();
- ejtt.tabMenu.getTabContentBox().getButtonByLabel("Print configuration as plain text.").click();
- ejtt.tabMenu.getTabContentBox().getButtonByLabel("Print configuration as HTML.").click();
-
- ejtt.tabMenu.getTabContentBox().getButtonByLabel("Stop this cache.").click();
- ejtt.tabMenu.getTabContentBox().getButtonByLabel("Start this cache.").click();
-
-
- // Now test the operations, one by one.
- Map<String, String> operationsToTest = new HashMap();
-
- //operationsToTest.put("Print cache details.", "See JOPR-319.");
-
- operationsToTest.put("Print cache details.", null);
- operationsToTest.put("Print cache details as HTML.", null);
- operationsToTest.put("Print lock information.", null);
- operationsToTest.put("Print lock info as HTML.", null);
- operationsToTest.put("Print configuration as plain text.", null);
- operationsToTest.put("Print configuration as HTML.", null);
-
-
- for( String opName : operationsToTest.keySet() ){
- ejtt.operations.testOperation( opName, operationsToTest.get(opName) );
- }
-
- }
-
-
-
-
-
- /**
- * Interceptor Summary tab.
- */
- public void testJBossCacheInterceptorSummary() throws IOException, EmbJoprTestException {
- if( isJBossConfigWithoutCache() ) return;
-
- ejtt.navTree.getNodeByLabel(JBCACHE_HA_PARTITION).expand();
- ejtt.navTree.getNodeByLabel(SUBNODE_INTERCEPTOR).click();
-
- // Gen Props - nothing useful.
- Properties props = new Properties();
- props.setProperty("Name", "Interceptor");
- ejtt.getTabMenu().getTabContentBox().getTableUnformatted(LABEL_GENERAL_PROPERTIES).checkValues(props);
-
-
- /*
- Numeric Metrics
- Hit/Miss Ratio 0 Hit/Miss Ratio
- Read/Write Ratio 0 Read/Write Ratio
- Number Of Attributes 0 the number of cache attributes
- Average Write Time 0.0ms the average amount of time per write operation
- Average Read Time 0.0ms the average amount of time per read operation
- */
- props = new Properties();
- props.setProperty("Hit/Miss Ratio", "0");
- props.setProperty("Read/Write Ratio", "0");
- props.setProperty("Number Of Attributes", "0.0ms");
- props.setProperty("Average Write Time", "0.0ms");
- props.setProperty("Average Read Time", "0.0ms");
- ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_NUMERIC_METRICS).checkValues(props);
-
- }
-
-
-
-
-
-
- /**
- * Interceptor Summary tab after querying Hibernate.
- */
- public void testJBossCacheInterceptorSummary_AfterQuery() throws IOException, EmbJoprTestException, NamingException {
- if( isJBossConfigWithoutCache() ) return;
-
-
- final String BEAN_JNDI = "TestOperationBean/remote";
-
- // Query the bean.
- log.info("Looking up "+BEAN_JNDI+"...");
- InitialContext ctx = new InitialContext();
- TestOperation bean = (TestOperation) ctx.lookup(BEAN_JNDI);
-
- log.info("Sending request...");
- bean.test();
-
-
-
-
- ejtt.navTree.getNodeByLabel(JBCACHE_HA_PARTITION).expand();
- ejtt.navTree.getNodeByLabel(SUBNODE_INTERCEPTOR).click();
-
- // Gen Props - nothing useful.
- Properties props = new Properties();
- props.setProperty("Name", "Interceptor");
- ejtt.getTabMenu().getTabContentBox().getTableUnformatted(LABEL_GENERAL_PROPERTIES).checkValues(props);
-
-
- /*
- Numeric Metrics
- Hit/Miss Ratio 0 Hit/Miss Ratio
- Read/Write Ratio 0 Read/Write Ratio
- Number Of Attributes 0 the number of cache attributes
- Average Write Time 0.0ms the average amount of time per write operation
- Average Read Time 0.0ms the average amount of time per read operation
- */
- props = new Properties();
- props.setProperty("Hit/Miss Ratio", "0");
- props.setProperty("Read/Write Ratio", "0");
- props.setProperty("Number Of Attributes", "0.0ms");
- props.setProperty("Average Write Time", "0.0ms");
- props.setProperty("Average Read Time", "0.0ms");
- ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_NUMERIC_METRICS).checkValues(props);
-
- }
-
-
-
-
-
-
-
-
-
-}// class
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheTestBase.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/jbcache/JBossCacheTestBase.java 2009-07-27 21:33:27 UTC (rev 591)
@@ -0,0 +1,51 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jboss.jopr.jsfunit.as5.jbcache;
+
+import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
+import org.jboss.jopr.jsfunit.ApplicationTestBaseAS5;
+
+/**
+ *
+ * @author Ondrej Zizka
+ */
+public class JBossCacheTestBase extends ApplicationTestBaseAS5 {
+
+ public final DeployableTypes APP_TYPE = DeployableTypes.JBCACHE;
+
+
+ // Cache which is active by default.
+ protected static final String JBCACHE_HA_PARTITION = "jboss.cache:config=ha-partition,service=Cache";
+ protected static final String JBCACHE_MVCC_ENTITY = "jboss.cache:config=mvcc-entity,service=Cache";
+ protected static final String JBCACHE_PESSIMISTIC_SHARED = "jboss.cache:config=pessimistic-shared,service=Cache";
+ protected static final String JBCACHE_TIMESTAMPS = "jboss.cache:config=timestamps-cache,service=Cache";
+
+
+ // Subnodes
+ protected static final String SUBNODE_CACHE = "Cache";
+ protected static final String SUBNODE_INTERCEPTOR = "Interceptor";
+ protected static final String SUBNODE_DATA_CONTAINER = "Data Container";
+ protected static final String SUBNODE_RPC_MANAGER = "RPC Manager";
+ protected static final String SUBNODE_REGION_MANAGER = "RegionManager";
+ protected static final String SUBNODE_TRANSACTION_TABLE = "Transaction Table";
+
+
+
+
+ protected boolean isJBossConfigWithoutCache(){
+ boolean isJBossConfigWithoutCache = ! ejtt.getJBossConfig().equals("all");
+ if( isJBossConfigWithoutCache )
+ log.warn("JBoss instance is not running the 'all' configuration ('"+ejtt.getJBossConfig()+"' instead) - " +
+ "thus, has no JBoss Cache. Set -Dcargo.jboss.configuration=all for maven.");
+ return isJBossConfigWithoutCache;
+ }
+
+
+
+
+
+
+}// class
More information about the embjopr-commits
mailing list