[rhq] Branch 'mazz/test-rhq-on-as7' - modules/enterprise
by mazz
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 7590d261fd66aedb93c6c310c62a99e8e2cb10bf
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Jul 20 17:14:55 2012 -0400
fix typo
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java
index f93b823..0fc0215 100644
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java
+++ b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java
@@ -475,7 +475,7 @@ public class Installer implements EntryPoint {
});
serverSettingWebSecureHttpPort = new SpinnerItem(ServerProperties.PROP_WEB_HTTPS_PORT,
- PROPS_MSG.rhq_server_startup_web_http_port());
+ PROPS_MSG.rhq_server_startup_web_https_port());
serverSettingWebSecureHttpPort.setWidth(fieldWidth);
serverSettingWebSecureHttpPort.setMin(1);
serverSettingWebSecureHttpPort.setMax(65535);
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - 2 commits - modules/enterprise modules/plugins
by snegrea
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java | 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java | 7
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java | 2
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java | 320 ++++++++++
modules/plugins/jboss-as-7/src/test/resources/itest/test-simple-2.war |binary
5 files changed, 325 insertions(+), 6 deletions(-)
New commits:
commit 17db07284817d0eeeb78a32fa66d7e64f40e5415
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 16:05:42 2012 -0500
[BZ 829751] - Make sure deploying a package updates the internal info
about it.(cherry picked from commit 2a2102df22a4c87662e80e5704a2e8302ce0377d)
Conflicts:
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java (used new file)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index 529ac32..8923398 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -848,7 +848,7 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
return bits.getBlob().getBits();
} catch (Exception e) {
throw new RuntimeException("Unable to retrieve package bits for resource: " + resourceId + " and package: "
- + installedPackageId + " before timeout.");
+ + installedPackageId + ".", e);
}
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java
index 3f26cec..667bf06 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/DeploymentComponent.java
@@ -164,6 +164,8 @@ public class DeploymentComponent extends BaseComponent<ResourceComponent<?>> imp
try {
redeployOnServer(detail.getKey().getName(), hash);
response.setOverallRequestResult(ContentResponseResult.SUCCESS);
+ //we just deployed a different file on the AS7 server, so let's refresh ourselves
+ deploymentFile = determineDeploymentFile();
DeployIndividualPackageResponse packageResponse = new DeployIndividualPackageResponse(detail.getKey(), ContentResponseResult.SUCCESS);
response.addPackageResponse(packageResponse);
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java
new file mode 100644
index 0000000..655b0a3
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java
@@ -0,0 +1,320 @@
+/*
+ * 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.itest.standalone;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Set;
+
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import org.rhq.core.clientapi.agent.inventory.CreateResourceRequest;
+import org.rhq.core.clientapi.agent.inventory.CreateResourceResponse;
+import org.rhq.core.clientapi.agent.inventory.DeleteResourceRequest;
+import org.rhq.core.clientapi.server.content.ContentDiscoveryReport;
+import org.rhq.core.clientapi.server.content.ContentServiceResponse;
+import org.rhq.core.clientapi.server.content.DeployPackagesRequest;
+import org.rhq.core.clientapi.server.content.RetrievePackageBitsRequest;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.modules.plugins.jbossas7.StandaloneASComponent;
+import org.rhq.modules.plugins.jbossas7.itest.AbstractJBossAS7PluginTest;
+import org.rhq.test.arquillian.DiscoveredResources;
+import org.rhq.test.arquillian.ResourceComponentInstances;
+import org.rhq.test.arquillian.RunDiscovery;
+import org.rhq.test.arquillian.ServerServicesSetup;
+
+/**
+ *
+ *
+ * @author Lukas Krejci
+ */
+@Test(groups = { "integration", "pc", "standalone" }, singleThreaded = true)
+public class DeploymentTest extends AbstractJBossAS7PluginTest {
+
+ private enum TestDeployments {
+ DEPLOYMENT_1("test-simple.war"), DEPLOYMENT_2("test-simple-2.war");
+
+ private String deploymentName;
+ private String resourcePath;
+ private byte[] hash;
+
+ private TestDeployments(String warName) {
+ this.deploymentName = warName;
+ this.resourcePath = "itest/" + warName;
+ hash = computeHash(DeploymentTest.class.getClassLoader().getResourceAsStream(resourcePath));
+ }
+
+ public String getDeploymentName() {
+ return deploymentName;
+ }
+
+ public String getResourcePath() {
+ return resourcePath;
+ }
+
+ public byte[] getHash() {
+ return hash;
+ }
+ }
+
+ @ResourceComponentInstances(plugin = PLUGIN_NAME, resourceType = "JBossAS7 Standalone Server")
+ private Set<StandaloneASComponent> standalones;
+
+ @DiscoveredResources(plugin = PLUGIN_NAME, resourceType = "JBossAS7 Standalone Server")
+ private Set<Resource> standaloneResources;
+
+ private Resource serverResource;
+
+ @DiscoveredResources(plugin = PLUGIN_NAME, resourceType = "Deployment")
+ private Set<Resource> deploymentResources;
+
+ private static TestDeployments DEPLOYMENT_TO_SERVE = TestDeployments.DEPLOYMENT_1;
+
+ private static long copyStreamAndReturnCount(InputStream in, OutputStream out) throws IOException {
+ int data;
+ long cnt = 0;
+ while ((data = in.read()) != -1) {
+ if (out != null) {
+ out.write(data);
+ }
+ cnt++;
+ }
+
+ return cnt;
+ }
+
+ //this is no test method
+ @ServerServicesSetup
+ @Test(enabled = false)
+ public void setupContentServices() {
+ Mockito.when(
+ serverServices.getContentServerService().downloadPackageBitsForChildResource(Mockito.anyInt(),
+ Mockito.anyString(), Mockito.any(PackageDetailsKey.class), Mockito.any(OutputStream.class))).then(
+ new Answer<Long>() {
+ @Override
+ public Long answer(InvocationOnMock invocation) throws Throwable {
+ InputStream str = getClass().getClassLoader().getResourceAsStream(DEPLOYMENT_TO_SERVE.getResourcePath());
+ OutputStream out = (OutputStream) invocation.getArguments()[invocation.getArguments().length - 1];
+ return copyStreamAndReturnCount(str, out);
+ }
+ });
+
+ Mockito.when(serverServices.getContentServerService().downloadPackageBitsGivenResource(Mockito.anyInt(), Mockito.any(PackageDetailsKey.class), Mockito.any(OutputStream.class))).then(new Answer<Long>() {
+ @Override
+ public Long answer(InvocationOnMock invocation) throws Throwable {
+ InputStream str = getClass().getClassLoader().getResourceAsStream(DEPLOYMENT_TO_SERVE.getResourcePath());
+ OutputStream out = (OutputStream) invocation.getArguments()[invocation.getArguments().length - 1];
+ return copyStreamAndReturnCount(str, out);
+ }
+ });
+ }
+
+ @Test(priority = 10)
+ @RunDiscovery
+ public void assignServerResource() {
+ assert standalones != null && standalones.size() == 1 : "Exactly 1 AS7 standalone server component should be present.";
+ assert standaloneResources != null && standaloneResources.size() == 1 : "Exactly 1 AS7 standalone server resource should be present.";
+ serverResource = standaloneResources.iterator().next();
+ }
+
+ //(dependsOnMethods = "assignServerResource")
+ @Test(priority = 11)
+ public void testDeploy() throws Exception {
+ ResourcePackageDetails packageDetails = getTestDeploymentPackageDetails(TestDeployments.DEPLOYMENT_1);
+
+ Configuration deploymentConfig = new Configuration();
+ deploymentConfig.put(new PropertySimple("runtimeName", packageDetails.getName()));
+
+ CreateResourceRequest request = new CreateResourceRequest();
+ request.setPackageDetails(packageDetails);
+ request.setParentResourceId(serverResource.getId());
+ request.setPluginConfiguration(null);
+ request.setPluginName(PLUGIN_NAME);
+ request.setResourceConfiguration(deploymentConfig);
+ request.setResourceName(packageDetails.getName());
+ request.setResourceTypeName("Deployment");
+
+ CreateResourceResponse response =
+ pluginContainer.getResourceFactoryManager().executeCreateResourceImmediately(request);
+
+ assert response.getStatus() == CreateResourceStatus.SUCCESS : "The deoloyment failed with an error mesasge: "
+ + response.getErrorMessage();
+ }
+
+ @Test(priority = 12)
+ public void testPackageDetectedForArchivedDeployment() throws Exception {
+ assert deploymentResources != null && deploymentResources.size() == 1 : "The new deployment should have been discovered";
+
+ Resource deployment = deploymentResources.iterator().next();
+
+ assert TestDeployments.DEPLOYMENT_1.getDeploymentName().equals(deployment.getName()) : "The deployment doesn't seem to have the expected name";
+
+ ContentDiscoveryReport report = pluginContainer.getContentManager().executeResourcePackageDiscoveryImmediately(deployment.getId(), "file");
+
+ Set<ResourcePackageDetails> details = report.getDeployedPackages();
+
+ assert details != null && details.size() == 1 : "The archived deployment should be backed by exactly 1 package.";
+
+ ResourcePackageDetails actualDetails = details.iterator().next();
+ ResourcePackageDetails expectedDetails = getTestDeploymentPackageDetails(TestDeployments.DEPLOYMENT_1);
+
+ //we don't expect the resource details to be equal, because the version field
+ //will be different - the test code simplistically just assigns "1.0"
+ //but the actual code assigns a sha256, because the test war doesn't contain
+ //explicit version information.
+ //We therefore just compare the name and type...
+ String actualName = actualDetails.getName();
+ String actualType = actualDetails.getPackageTypeName();
+ String expectedName = expectedDetails.getName();
+ String expectedType = expectedDetails.getPackageTypeName();
+
+ Assert.assertEquals(actualName, expectedName, "The deployment's package details are called differently than expected.");
+ Assert.assertEquals(actualType, expectedType, "The deployment's package details have different type than expected.");
+ }
+
+ @Test(priority = 13)
+ public void testDeploymentContentRetrieval() throws Exception {
+ testContentRetrieval(TestDeployments.DEPLOYMENT_1);
+ }
+
+ @Test(priority = 14)
+ public void testRedeploy() throws Exception {
+ Resource deployment = deploymentResources.iterator().next();
+ //we are updating the deployment 1. So provide a key to the first deployment but later on actually
+ //deliver bits of the deployment 2, so that we get the update we "wanted".
+ ResourcePackageDetails packageDetails = getTestDeploymentPackageDetails(TestDeployments.DEPLOYMENT_1);
+
+ //this is what our mocked serverside is going to serve the package bits for
+ TestDeployments origServedDeployemnt = DEPLOYMENT_TO_SERVE;
+ DEPLOYMENT_TO_SERVE = TestDeployments.DEPLOYMENT_2;
+
+ try {
+ DeployPackagesRequest request = new DeployPackagesRequest(1, deployment.getId(), Collections.singleton(packageDetails));
+
+ DeployPackagesResponse response = pluginContainer.getContentManager().deployPackagesImmediately(request);
+
+ testContentRetrieval(TestDeployments.DEPLOYMENT_2);
+ } finally {
+ //switch the served deployment back, so that other tests aren't affected
+ DEPLOYMENT_TO_SERVE = origServedDeployemnt;
+ }
+ }
+
+ @Test(priority = 15)
+ public void testUndeploy() throws Exception {
+ Resource deployment = deploymentResources.iterator().next();
+ DeleteResourceRequest request = new DeleteResourceRequest(0, deployment.getId());
+ getServerInventory().removeResource(deployment);
+ pluginContainer.getResourceFactoryManager().deleteResource(request);
+ }
+
+ private void testContentRetrieval(final TestDeployments deployment) throws Exception {
+ final boolean[] lockAndTestResult = new boolean[2];
+
+ //perform the test in the mocked server-side.
+ Mockito
+ .doAnswer(new Answer<Void>() {
+ @Override
+ public Void answer(InvocationOnMock invocation) throws Throwable {
+ InputStream data = (InputStream) invocation.getArguments()[1];
+ byte[] md5 = computeHash(data);
+
+ synchronized (lockAndTestResult) {
+ lockAndTestResult[0] = true;
+ //transfer the test result to the test thread so that
+ //the assert is captured.
+ lockAndTestResult[1] = Arrays.equals(deployment.getHash(), md5);
+ lockAndTestResult.notifyAll();
+ }
+
+ return null;
+ }
+ })
+ .when(serverServices.getContentServerService())
+ .completeRetrievePackageBitsRequest(Mockito.any(ContentServiceResponse.class),
+ Mockito.any(InputStream.class));
+
+ //setup the content retrieval request and execute it
+ Resource deploymentResource = deploymentResources.iterator().next();
+ RetrievePackageBitsRequest request =
+ new RetrievePackageBitsRequest(0, deploymentResource.getId(), getTestDeploymentPackageDetails(deployment));
+ pluginContainer.getContentManager().retrievePackageBits(request);
+
+ //the content retrieval is async so wait in the test method until the mocked server-side
+ //completed the test (unless it has already done so).
+ synchronized (lockAndTestResult) {
+ if (!lockAndTestResult[0]) {
+ lockAndTestResult.wait();
+ }
+ assert lockAndTestResult[1] : "The data obtained from the deployment are different to what should have been deployed.";
+ }
+ }
+
+ private ResourcePackageDetails getTestDeploymentPackageDetails(TestDeployments deployment) {
+ ResourcePackageDetails details = new ResourcePackageDetails(new PackageDetailsKey(deployment.getDeploymentName(), "1.0", "file", "noarch"));
+ details.setFileName(deployment.getDeploymentName());
+ details.setDeploymentTimeConfiguration(new Configuration());
+
+ return details;
+
+ }
+
+ private static byte[] computeHash(InputStream str) {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ try {
+ int data;
+ while ((data = str.read()) != -1) {
+ out.write(data);
+ }
+
+ return MessageDigest.getInstance("md5").digest(out.toByteArray());
+ } catch (IOException e) {
+ throw new IllegalStateException("Could not determine the MD5 of the test deployment.", e);
+ } catch (NoSuchAlgorithmException e) {
+ throw new IllegalStateException(
+ "Could not instantiate MD5 message digest algorithm, this should not happen.", e);
+ } finally {
+ try {
+ out.close();
+ } catch (IOException e) {
+ }
+ try {
+ str.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+}
diff --git a/modules/plugins/jboss-as-7/src/test/resources/itest/test-simple-2.war b/modules/plugins/jboss-as-7/src/test/resources/itest/test-simple-2.war
new file mode 100644
index 0000000..67fb7a0
Binary files /dev/null and b/modules/plugins/jboss-as-7/src/test/resources/itest/test-simple-2.war differ
commit d8c04da7d41cdda28e5e5f912dec936528d115dd
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Jul 20 16:01:56 2012 -0500
BZ 829394 Use the name from resource key, as this is available in UI and CLI
(cherry picked from commit e1f5fb046fb207ffefbb8c9bb7d15d2634f0dbba)
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
index 1139b1c..638dd1c 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseComponent.java
@@ -404,11 +404,8 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone
return report;
}
- String fileName = details.getFileName();
-
- if (fileName.startsWith("C:\\fakepath\\")) { // TODO this is a hack as the server adds the fake path somehow
- fileName = fileName.substring("C:\\fakepath\\".length());
- }
+ // Key is available from UI and CLI
+ String fileName = details.getKey().getName();
String runtimeName = report.getPackageDetails().getDeploymentTimeConfiguration().getSimpleValue("runtimeName");
if (runtimeName == null || runtimeName.isEmpty()) {
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - 5 commits - modules/plugins
by snegrea
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>
11 years, 9 months
[rhq] 3 commits - modules/core modules/plugins
by Heiko W. Rupp
modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java | 9 +
modules/core/native-system/src/main/java/org/rhq/core/system/pquery/ProcessInfoQuery.java | 2
modules/core/native-system/src/test/java/org/rhq/core/system/pquery/ProcessInfoQueryTest.java | 55 ++++++++++
modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/ObjectNameQueryUtilityTest.java | 13 ++
4 files changed, 76 insertions(+), 3 deletions(-)
New commits:
commit 4f7c64deab774aee682daa5c37352509ed0422ac
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Jul 20 11:31:48 2012 -0400
BZ 839080 - accept pid files that also contain whitespace or line endings (\n \r )
diff --git a/modules/core/native-system/src/main/java/org/rhq/core/system/pquery/ProcessInfoQuery.java b/modules/core/native-system/src/main/java/org/rhq/core/system/pquery/ProcessInfoQuery.java
index 82486ca..1e9eeb3 100644
--- a/modules/core/native-system/src/main/java/org/rhq/core/system/pquery/ProcessInfoQuery.java
+++ b/modules/core/native-system/src/main/java/org/rhq/core/system/pquery/ProcessInfoQuery.java
@@ -470,6 +470,6 @@ public class ProcessInfoQuery {
contents = "";
}
- return contents;
+ return contents.trim();
}
}
\ No newline at end of file
diff --git a/modules/core/native-system/src/test/java/org/rhq/core/system/pquery/ProcessInfoQueryTest.java b/modules/core/native-system/src/test/java/org/rhq/core/system/pquery/ProcessInfoQueryTest.java
index bc8d77d..466983a 100644
--- a/modules/core/native-system/src/test/java/org/rhq/core/system/pquery/ProcessInfoQueryTest.java
+++ b/modules/core/native-system/src/test/java/org/rhq/core/system/pquery/ProcessInfoQueryTest.java
@@ -291,6 +291,61 @@ public class ProcessInfoQueryTest {
}
/**
+ * Test PID files.
+ *
+ * @throws Exception
+ */
+ public void testPIQLPidfileNL() throws Exception {
+ File pidfile = File.createTempFile("test", ".pid");
+ try {
+ FileOutputStream fos = new FileOutputStream(pidfile);
+ fos.write("3\n".getBytes());
+ fos.flush();
+ fos.close();
+
+ results = query.query("process|pidfile|match=" + pidfile.getCanonicalPath());
+ assert results.size() == 1 : results;
+ assertPidExists(3, results, "pidfile had pid #3 in it and should have matched pid 3");
+
+ results = query.query("process|pidfile|nomatch=" + pidfile.getCanonicalPath());
+ assert results.size() == (query.getProcesses().size() - 1) : "should match all but pid 3:" + results;
+ assertPidDoesNotExist(3, results, "pidfile had pid #3 in it so .ne should not have matched pid 3");
+
+ results = query.query("process|pidfile|match|parent=" + pidfile.getCanonicalPath());
+ assert results.size() == 2 : "there are two child procs of parent process found in pidfile:" + results;
+ assertPidExists(4, results, "");
+ assertPidExists(5, results, "");
+ } finally {
+ pidfile.delete();
+ }
+ }
+
+ public void testPIQLPidfileNLLF() throws Exception {
+ File pidfile = File.createTempFile("test", ".pid");
+ try {
+ FileOutputStream fos = new FileOutputStream(pidfile);
+ fos.write("3\r\n".getBytes());
+ fos.flush();
+ fos.close();
+
+ results = query.query("process|pidfile|match=" + pidfile.getCanonicalPath());
+ assert results.size() == 1 : results;
+ assertPidExists(3, results, "pidfile had pid #3 in it and should have matched pid 3");
+
+ results = query.query("process|pidfile|nomatch=" + pidfile.getCanonicalPath());
+ assert results.size() == (query.getProcesses().size() - 1) : "should match all but pid 3:" + results;
+ assertPidDoesNotExist(3, results, "pidfile had pid #3 in it so .ne should not have matched pid 3");
+
+ results = query.query("process|pidfile|match|parent=" + pidfile.getCanonicalPath());
+ assert results.size() == 2 : "there are two child procs of parent process found in pidfile:" + results;
+ assertPidExists(4, results, "");
+ assertPidExists(5, results, "");
+ } finally {
+ pidfile.delete();
+ }
+ }
+
+ /**
* Test regular expressions.
*/
public void testPIQLProcessNameRegularExpression() {
commit c5d2853bba213e53a2e50b1e67394f32b1f43fc1
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jul 18 16:00:02 2012 -0400
Explicitly remove availability entries, as there is no cascade delete from resource to availability.
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java
index b2eddb3..d6bf7c1 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright (C) 2011-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -34,11 +34,11 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode;
+import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.shared.ResourceBuilder;
import org.rhq.core.domain.shared.ResourceTypeBuilder;
-import org.rhq.core.domain.test.AbstractEJB3Test;
import org.rhq.test.TransactionCallback;
public class JPADriftChangeSetTest extends DriftDataAccessTest {
@@ -79,6 +79,11 @@ public class JPADriftChangeSetTest extends DriftDataAccessTest {
private void purgeDB() {
EntityManager em = getEntityManager();
+ List<Availability> avails = (List<Availability>) em.createQuery("SELECT a FROM Availability a").getResultList();
+ for (Availability a : avails) {
+ em.remove(a);
+ }
+
List<Resource> resources = (List<Resource>) em.createQuery("from Resource where resourceType.name = :name")
.setParameter("name", RESOURCE_TYPE_NAME).getResultList();
for (Resource resource : resources) {
commit 82777d7d70ec46338aaa1b662099b0dcb653c67d
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jul 18 15:44:03 2012 -0400
Test very long tokens.
diff --git a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/ObjectNameQueryUtilityTest.java b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/ObjectNameQueryUtilityTest.java
index a7e9f77..93bd5b8 100644
--- a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/ObjectNameQueryUtilityTest.java
+++ b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/ObjectNameQueryUtilityTest.java
@@ -76,6 +76,19 @@ public class ObjectNameQueryUtilityTest {
onqu = new ObjectNameQueryUtility("a:b=c,d={e},f={g}", c);
System.out.println("Template: " + onqu.getQueryTemplate());
assert onqu.getQueryTemplate().equals("a:b=c,d=foo,f=bar");
+
+ // Test some very long replacement tokens inspired by BZ 828596
+ onqu = new ObjectNameQueryUtility("*:type=HttpMetricInspector,name=%name%");
+ assert onqu.getQueryTemplate().equals("*:type=HttpMetricInspector,name=%name%");
+ assert onqu.getVariableProperties().size() == 1;
+ assert onqu.getVariableProperties().get("name").equals("name");
+ testON = new ObjectName("FooBarABCDEFGHIJKLMNOPQRSTUVWXYZ:type=HttpMetricInspector,name=ABCDEFGHIJKLMNOPQRSTUVWXYZöABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ onqu.setMatchedKeyValues(testON.getKeyPropertyList());
+ formulatedMessageTemplate = "Http metrics for endpoint {name}";
+ String res = onqu.formatMessage(formulatedMessageTemplate);
+ assert res.equals("Http metrics for endpoint ABCDEFGHIJKLMNOPQRSTUVWXYZöABCDEFGHIJKLMNOPQRSTUVWXYZ") : res;
+
+
}
@Test
11 years, 9 months
[rhq] Branch 'jsanda/metrics-rhq' - modules/core
by John Sanda
modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 1aa2b84cf8896c1d783580d215d916ca545ca79f
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Jul 20 11:24:29 2012 -0400
fix bug for setting default metrics server plugin
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml b/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
index 569c1c8..4536167 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/sysconfig-data.xml
@@ -133,7 +133,7 @@
<data ID="58" PROPERTY_KEY="DRIFT_FILE_PURGE" PROPERTY_VALUE="2678400000"
DEFAULT_PROPERTY_VALUE="2678400000" FREAD_ONLY="FALSE"/>
- <data ID="59" PROPERTY_KEY="ACTIVE_METRICS_PLUGIN" PROPERTY_VALUE="drift-jpa"
+ <data ID="59" PROPERTY_KEY="ACTIVE_METRICS_PLUGIN" PROPERTY_VALUE="metrics-rhq"
DEFAULT_PROPERTY_VALUE="metrics-rhq" FREAD_ONLY="FALSE"/>
</table>
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - modules/enterprise
by John Sanda
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplatesView.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java | 32 ++++++----
2 files changed, 21 insertions(+), 13 deletions(-)
New commits:
commit 089c8ccc9ea18c2971e270ff0b85b82576040da4
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu Jun 14 07:12:22 2012 -0400
[BZ 831603] Do not allow plugin defined templates to be deleted
DriftTemplateManagerBean now throws an IllegalArgumentException if you
try to delete a plugin defined template. The delete action in the
templates ui is now disabled for plugin defined templates.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplatesView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplatesView.java
index a3ffed1..ab60c35 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplatesView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/drift/DriftDefinitionTemplatesView.java
@@ -167,7 +167,7 @@ public class DriftDefinitionTemplatesView extends TableSection<DriftDefinitionTe
for (ListGridRecord record : selection) {
if (!record.getAttributeAsBoolean(DriftDefinitionTemplateDataSource.ATTR_IS_USER_DEFINED)
.booleanValue()) {
- break;
+ return false;
}
}
result = true;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
index 9a1c980..528fd7a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
@@ -19,11 +19,26 @@
package org.rhq.enterprise.server.drift;
+import static javax.ejb.TransactionAttributeType.NEVER;
+import static org.rhq.core.domain.common.EntityContext.forResource;
+import static org.rhq.core.domain.drift.DriftChangeSetCategory.COVERAGE;
+import static org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode.normal;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.DriftDefinitionCriteria;
import org.rhq.core.domain.criteria.DriftDefinitionTemplateCriteria;
-import org.rhq.core.domain.drift.*;
+import org.rhq.core.domain.drift.DriftDefinition;
+import org.rhq.core.domain.drift.DriftDefinitionComparator;
+import org.rhq.core.domain.drift.DriftDefinitionTemplate;
+import org.rhq.core.domain.drift.DriftSnapshot;
+import org.rhq.core.domain.drift.DriftSnapshotRequest;
import org.rhq.core.domain.drift.dto.DriftChangeSetDTO;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageList;
@@ -34,17 +49,6 @@ import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionAttribute;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import static javax.ejb.TransactionAttributeType.NEVER;
-import static org.rhq.core.domain.common.EntityContext.forResource;
-import static org.rhq.core.domain.drift.DriftChangeSetCategory.COVERAGE;
-import static org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode.normal;
-
@Stateless
public class DriftTemplateManagerBean implements DriftTemplateManagerLocal, DriftTemplateManagerRemote {
@@ -164,6 +168,10 @@ public class DriftTemplateManagerBean implements DriftTemplateManagerLocal, Drif
@Override
public void deleteTemplate(Subject subject, int templateId) {
DriftDefinitionTemplate template = entityMgr.find(DriftDefinitionTemplate.class, templateId);
+ if (!template.isUserDefined()) {
+ throw new IllegalArgumentException(template.getName() + " is a plugin defined template. Plugin defined " +
+ "templates cannot be deleted.");
+ }
for (DriftDefinition defintion : template.getDriftDefinitions()) {
if (defintion.isAttached()) {
driftMgr.deleteDriftDefinition(subject, forResource(defintion.getResource().getId()), defintion
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - modules/core
by John Sanda
modules/core/domain/src/main/java/org/rhq/core/domain/resource/CannotConnectToAgentException.java | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit b02bb857d82472f400eeaa0f112e727290c5b7e9
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Jun 5 10:42:27 2012 -0400
[BZ 822299] changing servialVersionUID to be consistent
Conflicts:
modules/core/domain/src/main/java/org/rhq/core/domain/resource/CannotConnectToAgentException.java
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CannotConnectToAgentException.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CannotConnectToAgentException.java
index 709f5a4..6477b5d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CannotConnectToAgentException.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CannotConnectToAgentException.java
@@ -24,10 +24,16 @@ package org.rhq.core.domain.resource;
import javax.ejb.ApplicationException;
/**
+ * This exception should be throw when invoking an agent service fails because the agent is
+ * down or otherwise unreachable. This class is defined in the in the domain module instead
+ * of the server/jar module because it needs to be accessible by the UI.
+ *
* @author John Sanda
*/
@ApplicationException(rollback = true)
public class CannotConnectToAgentException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
public CannotConnectToAgentException() {
super();
}
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - modules/core modules/enterprise
by John Sanda
modules/core/domain/pom.xml | 7
modules/core/domain/src/main/java/org/rhq/core/domain/resource/CannotConnectToAgentException.java | 46 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java | 264 ++--------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryImportWizard.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java | 10
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 7
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 3
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java | 48 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java | 23
14 files changed, 235 insertions(+), 203 deletions(-)
New commits:
commit 65db439bacb243ee8ffdb937329324c1b62dff00
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Jun 4 15:58:10 2012 -0400
[BZ 822299] Display better error message and no exception when agent is unreachable
This commit introduces the class CannotConnectToAgentException which is
a wrapper around the CannotConnectException that gets thrown when a
request is sent to an agent that is down or otherwise unreachable.
Previously we just propagated the exception up the call stack. In the
UI, we were handling as a generic RuntimeException and also showing the
exception stack trace in the message center. With this commit we no
longer log the exception in the UI and instead just log a more
informative warning message. This change effects manual import, resource
create, and resource delete.
Conflicts:
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index 7006397..628cfff 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -66,6 +66,13 @@
<!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
</dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3x</artifactId>
+ <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
+ <scope>provided</scope> <!-- by JBossAS -->
+ </dependency>
+
<!-- needed for hibernate Instrument task
<dependency>
<groupId>javassist</groupId>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CannotConnectToAgentException.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CannotConnectToAgentException.java
new file mode 100644
index 0000000..709f5a4
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/CannotConnectToAgentException.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * * 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.core.domain.resource;
+
+import javax.ejb.ApplicationException;
+
+/**
+ * @author John Sanda
+ */
+@ApplicationException(rollback = true)
+public class CannotConnectToAgentException extends RuntimeException {
+ public CannotConnectToAgentException() {
+ super();
+ }
+
+ public CannotConnectToAgentException(String message) {
+ super(message);
+ }
+
+ public CannotConnectToAgentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CannotConnectToAgentException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
index 27abb56..001eb3c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceCompositeSearchView.java
@@ -22,7 +22,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
@@ -36,13 +35,12 @@ import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.CannotConnectToAgentException;
import org.rhq.core.domain.resource.DeleteResourceHistory;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.composite.ResourcePermission;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.table.AbstractTableAction;
import org.rhq.enterprise.gui.coregui.client.components.table.TableActionEnablement;
@@ -50,7 +48,6 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryCreateWizard;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.factory.ResourceFactoryImportWizard;
-import org.rhq.enterprise.gui.coregui.client.util.Log;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.TableUtility;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
@@ -62,19 +59,11 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message.Severity;
public class ResourceCompositeSearchView extends ResourceSearchView {
private final ResourceComposite parentResourceComposite;
- private boolean initialized;
- private List<Resource> singletonChildren;
- private Set<ResourceType> creatableChildTypes;
- private Set<ResourceType> importableChildTypes;
- private boolean hasCreatableTypes;
- private boolean hasImportableTypes;
- private boolean canCreate;
public ResourceCompositeSearchView(String locatorId, ResourceComposite parentResourceComposite, Criteria criteria,
String title, SortSpecifier[] sortSpecifier, String[] excludeFields, String... headerIcons) {
super(locatorId, criteria, title, sortSpecifier, excludeFields, headerIcons);
this.parentResourceComposite = parentResourceComposite;
- this.canCreate = this.parentResourceComposite.getResourcePermission().isCreateChildResources();
setInitialCriteriaFixed(true);
}
@@ -83,56 +72,6 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
this(locatorId, parentResourceComposite, criteria, title, null, null, headerIcons);
}
- @Override
- protected void onInit() {
- super.onInit();
-
- // To properly filter Create Child and Import menus we need existing singleton child resources. If the
- // user has creat permission and the parent type has singleton child types and creatable or importable child
- // types, perform an async call to fetch the singleton children. If we make the async call don't declare this
- // instance initialized until after it completesas we must have the children before the menu buttons can be drawn.
-
- final Resource parentResource = parentResourceComposite.getResource();
- ResourceType parentType = parentResource.getResourceType();
-
- creatableChildTypes = getCreatableChildTypes(parentType);
- importableChildTypes = getImportableChildTypes(parentType);
- hasCreatableTypes = !creatableChildTypes.isEmpty();
- hasImportableTypes = !importableChildTypes.isEmpty();
- singletonChildren = new ArrayList(); // initialize to non-null
-
- Integer[] singletonChildTypes = getSingletonChildTypes(parentType);
-
- if (canCreate && singletonChildTypes.length > 0 && (hasCreatableTypes || hasImportableTypes)) {
- ResourceCriteria criteria = new ResourceCriteria();
- criteria.addFilterParentResourceId(parentResource.getId());
- criteria.addFilterResourceTypeIds(singletonChildTypes);
- GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
- new AsyncCallback<PageList<Resource>>() {
-
- @Override
- public void onSuccess(PageList<Resource> result) {
- singletonChildren = result;
- initialized = true;
- }
-
- @Override
- public void onFailure(Throwable caught) {
- Log.error("Failed to load child resources for [" + parentResource + "]", caught);
- initialized = true;
- }
- });
-
- } else {
- initialized = true;
- }
- }
-
- @Override
- public boolean isInitialized() {
- return super.isInitialized() && this.initialized;
- }
-
// suppress unchecked warnings because the superclass has different generic types for the datasource
@SuppressWarnings("unchecked")
@Override
@@ -142,154 +81,105 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
@Override
protected void configureTable() {
- addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(),
- MSG.view_inventory_resources_deleteConfirm(), new AbstractTableAction(TableActionEnablement.ANY) {
-
- // only enabled if all selected are a deletable type and if the user has delete permission
- // on the resources.
- public boolean isEnabled(ListGridRecord[] selection) {
- boolean isEnabled = super.isEnabled(selection);
-
- if (isEnabled) {
- for (ListGridRecord record : selection) {
- ResourceComposite resComposite = (ResourceComposite) record
- .getAttributeAsObject("resourceComposite");
- Resource res = resComposite.getResource();
- if (!(isEnabled = res.getResourceType().isDeletable())) {
- break;
- }
- ResourcePermission resPermission = resComposite.getResourcePermission();
- if (!(isEnabled = resPermission.isDeleteResource())) {
- break;
- }
+ addTableAction(extendLocatorId("Delete"), MSG.common_button_delete(), MSG
+ .view_inventory_resources_deleteConfirm(), new AbstractTableAction(TableActionEnablement.ANY) {
+
+ // only enabled if all selected are a deletable type and if the user has delete permission
+ // on the resources.
+ public boolean isEnabled(ListGridRecord[] selection) {
+ boolean isEnabled = super.isEnabled(selection);
+
+ if (isEnabled) {
+ for (ListGridRecord record : selection) {
+ ResourceComposite resComposite = (ResourceComposite) record
+ .getAttributeAsObject("resourceComposite");
+ Resource res = resComposite.getResource();
+ if (!(isEnabled = res.getResourceType().isDeletable())) {
+ break;
+ }
+ ResourcePermission resPermission = resComposite.getResourcePermission();
+ if (!(isEnabled = resPermission.isDeleteResource())) {
+ break;
}
}
- return isEnabled;
}
+ return isEnabled;
+ }
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- int[] resourceIds = TableUtility.getIds(selection);
- ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ int[] resourceIds = TableUtility.getIds(selection);
+ ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();
- resourceManager.deleteResources(resourceIds, new AsyncCallback<List<DeleteResourceHistory>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_deleteFailed(),
- caught);
+ resourceManager.deleteResources(resourceIds, new AsyncCallback<List<DeleteResourceHistory>>() {
+ public void onFailure(Throwable caught) {
+ if (caught instanceof CannotConnectToAgentException) {
+ CoreGUI.getMessageCenter().notify(new Message(MSG.view_inventory_resources_deleteFailed2(),
+ Severity.Warning));
+ } else {
+ CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_deleteFailed(), caught);
}
+ }
- public void onSuccess(List<DeleteResourceHistory> result) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_inventory_resources_deleteSuccessful(), Severity.Info));
+ public void onSuccess(List<DeleteResourceHistory> result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_inventory_resources_deleteSuccessful(), Severity.Info));
- refresh(true);
- // refresh the entire gui so it encompasses any relevant tree view. Don't just call this.refresh(),
- // because CoreGUI.refresh is more comprehensive.
- CoreGUI.refresh();
- }
- });
- }
- });
+ refresh(true);
+ // refresh the entire gui so it encompasses any relevant tree view. Don't just call this.refresh(),
+ // because CoreGUI.refresh is more comprehensive.
+ CoreGUI.refresh();
+ }
+ });
+ }
+ });
- addImportAndCreateButtons();
+ if (this.parentResourceComposite.getResourcePermission().isCreateChildResources()) {
+ addImportButton();
+ }
super.configureTable();
}
@SuppressWarnings("unchecked")
- private void addImportAndCreateButtons() {
-
- final Resource parentResource = parentResourceComposite.getResource();
- ResourceType parentType = parentResource.getResourceType();
-
- // Create Child Menu and Manual Import Menu
- if (canCreate && (hasCreatableTypes || hasImportableTypes)) {
-
- if (hasCreatableTypes) {
- Map<String, ResourceType> displayNameMap = getDisplayNames(creatableChildTypes);
- LinkedHashMap<String, ResourceType> createTypeValueMap = new LinkedHashMap<String, ResourceType>(
- displayNameMap);
- removeExistingSingletons(singletonChildren, createTypeValueMap);
- addTableAction(extendLocatorId("CreateChild"), MSG.common_button_create_child(), null,
- createTypeValueMap, new AbstractTableAction(TableActionEnablement.ALWAYS) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- ResourceFactoryCreateWizard.showCreateWizard(parentResource, (ResourceType) actionValue);
- // we can refresh the table buttons immediately since the wizard is a dialog, the
- // user can't access enabled buttons anyway.
- ResourceCompositeSearchView.this.refreshTableInfo();
- }
- });
- }
+ private void addImportButton() {
+ ResourceType parentType = parentResourceComposite.getResource().getResourceType();
- if (hasImportableTypes) {
- Map<String, ResourceType> displayNameMap = getDisplayNames(importableChildTypes);
- LinkedHashMap<String, ResourceType> importTypeValueMap = new LinkedHashMap<String, ResourceType>(
- displayNameMap);
- removeExistingSingletons(singletonChildren, importTypeValueMap);
- addTableAction(extendLocatorId("Import"), MSG.common_button_import(), null, importTypeValueMap,
- new AbstractTableAction(TableActionEnablement.ALWAYS) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- ResourceFactoryImportWizard.showImportWizard(parentResource, (ResourceType) actionValue);
- // we can refresh the table buttons immediately since the wizard is a dialog, the
- // user can't access enabled buttons anyway.
- ResourceCompositeSearchView.this.refreshTableInfo();
- }
- });
- }
+ // manual import type menu
+ Set<ResourceType> importableChildTypes = getImportableChildTypes(parentType);
+ if (!importableChildTypes.isEmpty()) {
+ Map<String, ResourceType> displayNames = getDisplayNames(importableChildTypes);
+ LinkedHashMap<String, ResourceType> importTypeValueMap = new LinkedHashMap<String, ResourceType>(displayNames);
- } else {
- if (!canCreate && hasCreatableTypes) {
- addTableAction(extendLocatorId("CreateChild"), MSG.common_button_create_child(),
- new AbstractTableAction(TableActionEnablement.NEVER) {
- public void executeAction(ListGridRecord[] selection, Object actionValue) {
- // never called
- }
- });
- }
- if (!canCreate && hasImportableTypes) {
- addTableAction(extendLocatorId("Import"), MSG.common_button_import(), new AbstractTableAction(
- TableActionEnablement.NEVER) {
+ addTableAction(extendLocatorId("Import"), MSG.common_button_import(), null, importTypeValueMap,
+ new AbstractTableAction(TableActionEnablement.ALWAYS) {
public void executeAction(ListGridRecord[] selection, Object actionValue) {
- // never called
+ ResourceFactoryImportWizard.showImportWizard(parentResourceComposite.getResource(),
+ (ResourceType) actionValue);
+ // we can refresh the table buttons immediately since the wizard is a dialog, the
+ // user can't access enabled buttons anyway.
+ ResourceCompositeSearchView.this.refreshTableInfo();
}
});
- }
}
- }
- private void removeExistingSingletons(List<Resource> singletonChildren, Map<String, ResourceType> displayNameMap) {
+ // creatable child type menu
+ Set<ResourceType> creatableChildTypes = getCreatableChildTypes(parentType);
+ if (!creatableChildTypes.isEmpty()) {
+ Map<String, ResourceType> displayNames = getDisplayNames(creatableChildTypes);
+ LinkedHashMap<String, ResourceType> createTypeValueMap = new LinkedHashMap<String, ResourceType>(displayNames);
- List<String> existingSingletons = new ArrayList<String>();
+ addTableAction(extendLocatorId("CreateChild"), MSG.common_button_create_child(), null, createTypeValueMap,
+ new AbstractTableAction(TableActionEnablement.ALWAYS) {
- Set<String> displayNames = displayNameMap.keySet();
- for (final String displayName : displayNames) {
- final ResourceType type = displayNameMap.get(displayName);
- boolean exists = false;
-
- if (type.isSingleton()) {
- for (Resource child : singletonChildren) {
- exists = child.getResourceType().equals(displayNameMap.get(displayName));
- if (exists) {
- existingSingletons.add(displayName);
- break;
+ public void executeAction(ListGridRecord[] selection, Object actionValue) {
+ ResourceFactoryCreateWizard.showCreateWizard(parentResourceComposite.getResource(),
+ (ResourceType) actionValue);
+ // we can refresh the table buttons immediately since the wizard is a dialog, the
+ // user can't access enabled buttons anyway.
+ ResourceCompositeSearchView.this.refreshTableInfo();
}
- }
- }
- }
- for (String existing : existingSingletons) {
- displayNameMap.remove(existing);
- }
- }
-
- private static Integer[] getSingletonChildTypes(ResourceType type) {
- Set<Integer> results = new TreeSet<Integer>();
- Set<ResourceType> childTypes = type.getChildResourceTypes();
- for (ResourceType childType : childTypes) {
- if (childType.isSingleton()) {
- results.add(childType.getId());
- }
+ });
}
-
- return results.toArray(new Integer[results.size()]);
}
private static Set<ResourceType> getImportableChildTypes(ResourceType type) {
@@ -350,8 +240,8 @@ public class ResourceCompositeSearchView extends ResourceSearchView {
// -------- Static Utility loaders ------------
public static ResourceCompositeSearchView getChildrenOf(String locatorId, ResourceComposite parentResourceComposite) {
- return new ResourceCompositeSearchView(locatorId, parentResourceComposite, new Criteria("parentId",
- String.valueOf(parentResourceComposite.getResource().getId())), MSG.view_tabs_common_child_resources());
+ return new ResourceCompositeSearchView(locatorId, parentResourceComposite, new Criteria("parentId", String
+ .valueOf(parentResourceComposite.getResource().getId())), MSG.view_tabs_common_child_resources());
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
index aeb53ce..6477ad6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryCreateWizard.java
@@ -29,6 +29,7 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.resource.CannotConnectToAgentException;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -131,7 +132,13 @@ public class ResourceFactoryCreateWizard extends AbstractResourceFactoryWizard {
deployTimeConfiguration, packageVersionId, this.getNewResourceCreateTimeout(),
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.widget_resourceFactoryWizard_execute2(), caught);
+ if (caught instanceof CannotConnectToAgentException) {
+ CoreGUI.getMessageCenter().notify(new Message(MSG.widget_resourceFactoryWizard_execute2(),
+ Message.Severity.Warning));
+ } else {
+ CoreGUI.getErrorHandler().handleError(MSG.widget_resourceFactoryWizard_execute3(), caught);
+ }
+
getView().closeDialog();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryImportWizard.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryImportWizard.java
index 721970b..da2626b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryImportWizard.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/factory/ResourceFactoryImportWizard.java
@@ -27,6 +27,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
+import org.rhq.core.domain.resource.CannotConnectToAgentException;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
@@ -89,7 +90,13 @@ public class ResourceFactoryImportWizard extends AbstractResourceFactoryWizard {
GWTServiceLookup.getResourceService(300000).manuallyAddResource(createTypeId, parentResourceId,
newConfiguration, new AsyncCallback<Resource>() {
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.widget_resourceFactoryWizard_importFailure(), caught);
+ if (caught instanceof CannotConnectToAgentException) {
+ CoreGUI.getMessageCenter().notify(new Message(
+ MSG.widget_resourceFactoryWizard_importFailure2(), Message.Severity.Warning));
+ } else {
+ CoreGUI.getErrorHandler().handleError(MSG.widget_resourceFactoryWizard_importFailure(), caught);
+ }
+
getView().closeDialog();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 1cf8d06..17ccd78 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -33,6 +33,7 @@ import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.ConfigurationTemplate;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.CannotConnectToAgentException;
import org.rhq.core.domain.resource.CreateResourceHistory;
import org.rhq.core.domain.resource.DeleteResourceHistory;
import org.rhq.core.domain.resource.InventoryStatus;
@@ -301,6 +302,9 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
newResourceTypeId, newResourceName, pluginConfig, deploymentTimeConfiguration, packageVersionId,
timeout);
} catch (Throwable t) {
+ if (t instanceof CannotConnectToAgentException) {
+ throw (CannotConnectToAgentException) t;
+ }
throw getExceptionToThrowToClient(t);
}
}
@@ -310,6 +314,9 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
return SerialUtility.prepare(resourceFactoryManager.deleteResources(getSessionSubject(), resourceIds),
"ResourceService.deleteResources");
} catch (Throwable t) {
+ if (t instanceof CannotConnectToAgentException) {
+ throw (CannotConnectToAgentException) t;
+ }
throw getExceptionToThrowToClient(t);
}
}
@@ -411,6 +418,9 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
pluginConfiguration);
return SerialUtility.prepare(result, "ResourceService.manuallyAddResource");
} catch (Throwable t) {
+ if (t instanceof CannotConnectToAgentException) {
+ throw (CannotConnectToAgentException) t;
+ }
throw getExceptionToThrowToClient(t);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index f702f49..7eb9da5 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -1527,7 +1527,8 @@ view_inventory_platforms = Platforms
view_inventory_problemGroups = Problem Groups
view_inventory_resource_loadFailed = Resource with id [{0}] does not exist or is not accessible
view_inventory_resources_deleteConfirm = Are you sure you want to delete the selected resources?
-view_inventory_resources_deleteFailed = Failed to delete the selected resources
+view_inventory_resources_deleteFailed = Failed to delete the selected resources.
+view_inventory_resources_deleteFailed2 = Failed to delete the selected resources. Cannot connect to the agent. This may indicate that the agent is down.
view_inventory_resources_deleteSuccessful = A request to perform the resource deletion has been submitted successfully to the agent(s).
view_inventory_resources_disableConfirm = Are you sure you want to disable the selected resources? While disabled availabilities reported from the agent will be ignored. Disabling can be useful for resources that are expected to be down as part of normal operations or maintenance.
view_inventory_resources_disableFailed = Failed to disable the selected resources.
@@ -1994,10 +1995,12 @@ widget_resourceFactoryWizard_createWizardTitle = Create New Resource of Type [{0
widget_resourceFactoryWizard_createWizardWindowTitle = Resource Create Wizard
widget_resourceFactoryWizard_editConfigStepName = Deployment Options
widget_resourceFactoryWizard_execute1 = Failed to create a new resource - there is no package version
-widget_resourceFactoryWizard_execute2 = Failed to create a new resource
+widget_resourceFactoryWizard_execute2 = Failed to create a new resource. Cannot connect to the agent. This may indicate that the agent is down.
+widget_resourceFactoryWizard_execute3 = Failed to create a new resource
widget_resourceFactoryWizard_failedToDeleteVersion = Failed to delete package version while canceling a resource create
widget_resourceFactoryWizard_failedToGetType = Failed to get backing package type for new resource
widget_resourceFactoryWizard_importFailure = Failed to manually import resource
+widget_resourceFactoryWizard_importFailure2 = Failed to manually import resource. Cannot connect to the agent. This may indicate that the agent is down.
widget_resourceFactoryWizard_importSubmitted = A request to import a new resource of type [{0}] has been submitted
widget_resourceFactoryWizard_importWizardTitle = Import Resource of Type [{0}]
widget_resourceFactoryWizard_importWizardWindowTitle = Resource Import Wizard
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index ea2f6d6..a485fa6 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1782,10 +1782,11 @@ widget_resourceFactoryWizard_createWizardTitle = Neue Ressource vom Typ [{0}] an
widget_resourceFactoryWizard_createWizardWindowTitle = Assistent zum Erzeugen von Ressourcen
widget_resourceFactoryWizard_editConfigStepName = Optionen für das Deployment
widget_resourceFactoryWizard_execute1 = Konnte keine neue Ressource anlegen - es wurde keien Paketversion angegeben
-widget_resourceFactoryWizard_execute2 = Konnte keine neue Ressource anlegen
+#widget_resourceFactoryWizard_execute2 = Failed to create a new resource. Cannot connect to the agent. This may indicate that the agent is down.
##widget_resourceFactoryWizard_failedToDeleteVersion = Failed to delete package version while canceling a resource create
##widget_resourceFactoryWizard_failedToGetType = Failed to get backing package type for new resource
widget_resourceFactoryWizard_importFailure = Das manuelle importieren der Ressource ist fehlgeschlagen
+#widget_resourceFactoryWizard_importFailure2 = Failed to manually import resource. Cannot connect to the agent. This may indicate that the agent is down.
widget_resourceFactoryWizard_importSubmitted = Ein Auftrag, eine neue Ressource vom Typ [{0}] wurde abgeschickt
widget_resourceFactoryWizard_importWizardTitle = Importieren von Ressourcen des Typs [{0}]
widget_resourceFactoryWizard_importWizardWindowTitle = Wizard zum Import von Ressourcen
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index e01e151..6087fc9 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -1990,10 +1990,11 @@ widget_resourceFactoryWizard_createWizardWindowTitle = リソース作成ウィ
widget_resourceFactoryWizard_editConfigStepName = 編集の構成
widget_resourceFactoryWizard_editConfigStep_nothingToDo = このリソースのために定義が必要な構成は存在しません
widget_resourceFactoryWizard_execute1 = 新規リソースの作成に失敗しました - パッケージバージョンが存在しません
-widget_resourceFactoryWizard_execute2 = 新規リソースの作成に失敗しました
+#widget_resourceFactoryWizard_execute2 = Failed to create a new resource. Cannot connect to the agent. This may indicate that the agent is down.
widget_resourceFactoryWizard_failedToDeleteVersion = リソース作成のキャンセル中にパッケージバージョンの削除に失敗しました
widget_resourceFactoryWizard_failedToGetType = 新規リソースのパッケージタイプの取得に失敗しました
widget_resourceFactoryWizard_importFailure = 手動でのリソースのインポートに失敗しました
+#widget_resourceFactoryWizard_importFailure2 = Failed to manually import resource. Cannot connect to the agent. This may indicate that the agent is down.
widget_resourceFactoryWizard_importSubmitted = 新規リソースタイプ [{0}] のインポートリクエストが送信されました
widget_resourceFactoryWizard_importWizardTitle = リソースタイプ [{0}] をインポート
widget_resourceFactoryWizard_importWizardWindowTitle = リソースインポートウィザード
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index e30bc3e..6770069 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -2105,10 +2105,11 @@ widget_resourceFactoryWizard_createWizardTitle = Criar novo recurso do tipo [{0}
widget_resourceFactoryWizard_createWizardWindowTitle = Assistente para Cria\u00E7\u00E3o de Recurso
widget_resourceFactoryWizard_editConfigStepName = Op��es de implanta��o
widget_resourceFactoryWizard_execute1 = Falha ao criar novo recurso - vers\u00E3o do pacote inexistente
-widget_resourceFactoryWizard_execute2 = Falha ao criar novo recurso
+#widget_resourceFactoryWizard_execute2 = Failed to create a new resource. Cannot connect to the agent. This may indicate that the agent is down.
widget_resourceFactoryWizard_failedToDeleteVersion = Falha ao excluir a vers\u00E3o do pacote durante o cancelamento da cria\u00E7\u00E3o do recurso
widget_resourceFactoryWizard_failedToGetType = Falha ao recuperar o tipo de pacote para o novo recurso
widget_resourceFactoryWizard_importFailure = Falha ao importar recursos manualmente
+#widget_resourceFactoryWizard_importFailure2 = Failed to manually import resource. Cannot connect to the agent. This may indicate that the agent is down.
widget_resourceFactoryWizard_importSubmitted = Uma requisi\u00E7\u00E3o para importar um novo recurso do tipo [{0}] foi submetida
widget_resourceFactoryWizard_importWizardTitle = Importar Recursos do Tipo [{0}]
widget_resourceFactoryWizard_importWizardWindowTitle = Assistente para Importa\u00E7\u00E3o de Recurso
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index a10ffaf..d799f0f 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -1994,10 +1994,11 @@
#widget_resourceFactoryWizard_createWizardWindowTitle = Resource Create Wizard
#widget_resourceFactoryWizard_editConfigStepName = Deployment Options
#widget_resourceFactoryWizard_execute1 = Failed to create a new resource - there is no package version
-#widget_resourceFactoryWizard_execute2 = Failed to create a new resource
+#widget_resourceFactoryWizard_execute2 = Failed to create a new resource. Cannot connect to the agent. This may indicate that the agent is down.
#widget_resourceFactoryWizard_failedToDeleteVersion = Failed to delete package version while canceling a resource create
#widget_resourceFactoryWizard_failedToGetType = Failed to get backing package type for new resource
#widget_resourceFactoryWizard_importFailure = Failed to manually import resource
+#widget_resourceFactoryWizard_importFailure2 = Failed to manually import resource. Cannot connect to the agent. This may indicate that the agent is down.
#widget_resourceFactoryWizard_importSubmitted = A request to import a new resource of type [{0}] has been submitted
#widget_resourceFactoryWizard_importWizardTitle = Import Resource of Type [{0}]
#widget_resourceFactoryWizard_importWizardWindowTitle = Resource Import Wizard
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 910a1a5..ffe64e2 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1988,10 +1988,11 @@ widget_resourceFactoryWizard_createWizardTitle = \u521b\u5efa\u7c7b\u578b[{0}]\u
widget_resourceFactoryWizard_createWizardWindowTitle = \u8d44\u6e90\u521b\u5efa\u5411\u5bfc
##widget_resourceFactoryWizard_editConfigStepName = Deployment Options
widget_resourceFactoryWizard_execute1 = \u521b\u5efa\u8d44\u6e90\u5931\u8d25 - \u6ca1\u6709\u5305\u7248\u672c
-widget_resourceFactoryWizard_execute2 = \u521b\u5efa\u8d44\u6e90\u5931\u8d25
+#widget_resourceFactoryWizard_execute2 = Failed to create a new resource. Cannot connect to the agent. This may indicate that the agent is down.
widget_resourceFactoryWizard_failedToDeleteVersion = \u53d6\u6d88\u521b\u5efa\u8d44\u6e90\u65f6\u65e0\u6cd5\u5220\u9664\u5305\u7684\u7248\u672c
widget_resourceFactoryWizard_failedToGetType = Failed to get backing package type for new resource
widget_resourceFactoryWizard_importFailure = \u624b\u5de5\u5bfc\u5165\u8d44\u6e90\u5931\u8d25
+#widget_resourceFactoryWizard_importFailure2 = Failed to manually import resource. Cannot connect to the agent. This may indicate that the agent is down.
widget_resourceFactoryWizard_importSubmitted = \u5bfc\u5165\u7c7b\u578b[{0}]\u7684\u65b0\u8d44\u6e90\u8bf7\u6c42\u5df2\u88ab\u63d0\u4ea4
widget_resourceFactoryWizard_importWizardTitle = \u5bfc\u5165\u7c7b\u578b[{0}]\u7684\u8d44\u6e90
widget_resourceFactoryWizard_importWizardWindowTitle = \u5bfc\u5165\u8d44\u6e90\u5411\u5bfc
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index ce4e6a7..2511d28 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
+ * Copyright (C) 2005-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -51,7 +51,10 @@ import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SimpleTrigger;
+import org.jboss.remoting.CannotConnectException;
+
import org.rhq.core.clientapi.agent.PluginContainerException;
+import org.rhq.core.clientapi.agent.discovery.DiscoveryAgentService;
import org.rhq.core.clientapi.agent.discovery.InvalidPluginConfigurationClientException;
import org.rhq.core.clientapi.agent.upgrade.ResourceUpgradeRequest;
import org.rhq.core.clientapi.agent.upgrade.ResourceUpgradeResponse;
@@ -61,9 +64,11 @@ import org.rhq.core.clientapi.server.discovery.StaleTypeException;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.discovery.MergeResourceResponse;
import org.rhq.core.domain.discovery.ResourceSyncInfo;
import org.rhq.core.domain.resource.Agent;
+import org.rhq.core.domain.resource.CannotConnectToAgentException;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.ProductVersion;
import org.rhq.core.domain.resource.Resource;
@@ -438,16 +443,28 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
+ " to manually add child resources.");
}
+ Resource parentResource = this.resourceManager.getResourceById(user, parentResourceId);
+
+ if (!resourceType.isSupportsManualAdd()) {
+ throw new RuntimeException("Cannot manually add " + resourceType + " child Resource under parent "
+ + parentResource + ", since the " + resourceType
+ + " type does not support manual add.");
+ }
+
+ abortResourceManualAddIfExistingSingleton(parentResource, resourceType);
+
MergeResourceResponse mergeResourceResponse;
try {
- Resource parentResource = this.resourceManager.getResourceById(user, parentResourceId);
AgentClient agentClient = this.agentManager.getAgentClient(parentResource.getAgent());
- mergeResourceResponse = agentClient.getDiscoveryAgentService().manuallyAddResource(resourceType,
- parentResourceId, pluginConfiguration, user.getId());
+ DiscoveryAgentService discoveryAgentService = agentClient.getDiscoveryAgentService();
+ mergeResourceResponse = discoveryAgentService.manuallyAddResource(resourceType,
+ parentResourceId, pluginConfiguration, user.getId());
+ } catch (CannotConnectException e) {
+ throw new CannotConnectToAgentException("Error adding [" + resourceType + "] Resource to inventory as " +
+ "a child of " + parentResource + " - cause: " + e.getMessage(), e);
} catch (RuntimeException e) {
- throw new RuntimeException("Error adding " + resourceType.getName()
- + " resource to inventory as a child of the resource with id " + parentResourceId + " - cause: "
- + e.getLocalizedMessage(), e);
+ throw new RuntimeException("Error adding [" + resourceType
+ + "] Resource to inventory as a child of " + parentResource + " - cause: " + e, e);
}
return mergeResourceResponse;
@@ -1060,4 +1077,21 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
return newValue != null && (oldValue == null || !newValue.equals(oldValue));
}
+ private void abortResourceManualAddIfExistingSingleton(Resource parentResource, ResourceType resourceType) {
+ if (resourceType.isSingleton()) {
+ ResourceCriteria resourceCriteria = new ResourceCriteria();
+ resourceCriteria.addFilterParentResourceId(parentResource.getId());
+ resourceCriteria.addFilterResourceTypeId(resourceType.getId());
+ PageList<Resource> childResourcesOfType = resourceManager.findResourcesByCriteria(subjectManager.getOverlord(),
+ resourceCriteria);
+ if (childResourcesOfType.size() >= 1) {
+ throw new RuntimeException("Cannot manually add " + resourceType + " child Resource under parent "
+ + parentResource + ", since " + resourceType
+ + " is a singleton type, and there is already a child Resource of that type. "
+ + "If the existing child Resource corresponds to a managed Resource which no longer exists, "
+ + "uninventory it and then try again.");
+ }
+ }
+ }
+
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
index b612c5e..77b847b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
@@ -38,6 +38,8 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.jboss.remoting.CannotConnectException;
+
import org.rhq.core.clientapi.agent.inventory.CreateResourceRequest;
import org.rhq.core.clientapi.agent.inventory.CreateResourceResponse;
import org.rhq.core.clientapi.agent.inventory.DeleteResourceRequest;
@@ -52,6 +54,7 @@ import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
import org.rhq.core.domain.resource.Agent;
+import org.rhq.core.domain.resource.CannotConnectToAgentException;
import org.rhq.core.domain.resource.CreateResourceHistory;
import org.rhq.core.domain.resource.CreateResourceStatus;
import org.rhq.core.domain.resource.DeleteResourceHistory;
@@ -610,6 +613,16 @@ public class ResourceFactoryManagerBean implements ResourceFactoryManagerLocal,
} catch (NoResultException nre) {
return null;
//eat the exception. Some of the queries return no results if no package yet exists which is fine.
+ } catch(CannotConnectException e) {
+ log.error("Error while sending create resource request to agent service", e);
+
+ // Submit the error as a failure response
+ String errorMessage = ThrowableUtil.getAllMessages(e);
+ CreateResourceResponse response = new CreateResourceResponse(persistedHistory.getId(), null, null,
+ CreateResourceStatus.FAILURE, errorMessage, null);
+ resourceFactoryManager.completeCreateResource(response);
+
+ throw new CannotConnectToAgentException("Error while sending create resource request to agent service", e);
} catch (Exception e) {
log.error("Error while sending create resource request to agent service", e);
@@ -660,6 +673,16 @@ public class ResourceFactoryManagerBean implements ResourceFactoryManagerLocal,
resourceFactoryAgentService.deleteResource(request);
return persistedHistory;
+ } catch(CannotConnectException e) {
+ log.error("Error while sending delete resource request to agent service", e);
+
+ // Submit the error as a failure response
+ String errorMessage = ThrowableUtil.getAllMessages(e);
+ DeleteResourceResponse response = new DeleteResourceResponse(persistedHistory.getId(),
+ DeleteResourceStatus.FAILURE, errorMessage);
+ resourceFactoryManager.completeDeleteResourceRequest(response);
+
+ throw new CannotConnectToAgentException("Error while sending delete resource request to agent service", e);
} catch (Exception e) {
log.error("Error while sending delete resource request to agent service", e);
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - 2 commits - modules/enterprise
by John Sanda
modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java | 41 +++++++---
1 file changed, 30 insertions(+), 11 deletions(-)
New commits:
commit 271479899bf05eefe3f3d27d0cc0a15d4c7509ed
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Jun 6 14:29:25 2012 -0400
[BZ 824129,829309] Fix quote parsing
diff --git a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
index 2d0e41a..99595ab 100644
--- a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
+++ b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
@@ -410,26 +410,46 @@ public class ClientMain {
List<String> args = new ArrayList<String>();
boolean keep_going = true;
+ boolean isScriptFileCommand = false;
+
+ // we don't want to parse numbers and we want ' to be a normal word
+ // character
strtok.ordinaryChars('0', '9');
strtok.ordinaryChar('.');
strtok.ordinaryChar('-');
- strtok.quoteChar('\'');
- strtok.quoteChar('"');
- strtok.wordChars(33, 33);
- strtok.wordChars(35, 38);
- strtok.wordChars(40, 127);
+ strtok.ordinaryChar('\'');
+ strtok.wordChars(33, 127);
// parse the command line
while (keep_going) {
int nextToken;
try {
+ // if we are executing a script file and have reached the arguments, we
+ // want to reset the tokenizer's syntax so that handle single and double
+ // quotes correctly.
+ if (isScriptFileCommand && args.size() > 2 && args.get(args.size() - 2).equals("-f")) {
+ strtok.resetSyntax();
+ strtok.ordinaryChars('0', '9');
+ strtok.ordinaryChar('.');
+ strtok.ordinaryChar('-');
+ strtok.quoteChar('\'');
+ strtok.quoteChar('"');
+ strtok.wordChars(33, 33);
+ strtok.wordChars(35, 38);
+ strtok.wordChars(40, 127);
+ }
+
nextToken = strtok.nextToken();
+
} catch (IOException e) {
nextToken = StreamTokenizer.TT_EOF;
}
if (nextToken == java.io.StreamTokenizer.TT_WORD) {
+ if (args.size() > 0 && strtok.sval.equals("-f")) {
+ isScriptFileCommand = true;
+ }
args.add(strtok.sval);
} else if (nextToken == '\"' || nextToken == '\'') {
args.add(strtok.sval);
@@ -437,7 +457,6 @@ public class ClientMain {
keep_going = false;
}
}
-
return args.toArray(new String[args.size()]);
}
commit f62dd242758fc9712abcc9f06c8d114ca6d9a08b
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu May 31 19:19:39 2012 -0400
[BZ 824129] Do not treat quotes as ordinary characters
I am not sure why but we were treating both single and double quotes as
ordinary word character instead of quote or string delimiters.
diff --git a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
index 308d6c1..2d0e41a 100644
--- a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
+++ b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/ClientMain.java
@@ -22,9 +22,6 @@
*/
package org.rhq.enterprise.client;
-import gnu.getopt.Getopt;
-import gnu.getopt.LongOpt;
-
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -35,6 +32,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.client.commands.ClientCommand;
+import org.rhq.enterprise.client.commands.ScriptCommand;
+import org.rhq.enterprise.client.script.CommandLineParseException;
+import org.rhq.enterprise.clientapi.RemoteClient;
+
+import gnu.getopt.Getopt;
+import gnu.getopt.LongOpt;
import jline.ArgumentCompletor;
import jline.Completor;
import jline.ConsoleReader;
@@ -42,12 +47,6 @@ import jline.MultiCompletor;
import jline.SimpleCompletor;
import mazz.i18n.Msg;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.enterprise.client.commands.ClientCommand;
-import org.rhq.enterprise.client.commands.ScriptCommand;
-import org.rhq.enterprise.client.script.CommandLineParseException;
-import org.rhq.enterprise.clientapi.RemoteClient;
-
/**
* @author Greg Hinkle
* @author Simeon Pinder
@@ -411,13 +410,14 @@ public class ClientMain {
List<String> args = new ArrayList<String>();
boolean keep_going = true;
- // we don't want to parse numbers and we want ' to be a normal word
- // character
strtok.ordinaryChars('0', '9');
strtok.ordinaryChar('.');
strtok.ordinaryChar('-');
- strtok.ordinaryChar('\'');
- strtok.wordChars(33, 127);
+ strtok.quoteChar('\'');
+ strtok.quoteChar('"');
+ strtok.wordChars(33, 33);
+ strtok.wordChars(35, 38);
+ strtok.wordChars(40, 127);
// parse the command line
while (keep_going) {
@@ -431,7 +431,7 @@ public class ClientMain {
if (nextToken == java.io.StreamTokenizer.TT_WORD) {
args.add(strtok.sval);
- } else if (nextToken == '\"') {
+ } else if (nextToken == '\"' || nextToken == '\'') {
args.add(strtok.sval);
} else if ((nextToken == java.io.StreamTokenizer.TT_EOF) || (nextToken == java.io.StreamTokenizer.TT_EOL)) {
keep_going = false;
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - modules/enterprise
by John Sanda
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ChildHistoryView.java | 17 ++++++----
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 5 +-
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties | 11 +-----
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 3 +
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 3 +
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 3 +
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 3 +
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 3 +
8 files changed, 27 insertions(+), 21 deletions(-)
New commits:
commit 3716309131417730d4a3b943b1345c6ea2c2caea
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed May 30 19:59:27 2012 -0400
[BZ 802796] providing more info about the deployment timeout
Conflicts:
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ChildHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ChildHistoryView.java
index 0d41906..3307387 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ChildHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ChildHistoryView.java
@@ -19,6 +19,10 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@ -33,7 +37,12 @@ import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.SpinnerItem;
-import com.smartgwt.client.widgets.grid.*;
+import com.smartgwt.client.widgets.grid.CellFormatter;
+import com.smartgwt.client.widgets.grid.HoverCustomizer;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
import org.rhq.core.domain.criteria.Criteria;
import org.rhq.core.domain.resource.CreateResourceHistory;
import org.rhq.core.domain.resource.CreateResourceStatus;
@@ -51,10 +60,6 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-
/**
* @author John Mazzitelli
*/
@@ -142,7 +147,7 @@ public class ChildHistoryView extends Table<ChildHistoryView.DataSource> {
case INVALID_CONFIGURATION:
return MSG.view_resource_inventory_childhistory_status_invalidConfig();
case TIMED_OUT:
- return MSG.common_status_timedOut();
+ return MSG.widget_resourceFactoryWizard_timeoutFailure();
}
} else if (DataSource.TYPE_DELETE.equals(type)) {
switch (DeleteResourceStatus.valueOf(value.toString())) {
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 24c41ae..f702f49 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -101,7 +101,7 @@ common_status_inprogress = In Progress
common_status_nochange = No Change
common_status_partial = Partial
common_status_success = Success
-common_status_timedOut = Timed Out
+common_status_timedOut = Timed Out.
common_status_unknown = Unknown
common_title_add_column = Add Column
common_title_add_graph_to_view = Add Graph to Monitor View
@@ -2005,7 +2005,8 @@ widget_resourceFactoryWizard_infoStepName = Resource Information
widget_resourceFactoryWizard_infoStep_loadFail = Failed to get available Architectures
widget_resourceFactoryWizard_namePrompt = New Resource Name
widget_resourceFactoryWizard_templatePrompt = Connection Settings Template
-widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the {0} Agent). Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
+widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
+widget_resourceFactoryWizard_timeoutFailure = Timed out. Note that it is possible that the deployment may still succeed.
widget_resourceFactoryWizard_uploadFailure = Failed to upload file
widget_resourceFactoryWizard_uploadFileStepName = Upload Resource Content File
widget_resourceFactoryWizard_uploadInProgress = The upload is in progress... This can take several minutes to complete for large distribution files.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
index 06c3525..6069829 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
@@ -89,7 +89,6 @@ common_label_filters = Filtry
common_label_hour = hodina
common_label_item = položka
common_label_items = položky
-common_label_link = Odkaz
common_label_month = měsíc
common_label_none = žádný
common_label_none2 = žádný
@@ -555,12 +554,13 @@ view_admin_content = Obsah
view_admin_downloads_agentDownload = Stáhnout agenta
view_admin_downloads_agent_buildNumber = Sestavení agenta
##view_admin_downloads_agent_help = <p> This is the {0} Agent Update Binary jar file. The purpose of this jar file is to allow you to install a fresh agent on a machine where an agent does not yet exist and to allow you to update an agent that is already installed on a machine. For more details, run this agent download jar with the --help command line option:<br/> <b>java -jar <agent-download.jar> --help</b> </p> <h3>Agent Install</h3> <p> <b>java -jar <agent-download.jar> --install[=<new agent directory>]</b><br/> This command will install a new agent. If you do not specify the new agent directory, the default will be "." </p> <h3>Agent Update</h3> <p> <b>java -jar <agent-download.jar> --update[=<old agent home>]</b><br/> This will update an existing agent that was already installed. If you do not specify the directory where the old, existing agent was installed, it will assumed to be "rhq-agent". </p>
+view_admin_downloads_agent_link_label = Odkaz
view_admin_downloads_agent_link_value = Stáhnout agenta {0} ({1})
view_admin_downloads_agent_loadError = Nelze získat informace o verzi agenta
view_admin_downloads_agent_md5 = Agent MD5
view_admin_downloads_agent_version = Verze agenta
view_admin_downloads_bundleDownload = Stáhnutí nasazovacího balíku
-##view_admin_downloads_bundle_help = <p> This is the Bundle Deployer tool. It is for use by developers and packagers of {0} bundles. This standalone tool allows you to test your bundles and their recipes from a console. </p>
+view_admin_downloads_bundle_link_label = Odkaz
view_admin_downloads_bundle_link_value = Stáhnout nasazovače balíků {0}
view_admin_downloads_bundle_loadError = Nelze získat informace nasazovače balíků
view_admin_downloads_cliAlertScriptsDownload = Stáhnout CLI agent skripty
@@ -570,6 +570,7 @@ view_admin_downloads_cliAlertScripts_none = Žádné CLI výstrahové skripty ne
view_admin_downloads_cliDownload = Stáhnout klienta pro příkazovou řádku
view_admin_downloads_cli_buildNumber = CLI číslo sestavení
##view_admin_downloads_cli_help = <p> This is the Command Line Client tool, otherwise known as the CLI. It is a standalone tool that runs from within a console and provides a command line interface to the {0} Server. You can invoke commands via the CLI as well as run scripts to perform automated tasks. See the documentation for more information on how to install and use the CLI. </p>
+view_admin_downloads_cli_link_label = Odkaz
view_admin_downloads_cli_link_value = Stáhnout CLI {0} ({1})
view_admin_downloads_cli_loadError = Nelze získat informace o verzi CLI
view_admin_downloads_cli_md5 = CLI MD5
@@ -939,8 +940,6 @@ view_alert_definitions_update_success = Úspěšně změněna definice výstrahy
view_alert_details_field_ack_at = Potvrzeno v
view_alert_details_field_ack_by = Potvrzeno kým
view_alert_details_field_recovery_info = Informace o obnově
-view_alert_details_field_resource_ancestry = Původ zdroje
-view_alert_details_field_watched_resource = Sledovaný zdroj
view_alert_details_loadFailed = Nepodařilo se načíst výstrahy
view_alerts_ack_confirm = Potvrdit vybrané výstrahy?
view_alerts_ack_confirm_all = Potvrdit všechny výstrahy tohoto zdroje?
@@ -1186,7 +1185,6 @@ view_configEdit_addItem = Přidat položku do seznamu
view_configEdit_confirm_1 = Jste si jisti, že chcete smazat vybrané vlastnosti z množiny?
view_configEdit_confirm_2 = Jste si jisti, že chcete smazat tento řádek?
view_configEdit_confirm_3 = Jste si jisti, že chcete smazat [{0}] vybrané [{1}]?
-view_configEdit_description = Popis
view_configEdit_editRow = Editovat řádek
view_configEdit_enterPropName = Vložte platné jméno vlastnosti, která má být přidána.
view_configEdit_error_1 = Konfigurace pro tento zdroj není podporována.
@@ -1200,11 +1198,8 @@ view_configEdit_msg_2 = Vlastnost odebrána z množiny.
view_configEdit_msg_3 = [{0} {1}] smazáno ze seznamu.
view_configEdit_msg_4 = Položka přidána do seznamu.
view_configEdit_properties = Vlastnosti
-view_configEdit_property = Vlastnost
view_configEdit_tooltip_1 = Smazat vybrané položky ze seznamu.
view_configEdit_tooltip_2 = Přidat položku do seznamu.
-view_configEdit_unset = Nenastaveno?
-view_configEdit_value = Hodnota
view_configEdit_viewRow = Zobrazit řádek
view_configurationDetails_allPropertiesValid = Všechny vlastnosti konfigurace mají platné hodnoty, takže konfigurace bude uložena.
view_configurationDetails_configNotUpdatedDueToNoChange = Konfigurace nebyla změněna, protože nová konfigurace je ekvivalentní té stávající.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index 319aa5e..ea2f6d6 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1793,8 +1793,9 @@ widget_resourceFactoryWizard_infoStepName = Information über die Ressource
widget_resourceFactoryWizard_infoStep_loadFail = Konnte die verfügbaren Architekturen nicht ermitteln
widget_resourceFactoryWizard_namePrompt = Name der neuen Ressource
widget_resourceFactoryWizard_templatePrompt = Vorlage für die Verbindungseinstellungen
-##widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the RHQ Agent). Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
widget_resourceFactoryWizard_uploadFailure = Konnte die Datei nicht hochladen
+##widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
+###widget_resourceFactoryWizard_timeoutFailure = Timed out. Note that it is possible that the deployment may still succeed.
##widget_resourceFactoryWizard_uploadFileStepName = Upload Resource Content File
##widget_resourceFactoryWizard_uploadInProgress = The upload is in progress... This can take several minutes to complete for large distribution files.
widget_resourceFactoryWizard_versionPrompt = Paketversion
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index f00b098..e01e151 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -2001,7 +2001,8 @@ widget_resourceFactoryWizard_infoStepName = リソース情報
widget_resourceFactoryWizard_infoStep_loadFail = アーキテクチャーを利用可能にするのに失敗しました
widget_resourceFactoryWizard_namePrompt = 新規リソース名
widget_resourceFactoryWizard_templatePrompt = コネクション設定テンプレート
-widget_resourceFactoryWizard_timeoutHelp = タイムアウト間隔。もし指定されたならば({0}エージェント上での)子のリソース作成のためのデフォルトタイムアウトを上書きします。大きなアプリケーションのデプロイのような長時間かかる作成アクションに特に有用です。通常、前回の試みのときにタイムアウトの失敗だった場合に使われます。
+##widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
+###widget_resourceFactoryWizard_timeoutFailure = Timed out. Note that it is possible that the deployment may still succeed.
widget_resourceFactoryWizard_uploadFailure = ファイルアップロードの失敗
widget_resourceFactoryWizard_uploadFileStepName = リソースコンテントファイルのアップロード
widget_resourceFactoryWizard_uploadInProgress = アップロードは処理中です... 大きなファイルを配布するには数分かかることもあります。
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index 8c125c9..e30bc3e 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -2116,7 +2116,8 @@ widget_resourceFactoryWizard_infoStepName = Informa\u00E7\u00E3o do Recurso
widget_resourceFactoryWizard_infoStep_loadFail = Falha ao recuperar Arquiteturas dispon\u00EDveis.
widget_resourceFactoryWizard_namePrompt = Novo Nome do Recurso
widget_resourceFactoryWizard_templatePrompt = Modelo de Propriedades para Conex\u00E3o
-##widget_resourceFactoryWizard_timeoutHelp = Dura��o do timeout. Se especificado ir� sobrescrever o timeout padr�o para cria��o de recursos filhos (no RHQ Agent). �til principalmente para a��es muito longas, como a implanta��o de uma apli��o muito grande. Geralmente utilizado devido a tentativas que sofreram timeout anteriormente.
+##widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
+##widget_resourceFactoryWizard_timeoutFailure = Timed out. Note that it is possible that the deployment may still succeed.
widget_resourceFactoryWizard_uploadFailure = Falha ao realizar o upload do arquivo
widget_resourceFactoryWizard_uploadFileStepName = Upload do Arquivo do Recurso
widget_resourceFactoryWizard_uploadInProgress = Upload em andamento... Esse processo pode demorar alguns minutos para ser finalizado em caso de arquivos muito grandes.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index f723748..a10ffaf 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -2005,7 +2005,8 @@
#widget_resourceFactoryWizard_infoStep_loadFail = Failed to get available Architectures
#widget_resourceFactoryWizard_namePrompt = New Resource Name
#widget_resourceFactoryWizard_templatePrompt = Connection Settings Template
-#widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the {0} Agent). Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
+#widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
+#widget_resourceFactoryWizard_timeoutFailure = Timed out. Note that it is possible that the deployment may still succeed.
#widget_resourceFactoryWizard_uploadFailure = Failed to upload file
#widget_resourceFactoryWizard_uploadFileStepName = Upload Resource Content File
#widget_resourceFactoryWizard_uploadInProgress = The upload is in progress... This can take several minutes to complete for large distribution files.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 6c4b254..910a1a5 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1999,7 +1999,8 @@ widget_resourceFactoryWizard_infoStepName = \u8d44\u6e90\u6d88\u606f
widget_resourceFactoryWizard_infoStep_loadFail = \u65e0\u6cd5\u53d6\u5f97\u67b6\u6784
widget_resourceFactoryWizard_namePrompt = \u65b0\u8d44\u6e90\u540d
widget_resourceFactoryWizard_templatePrompt = \u8fde\u63a5\u8bbe\u7f6e\u6a21\u677f
-##widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the RHQ Agent). Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
+#widget_resourceFactoryWizard_timeoutHelp = A timeout duration. If specified will override the default timeout for child resource creation (on the {0} Agent). The default timeout is set to 60 seconds. Useful for particularly long create actions, like deployment of a large application. Usually used if a previous attempt suffered a timeout failure.
+#widget_resourceFactoryWizard_timeoutFailure = Timed out. Note that it is possible that the deployment may still succeed.
widget_resourceFactoryWizard_uploadFailure = \u4e0a\u4f20\u6587\u4ef6\u5931\u8d25
widget_resourceFactoryWizard_uploadFileStepName = \u4e0a\u4f20\u8d44\u6e90Content\u6587\u4ef6
widget_resourceFactoryWizard_uploadInProgress = \u6b63\u5728\u4e0a\u4f20\u4e2d... \u5927\u7684\u53d1\u5e03\u6587\u4ef6\u9700\u8981\u6d88\u8017\u6570\u5206\u949f\u5b8c\u6210.
11 years, 9 months