modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
| 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCContainerComponent.java
| 66 --
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCacheComponent.java
| 81 --
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnComponent.java
| 10
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedComponent.java
| 90 ++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedSubResourcesComponent.java
| 72 ++
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ThreadPoolComponent.java
| 63 --
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ThreadsComponent.java
| 56 -
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
| 234 +++++--
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/TemplatedComponentTest.java
| 310 ++++++++++
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/TemplatedSubResourcesComponentTest.java
| 177 +++++
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/TemplatedResourcesTest.java
| 151 ++++
12 files changed, 961 insertions(+), 351 deletions(-)
New commits:
commit c11fc265f512a6f40ea38979126aa78d2e954ddc
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 15:54:23 2012 -0500
[BZ 826066] Created unit tests and integration for the generic components that support
templated resources.
(cherry picked from commit e03cd902cb0c2043feafdf3c0a2555f13e9d4128)
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedComponent.java
index ed07a8a..12eb883 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedComponent.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedComponent.java
@@ -48,7 +48,7 @@ public class TemplatedComponent extends
BaseComponent<ResourceComponent<?>> {
//manually load type based on the resource path
PropertySimple pathProperty = (PropertySimple)
context.getPluginConfiguration().get("path");
String type = pathProperty.getStringValue();
- type = type.substring(path.lastIndexOf(',') + 1,
type.lastIndexOf('='));
+ type = type.substring(type.lastIndexOf(',') + 1,
type.lastIndexOf('='));
configuration.put(new PropertySimple(TYPE_CONFIGURATION, type));
return configuration;
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/TemplatedComponentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/TemplatedComponentTest.java
new file mode 100644
index 0000000..061390c
--- /dev/null
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/TemplatedComponentTest.java
@@ -0,0 +1,310 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2011, 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 program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.modules.plugins.jbossas7;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.Map;
+
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.testng.PowerMockObjectFactory;
+import org.testng.Assert;
+import org.testng.IObjectFactory;
+import org.testng.annotations.ObjectFactory;
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.modules.plugins.jbossas7.json.Address;
+
+/**
+ * @author Stefan Negrea
+ *
+ */
+@PrepareForTest({ TemplatedComponent.class })
+public class TemplatedComponentTest {
+
+ @ObjectFactory
+ public IObjectFactory getObjectFactory() {
+ return new PowerMockObjectFactory();
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Test
+ public void loadResourceConfigurationWithType() throws Exception {
+ //tell the method story as it happens: mock or create dependencies and configure
+ //those dependencies to get the method under test to completion.
+ ResourceContext mockResourceContext = mock(ResourceContext.class);
+
+ ResourceType mockResourceType = mock(ResourceType.class);
+ when(mockResourceContext.getResourceType()).thenReturn(mockResourceType);
+
+ ConfigurationDefinition mockConfigurationDefinition =
mock(ConfigurationDefinition.class);
+
when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);
+
+ ConfigurationTemplate mockConfigurationTemplate =
mock(ConfigurationTemplate.class);
+
when(mockConfigurationDefinition.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);
+
+ Configuration mockConfiguration = mock(Configuration.class);
+
when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);
+
+ Property mockProperty = mock(Property.class);
+ when(mockConfiguration.get(eq("__type"))).thenReturn(mockProperty);
+
+ Map<String, PropertyDefinition> mockMap = (Map<String,
PropertyDefinition>) mock(Map.class);
+ when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);
+
+ ConfigurationLoadDelegate mockConfigurationLoadDelegate =
mock(ConfigurationLoadDelegate.class);
+ PowerMockito.whenNew(ConfigurationLoadDelegate.class)
+ .withParameterTypes(ConfigurationDefinition.class, ASConnection.class,
Address.class)
+ .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class),
any(Address.class))
+ .thenReturn(mockConfigurationLoadDelegate);
+
+
when(mockConfigurationLoadDelegate.loadResourceConfiguration()).thenReturn(mockConfiguration);
+
+ PropertySimple pathPropertySimple = new PropertySimple("path",
"abc=def,xyz=test1");
+
when(mockConfiguration.get(eq("path"))).thenReturn(pathPropertySimple);
+
when(mockResourceContext.getPluginConfiguration()).thenReturn(mockConfiguration);
+
+ ASConnection mockASConnection = mock(ASConnection.class);
+
+ PropertySimple typePropertySimple = new PropertySimple("__type",
"xyz");
+ PowerMockito.whenNew(PropertySimple.class).withParameterTypes(String.class,
Object.class)
+ .withArguments(eq("__type"),
eq("xyz")).thenReturn(typePropertySimple);
+
+ //create object to test and inject required dependencies
+ TemplatedComponent objectUnderTest = new TemplatedComponent();
+
+ objectUnderTest.context = mockResourceContext;
+ objectUnderTest.testConnection = mockASConnection;
+
+ //run code under test
+ Configuration result = objectUnderTest.loadResourceConfiguration();
+
+ //verify the results (Assert and mock verification)
+ Assert.assertEquals(result, mockConfiguration);
+
+ verify(mockMap, times(1)).remove(eq("__type"));
+ verify(mockConfiguration, times(1)).get(eq("__type"));
+ verify(mockConfiguration, never()).get(eq("__name"));
+ verify(mockConfiguration, times(1)).get(eq("path"));
+ verify(mockConfiguration, times(1)).put(eq(typePropertySimple));
+
+
PowerMockito.verifyNew(PropertySimple.class).withArguments(eq("__type"),
eq("xyz"));
+
PowerMockito.verifyNew(ConfigurationLoadDelegate.class).withArguments(any(ConfigurationDefinition.class),
+ eq(mockASConnection), any(Address.class));
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Test
+ public void loadResourceConfigurationWithName() throws Exception {
+ //tell the method story as it happens: mock or create dependencies and configure
+ //those dependencies to get the method under test to completion.
+ ResourceContext mockResourceContext = mock(ResourceContext.class);
+
+ ResourceType mockResourceType = mock(ResourceType.class);
+ when(mockResourceContext.getResourceType()).thenReturn(mockResourceType);
+
+ ConfigurationDefinition mockConfigurationDefinition =
mock(ConfigurationDefinition.class);
+
when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);
+
+ ConfigurationTemplate mockConfigurationTemplate =
mock(ConfigurationTemplate.class);
+
when(mockConfigurationDefinition.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);
+
+ Configuration mockConfiguration = mock(Configuration.class);
+
when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);
+
+ Property mockProperty = mock(Property.class);
+ when(mockConfiguration.get("_type")).thenReturn(null);
+ when(mockConfiguration.get(eq("__name"))).thenReturn(mockProperty);
+
+
+ Map<String, PropertyDefinition> mockMap = (Map<String,
PropertyDefinition>) mock(Map.class);
+ when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);
+
+ ConfigurationLoadDelegate mockConfigurationLoadDelegate =
mock(ConfigurationLoadDelegate.class);
+ PowerMockito.whenNew(ConfigurationLoadDelegate.class)
+ .withParameterTypes(ConfigurationDefinition.class, ASConnection.class,
Address.class)
+ .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class),
any(Address.class))
+ .thenReturn(mockConfigurationLoadDelegate);
+
+
when(mockConfigurationLoadDelegate.loadResourceConfiguration()).thenReturn(mockConfiguration);
+
+ PropertySimple pathPropertySimple = new PropertySimple("path",
"abc=def,xyz=test1");
+
when(mockConfiguration.get(eq("path"))).thenReturn(pathPropertySimple);
+
when(mockResourceContext.getPluginConfiguration()).thenReturn(mockConfiguration);
+
+ ASConnection mockASConnection = mock(ASConnection.class);
+
+ PropertySimple namePropertySimple = new PropertySimple("__name",
"test1");
+ PowerMockito.whenNew(PropertySimple.class).withParameterTypes(String.class,
Object.class)
+ .withArguments(eq("__name"),
eq("test1")).thenReturn(namePropertySimple);
+
+ //create object to test and inject required dependencies
+ TemplatedComponent objectUnderTest = new TemplatedComponent();
+
+ objectUnderTest.context = mockResourceContext;
+ objectUnderTest.testConnection = mockASConnection;
+
+ //run code under test
+ Configuration result = objectUnderTest.loadResourceConfiguration();
+
+ //verify the results (Assert and mock verification)
+ Assert.assertEquals(result, mockConfiguration);
+
+ verify(mockMap, times(1)).remove(eq("__name"));
+ verify(mockConfiguration, times(1)).get(eq("__type"));
+ verify(mockConfiguration, times(1)).get(eq("__name"));
+ verify(mockConfiguration, times(1)).get(eq("path"));
+ verify(mockConfiguration, times(1)).put(eq(namePropertySimple));
+
+
PowerMockito.verifyNew(PropertySimple.class).withArguments(eq("__name"),
eq("test1"));
+
PowerMockito.verifyNew(ConfigurationLoadDelegate.class).withArguments(any(ConfigurationDefinition.class),
+ eq(mockASConnection), any(Address.class));
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Test
+ public void updateResourceConfigurationWithType() throws Exception {
+ //tell the method story as it happens: mock or create dependencies and configure
+ //those dependencies to get the method under test to completion.
+ ResourceContext mockResourceContext = mock(ResourceContext.class);
+
+ ResourceType mockResourceType = mock(ResourceType.class);
+ when(mockResourceContext.getResourceType()).thenReturn(mockResourceType);
+
+ ConfigurationDefinition mockConfigurationDefinition =
mock(ConfigurationDefinition.class);
+
when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);
+
+ ConfigurationTemplate mockConfigurationTemplate =
mock(ConfigurationTemplate.class);
+
when(mockConfigurationDefinition.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);
+
+ Configuration mockConfiguration = mock(Configuration.class);
+
when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);
+
+ Property mockProperty = mock(Property.class);
+ when(mockConfiguration.get(eq("__type"))).thenReturn(mockProperty);
+
+ Map<String, PropertyDefinition> mockMap = (Map<String,
PropertyDefinition>) mock(Map.class);
+ when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);
+
+ ConfigurationUpdateReport mockReport = mock(ConfigurationUpdateReport.class);
+ when(mockReport.getConfiguration()).thenReturn(mockConfiguration);
+
+ ConfigurationWriteDelegate mockConfigurationWriteDelegate =
mock(ConfigurationWriteDelegate.class);
+ PowerMockito.whenNew(ConfigurationWriteDelegate.class)
+ .withParameterTypes(ConfigurationDefinition.class, ASConnection.class,
Address.class)
+ .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class),
any(Address.class))
+ .thenReturn(mockConfigurationWriteDelegate);
+
+ ASConnection mockASConnection = mock(ASConnection.class);
+
+
+ //create object to test and inject required dependencies
+ TemplatedComponent objectUnderTest = new TemplatedComponent();
+
+ objectUnderTest.context = mockResourceContext;
+ objectUnderTest.testConnection = mockASConnection;
+
+ //run code under test
+ objectUnderTest.updateResourceConfiguration(mockReport);
+
+ //verify the results (Assert and mock verification)
+ verify(mockMap, times(1)).remove(eq("__type"));
+ verify(mockConfiguration, times(1)).get(eq("__type"));
+ verify(mockConfiguration, never()).get(eq("__name"));
+ verify(mockConfiguration, times(1)).remove(eq("__type"));
+
+
PowerMockito.verifyNew(ConfigurationWriteDelegate.class).withArguments(any(ConfigurationDefinition.class),
+ eq(mockASConnection), any(Address.class));
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Test
+ public void updateResourceConfigurationWithName() throws Exception {
+ //tell the method story as it happens: mock or create dependencies and configure
+ //those dependencies to get the method under test to completion.
+ ResourceContext mockResourceContext = mock(ResourceContext.class);
+
+ ResourceType mockResourceType = mock(ResourceType.class);
+ when(mockResourceContext.getResourceType()).thenReturn(mockResourceType);
+
+ ConfigurationDefinition mockConfigurationDefinition =
mock(ConfigurationDefinition.class);
+
when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);
+
+ ConfigurationTemplate mockConfigurationTemplate =
mock(ConfigurationTemplate.class);
+
when(mockConfigurationDefinition.getDefaultTemplate()).thenReturn(mockConfigurationTemplate);
+
+ Configuration mockConfiguration = mock(Configuration.class);
+
when(mockConfigurationTemplate.getConfiguration()).thenReturn(mockConfiguration);
+
+ Property mockProperty = mock(Property.class);
+ when(mockConfiguration.get(eq("__type"))).thenReturn(null);
+ when(mockConfiguration.get(eq("__name"))).thenReturn(mockProperty);
+
+ Map<String, PropertyDefinition> mockMap = (Map<String,
PropertyDefinition>) mock(Map.class);
+ when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);
+
+ ConfigurationUpdateReport mockReport = mock(ConfigurationUpdateReport.class);
+ when(mockReport.getConfiguration()).thenReturn(mockConfiguration);
+
+ ConfigurationWriteDelegate mockConfigurationWriteDelegate =
mock(ConfigurationWriteDelegate.class);
+ PowerMockito.whenNew(ConfigurationWriteDelegate.class)
+ .withParameterTypes(ConfigurationDefinition.class, ASConnection.class,
Address.class)
+ .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class),
any(Address.class))
+ .thenReturn(mockConfigurationWriteDelegate);
+
+ ASConnection mockASConnection = mock(ASConnection.class);
+
+ //create object to test and inject required dependencies
+ TemplatedComponent objectUnderTest = new TemplatedComponent();
+
+ objectUnderTest.context = mockResourceContext;
+ objectUnderTest.testConnection = mockASConnection;
+
+ //run code under test
+ objectUnderTest.updateResourceConfiguration(mockReport);
+
+ //verify the results (Assert and mock verification)
+ verify(mockMap, times(1)).remove(eq("__name"));
+ verify(mockConfiguration, times(1)).get(eq("__type"));
+ verify(mockConfiguration, times(1)).get(eq("__name"));
+ verify(mockConfiguration, times(1)).remove(eq("__name"));
+
+
PowerMockito.verifyNew(ConfigurationWriteDelegate.class).withArguments(any(ConfigurationDefinition.class),
+ eq(mockASConnection), any(Address.class));
+ }
+
+}
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/TemplatedSubResourcesComponentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/TemplatedSubResourcesComponentTest.java
new file mode 100644
index 0000000..cefd3f1
--- /dev/null
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/TemplatedSubResourcesComponentTest.java
@@ -0,0 +1,177 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2011, 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 program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.modules.plugins.jbossas7;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.Map;
+
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.testng.PowerMockObjectFactory;
+import org.testng.Assert;
+import org.testng.IObjectFactory;
+import org.testng.annotations.ObjectFactory;
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.modules.plugins.jbossas7.json.Address;
+
+/**
+ * @author Stefan Negrea
+ *
+ */
+@PrepareForTest({ TemplatedSubResourcesComponent.class })
+public class TemplatedSubResourcesComponentTest {
+
+ @ObjectFactory
+ public IObjectFactory getObjectFactory() {
+ return new PowerMockObjectFactory();
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ @Test
+ public void createResourceWithType() throws Exception {
+ //tell the method story as it happens: mock or create dependencies and configure
+ //those dependencies to get the method under test to completion.
+ CreateResourceReport mockReport = mock(CreateResourceReport.class);
+
+ Configuration mockConfiguration = mock(Configuration.class);
+ when(mockReport.getResourceConfiguration()).thenReturn(mockConfiguration);
+
+ PropertySimple typePropertySimple = new PropertySimple("__type",
"xyz");
+
when(mockConfiguration.get(eq("__type"))).thenReturn(typePropertySimple);
+
+ ResourceType mockResourceType = mock(ResourceType.class);
+ when(mockReport.getResourceType()).thenReturn(mockResourceType);
+
+ ConfigurationDefinition mockConfigurationDefinition =
mock(ConfigurationDefinition.class);
+
when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);
+
+ Map<String, PropertyDefinition> mockMap = (Map<String,
PropertyDefinition>) mock(Map.class);
+ when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);
+
+ CreateResourceDelegate mockCreateResourceDelegate =
mock(CreateResourceDelegate.class);
+ PowerMockito.whenNew(CreateResourceDelegate.class)
+ .withParameterTypes(ConfigurationDefinition.class, ASConnection.class,
Address.class)
+ .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class),
any(Address.class))
+ .thenReturn(mockCreateResourceDelegate);
+
+ when(mockReport.getResourceConfiguration()).thenReturn(mockConfiguration);
+
+ when(mockReport.getPluginConfiguration()).thenReturn(mockConfiguration);
+
+ PropertySimple pathPropertySimple = new PropertySimple("path",
"xyz");
+ PowerMockito.whenNew(PropertySimple.class).withParameterTypes(String.class,
Object.class)
+ .withArguments(eq("path"),
eq("xyz")).thenReturn(pathPropertySimple);
+
+
when(mockCreateResourceDelegate.createResource(eq(mockReport))).thenReturn(mockReport);
+
+ ASConnection mockASConnection = mock(ASConnection.class);
+
+ //create object to test and inject required dependencies
+ TemplatedSubResourcesComponent objectUnderTest = new
TemplatedSubResourcesComponent();
+ objectUnderTest.testConnection = mockASConnection;
+
+ //run code under test
+ CreateResourceReport result = objectUnderTest.createResource(mockReport);
+
+ //verify the results (Assert and mock verification)
+ Assert.assertEquals(result, mockReport);
+
+ verify(mockMap, times(1)).remove(eq("__type"));
+ verify(mockConfiguration, times(2)).get(eq("__type"));
+ verify(mockConfiguration, never()).get(eq("__name"));
+ verify(mockConfiguration, times(1)).put(eq(pathPropertySimple));
+
+ PowerMockito.verifyNew(PropertySimple.class).withArguments(eq("path"),
eq("xyz"));
+
PowerMockito.verifyNew(CreateResourceDelegate.class).withArguments(any(ConfigurationDefinition.class),
+ eq(mockASConnection), any(Address.class));
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ @Test
+ public void createResourceWithName() throws Exception {
+ //tell the method story as it happens: mock or create dependencies and configure
+ //those dependencies to get the method under test to completion.
+ CreateResourceReport mockReport = mock(CreateResourceReport.class);
+
+ Configuration mockConfiguration = mock(Configuration.class);
+ when(mockReport.getResourceConfiguration()).thenReturn(mockConfiguration);
+
+ PropertySimple namePropertySimple = new PropertySimple("__name",
"xyz");
+ when(mockConfiguration.get(eq("__type"))).thenReturn(null);
+
when(mockConfiguration.get(eq("__name"))).thenReturn(namePropertySimple);
+
+ ResourceType mockResourceType = mock(ResourceType.class);
+ when(mockReport.getResourceType()).thenReturn(mockResourceType);
+
+ ConfigurationDefinition mockConfigurationDefinition =
mock(ConfigurationDefinition.class);
+
when(mockResourceType.getResourceConfigurationDefinition()).thenReturn(mockConfigurationDefinition);
+
+ Map<String, PropertyDefinition> mockMap = (Map<String,
PropertyDefinition>) mock(Map.class);
+ when(mockConfigurationDefinition.getPropertyDefinitions()).thenReturn(mockMap);
+
+ CreateResourceDelegate mockCreateResourceDelegate =
mock(CreateResourceDelegate.class);
+ PowerMockito.whenNew(CreateResourceDelegate.class)
+ .withParameterTypes(ConfigurationDefinition.class, ASConnection.class,
Address.class)
+ .withArguments(any(ConfigurationDefinition.class), any(ASConnection.class),
any(Address.class))
+ .thenReturn(mockCreateResourceDelegate);
+
+ when(mockReport.getResourceConfiguration()).thenReturn(mockConfiguration);
+
+ when(mockReport.getPluginConfiguration()).thenReturn(mockConfiguration);
+
+
when(mockCreateResourceDelegate.createResource(eq(mockReport))).thenReturn(mockReport);
+
+ ASConnection mockASConnection = mock(ASConnection.class);
+
+ //create object to test and inject required dependencies
+ TemplatedSubResourcesComponent objectUnderTest = new
TemplatedSubResourcesComponent();
+ objectUnderTest.testConnection = mockASConnection;
+
+ //run code under test
+ CreateResourceReport result = objectUnderTest.createResource(mockReport);
+
+ //verify the results (Assert and mock verification)
+ Assert.assertEquals(result, mockReport);
+
+ verify(mockMap, times(1)).remove(eq("__name"));
+ verify(mockConfiguration, times(1)).get(eq("__type"));
+ verify(mockConfiguration, times(2)).get(eq("__name"));
+
+ verify(mockReport, times(1)).setUserSpecifiedResourceName(eq("xyz"));
+
+
PowerMockito.verifyNew(CreateResourceDelegate.class).withArguments(any(ConfigurationDefinition.class),
+ eq(mockASConnection), any(Address.class));
+ }
+}
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/TemplatedResourcesTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/TemplatedResourcesTest.java
new file mode 100644
index 0000000..5d64977
--- /dev/null
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/TemplatedResourcesTest.java
@@ -0,0 +1,151 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2012 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.modules.plugins.jbossas7.itest.standalone;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import org.rhq.core.clientapi.agent.configuration.ConfigurationUpdateRequest;
+import org.rhq.core.clientapi.server.configuration.ConfigurationUpdateResponse;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.resource.InventoryStatus;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pc.configuration.ConfigurationManager;
+import org.rhq.core.pc.inventory.InventoryManager;
+import org.rhq.core.pc.inventory.ResourceContainer;
+import org.rhq.modules.plugins.jbossas7.itest.AbstractJBossAS7PluginTest;
+import org.rhq.test.arquillian.RunDiscovery;
+
+@Test(groups = { "integration", "pc", "standalone" },
singleThreaded = true)
+public class TemplatedResourcesTest extends AbstractJBossAS7PluginTest {
+
+ private Log log = LogFactory.getLog(this.getClass());
+
+ @Test(priority = 10, groups = "discovery")
+ @RunDiscovery(discoverServices = true, discoverServers = true)
+ public void discoverPlatform() throws Exception {
+ Resource platform = this.pluginContainer.getInventoryManager().getPlatform();
+ assertNotNull(platform);
+ assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ Thread.sleep(20 * 1000L);
+ }
+
+ @Test(priority = 11)
+ public void loadUpdateTemplatedResourceConfiguration() throws Exception {
+ InventoryManager inventoryManager = this.pluginContainer.getInventoryManager();
+ ConfigurationManager configurationManager =
this.pluginContainer.getConfigurationManager();
+
+ Resource platform = inventoryManager.getPlatform();
+ ResourceContainer platformContainer =
inventoryManager.getResourceContainer(platform);
+
+ Resource server = getResourceByTypeAndKey(platform,
StandaloneServerComponentTest.RESOURCE_TYPE,
+ StandaloneServerComponentTest.RESOURCE_KEY);
+ inventoryManager.activateResource(server, platformContainer, false);
+
+ Thread.sleep(20 * 1000L);
+
+ for (ResourceData resourceData : testResourceData) {
+ ResourceType resourceType = new ResourceType(resourceData.resourceTypeName,
PLUGIN_NAME,
+ ResourceCategory.SERVICE, null);
+ Resource subsystem = getResourceByTypeAndKey(server, resourceType,
resourceData.resourceKey);
+
+ Assert.assertNotNull(subsystem);
+
+ Queue<Resource> unparsedResources = new LinkedList<Resource>();
+ unparsedResources.add(subsystem);
+
+ List<Resource> foundResources = new ArrayList<Resource>();
+ while (!unparsedResources.isEmpty()) {
+ Resource currentResource = unparsedResources.poll();
+
+ for (Resource childResource : currentResource.getChildResources()) {
+ unparsedResources.add(childResource);
+ if
(childResource.getResourceType().getName().equals(resourceData.subResourceType)) {
+ foundResources.add(childResource);
+ }
+ }
+ }
+
+ for (Resource resourceUnderTest : foundResources) {
+ log.info(foundResources);
+
+ Configuration resourceUnderTestConfig = configurationManager
+ .loadResourceConfiguration(resourceUnderTest.getId());
+
+ Assert.assertNotNull(resourceUnderTestConfig);
+ Assert.assertFalse(resourceUnderTestConfig.getProperties().isEmpty());
+
+ boolean specialPropertyFound = false;
+ for (Property property : resourceUnderTestConfig.getProperties()) {
+ if
(property.getName().equals(resourceData.specialConfigurationProperty)) {
+ Assert.assertNotNull(((PropertySimple)
property).getStringValue());
+ specialPropertyFound = true;
+ break;
+ }
+ }
+
+ Assert.assertTrue(specialPropertyFound,
resourceData.specialConfigurationProperty
+ + "property not found in the list of properties");
+
+ ConfigurationUpdateRequest testUpdateRequest = new
ConfigurationUpdateRequest(1,
+ resourceUnderTestConfig, resourceUnderTest.getId());
+ ConfigurationUpdateResponse response = configurationManager
+ .executeUpdateResourceConfigurationImmediately(testUpdateRequest);
+
+ Assert.assertNotNull(response);
+ }
+ }
+ }
+
+ private ResourceData[] testResourceData = new ResourceData[] {
+ new ResourceData("Infinispan", "subsystem=infinispan",
"Cache", "__type"),
+ new ResourceData("Threads", "subsystem=threads",
"ThreadPool", "__type"),
+ new ResourceData("Messaging", "subsystem=messaging",
"Path", "__name")
+ };
+
+ private static class ResourceData {
+ final String resourceTypeName;
+ final String resourceKey;
+ final String subResourceType;
+ final String specialConfigurationProperty;
+
+ public ResourceData(String resourceTypeName, String resourceKey, String
subResourceType,
+ String specialConfigurationProperty) {
+ this.resourceTypeName = resourceTypeName;
+ this.resourceKey = resourceKey;
+ this.subResourceType = subResourceType;
+ this.specialConfigurationProperty = specialConfigurationProperty;
+ }
+ }
+}
commit 3473c273c89f5d3d7727d60c78854c4ed1ab1e40
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 15:53:37 2012 -0500
BZ 827652 - fix a typo.
(cherry picked from commit 08c02d70f5adfb4edb75f064e99170512992ab9e)
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 844e6ac..cf9a937 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -156,7 +156,7 @@
<resource-configuration>
<c:group name="proxy" displayName="Proxy Options">
- <c:simple-property name="proxy-list" required="false"
type="string" readOnly="false" defaultValue=""
description="List of proxies, Format (hostname:port) separated with
comas."/>
+ <c:simple-property name="proxy-list" required="false"
type="string" readOnly="false" defaultValue=""
description="List of proxies, Format (hostname:port) separated with
commas."/>
<c:simple-property name="proxy-url" required="false"
type="string" readOnly="false" defaultValue="/"
description="Base URL for MCMP requests."/>
</c:group>
@@ -174,7 +174,7 @@
<c:group name="context" displayName="Web Context
Options">
<c:simple-property name="excluded-contexts"
required="false" type="string" readOnly="false"
defaultValue="ROOT,admin-console,invoker,jbossws,jmx-console,juddi,web-console"
- description="List of contexts mod_cluster should
ignore, Format String separated with comas."/>
+ description="List of contexts mod_cluster should
ignore, Format String separated with commas."/>
<c:simple-property name="auto-enable-contexts"
required="false" type="boolean" readOnly="false"
defaultValue="true" description="Enable contexts even if disabled in
mod_cluster_manger (httpd)."/>
</c:group>
@@ -1306,8 +1306,8 @@
<operation name="list-proxies" description="Read the list of
httpd connected to the node.">
<results>
- <!-- List of proxies the node is connected to. Format (hostname:port)
separated with comas.-->
- <c:simple-property name="proxy-list" description="List of
proxies the node is connected to. Format (hostname:port) separated with comas"/>
+ <!-- List of proxies the node is connected to. Format (hostname:port)
separated with commas.-->
+ <c:simple-property name="proxy-list" description="List of
proxies the node is connected to. Format (hostname:port) separated with commas"/>
</results>
</operation>
commit e193bbabe228d5facaff69d5b84c2f96403e2751
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 15:52:50 2012 -0500
BZ 828349 - a server-group of a managed server can now be changed.
(cherry picked from commit 80bd3e2100151494746ffe8e4594762afbdc767d)
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index a9a0854..844e6ac 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1569,13 +1569,13 @@
<c:simple-property name="hostname" displayName="Name of the host
to put the server on" required="true" readOnly="true">
<c:option-source target="resource" expression="type=^Host$
plugin=&pluginName;"/>
</c:simple-property>
- <c:simple-property name="group" readOnly="true"
displayName="Server Group" description="Server Group this instance belongs
to.">
+ <c:simple-property name="group" readOnly="false"
displayName="Server Group" description="Server Group this instance belongs
to.">
<c:option-source target="resource"
expression="type=ServerGroup"/>
</c:simple-property>
- <c:simple-property name="socket-binding-group"
readOnly="true" displayName="Socket binding group"
description="Socket bindings to use" required="true"
default="standard-sockets">
+ <c:simple-property name="socket-binding-group"
readOnly="false" displayName="Socket binding group"
description="Socket bindings to use" required="true"
default="standard-sockets">
<c:option-source target="resource"
expression="type=SocketBindingGroup"/>
</c:simple-property>
- <c:simple-property name="socket-binding-port-offset"
readOnly="true" displayName="Port Offset" type="integer"
default="0" description="Offset to the base ports"/>
+ <c:simple-property name="socket-binding-port-offset"
readOnly="false" displayName="Port Offset" type="integer"
default="0" description="Offset to the base ports"/>
<c:simple-property name="auto-start" displayName="Autostart"
default="false" type="boolean"/>
<!--
<c:simple-property name="jmv" displayName="JVM"
defaultValue="default" type="string" description="JVM definition
to use with this server">
commit b23c393dd0a3c7aecc87d8cadd9f79cfa8786e1b
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 15:52:05 2012 -0500
[BZ 827636] Updated Cache component and parents to use generic component code since
the functionality required was implemented in a generic fashion.
(cherry picked from commit 64d1a7cc342250063d5325aba89fed454c73cd45)
Conflicts:
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCContainerComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCContainerComponent.java
deleted file mode 100644
index aec501b..0000000
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCContainerComponent.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.rhq.modules.plugins.jbossas7;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.Property;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.resource.CreateResourceStatus;
-import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
-import org.rhq.core.pluginapi.inventory.CreateResourceReport;
-import org.rhq.modules.plugins.jbossas7.json.Address;
-import org.rhq.modules.plugins.jbossas7.json.Operation;
-import org.rhq.modules.plugins.jbossas7.json.Result;
-
-/**
- * // TODO: Document this
- * @author Heiko W. Rupp
- */
-public class IspnCContainerComponent extends BaseComponent implements
CreateChildResourceFacet{
- static final String FLAVOR = "_flavor";
-
-// private final Log log = LogFactory.getLog(IspnCContainerComponent.class);
-
- /**
- * Create embedded cache elements
- * Ttick is to take the _flavor property and turn it into a part of the path
- * @param report contains all of the necessary information to create the specified
resource and should be populated
- * with the
- *
- * @return
- */
- @Override
- public CreateResourceReport createResource(CreateResourceReport report) {
-
- Configuration config = report.getResourceConfiguration();
- String flavor = config.getSimpleValue(FLAVOR,null);
- if (flavor==null) {
- report.setStatus(CreateResourceStatus.INVALID_CONFIGURATION);
- report.setErrorMessage("No flavor given");
-
- return report;
- }
- String newName = report.getUserSpecifiedResourceName();
- Address address = new Address(this.address);
- address.add(flavor,newName);
- Operation add = new Operation("add",address);
- for (Property prop: config.getProperties()) {
- if (prop.getName().equals(FLAVOR)) {
- continue;
- }
- PropertySimple ps = (PropertySimple) prop;
- add.addAdditionalProperty(prop.getName(),ps.getStringValue()); // TODO format
conversion?
-
- }
- Result result = getASConnection().execute(add);
- if (result.isSuccess()) {
- report.setResourceKey(address.getPath());
- report.setResourceName(address.getPath());
- report.setStatus(CreateResourceStatus.SUCCESS);
- }
- else {
- report.setErrorMessage(result.getFailureDescription());
- report.setStatus(CreateResourceStatus.FAILURE);
- }
-
- return report;
- }
-}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCacheComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCacheComponent.java
deleted file mode 100644
index c6de975..0000000
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnCacheComponent.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.modules.plugins.jbossas7;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.measurement.MeasurementDataTrait;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
-import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
-
-/**
- * Component class for Infinispan caches
- * @author Heiko W. Rupp
- */
-public class IspnCacheComponent extends BaseComponent implements ConfigurationFacet {
-
-
- @Override
- public void getValues(MeasurementReport report, Set metrics) throws Exception {
-
- Set<MeasurementScheduleRequest> requests = metrics;
- Set<MeasurementScheduleRequest> todo = new
HashSet<MeasurementScheduleRequest>();
-
- for (MeasurementScheduleRequest req: requests) {
- if (req.getName().equals("__flavor")) {
- String flavor = getCacheFlavorFromPath();
- MeasurementDataTrait trait = new MeasurementDataTrait(req,flavor);
- report.addData(trait);
- }
- else
- todo.add(req);
- }
-
-
- super.getValues(report, todo);
- }
-
- private String getCacheFlavorFromPath() {
- String flavor = path.substring(path.lastIndexOf(",")+1);
- flavor = flavor.substring(0,flavor.indexOf("="));
- return flavor;
- }
-
- @Override
- public Configuration loadResourceConfiguration() throws Exception {
- Configuration config = super.loadResourceConfiguration();
- String f = getCacheFlavorFromPath();
- PropertySimple flavor = new PropertySimple(IspnCContainerComponent.FLAVOR,f);
- config.put(flavor);
- return config;
- }
-
- @Override
- public void updateResourceConfiguration(ConfigurationUpdateReport report) {
-
- report.getConfiguration().remove(IspnCContainerComponent.FLAVOR);
-
- super.updateResourceConfiguration(report);
- }
-}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnComponent.java
deleted file mode 100644
index bf809cf..0000000
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/IspnComponent.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.rhq.modules.plugins.jbossas7;
-
-/**
- * Component class for Infinispan
- * @author Heiko W. Rupp
- */
-public class IspnComponent extends BaseComponent {
-
-
-}
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 98aa086..a9a0854 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1884,7 +1884,7 @@
<service name="Infinispan (Managed Server)"
discovery="SubsystemDiscovery"
- class="IspnComponent"
+ class="BaseComponent"
singleton="true">
<plugin-configuration>
@@ -1894,7 +1894,7 @@
<service name="Cache Container (Managed Server)"
discovery="SubsystemDiscovery"
- class="IspnCContainerComponent">
+ class="TemplatedSubResourcesComponent">
<plugin-configuration>
<c:simple-property name="path" readOnly="true"
default="cache-container"/>
@@ -1921,21 +1921,13 @@
<service name="Cache (Managed Server)"
discovery="SubsystemDiscovery"
- class="IspnCacheComponent">
+ class="TemplatedComponent">
<plugin-configuration>
<c:simple-property name="path" readOnly="true"
default="distributed-cache|local-cache|invalidation-cache|replicated-cache"/>
</plugin-configuration>
<resource-configuration>
- <c:simple-property name="_flavor" displayName="Kind of
cache" required="true" readOnly="true"
default="local-cache" description="What special kind of cache is
this.">
- <c:property-options>
- <c:option value="local-cache"/>
- <c:option value="invalidation-cache"/>
- <c:option value="distributed-cache"/>
- <c:option value="replicated-cache"/>
- </c:property-options>
- </c:simple-property>
<c:simple-property name="start" required="false"
type="string" readOnly="true" default="LAZY"
description="The cache start mode, which can be EAGER (immediate start) or LAZY
(on-demand start).">
<c:property-options>
<c:option value="LAZY"/>
@@ -1965,6 +1957,27 @@
<c:simple-property name="module" required="false"
type="string" readOnly="true" description="The module whose class
loader should be used when building this cache's configuration."/>
<c:simple-property name="owners" required="false"
type="integer" readOnly="true" defaultValue="2"
description="Number of cluster-wide replicas for each cache entry. The
default value is 2."/>
<c:simple-property name="virtual-nodes"
required="false" type="integer" readOnly="true"
defaultValue="1" description="Controls the number of virtual nodes per
'real' node. If numVirtualNodes is 1, then virtual nodes are disabled.
The topology aware consistent hash must be used if you wish to take advantage of virtual
nodes. A default of 1 is used. The default value is 1."/>
+
+ <c:simple-property name="__type" displayName="Type of
cache" required="true" readOnly="true"
default="local-cache" description="Type of cache">
+ <c:property-options>
+ <c:option value="local-cache"/>
+ <c:option value="invalidation-cache"/>
+ <c:option value="distributed-cache"/>
+ <c:option value="replicated-cache"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:template name="Local Cache" description="Local
Cache">
+ <c:simple-property name="__type" readOnly="true"
default="local-cache"/>
+ </c:template>
+ <c:template name="Invalidation Cache"
description="Invalidation Cache">
+ <c:simple-property name="__type" readOnly="true"
default="invalidation-cache"/>
+ </c:template>
+ <c:template name="Distributed Cache"
description="Distributed Cache">
+ <c:simple-property name="__type" readOnly="true"
default="distributed-cache"/>
+ </c:template>
+ <c:template name="Replicated Cache" description="Replicated
Cache">
+ <c:simple-property name="__type" readOnly="true"
default="replicated-cache"/>
+ </c:template>
</resource-configuration>
</service>
@@ -10970,9 +10983,9 @@
<service name="Infinispan"
- discovery="SubsystemDiscovery"
- class="IspnComponent"
- singleton="true">
+ discovery="SubsystemDiscovery"
+ class="BaseComponent"
+ singleton="true">
<runs-inside>
<parent-resource-type name="Profile"
plugin="&pluginName;"/>
@@ -10985,7 +10998,7 @@
<service name="Cache Container"
discovery="SubsystemDiscovery"
- class="IspnCContainerComponent"
+ class="TemplatedSubResourcesComponent"
createDeletePolicy="both"
creationDataType="configuration">
@@ -11014,7 +11027,7 @@
<service name="Cache"
discovery="SubsystemDiscovery"
- class="IspnCacheComponent"
+ class="TemplatedComponent"
createDeletePolicy="both"
creationDataType="configuration">
@@ -11023,14 +11036,6 @@
</plugin-configuration>
<resource-configuration>
- <c:simple-property name="_flavor" displayName="Kind of
cache" required="true" readOnly="true"
default="local-cache" description="What special kind of cache is
this.">
- <c:property-options>
- <c:option value="local-cache"/>
- <c:option value="invalidation-cache"/>
- <c:option value="distributed-cache"/>
- <c:option value="replicated-cache"/>
- </c:property-options>
- </c:simple-property>
<c:simple-property name="start" required="false"
type="string" readOnly="false" default="LAZY"
description="The cache start mode, which can be EAGER (immediate start) or LAZY
(on-demand start).">
<c:property-options>
<c:option value="LAZY"/>
@@ -11046,7 +11051,7 @@
</c:property-options>
</c:simple-property>
<c:simple-property name="jndi-name" required="false"
type="string" readOnly="false" description="The jndi-name to
which to bind this cache instance."/>
- <c:simple-property name="mode" required="false"
type="string" readOnly="true" default="SYNC"
description="Sets the clustered cache mode, ASYNC for asynchronous operation, or SYNC
for synchronous operation.">
+ <c:simple-property name="mode" required="true"
type="string" readOnly="false" default="SYNC"
description="Sets the clustered cache mode, ASYNC for asynchronous operation, or SYNC
for synchronous operation.">
<c:property-options>
<c:option value="SYNC"/>
<c:option value="ASYNC"/>
@@ -11055,12 +11060,32 @@
<c:simple-property name="queue-size" required="false"
type="integer" readOnly="false" default="0"
description="In ASYNC mode, this attribute can be used to trigger flushing of the
queue when it reaches a specific threshold."/>
<c:simple-property name="queue-flush-interval"
required="false" type="long" readOnly="false"
default="10" description="In ASYNC mode, this attribute controls how often
the asynchronous thread used to flush the replication queue runs. This should be a
positive integer which represents thread wakeup time in milliseconds."/>
<c:simple-property name="remote-timeout"
required="false" type="long" readOnly="false"
default="17500" description="In SYNC mode, the timeout (in ms) used to wait
for an acknowledgment when making a remote call, after which the call is aborted and an
exception is thrown."/>
-
<c:simple-property name="async-marshalling"
required="false" type="boolean" readOnly="false"
defaultValue="false" description="If enabled, this will cause marshalling
of entries to be performed asynchronously. The default value is false."/>
<c:simple-property name="l1-lifespan" required="false"
type="long" readOnly="false" defaultValue="600000"
description="Maximum lifespan of an entry placed in the L1 cache. This element
configures the L1 cache behavior in 'distributed' caches instances. In
any other cache modes, this element is ignored. The default value is 600000."/>
<c:simple-property name="module" required="false"
type="string" readOnly="false" description="The module whose
class loader should be used when building this cache's configuration."/>
<c:simple-property name="owners" required="false"
type="integer" readOnly="false" defaultValue="2"
description="Number of cluster-wide replicas for each cache entry. The
default value is 2."/>
<c:simple-property name="virtual-nodes" required="false"
type="integer" readOnly="false" defaultValue="1"
description="Controls the number of virtual nodes per 'real' node.
If numVirtualNodes is 1, then virtual nodes are disabled. The topology aware consistent
hash must be used if you wish to take advantage of virtual nodes. A default of 1 is used.
The default value is 1."/>
+
+ <c:simple-property name="__type" displayName="Type of
cache" required="true" readOnly="true"
default="local-cache" description="Type of cache">
+ <c:property-options>
+ <c:option value="local-cache"/>
+ <c:option value="invalidation-cache"/>
+ <c:option value="distributed-cache"/>
+ <c:option value="replicated-cache"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:template name="Local Cache" description="Local
Cache">
+ <c:simple-property name="__type" readOnly="true"
default="local-cache"/>
+ </c:template>
+ <c:template name="Invalidation Cache"
description="Invalidation Cache">
+ <c:simple-property name="__type" readOnly="true"
default="invalidation-cache"/>
+ </c:template>
+ <c:template name="Distributed Cache" description="Distributed
Cache">
+ <c:simple-property name="__type" readOnly="true"
default="distributed-cache"/>
+ </c:template>
+ <c:template name="Replicated Cache" description="Replicated
Cache">
+ <c:simple-property name="__type" readOnly="true"
default="replicated-cache"/>
+ </c:template>
</resource-configuration>
</service>
commit 8c642fd50860263a73484741ab008e3f26587607
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 15:48:58 2012 -0500
[BZ 826066] Path resource has now templates and a property to allow users to create
all four types.
Also, updated the code for templated AS7 resources to take into account either name or
type can be templated.
(cherry picked from commit ba758053aebffb25af2f35fab27a49ee1a942258)
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
index a289a1a..dad90bc 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HornetQComponent.java
@@ -30,7 +30,7 @@ import org.rhq.core.pluginapi.inventory.CreateResourceReport;
* Component class for HornetQ related stuff
* @author Heiko W. Rupp
*/
-public class HornetQComponent extends BaseComponent {
+public class HornetQComponent extends TemplatedSubResourcesComponent {
@Override
public CreateResourceReport createResource(CreateResourceReport report) {
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedComponent.java
new file mode 100644
index 0000000..ed07a8a
--- /dev/null
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedComponent.java
@@ -0,0 +1,90 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2012, 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 program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.modules.plugins.jbossas7;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+
+/**
+ * @author Stefan Negrea
+ *
+ */
+public class TemplatedComponent extends BaseComponent<ResourceComponent<?>>
{
+
+ private final static String TYPE_CONFIGURATION = "__type";
+ private final static String NAME_CONFIGURATION = "__name";
+
+ @Override
+ public Configuration loadResourceConfiguration() throws Exception {
+ ConfigurationDefinition configDef =
context.getResourceType().getResourceConfigurationDefinition();
+
+ if (configDef.getDefaultTemplate().getConfiguration().get(TYPE_CONFIGURATION) !=
null) {
+ //__type is a fake property, do not attempt to load it from the managed
server
+ configDef.getPropertyDefinitions().remove(TYPE_CONFIGURATION);
+ ConfigurationLoadDelegate delegate = new ConfigurationLoadDelegate(configDef,
getASConnection(), address);
+ Configuration configuration = delegate.loadResourceConfiguration();
+
+ //manually load type based on the resource path
+ PropertySimple pathProperty = (PropertySimple)
context.getPluginConfiguration().get("path");
+ String type = pathProperty.getStringValue();
+ type = type.substring(path.lastIndexOf(',') + 1,
type.lastIndexOf('='));
+ configuration.put(new PropertySimple(TYPE_CONFIGURATION, type));
+
+ return configuration;
+ } else if
(configDef.getDefaultTemplate().getConfiguration().get(NAME_CONFIGURATION) != null) {
+ //__name is a fake property, do not attempt to load it from the managed
server
+ configDef.getPropertyDefinitions().remove(NAME_CONFIGURATION);
+ ConfigurationLoadDelegate delegate = new ConfigurationLoadDelegate(configDef,
getASConnection(), address);
+ Configuration configuration = delegate.loadResourceConfiguration();
+
+ //manually load name based on the resource path
+ PropertySimple pathProperty = (PropertySimple)
context.getPluginConfiguration().get("path");
+ String name = pathProperty.getStringValue();
+ name = name.substring(name.lastIndexOf('=') + 1);
+ configuration.put(new PropertySimple(NAME_CONFIGURATION, name));
+
+ return configuration;
+ }
+
+ return super.loadResourceConfiguration();
+ }
+
+ @Override
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ ConfigurationDefinition configDef =
context.getResourceType().getResourceConfigurationDefinition();
+
+ if (configDef.getDefaultTemplate().getConfiguration().get(TYPE_CONFIGURATION) !=
null) {
+ //__type is a fake property, do not attempt to save it.
+ configDef.getPropertyDefinitions().remove(TYPE_CONFIGURATION);
+ report.getConfiguration().remove(TYPE_CONFIGURATION);
+ } else if
(configDef.getDefaultTemplate().getConfiguration().get(NAME_CONFIGURATION) != null) {
+ //__name is a fake property, do not attempt to save it.
+ configDef.getPropertyDefinitions().remove(NAME_CONFIGURATION);
+ report.getConfiguration().remove(NAME_CONFIGURATION);
+ }
+
+ ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef,
getASConnection(), address);
+ delegate.updateResourceConfiguration(report);
+ }
+}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedSubResourcesComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedSubResourcesComponent.java
new file mode 100644
index 0000000..0a9cf23
--- /dev/null
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/TemplatedSubResourcesComponent.java
@@ -0,0 +1,72 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2012, 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 program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.modules.plugins.jbossas7;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+
+/**
+ * @author Stefan Negrea
+ *
+ */
+public class TemplatedSubResourcesComponent extends
BaseComponent<ResourceComponent<?>> {
+
+ private final static String TYPE_CONFIGURATION = "__type";
+ private final static String NAME_CONFIGURATION = "__name";
+
+ @Override
+ public CreateResourceReport createResource(CreateResourceReport report) {
+ if (report.getResourceConfiguration().get(TYPE_CONFIGURATION) != null) {
+ //Need to munge the report and configuration definition for with type in
configuration:
+ //1) Remove type from the properties and configuration.
+ //2) Update path to the selected type.
+ ConfigurationDefinition configDef =
report.getResourceType().getResourceConfigurationDefinition();
+ configDef.getPropertyDefinitions().remove(TYPE_CONFIGURATION);
+ CreateResourceDelegate delegate = new CreateResourceDelegate(configDef,
getASConnection(), address);
+
+ Configuration configuration = report.getResourceConfiguration();
+ PropertySimple typeProperty = (PropertySimple)
configuration.get(TYPE_CONFIGURATION);
+ configuration.remove(TYPE_CONFIGURATION);
+ report.getPluginConfiguration().put(new PropertySimple("path",
typeProperty.getStringValue()));
+
+ return delegate.createResource(report);
+ } else if (report.getResourceConfiguration().get(NAME_CONFIGURATION) != null) {
+ //Need to munge the report and configuration definition for with name in
configuration:
+ //1) Remove name from the properties and configuration.
+ //2) Update user specified name to the implicitly selected name.
+ ConfigurationDefinition configDef =
report.getResourceType().getResourceConfigurationDefinition();
+ configDef.getPropertyDefinitions().remove(NAME_CONFIGURATION);
+ CreateResourceDelegate delegate = new CreateResourceDelegate(configDef,
getASConnection(), address);
+
+ Configuration configuration = report.getResourceConfiguration();
+ PropertySimple nameProperty = (PropertySimple)
configuration.get(NAME_CONFIGURATION);
+ configuration.remove(NAME_CONFIGURATION);
+ report.setUserSpecifiedResourceName(nameProperty.getStringValue());
+
+ return delegate.createResource(report);
+ } else {
+ return super.createResource(report);
+ }
+ }
+}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ThreadPoolComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ThreadPoolComponent.java
deleted file mode 100644
index 7fd478c..0000000
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ThreadPoolComponent.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright 2012, 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 program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.rhq.modules.plugins.jbossas7;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
-import org.rhq.core.pluginapi.inventory.ResourceComponent;
-
-/**
- * @author Stefan Negrea
- *
- */
-public class ThreadPoolComponent extends BaseComponent<ResourceComponent<?>>
{
-
- @Override
- public Configuration loadResourceConfiguration() throws Exception {
- ConfigurationDefinition configDef =
context.getResourceType().getResourceConfigurationDefinition();
- //type is a fake property, do not attempt to load it from the managed server
- configDef.getPropertyDefinitions().remove("type");
- ConfigurationLoadDelegate delegate = new ConfigurationLoadDelegate(configDef,
getASConnection(), address);
- Configuration configuration = delegate.loadResourceConfiguration();
-
- //manually load type based on the resource path
- PropertySimple pathProperty = (PropertySimple)
context.getPluginConfiguration().get("path");
- String type = pathProperty.getStringValue();
- type = type.substring(path.lastIndexOf(',') + 1,
type.lastIndexOf('='));
- configuration.put(new PropertySimple("type", type));
-
- return configuration;
- }
-
- @Override
- public void updateResourceConfiguration(ConfigurationUpdateReport report) {
- ConfigurationDefinition configDef =
context.getResourceType().getResourceConfigurationDefinition();
- //type is a fake property, do not attempt to save it.
- configDef.getPropertyDefinitions().remove("type");
- ConfigurationWriteDelegate delegate = new ConfigurationWriteDelegate(configDef,
getASConnection(), address);
-
- //type is a fake property, do not attempt to save it.
- report.getConfiguration().remove("type");
- delegate.updateResourceConfiguration(report);
- }
-}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ThreadsComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ThreadsComponent.java
deleted file mode 100644
index a215398..0000000
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ThreadsComponent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright 2012, 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 program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.rhq.modules.plugins.jbossas7;
-
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.configuration.PropertySimple;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
-import org.rhq.core.pluginapi.inventory.CreateResourceReport;
-import org.rhq.core.pluginapi.inventory.ResourceComponent;
-
-/**
- * @author Stefan Negrea
- *
- */
-public class ThreadsComponent extends BaseComponent<ResourceComponent<?>> {
-
- @Override
- public CreateResourceReport createResource(CreateResourceReport report) {
- if (report.getResourceType().getName().equals("ThreadPool")) {
- //Need to munge the report and configuration definition for ThreadPools:
- //1) Remove type from the properties and configuration.
- //2) Update path to the selected thread pool type.
- ConfigurationDefinition configDef =
report.getResourceType().getResourceConfigurationDefinition();
- configDef.getPropertyDefinitions().remove("type");
- CreateResourceDelegate delegate = new CreateResourceDelegate(configDef,
getASConnection(), address);
-
- Configuration configuration = report.getResourceConfiguration();
- PropertySimple threadPoolType = (PropertySimple)
configuration.get("type");
- configuration.remove("type");
- report.getPluginConfiguration().put(new PropertySimple("path",
threadPoolType.getStringValue()));
-
- return delegate.createResource(report);
- } else {
- return super.createResource(report);
- }
- }
-
-}
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 8864361..98aa086 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -2916,7 +2916,7 @@
<service name="Threads (Managed Server)"
discovery="SubsystemDiscovery"
- class="ThreadsComponent"
+ class="TemplatedSubResourcesComponent"
singleton="true">
<plugin-configuration>
@@ -2948,8 +2948,9 @@
<service name="ThreadPool (Managed Server)"
discovery="SubsystemDiscovery"
- class="ThreadPoolComponent"
- description="A thread pool executor">
+ class="TemplatedComponent"
+ description="A thread pool executor"
+ createDeletePolicy="neither">
<plugin-configuration>
<c:simple-property name="path" readOnly="true"
default="bounded-queue-thread-pool|queueless-thread-pool|scheduled-thread-pool|unbounded-queue-thread-pool"/>
@@ -2963,15 +2964,15 @@
<metric property="task-count" description="The approximate
total number of tasks that have ever been scheduled for execution."/>
<resource-configuration>
- <c:map-property name="keepalive-time" readOnly="true"
description="Used to specify the amount of time that pool threads should be kept
running when idle; if not specified, threads will run until the executor is shut
down.">
- <c:simple-property name="time" required="true"
readOnly="true" type="long" description="The time"/>
- <c:simple-property name="unit" required="true"
readOnly="true" type="string" description="The time
unit"/>
+ <c:map-property name="keepalive-time" readOnly="false"
description="Used to specify the amount of time that pool threads should be kept
running when idle; if not specified, threads will run until the executor is shut
down.">
+ <c:simple-property name="time" required="true"
readOnly="false" type="long" description="The time"/>
+ <c:simple-property name="unit" required="true"
readOnly="false" type="string" description="The time
unit"/>
</c:map-property>
- <c:simple-property name="max-threads:expr"
required="true" type="string" readOnly="true"
displayName="Max Threads" description="The maximum thread pool
size."/>
+ <c:simple-property name="max-threads:expr"
required="true" type="string" readOnly="false"
displayName="Max Threads" description="The maximum thread pool
size."/>
<c:simple-property name="name" required="false"
type="string" readOnly="true" description="The name of the thread
pool."/>
- <c:simple-property name="thread-factory"
required="false" type="string" readOnly="true"
description="Specifies the name of a specific thread factory to use to create worker
threads. If not defined an appropriate default thread factory will be used."/>
+ <c:simple-property name="thread-factory"
required="false" type="string" readOnly="false"
description="Specifies the name of a specific thread factory to use to create worker
threads. If not defined an appropriate default thread factory will be used."/>
- <c:simple-property name="type" readOnly="true"
default="scheduled-thread-pool" displayName="Thread Pool Type"
description="Thread pool type">
+ <c:simple-property name="__type" readOnly="true"
default="scheduled-thread-pool" displayName="Thread Pool Type"
description="Thread pool type">
<c:property-options>
<c:option value="bounded-queue-thread-pool"/>
<c:option value="queueless-thread-pool"/>
@@ -2980,16 +2981,16 @@
</c:property-options>
</c:simple-property>
<c:template name="Bounded Queue Thread Pool"
description="Bounded Queue Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="bounded-queue-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="bounded-queue-thread-pool"/>
</c:template>
<c:template name="Queueless Thread Pool"
description="Queueless Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="queueless-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="queueless-thread-pool"/>
</c:template>
<c:template name="Scheduled Thread Pool"
description="Scheduled Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="scheduled-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="scheduled-thread-pool"/>
</c:template>
<c:template name="Unbounded Queue Thread Pool"
description="Unbounded Queue Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="unbounded-queue-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="unbounded-queue-thread-pool"/>
</c:template>
</resource-configuration>
</service>
@@ -4599,17 +4600,37 @@
<service name="Path (Managed Server)"
discovery="SubsystemDiscovery"
- class="BaseComponent"
- createDeletePolicy="neither"
- singleton="true">
+ class="TemplatedComponent"
+ createDeletePolicy="neither">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true"
default="path=journal-directory"/>
+ <c:simple-property name="path" readOnly="true"
default="path"/>
</plugin-configuration>
<resource-configuration>
- <c:simple-property name="path" required="true"
type="string" readOnly="false" description="The actual filesystem
path. Treated as an absolute path, unless the 'relative-to'
attribute is specified, in which case the value is treated as relative to that path.
<p>If treated as an absolute path, the actual runtime pathname specified by
the value of this attribute will be determined as follows: </p>If
this value is already absolute, then the value is directly used. Otherwise the runtime
pathname is resolved in a system-dependent way. On UNIX systems, a relative
pathname is made absolute by resolving it against the current user directory. On Microsoft
Windows systems, a relative pathname is made absolute by resolving it against the current
directory of the drive named by the pathname, if any; if not, it is resolved against the
current user directory."/>
- <c:simple-property name="relative-to" required="false"
type="string" readOnly="false" description="The name of another
previously named path, or of one of the standard paths provided by the system. If
'relative-to' is provided, the value of the
'path' attribute is treated as relative to the path specified by this
attribute. The standard paths provided by the system
include:<ul><li>jboss.home - the root
directory of the JBoss AS distribution</li><li>user.home
- user's home directory</li><li>user.dir
- user's current working
directory</li><li>java.home - java installation
directory</li><li>jboss.server.base.dir - root
directory for an individual server
instance</li><li>jboss.server.data.dir - directory the
server will use for persistent data file
storage</li><li>jboss.server.log.dir - directory the
server will use for log file
storage</li><li>jboss.server.tmp.dir - directory the
server will use for temporary file
storage</li><li>jboss.domain.servers.dir - directory
under which a host controller will create the working area for individual server
instances</li></ul>"/>
+ <c:simple-property name="path" required="true"
type="string" readOnly="true" description="The actual filesystem
path. Treated as an absolute path, unless the 'relative-to'
attribute is specified, in which case the value is treated as relative to that path.
<p>If treated as an absolute path, the actual runtime pathname specified by
the value of this attribute will be determined as follows: </p>If
this value is already absolute, then the value is directly used. Otherwise the runtime
pathname is resolved in a system-dependent way. On UNIX systems, a relative
pathname is made absolute by resolving it against the current user directory. On Microsoft
Windows systems, a relative pathname is made absolute by resolving it against the current
directory of the drive named by the pathname, if any; if not, it is resolved against the
current user directory."/>
+ <c:simple-property name="relative-to" required="false"
type="string" readOnly="true" description="The name of another
previously named path, or of one of the standard paths provided by the system. If
'relative-to' is provided, the value of the
'path' attribute is treated as relative to the path specified by this
attribute. The standard paths provided by the system
include:<ul><li>jboss.home - the root
directory of the JBoss AS distribution</li><li>user.home
- user's home directory</li><li>user.dir
- user's current working
directory</li><li>java.home - java installation
directory</li><li>jboss.server.base.dir - root
directory for an individual server
instance</li><li>jboss.server.data.dir - directory the
server will use for persistent data file
storage</li><li>jboss.server.log.dir - directory the
server will use for log file
storage</li><li>jboss.server.tmp.dir - directory the
server will use for temporary file
storage</li><li>jboss.domain.servers.dir - directory
under which a host controller will create the working area for individual server
instances</li></ul>"/>
+
+ <c:simple-property name="__name" readOnly="true"
displayName="Path Type" description="Path Type">
+ <c:property-options>
+ <c:option value="journal-directory"/>
+ <c:option value="paging-directory"/>
+ <c:option value="large-messages-directory"/>
+ <c:option value="bindings-directory"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:template name="Journal Directory" description="The
directory in which the message journal lives. The default is
${jboss.server.data.dir}/messaging/journal.">
+ <c:simple-property name="__name" readOnly="true"
default="journal-directory"/>
+ </c:template>
+ <c:template name="Paging Directory" description="The
directory where page files are stored. The default is
${jboss.server.data.dir}/messaging/paging.">
+ <c:simple-property name="__name" readOnly="true"
default="paging-directory"/>
+ </c:template>
+ <c:template name="Large Messages Directory"
description="The directory in which large messages are stored. The default is
${jboss.server.data.dir}/messaging/largemessages.">
+ <c:simple-property name="__name" readOnly="true"
default="large-messages-directory"/>
+ </c:template>
+ <c:template name="Bindings Directory" description="The
directory in which the bindings journal lives. The default is
${jboss.server.data.dir}/messaging/bindings.">
+ <c:simple-property name="__name" readOnly="true"
default="bindings-directory"/>
+ </c:template>
</resource-configuration>
</service>
@@ -5714,7 +5735,7 @@
<service name="Threads (Profile)"
discovery="SubsystemDiscovery"
- class="ThreadsComponent"
+ class="TemplatedSubResourcesComponent"
singleton="true">
<plugin-configuration>
@@ -5746,7 +5767,7 @@
<service name="ThreadPool (Profile)"
discovery="SubsystemDiscovery"
- class="ThreadPoolComponent"
+ class="TemplatedComponent"
description="A thread pool executor"
createDeletePolicy="both">
@@ -5763,7 +5784,7 @@
<c:simple-property name="name" required="false"
type="string" readOnly="true" description="The name of the thread
pool."/>
<c:simple-property name="thread-factory"
required="false" type="string" readOnly="false"
description="Specifies the name of a specific thread factory to use to create worker
threads. If not defined an appropriate default thread factory will be used."/>
- <c:simple-property name="type" readOnly="true"
default="scheduled-thread-pool" displayName="Thread Pool Type"
description="Thread pool type">
+ <c:simple-property name="__type" readOnly="true"
default="scheduled-thread-pool" displayName="Thread Pool Type"
description="Thread pool type">
<c:property-options>
<c:option value="bounded-queue-thread-pool"/>
<c:option value="queueless-thread-pool"/>
@@ -5772,16 +5793,16 @@
</c:property-options>
</c:simple-property>
<c:template name="Bounded Queue Thread Pool"
description="Bounded Queue Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="bounded-queue-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="bounded-queue-thread-pool"/>
</c:template>
<c:template name="Queueless Thread Pool"
description="Queueless Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="queueless-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="queueless-thread-pool"/>
</c:template>
<c:template name="Scheduled Thread Pool"
description="Scheduled Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="scheduled-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="scheduled-thread-pool"/>
</c:template>
<c:template name="Unbounded Queue Thread Pool"
description="Unbounded Queue Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="unbounded-queue-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="unbounded-queue-thread-pool"/>
</c:template>
</resource-configuration>
</service>
@@ -6644,17 +6665,37 @@
<service name="Path (Profile)"
discovery="SubsystemDiscovery"
- class="BaseComponent"
- createDeletePolicy="both"
- singleton="true">
+ class="TemplatedComponent"
+ createDeletePolicy="both">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true"
default="path=journal-directory"/>
+ <c:simple-property name="path" readOnly="true"
default="path"/>
</plugin-configuration>
<resource-configuration>
<c:simple-property name="path" required="true"
type="string" readOnly="false" description="The actual filesystem
path. Treated as an absolute path, unless the 'relative-to'
attribute is specified, in which case the value is treated as relative to that path.
<p>If treated as an absolute path, the actual runtime pathname specified by
the value of this attribute will be determined as follows: </p>If
this value is already absolute, then the value is directly used. Otherwise the runtime
pathname is resolved in a system-dependent way. On UNIX systems, a relative
pathname is made absolute by resolving it against the current user directory. On Microsoft
Windows systems, a relative pathname is made absolute by resolving it against the current
directory of the drive named by the pathname, if any; if not, it is resolved against the
current user directory."/>
<c:simple-property name="relative-to" required="false"
type="string" readOnly="false" description="The name of another
previously named path, or of one of the standard paths provided by the system. If
'relative-to' is provided, the value of the
'path' attribute is treated as relative to the path specified by this
attribute. The standard paths provided by the system
include:<ul><li>jboss.home - the root
directory of the JBoss AS distribution</li><li>user.home
- user's home directory</li><li>user.dir
- user's current working
directory</li><li>java.home - java installation
directory</li><li>jboss.server.base.dir - root
directory for an individual server
instance</li><li>jboss.server.data.dir - directory the
server will use for persistent data file
storage</li><li>jboss.server.log.dir - directory the
server will use for log file
storage</li><li>jboss.server.tmp.dir - directory the
server will use for temporary file
storage</li><li>jboss.domain.servers.dir - directory
under which a host controller will create the working area for individual server
instances</li></ul>"/>
+
+ <c:simple-property name="__name" readOnly="true"
displayName="Path Type" description="Path Type">
+ <c:property-options>
+ <c:option value="journal-directory"/>
+ <c:option value="paging-directory"/>
+ <c:option value="large-messages-directory"/>
+ <c:option value="bindings-directory"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:template name="Journal Directory" description="The
directory in which the message journal lives. The default is
${jboss.server.data.dir}/messaging/journal.">
+ <c:simple-property name="__name" readOnly="true"
default="journal-directory"/>
+ </c:template>
+ <c:template name="Paging Directory" description="The
directory where page files are stored. The default is
${jboss.server.data.dir}/messaging/paging.">
+ <c:simple-property name="__name" readOnly="true"
default="paging-directory"/>
+ </c:template>
+ <c:template name="Large Messages Directory"
description="The directory in which large messages are stored. The default is
${jboss.server.data.dir}/messaging/largemessages.">
+ <c:simple-property name="__name" readOnly="true"
default="large-messages-directory"/>
+ </c:template>
+ <c:template name="Bindings Directory" description="The
directory in which the bindings journal lives. The default is
${jboss.server.data.dir}/messaging/bindings.">
+ <c:simple-property name="__name" readOnly="true"
default="bindings-directory"/>
+ </c:template>
</resource-configuration>
</service>
@@ -10450,7 +10491,7 @@
<service name="Threads"
discovery="SubsystemDiscovery"
- class="ThreadsComponent"
+ class="TemplatedSubResourcesComponent"
singleton="true">
<runs-inside>
@@ -10486,7 +10527,7 @@
<service name="ThreadPool"
discovery="SubsystemDiscovery"
- class="ThreadPoolComponent"
+ class="TemplatedComponent"
description="A thread pool executor"
createDeletePolicy="both">
@@ -10510,7 +10551,7 @@
<c:simple-property name="name" required="false"
type="string" readOnly="true" description="The name of the thread
pool."/>
<c:simple-property name="thread-factory" required="false"
type="string" readOnly="false" description="Specifies the name of
a specific thread factory to use to create worker threads. If not defined an appropriate
default thread factory will be used."/>
- <c:simple-property name="type" readOnly="true"
default="scheduled-thread-pool" displayName="Thread Pool Type"
description="Thread pool type">
+ <c:simple-property name="__type" readOnly="true"
default="scheduled-thread-pool" displayName="Thread Pool Type"
description="Thread pool type">
<c:property-options>
<c:option value="bounded-queue-thread-pool"/>
<c:option value="queueless-thread-pool"/>
@@ -10519,16 +10560,16 @@
</c:property-options>
</c:simple-property>
<c:template name="Bounded Queue Thread Pool"
description="Bounded Queue Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="bounded-queue-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="bounded-queue-thread-pool"/>
</c:template>
<c:template name="Queueless Thread Pool" description="Queueless
Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="queueless-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="queueless-thread-pool"/>
</c:template>
<c:template name="Scheduled Thread Pool" description="Scheduled
Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="scheduled-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="scheduled-thread-pool"/>
</c:template>
<c:template name="Unbounded Queue Thread Pool"
description="Unbounded Queue Thread Pool">
- <c:simple-property name="type" readOnly="true"
default="unbounded-queue-thread-pool"/>
+ <c:simple-property name="__type" readOnly="true"
default="unbounded-queue-thread-pool"/>
</c:template>
</resource-configuration>
</service>
@@ -12555,17 +12596,37 @@
<service name="Path"
discovery="SubsystemDiscovery"
- class="BaseComponent"
- createDeletePolicy="both"
- singleton="true">
+ class="TemplatedComponent"
+ createDeletePolicy="both">
<plugin-configuration>
- <c:simple-property name="path" readOnly="true"
default="path=journal-directory"/>
+ <c:simple-property name="path" readOnly="true"
default="path"/>
</plugin-configuration>
<resource-configuration>
<c:simple-property name="path" required="true"
type="string" readOnly="false" description="The actual filesystem
path. Treated as an absolute path, unless the 'relative-to'
attribute is specified, in which case the value is treated as relative to that path.
<p>If treated as an absolute path, the actual runtime pathname specified by
the value of this attribute will be determined as follows: </p>If
this value is already absolute, then the value is directly used. Otherwise the runtime
pathname is resolved in a system-dependent way. On UNIX systems, a relative
pathname is made absolute by resolving it against the current user directory. On Microsoft
Windows systems, a relative pathname is made absolute by resolving it against the current
directory of the drive named by the pathname, if any; if not, it is resolved against the
current user directory."/>
<c:simple-property name="relative-to" required="false"
type="string" readOnly="false" description="The name of another
previously named path, or of one of the standard paths provided by the system. If
'relative-to' is provided, the value of the
'path' attribute is treated as relative to the path specified by this
attribute. The standard paths provided by the system
include:<ul><li>jboss.home - the root
directory of the JBoss AS distribution</li><li>user.home
- user's home directory</li><li>user.dir
- user's current working
directory</li><li>java.home - java installation
directory</li><li>jboss.server.base.dir - root
directory for an individual server
instance</li><li>jboss.server.data.dir - directory the
server will use for persistent data file
storage</li><li>jboss.server.log.dir - directory the
server will use for log file
storage</li><li>jboss.server.tmp.dir - directory the
server will use for temporary file
storage</li><li>jboss.domain.servers.dir - directory
under which a host controller will create the working area for individual server
instances</li></ul>"/>
+
+ <c:simple-property name="__name" readOnly="true"
displayName="Path Type" description="Path Type">
+ <c:property-options>
+ <c:option value="journal-directory"/>
+ <c:option value="paging-directory"/>
+ <c:option value="large-messages-directory"/>
+ <c:option value="bindings-directory"/>
+ </c:property-options>
+ </c:simple-property>
+ <c:template name="Journal Directory" description="The
directory in which the message journal lives. The default is
${jboss.server.data.dir}/messaging/journal.">
+ <c:simple-property name="__name" readOnly="true"
default="journal-directory"/>
+ </c:template>
+ <c:template name="Paging Directory" description="The
directory where page files are stored. The default is
${jboss.server.data.dir}/messaging/paging.">
+ <c:simple-property name="__name" readOnly="true"
default="paging-directory"/>
+ </c:template>
+ <c:template name="Large Messages Directory" description="The
directory in which large messages are stored. The default is
${jboss.server.data.dir}/messaging/largemessages.">
+ <c:simple-property name="__name" readOnly="true"
default="large-messages-directory"/>
+ </c:template>
+ <c:template name="Bindings Directory" description="The
directory in which the bindings journal lives. The default is
${jboss.server.data.dir}/messaging/bindings.">
+ <c:simple-property name="__name" readOnly="true"
default="bindings-directory"/>
+ </c:template>
</resource-configuration>
</service>