From: <jsh...@rh...> - 2008-10-17 15:36:16
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } #msg DL { border : 1px #006 solid; background-color : #369; padding : 6px; color : #fff; } #msg DT { float : left; width : 6em; font-weight : bold; } #msg DL, #msg DT, #msg UL, #msg LI { font-family : arial,helvetica,sans-serif; font-size : 10pt; } h3 { font-family : arial,helvetica,sans-serif; font-size : 10pt; font-weight : bold; } #msg PRE { overflow : auto; white-space : normal; background-color : #ffc; border : 1px #fc0 solid; padding : 6px; } #msg UL, PRE, .diff { overflow : auto; } #patch h4 { font-family : arial,helvetica,sans-serif; font-size : 10pt; } #patch h4 { padding: 8px; background : #369; color : #fff; margin : 0; } #patch .propset h4, #patch .binary h4 {margin: 0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {background:#eeeeee;padding: 0 0 10px 0;} #patch .propset .diff, #patch .binary .diff {padding: 10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch .add {background:#ddffdd;} #patch .rem {background:#ffdddd;} #patch .lines, .info {color:#888888;background:#ffffff;} .diff { width : 100%; } --></style> <title>[rhq-project.org rhq] [1788] don't run tests if augeas not available</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>1788</dd> <dt>Author</dt> <dd>jshaughn</dd> <dt>Date</dt> <dd>2008-10-17 10:36:07 -0500 (Fri, 17 Oct 2008)</dd> </dl> <h3>Log Message</h3> <pre>don't run tests if augeas not available</pre> <h3>Modified Paths</h3> <ul> <li><a href="#rhqtrunkmodulespluginsgrubsrctestjavaorgrhqpluginsgrubGrubComponentTestjava">rhq/trunk/modules/plugins/grub/src/test/java/org/rhq/plugins/grub/GrubComponentTest.java</a></li> <li><a href="#rhqtrunkmodulespluginshostssrctestjavaorgrhqpluginshostsHostsComponentTestjava">rhq/trunk/modules/plugins/hosts/src/test/java/org/rhq/plugins/hosts/HostsComponentTest.java</a></li> <li><a href="#rhqtrunkmodulespluginssshdsrctestjavaorgrhqpluginssshdOpenSSHDComponentTestjava">rhq/trunk/modules/plugins/sshd/src/test/java/org/rhq/plugins/sshd/OpenSSHDComponentTest.java</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="rhqtrunkmodulespluginsgrubsrctestjavaorgrhqpluginsgrubGrubComponentTestjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/plugins/grub/src/test/java/org/rhq/plugins/grub/GrubComponentTest.java (1787 => 1788)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/grub/src/test/java/org/rhq/plugins/grub/GrubComponentTest.java 2008-10-17 14:30:08 UTC (rev 1787) +++ rhq/trunk/modules/plugins/grub/src/test/java/org/rhq/plugins/grub/GrubComponentTest.java 2008-10-17 15:36:07 UTC (rev 1788) </span><span class="lines">@@ -21,15 +21,17 @@ </span><span class="cx"> import java.util.Collection; import java.util.Iterator; import java.util.Map; </span><span class="add">+ </span><span class="cx"> import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; </span><span class="add">+ </span><span class="cx"> import org.rhq.core.domain.configuration.Configuration; </span><span class="rem">-import org.rhq.core.domain.configuration.PropertySimple; </span><span class="cx"> import org.rhq.core.domain.configuration.Property; import org.rhq.core.domain.configuration.PropertyList; import org.rhq.core.domain.configuration.PropertyMap; </span><span class="add">+import org.rhq.core.domain.configuration.PropertySimple; </span><span class="cx"> /** * @author Jason Dobies </span><span class="lines">@@ -52,32 +54,39 @@ </span><span class="cx"> @Test public void loadResourceConfiguration() throws Exception { </span><span class="rem">- Configuration configuration = component.loadResourceConfiguration(pluginConfiguration); </span><span class="add">+ Configuration configuration; + try { + configuration = component.loadResourceConfiguration(pluginConfiguration); + } catch (UnsatisfiedLinkError ule) { + // Skip tests if augeas not available + return; + } </span><span class="cx"> assert configuration != null : "Null configuration returned from load call"; Collection<Property> allProperties = configuration.getProperties(); </span><span class="rem">- assert allProperties.size() == 2 : "Incorrect number of properties found. Expected: 2, Found: " + allProperties.size(); </span><span class="add">+ assert allProperties.size() == 2 : "Incorrect number of properties found. Expected: 2, Found: " + + allProperties.size(); </span><span class="cx"> Iterator<Property> propertyIterator = allProperties.iterator(); // General properties </span><span class="rem">- PropertyMap generalProperties = (PropertyMap)propertyIterator.next(); </span><span class="add">+ PropertyMap generalProperties = (PropertyMap) propertyIterator.next(); </span><span class="cx"> assert generalProperties != null : "General properties map was null"; </span><span class="rem">- Map<String,Property> map = generalProperties.getMap(); </span><span class="add">+ Map<String, Property> map = generalProperties.getMap(); </span><span class="cx"> for (Property property : map.values()) { </span><span class="rem">- PropertySimple propertySimple = (PropertySimple)property; </span><span class="add">+ PropertySimple propertySimple = (PropertySimple) property; </span><span class="cx"> log.info(property.getName() + ": " + propertySimple.getStringValue()); } // Kernel list </span><span class="rem">- PropertyList entryList = (PropertyList)propertyIterator.next(); </span><span class="add">+ PropertyList entryList = (PropertyList) propertyIterator.next(); </span><span class="cx"> for (Property property : entryList.getList()) { </span><span class="rem">- PropertyMap entry = (PropertyMap)property; </span><span class="add">+ PropertyMap entry = (PropertyMap) property; </span><span class="cx"> Property titleProperty = entry.get("title"); Property rootProperty = entry.get("root"); </span><span class="lines">@@ -89,10 +98,10 @@ </span><span class="cx"> assert kernelProperty != null : "Kernel was null in entry"; assert initrdProperty != null : "Initrd was null in entry"; </span><span class="rem">- log.info("Title: " + ((PropertySimple)titleProperty).getStringValue()); - log.info("Root: " + ((PropertySimple)rootProperty).getStringValue()); - log.info("Kernel: " + ((PropertySimple)kernelProperty).getStringValue()); - log.info("Initrd: " + ((PropertySimple)initrdProperty).getStringValue()); </span><span class="add">+ log.info("Title: " + ((PropertySimple) titleProperty).getStringValue()); + log.info("Root: " + ((PropertySimple) rootProperty).getStringValue()); + log.info("Kernel: " + ((PropertySimple) kernelProperty).getStringValue()); + log.info("Initrd: " + ((PropertySimple) initrdProperty).getStringValue()); </span><span class="cx"> } } </span></pre></div> <a id="rhqtrunkmodulespluginshostssrctestjavaorgrhqpluginshostsHostsComponentTestjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/plugins/hosts/src/test/java/org/rhq/plugins/hosts/HostsComponentTest.java (1787 => 1788)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/hosts/src/test/java/org/rhq/plugins/hosts/HostsComponentTest.java 2008-10-17 14:30:08 UTC (rev 1787) +++ rhq/trunk/modules/plugins/hosts/src/test/java/org/rhq/plugins/hosts/HostsComponentTest.java 2008-10-17 15:36:07 UTC (rev 1788) </span><span class="lines">@@ -19,15 +19,17 @@ </span><span class="cx"> package org.rhq.plugins.hosts; import java.util.Collection; </span><span class="add">+ </span><span class="cx"> import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; </span><span class="add">+ </span><span class="cx"> import org.rhq.core.domain.configuration.Configuration; </span><span class="rem">-import org.rhq.core.domain.configuration.PropertySimple; </span><span class="cx"> import org.rhq.core.domain.configuration.Property; import org.rhq.core.domain.configuration.PropertyList; import org.rhq.core.domain.configuration.PropertyMap; </span><span class="add">+import org.rhq.core.domain.configuration.PropertySimple; </span><span class="cx"> /** * @author Jason Dobies </span><span class="lines">@@ -50,18 +52,25 @@ </span><span class="cx"> @Test public void loadResourceConfiguration() throws Exception { </span><span class="rem">- Configuration configuration = component.loadResourceConfiguration(pluginConfiguration); </span><span class="add">+ Configuration configuration; + try { + configuration = component.loadResourceConfiguration(pluginConfiguration); + } catch (UnsatisfiedLinkError ule) { + // Skip tests if augeas not available + return; + } </span><span class="cx"> assert configuration != null : "Null configuration returned from load call"; Collection<Property> allProperties = configuration.getProperties(); </span><span class="rem">- assert allProperties.size() == 1 : "Incorrect number of properties found. Expected: 1, Found: " + allProperties.size(); </span><span class="add">+ assert allProperties.size() == 1 : "Incorrect number of properties found. Expected: 1, Found: " + + allProperties.size(); </span><span class="cx"> </span><span class="rem">- PropertyList entryList = (PropertyList)allProperties.iterator().next(); </span><span class="add">+ PropertyList entryList = (PropertyList) allProperties.iterator().next(); </span><span class="cx"> for (Property property : entryList.getList()) { </span><span class="rem">- PropertyMap entry = (PropertyMap)property; </span><span class="add">+ PropertyMap entry = (PropertyMap) property; </span><span class="cx"> Property ipProperty = entry.get("ip"); Property canonicalProperty = entry.get("canonical"); </span><span class="lines">@@ -69,8 +78,8 @@ </span><span class="cx"> assert ipProperty != null : "IP was null in entry"; assert canonicalProperty != null : "Canonical was null in entry"; </span><span class="rem">- log.info("IP: " + ((PropertySimple)ipProperty).getStringValue()); - log.info("Canonical: " + ((PropertySimple)canonicalProperty).getStringValue()); </span><span class="add">+ log.info("IP: " + ((PropertySimple) ipProperty).getStringValue()); + log.info("Canonical: " + ((PropertySimple) canonicalProperty).getStringValue()); </span><span class="cx"> } } </span></pre></div> <a id="rhqtrunkmodulespluginssshdsrctestjavaorgrhqpluginssshdOpenSSHDComponentTestjava"></a> <div class="modfile"><h4>Modified: rhq/trunk/modules/plugins/sshd/src/test/java/org/rhq/plugins/sshd/OpenSSHDComponentTest.java (1787 => 1788)</h4> <pre class="diff"> <span class="info">--- rhq/trunk/modules/plugins/sshd/src/test/java/org/rhq/plugins/sshd/OpenSSHDComponentTest.java 2008-10-17 14:30:08 UTC (rev 1787) +++ rhq/trunk/modules/plugins/sshd/src/test/java/org/rhq/plugins/sshd/OpenSSHDComponentTest.java 2008-10-17 15:36:07 UTC (rev 1788) </span><span class="lines">@@ -18,26 +18,29 @@ </span><span class="cx"> */ package org.rhq.plugins.sshd; </span><span class="add">+import java.io.File; </span><span class="cx"> import java.net.URL; </span><span class="rem">-import java.io.File; </span><span class="add">+import java.util.Collection; </span><span class="cx"> import java.util.HashMap; import java.util.Set; </span><span class="rem">-import java.util.Collection; </span><span class="add">+ </span><span class="cx"> import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import javax.xml.bind.util.ValidationEventCollector; </span><span class="add">+ +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; </span><span class="cx"> import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test; </span><span class="rem">-import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; </span><span class="add">+ +import org.rhq.core.clientapi.agent.metadata.PluginMetadataParser; +import org.rhq.core.clientapi.descriptor.DescriptorPackages; +import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor; </span><span class="cx"> import org.rhq.core.domain.configuration.Configuration; </span><span class="add">+import org.rhq.core.domain.configuration.Property; </span><span class="cx"> import org.rhq.core.domain.configuration.PropertySimple; </span><span class="rem">-import org.rhq.core.domain.configuration.Property; </span><span class="cx"> import org.rhq.core.domain.configuration.definition.ConfigurationDefinition; import org.rhq.core.domain.resource.ResourceType; </span><span class="rem">-import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor; -import org.rhq.core.clientapi.descriptor.DescriptorPackages; -import org.rhq.core.clientapi.agent.metadata.PluginMetadataParser; </span><span class="cx"> /** * @author Jason Dobies </span><span class="lines">@@ -62,7 +65,8 @@ </span><span class="cx"> public void initResourceConfigurationDefinition() throws Exception { PluginDescriptor pluginDescriptor; </span><span class="rem">- URL descriptorUrl = this.getClass().getClassLoader().getResource("META-INF" + File.separator + "rhq-plugin.xml"); </span><span class="add">+ URL descriptorUrl = this.getClass().getClassLoader() + .getResource("META-INF" + File.separator + "rhq-plugin.xml"); </span><span class="cx"> System.out.println("Loading plugin descriptor at: " + descriptorUrl); JAXBContext jaxbContext = JAXBContext.newInstance(DescriptorPackages.PC_PLUGIN); </span><span class="lines">@@ -72,10 +76,12 @@ </span><span class="cx"> unmarshaller.setEventHandler(vec); pluginDescriptor = (PluginDescriptor) unmarshaller.unmarshal(descriptorUrl.openStream()); </span><span class="rem">- PluginMetadataParser parser = new PluginMetadataParser(pluginDescriptor, new HashMap<String, PluginMetadataParser>()); </span><span class="add">+ PluginMetadataParser parser = new PluginMetadataParser(pluginDescriptor, + new HashMap<String, PluginMetadataParser>()); </span><span class="cx"> Set<ResourceType> resourceTypes = parser.getRootResourceTypes(); </span><span class="rem">- assert resourceTypes.size() == 1 : "Incorrect number of resource types found. Expected: 1, Found: " + resourceTypes.size(); </span><span class="add">+ assert resourceTypes.size() == 1 : "Incorrect number of resource types found. Expected: 1, Found: " + + resourceTypes.size(); </span><span class="cx"> ResourceType sshdType = resourceTypes.iterator().next(); resourceConfigurationDefinition = sshdType.getResourceConfigurationDefinition(); </span><span class="lines">@@ -83,7 +89,13 @@ </span><span class="cx"> @Test public void loadResourceConfiguration() throws Exception { </span><span class="rem">- Configuration configuration = component.loadResourceConfiguration(pluginConfiguration, resourceConfigurationDefinition); </span><span class="add">+ Configuration configuration; + try { + configuration = component.loadResourceConfiguration(pluginConfiguration, resourceConfigurationDefinition); + } catch (UnsatisfiedLinkError ule) { + // Skip tests if augeas not available + return; + } </span><span class="cx"> assert configuration != null : "Configuration returned as null"; </span><span class="lines">@@ -91,9 +103,10 @@ </span><span class="cx"> for (Property property : allProperties) { if (property instanceof PropertySimple) { </span><span class="rem">- PropertySimple propertySimple = (PropertySimple)property; </span><span class="add">+ PropertySimple propertySimple = (PropertySimple) property; </span><span class="cx"> log.info("Property: " + propertySimple.getName() + " - " + propertySimple.getStringValue()); </span><span class="rem">- assert propertySimple.getStringValue() != null : "Null string value found for property: " + propertySimple.getName(); </span><span class="add">+ assert propertySimple.getStringValue() != null : "Null string value found for property: " + + propertySimple.getName(); </span><span class="cx"> } } } </span> </pre> </div> </div> </body> </html> |