[jboss-cvs] JBossAS SVN: r86918 - in trunk/testsuite/src/main/org/jboss/test/profileservice: test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 7 09:13:01 EDT 2009
Author: emuckenhuber
Date: 2009-04-07 09:13:01 -0400 (Tue, 07 Apr 2009)
New Revision: 86918
Modified:
trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
Log:
update profileservice tests
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java 2009-04-07 13:10:41 UTC (rev 86917)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/override/test/JmsDestinationOverrideTestCase.java 2009-04-07 13:13:01 UTC (rev 86918)
@@ -21,11 +21,24 @@
*/
package org.jboss.test.profileservice.override.test;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.deployers.spi.management.KnownComponentTypes;
import org.jboss.deployers.spi.management.ManagementView;
+import org.jboss.managed.api.ComponentType;
+import org.jboss.managed.api.DeploymentTemplateInfo;
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedProperty;
+import org.jboss.metatype.api.types.MapCompositeMetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.CompositeValueSupport;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.plugins.types.MutableCompositeMetaType;
/**
* Test updating a Queue and Topic.
@@ -36,6 +49,23 @@
public class JmsDestinationOverrideTestCase extends AbstractProfileServiceTest
{
+ /** The meta type. */
+ protected static final MapCompositeMetaType securityConfType;
+
+ /** The composite meta type. */
+ public static MutableCompositeMetaType composite;
+
+ static
+ {
+ // Create the meta type
+ composite = new MutableCompositeMetaType("SecurityConfig", "The security config");
+ composite.addItem("read", "read permission", SimpleMetaType.BOOLEAN);
+ composite.addItem("write", "write permission", SimpleMetaType.BOOLEAN);
+ composite.addItem("create", "create permission", SimpleMetaType.BOOLEAN);
+ composite.freeze();
+ securityConfType = new MapCompositeMetaType(composite);
+ }
+
public JmsDestinationOverrideTestCase(String name)
{
super(name);
@@ -70,7 +100,56 @@
throw e;
}
}
+
+ public void testQueueTemplate() throws Exception
+ {
+ String jndiName = getName();
+ ManagementView mgtView = getManagementView();
+
+ Map<String, MetaValue> propValues = new HashMap<String, MetaValue>();
+
+ propValues.put("name", SimpleValueSupport.wrap("queueTemplate"));
+ propValues.put("JNDIName", SimpleValueSupport.wrap(jndiName));
+ // Security config
+ Map<String, MetaValue> values = new HashMap<String, MetaValue>();
+ values.put("admin", createCompositeValue(true, true, true));
+ values.put("publisher", createCompositeValue(true, true, false));
+ values.put("user", createCompositeValue(true, null, null));
+ CompositeValue map = new MapCompositeValueSupport(values, securityConfType);
+ propValues.put("securityConfig", map);
+
+ ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
+ DeploymentTemplateInfo info = mgtView.getTemplate("QueueTemplate");
+
+ // update values
+ Map<String, ManagedProperty> props = info.getProperties();
+ for(String propName : propValues.keySet())
+ {
+ ManagedProperty prop = props.get(propName);
+ log.debug("createComponentTest("+propName+") before: "+prop.getValue());
+ assertNotNull("property " + propName + " found in template " + jndiName, prop);
+ prop.setValue(propValues.get(propName));
+ log.debug("createComponentTest("+propName+") after: "+prop.getValue());
+ }
+ mgtView.applyTemplate(jndiName, info);
+
+ // update security Config
+ ManagedComponent queue = mgtView.getComponent("testQueueTemplate", type);
+ assertNotNull(queue);
+ assertEquals("testQueueTemplate", queue.getName());
+
+ values = new HashMap<String, MetaValue>();
+ values.put("admin", createCompositeValue(true, true, true));
+ values.put("publisher", createCompositeValue(true, true, false));
+ values.put("user", createCompositeValue(false, false, false));
+ map = new MapCompositeValueSupport(values, securityConfType);
+
+ queue.getProperty("securityConfig").setValue(map);
+ mgtView.updateComponent(queue);
+ }
+
+
public void testTopic() throws Throwable
{
final String deploymentName = "profileservice-testTopic-service.xml";
@@ -100,6 +179,17 @@
throw e;
}
}
+
+ protected CompositeValue createCompositeValue(Boolean read, Boolean write, Boolean create)
+ {
+ Map<String, MetaValue> map = new HashMap<String, MetaValue>();
+
+ map.put("read", new SimpleValueSupport(SimpleMetaType.BOOLEAN, read));
+ map.put("write", new SimpleValueSupport(SimpleMetaType.BOOLEAN, write));
+ map.put("create", new SimpleValueSupport(SimpleMetaType.BOOLEAN, create));
+
+ return new CompositeValueSupport(composite, map);
+ }
}
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-04-07 13:10:41 UTC (rev 86917)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/JmsDestinationUnitTestCase.java 2009-04-07 13:13:01 UTC (rev 86918)
@@ -173,6 +173,17 @@
public void testQueueMetrics() throws Exception
{
+ // Get the managed component
+ ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
+ ManagedComponent component = getManagementView().getComponent("testCreateQueue", type);
+
+ // The message count property
+ ManagedProperty property = component.getProperty("messageCount");
+ assertNotNull(property);
+ ManagedProperty messageCounter = component.getProperty("messageCounter");
+ assertNotNull(messageCounter);
+
+ // Send a message
Queue queue = (Queue) getInitialContext().lookup("testCreateQueue");
assertNotNull(queue);
QueueConnectionFactory qCf = (QueueConnectionFactory) getInitialContext().lookup("ConnectionFactory");
@@ -181,15 +192,22 @@
QueueSession s = c.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueSender sender = s.createSender(queue);
+ //
sender.send(s.createTextMessage("Hey!"));
+
+ SimpleValue messageCount = (SimpleValue) property.getValue();
+ assertTrue((Integer) (messageCount).getValue() > 0);
+ assertEquals(((CompositeValue) messageCounter.getValue()).get("messageCount"), messageCount);
+
+ //
+ sender.send(s.createTextMessage("Message2"));
+
+ SimpleValue messageCount2 = (SimpleValue) property.getValue();
+ assertTrue(messageCount2.compareTo(messageCount) > 0);
+ assertEquals(((CompositeValue) messageCounter.getValue()).get("messageCount"), messageCount2);
+
c.stop();
c.close();
-
- ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
- ManagedComponent component = getManagementView().getComponent("testCreateQueue", type);
- ManagedProperty property = component.getProperty("messageCount");
- assertNotNull(property);
- assertTrue((Integer) ((SimpleValue)property.getValue()).getValue() > 0);
}
public void testQueueOperations() throws Exception
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java 2009-04-07 13:10:41 UTC (rev 86917)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java 2009-04-07 13:13:01 UTC (rev 86918)
@@ -34,8 +34,8 @@
import org.jboss.managed.api.ManagedComponent;
import org.jboss.managed.api.ManagedDeployment;
import org.jboss.managed.api.ManagedOperation;
-import org.jboss.managed.api.RunState;
import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.RunState;
import org.jboss.managed.plugins.ManagedOperationMatcher;
import org.jboss.metatype.api.types.EnumMetaType;
import org.jboss.metatype.api.types.MetaType;
@@ -128,7 +128,6 @@
throws Exception
{
ManagementView mgtView = getManagementView();
- mgtView.reload();
ComponentType type = KnownComponentTypes.MCBean.Any.getType();
ManagedComponent mc = mgtView.getComponent("jboss.system:type=MCServer", type);
assertNotNull(mc);
More information about the jboss-cvs-commits
mailing list