modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 2 modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/PerfTestComponent.java | 9 + modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/ScenarioManager.java | 48 ++++++++++ modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/EmptyTraitFactory.java | 35 +++++++ modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/SimpleTraitFactory.java | 45 +++++++++ modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/TraitFactory.java | 31 ++++++ modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml | 2 modules/plugins/perftest/src/main/resources/configurable-5.xml | 1 modules/plugins/perftest/src/main/resources/perftest-scenario.xsd | 13 ++ 9 files changed, 185 insertions(+), 1 deletion(-)
New commits: commit d497c5a9a23761c77c1292a08ff8cb9fa9f943f1 Merge: 95ab1a9... 3e03058... Author: Heiko W. Rupp hwr@redhat.com Date: Fri Nov 26 15:50:30 2010 +0100
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 95ab1a9636844d612b52a899affc9572c021be8a Author: Heiko W. Rupp hwr@redhat.com Date: Fri Nov 26 15:15:40 2010 +0100
Add trait generation to the perftest pluging
diff --git a/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/PerfTestComponent.java b/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/PerfTestComponent.java index bd429f6..485ff20 100644 --- a/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/PerfTestComponent.java +++ b/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/PerfTestComponent.java @@ -34,6 +34,7 @@ import org.rhq.core.domain.event.EventSeverity; import org.rhq.core.domain.measurement.AvailabilityType; import org.rhq.core.domain.measurement.DataType; import org.rhq.core.domain.measurement.MeasurementDataNumeric; +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.domain.measurement.calltime.CallTimeData; @@ -53,6 +54,7 @@ import org.rhq.plugins.perftest.calltime.CalltimeFactory; import org.rhq.plugins.perftest.configuration.SimpleConfigurationFactory; import org.rhq.plugins.perftest.event.PerfTestEventPoller; import org.rhq.plugins.perftest.measurement.MeasurementFactory; +import org.rhq.plugins.perftest.trait.TraitFactory;
import java.io.InputStream; import java.util.List; @@ -109,6 +111,7 @@ public class PerfTestComponent implements ResourceComponent, MeasurementFacet, C */ MeasurementFactory measurementFactory = scenarioManager.getMeasurementFactory(resourceTypeName); CalltimeFactory calltimeFactory = scenarioManager.getCalltimeFactory(resourceTypeName); + TraitFactory traitFactory = scenarioManager.getTraitFactory(resourceTypeName);
for (MeasurementScheduleRequest metric : metrics) { switch (metric.getDataType()) { @@ -126,6 +129,12 @@ public class PerfTestComponent implements ResourceComponent, MeasurementFacet, C } break; case TRAIT: + MeasurementDataTrait measurementDataTrait = traitFactory.nextValue(metric); + if (measurementDataTrait != null) { + report.addData(measurementDataTrait); + } + break; + case COMPLEX: log.error("DataType " + metric.getDataType() + " not yet supported"); } diff --git a/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/ScenarioManager.java b/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/ScenarioManager.java index d9aabf9..5cd8fea 100644 --- a/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/ScenarioManager.java +++ b/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/ScenarioManager.java @@ -61,6 +61,11 @@ import org.rhq.plugins.perftest.scenario.SimpleConfigurationGenerator; import org.rhq.plugins.perftest.scenario.SimpleContentGenerator; import org.rhq.plugins.perftest.scenario.SimpleNumericMeasurementGenerator; import org.rhq.plugins.perftest.scenario.SimpleResourceGenerator; +import org.rhq.plugins.perftest.scenario.SimpleTraitMeasurementGenerator; +import org.rhq.plugins.perftest.scenario.TraitGenerator; +import org.rhq.plugins.perftest.trait.EmptyTraitFactory; +import org.rhq.plugins.perftest.trait.SimpleTraitFactory; +import org.rhq.plugins.perftest.trait.TraitFactory;
/** * Loads performance testing scenarios and parses into usable components by the JON resource components. @@ -94,6 +99,12 @@ public class ScenarioManager { */ private static final EmptyCalltimeFactory EMPTY_CALLTIME_FACTORY = new EmptyCalltimeFactory();
+ /** + * Trait factory used when a scenario doesn't define any metrics for a particular resource type. + */ + private static final TraitFactory EMPTY_TRAIT_FACTORY = new EmptyTraitFactory(); + + // Attributes --------------------------------------------
private final Log log = LogFactory.getLog(ScenarioManager.class); @@ -115,6 +126,7 @@ public class ScenarioManager { */ private Map<String, MeasurementFactory> measurementFactories = new HashMap<String, MeasurementFactory>(); private Map<String, CalltimeFactory> calltimeFactories = new HashMap<String, CalltimeFactory>(); + private Map<String, TraitFactory> traitFactories = new HashMap<String, TraitFactory>();
/** * Mapping of resource type name to configuration factory to populate the plugin configuration for newly discovered @@ -234,6 +246,28 @@ public class ScenarioManager { return calltimeFactory; }
+ public TraitFactory getTraitFactory(String resourceTypeName) { + TraitFactory traitFactory = traitFactories.get(resourceTypeName); + + if (traitFactory == null) { + Resource resource = findResource(resourceTypeName); + if (resource == null) { + traitFactory = EMPTY_TRAIT_FACTORY; + } else { + JAXBElement<? extends TraitGenerator> element = resource.getTraitGenerator(); + if (element == null) { + traitFactory = EMPTY_TRAIT_FACTORY; + } else { + TraitGenerator generator = element.getValue(); + traitFactory = createTraitFactory(generator); + } + } + + traitFactories.put(resourceTypeName,traitFactory); + } + return traitFactory; + } + /** * Returns the configuration factory defined in the scenario for creating plugin configurations for the specified * resource type. @@ -348,6 +382,20 @@ public class ScenarioManager { }
/** + * Creates an appropriate Traits factory based on the provided generator. + * @param generator read from the scenario + * @return TraitFactory instance + */ + private TraitFactory createTraitFactory(TraitGenerator generator) { + if (generator instanceof SimpleTraitMeasurementGenerator) { + return new SimpleTraitFactory(); + } + + return null; + } + + + /** * Creates the appropriate configuration factory instance based on the provided generator. * * @param generator read from the scenario diff --git a/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/EmptyTraitFactory.java b/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/EmptyTraitFactory.java new file mode 100644 index 0000000..af724c6 --- /dev/null +++ b/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/EmptyTraitFactory.java @@ -0,0 +1,35 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2010 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.plugins.perftest.trait; + +import org.rhq.core.domain.measurement.MeasurementDataTrait; +import org.rhq.core.domain.measurement.MeasurementScheduleRequest; + +/** + * Factory returning no values + * + * @author Heiko W. Rupp + */ +public class EmptyTraitFactory implements TraitFactory { + + + public MeasurementDataTrait nextValue(MeasurementScheduleRequest request) { + return null; + } +} diff --git a/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/SimpleTraitFactory.java b/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/SimpleTraitFactory.java new file mode 100644 index 0000000..566ecde --- /dev/null +++ b/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/SimpleTraitFactory.java @@ -0,0 +1,45 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2010 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.plugins.perftest.trait; + +import org.rhq.core.domain.measurement.MeasurementData; +import org.rhq.core.domain.measurement.MeasurementDataTrait; +import org.rhq.core.domain.measurement.MeasurementScheduleRequest; +import org.rhq.plugins.perftest.trait.TraitFactory; + +import java.util.Date; + +/** + * Create trait data + * + * @author Heiko W. Rupp + */ +public class SimpleTraitFactory implements TraitFactory { + + public MeasurementDataTrait nextValue(MeasurementScheduleRequest request) { + + String name = request.getName(); + Date date = new Date(); + + MeasurementDataTrait data = new MeasurementDataTrait(request,name + ", " + date); + + return data; + + } +} diff --git a/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/TraitFactory.java b/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/TraitFactory.java new file mode 100644 index 0000000..b5932c0 --- /dev/null +++ b/modules/plugins/perftest/src/main/java/org/rhq/plugins/perftest/trait/TraitFactory.java @@ -0,0 +1,31 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2010 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.plugins.perftest.trait; + +import org.rhq.core.domain.measurement.MeasurementDataTrait; +import org.rhq.core.domain.measurement.MeasurementScheduleRequest; + +/** + * Trait data providers need to implement this + * @author Heiko W. Rupp + */ +public interface TraitFactory { + + public MeasurementDataTrait nextValue(MeasurementScheduleRequest request); +} diff --git a/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml index 06900c8..df3cdbc 100644 --- a/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/perftest/src/main/resources/META-INF/rhq-plugin.xml @@ -314,6 +314,8 @@ <metric property="metric002" defaultOn="true" displayType="summary" defaultInterval="720000"/> <metric property="metric003" defaultOn="true" displayType="summary" defaultInterval="600000"/> <metric property="metric004" defaultOn="true" displayType="summary" defaultInterval="600000"/> + <metric property="trait001" defaultOn="true" dataType="trait" displayType="summary" defaultInterval="1200000"/> + <metric property="trait002" defaultOn="true" dataType="trait" displayType="summary" defaultInterval="1440000"/> <metric displayName="CallTime" property="calltime" defaultOn="true" dataType="calltime" defaultInterval="1200000" units="milliseconds"/> <event name="PerfTestEventType" description="a test event type"/> </service> diff --git a/modules/plugins/perftest/src/main/resources/configurable-5.xml b/modules/plugins/perftest/src/main/resources/configurable-5.xml index ffa4b02..c3f68b4 100644 --- a/modules/plugins/perftest/src/main/resources/configurable-5.xml +++ b/modules/plugins/perftest/src/main/resources/configurable-5.xml @@ -21,6 +21,7 @@ <resource type="service-d-metrics"> <simpleResourceGenerator property="on.perftest.service-d-metrics-count"/> <simpleNumericMeasurementGenerator/> + <simpleTraitMeasurementGenerator/> <ConfigurableCallTimeDataGenerator minMsgCount="1" maxMsgCount="500" minDuration="10" maxDuration="500" diff --git a/modules/plugins/perftest/src/main/resources/perftest-scenario.xsd b/modules/plugins/perftest/src/main/resources/perftest-scenario.xsd index c172efb..ab938e5 100644 --- a/modules/plugins/perftest/src/main/resources/perftest-scenario.xsd +++ b/modules/plugins/perftest/src/main/resources/perftest-scenario.xsd @@ -20,6 +20,7 @@ <xs:element ref="perf:resourceGenerator" minOccurs="1" maxOccurs="1"/> <xs:element ref="perf:pluginConfigurationGenerator" minOccurs="0" maxOccurs="1"/> <xs:element ref="perf:measurementGenerator" minOccurs="0" maxOccurs="1"/> + <xs:element ref="perf:traitGenerator" minOccurs="0" maxOccurs="1"/> <xs:element ref="perf:calltimeGenerator" minOccurs="0" maxOccurs="1"/> <xs:element ref="perf:contentGenerator" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> @@ -67,6 +68,18 @@ </xs:complexContent> </xs:complexType>
+ + <xs:element name="traitGenerator" type="perf:traitGenerator" abstract="true"/> + <xs:complexType name="traitGenerator"/> + <xs:element name="simpleTraitMeasurementGenerator" type="perf:simpleTraitMeasurementGenerator" + substitutionGroup="perf:traitGenerator"/> + <xs:complexType name="simpleTraitMeasurementGenerator"> + xs:complexContent + <xs:extension base="perf:traitGenerator"/> + </xs:complexContent> + </xs:complexType> + + <xs:element name="calltimeGenerator" type="perf:calltimeGenerator" abstract="true"/> <xs:complexType name="calltimeGenerator"/>
commit 894083ba061d8b731236753a171a1218cbcb1fd9 Author: Heiko W. Rupp hwr@redhat.com Date: Fri Nov 26 12:44:35 2010 +0100
Fix a typo.
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 ca4c150..5ac633d 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 @@ -1086,7 +1086,7 @@ view_portlet_tagCloud_title=Tag-Wolke
#=================== Inventory ===================== view_inventory_adq = Discovery-Warteschlange -view_inventory_sectionHelp = In diesem Abschnitt können neu gefundene Ressourcen, sowie Ressourcen ud Gruppen im Inventar angesehen und verwaltet werden. +view_inventory_sectionHelp = In diesem Abschnitt können neu gefundene Ressourcen, sowie Ressourcen und Gruppen im Inventar angesehen und verwaltet werden. view_inventory_cannotGetGlobalPerms = Could not determine global permissions - assuming none.~ view_inventory_problemGroups=Gruppen mit Problemen view_inventory_collectionInterval=Erfassungs-Intervall
rhq-commits@lists.fedorahosted.org