[jboss-cvs] JBossAS SVN: r89835 - branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 4 12:22:43 EDT 2009


Author: emuckenhuber
Date: 2009-06-04 12:22:43 -0400 (Thu, 04 Jun 2009)
New Revision: 89835

Added:
   branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/Ejb3MetricsUnitTestCase.java
Log:
add basic ejb3 metrics unit testcase.

Added: branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/Ejb3MetricsUnitTestCase.java
===================================================================
--- branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/Ejb3MetricsUnitTestCase.java	                        (rev 0)
+++ branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/Ejb3MetricsUnitTestCase.java	2009-06-04 16:22:43 UTC (rev 89835)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+package org.jboss.test.profileservice.test;
+
+import java.util.Set;
+
+import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.ManagedComponent;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.TableValue;
+
+
+/**
+ * Basic EJB3 metrics unit testcase.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class Ejb3MetricsUnitTestCase extends AbstractProfileServiceTest
+{
+
+   public Ejb3MetricsUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testMetrics() throws Exception
+   {
+     ManagementView mgtView = getManagementView();
+     
+     ComponentType sessionType = new ComponentType("EJB3", "Session");
+     Set<ManagedComponent> sessions = mgtView.getComponentsForType(sessionType);
+
+     // Get stats property
+     ManagedComponent session = sessions.iterator().next();     
+     ManagedProperty stats = session.getProperty("stats");
+     assertNotNull(stats);
+     TableValue table = (TableValue) stats.getValue();
+     assertNotNull(table);
+     getLog().debug(table);
+     
+     //
+     ComponentType slsbType = new ComponentType("EJB3", "SLSB");
+     Set<ManagedComponent> slsbs = mgtView.getComponentsForType(slsbType);
+     
+     ManagedComponent slsb = slsbs.iterator().next();
+     ManagedProperty currentSize = slsb.getProperty("currentSize");
+     assertNotNull(currentSize);
+     SimpleValue simple = (SimpleValue ) currentSize.getValue();
+     assertNotNull(simple);
+     getLog().debug(simple);
+      
+   }
+   
+}
+




More information about the jboss-cvs-commits mailing list