modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentManager.java | 9 +-- modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/InventoryPrinter.java | 26 ++++------ 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/BaseServerComponent.java | 13 +---- modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java | 19 +++---- 5 files changed, 34 insertions(+), 40 deletions(-)
New commits: commit 6785f80b99a4def0128939113fd5af7d3b4ebee5 Author: Thomas Segismont tsegismo@redhat.com Date: Thu Jan 30 12:30:48 2014 +0100
Bug 1025050 - EAP 6 plug-in should not require start script environment variables to be set
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 000d08c..bda2e5e 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 @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2013 Red Hat, Inc. + * Copyright (C) 2005-2014 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -16,6 +16,7 @@ * along with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + package org.rhq.modules.plugins.jbossas7;
import static org.rhq.modules.plugins.jbossas7.ASConnection.verbose; @@ -361,7 +362,9 @@ public class BaseComponent<T extends ResourceComponent<?>> implements AS7Compone
@Override public void deleteResource() throws Exception { - getLog().info("Removing AS7 resource [" + path + "]..."); + if (getLog().isDebugEnabled()) { + getLog().debug("Removing AS7 resource [" + path + "]..."); + }
if (context.getResourceType().getName().equals(MANAGED_SERVER)) { // We need to do two steps because of AS7-4032 diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java index 5e2f272..bc7112a 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2013 Red Hat, Inc. + * Copyright (C) 2005-2014 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -121,7 +121,9 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend try { if ((availabilityType == AvailabilityType.UP) && (previousAvailabilityType != AvailabilityType.UP)) { validateServerAttributes(); - log.info(getResourceDescription() + " has just come UP."); + if (log.isDebugEnabled()) { + log.debug(getResourceDescription() + " has just come UP."); + } } } finally { previousAvailabilityType = availabilityType; @@ -423,13 +425,6 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend } }
- Map<String, String> startScriptEnv = startScriptConfig.getStartScriptEnv(); - if (startScriptEnv.isEmpty()) { - errors.add("No start script environment variables are set. At a minimum, PATH should be set " - + "(on UNIX, it should contain at least /bin and /usr/bin). It is recommended that " - + "JAVA_HOME also be set, otherwise the PATH will be used to find java."); - } - return errors; }
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java index d0f023a..1fd155c 100644 --- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java +++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2013 Red Hat, Inc. + * Copyright (C) 2005-2014 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -16,6 +16,7 @@ * along with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + package org.rhq.modules.plugins.jbossas7.itest;
import static org.testng.Assert.assertEquals; @@ -199,17 +200,17 @@ public abstract class AbstractServerComponentTest extends AbstractJBossAS7Plugin }
protected void validateStartScriptEnv(Map<String, String> env) { - Assert.assertTrue(env.size() <= 4, env.toString()); - String javaHome = env.get("JAVA_HOME"); - Assert.assertNotNull(javaHome); - Assert.assertTrue(new File(javaHome).isDirectory()); + if (javaHome != null) { + Assert.assertTrue(new File(javaHome).isDirectory()); + }
String path = env.get("PATH"); - Assert.assertNotNull(path); - String[] pathElements = path.split(File.pathSeparator); - Assert.assertTrue(pathElements.length >= 1); - Assert.assertTrue(new File(pathElements[0]).isDirectory()); + if (path != null) { + String[] pathElements = path.split(File.pathSeparator); + Assert.assertTrue(pathElements.length >= 1); + Assert.assertTrue(new File(pathElements[0]).isDirectory()); + } }
protected abstract String getBindAddressSystemPropertyName();
commit 5df3797396c237111cfcbd14dbf8c27e078384b1 Author: Thomas Segismont tsegismo@redhat.com Date: Thu Jan 30 11:41:44 2014 +0100
Fix UnsupportedOperationException @ ContentManager.handleDiscoveredContent
This was due to org.rhq.core.pc.inventory.ResourceContainer#getInstalledPackages, which used to create a new empty set, and now returns Collections#emptySet, which is immutable.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentManager.java index 853d3b1..464978d 100644 --- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentManager.java +++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/content/ContentManager.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2013 Red Hat, Inc. + * Copyright (C) 2005-2014 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -16,6 +16,7 @@ * along with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + package org.rhq.core.pc.content;
import static org.rhq.core.domain.resource.InventoryStatus.COMMITTED; @@ -588,10 +589,8 @@ public class ContentManager extends AgentService implements ContainerService, Co ResourceContainer container = inventoryManager.getResourceContainer(resourceId);
Set<ResourcePackageDetails> updatedPackageSet = new HashSet<ResourcePackageDetails>(details); - Set<ResourcePackageDetails> existingInstalledPackagesSet = container.getInstalledPackages(); - if (existingInstalledPackagesSet == null) { - existingInstalledPackagesSet = new HashSet<ResourcePackageDetails>(); - } + Set<ResourcePackageDetails> existingInstalledPackagesSet = new HashSet<ResourcePackageDetails>( + container.getInstalledPackages());
// Strip out content that have been removed (i.e. not returned on the latest discovery) int originalPackageCount = existingInstalledPackagesSet.size(); diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/InventoryPrinter.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/InventoryPrinter.java index bcaa45d..9f667a4 100644 --- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/InventoryPrinter.java +++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/InventoryPrinter.java @@ -1,25 +1,22 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2012 Red Hat, Inc. + * Copyright (C) 2005-2014 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, version 2, as - * published by the Free Software Foundation, and/or the GNU Lesser - * General Public License, version 2.1, also as published by the Free - * Software Foundation. + * 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 and the GNU Lesser General Public License - * for more details. + * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * and the GNU Lesser General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ + package org.rhq.core.pc.util;
import java.io.PrintWriter; @@ -32,6 +29,7 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails; import org.rhq.core.domain.drift.DriftDefinition; import org.rhq.core.domain.measurement.Availability; import org.rhq.core.domain.measurement.AvailabilityType; @@ -223,10 +221,8 @@ public class InventoryPrinter { } String availString = (availType == null) ? "UNKNOWN" : availType.toString();
- int installedPackageCount = 0; - if (resourceContainer.getInstalledPackages() != null) { - installedPackageCount = resourceContainer.getInstalledPackages().size(); - } + Set<ResourcePackageDetails> installedPackages = resourceContainer.getInstalledPackages(); + int installedPackageCount = installedPackages == null ? 0 : installedPackages.size();
if (dumpXml) { exportWriter.printf("%s<resource>\n", indent); @@ -434,4 +430,4 @@ public class InventoryPrinter { return serviceCount; } } -} \ No newline at end of file +}