modules/helpers/perftest-data-gen/install_files.sh | 7 modules/helpers/perftest-data-gen/pom.xml | 44 ++++ modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java | 101 ++++++++++ modules/helpers/pom.xml | 1 pom.xml | 36 +++ 5 files changed, 187 insertions(+), 2 deletions(-)
New commits: commit d45fd8b2b3624846b7b0b27a79e3abde96a2d063 Author: Heiko W. Rupp hwr@redhat.com Date: Thu Aug 19 14:51:33 2010 +0200
Add a script to copy the generated csv files over to the server tests.
diff --git a/modules/helpers/perftest-data-gen/install_files.sh b/modules/helpers/perftest-data-gen/install_files.sh new file mode 100644 index 0000000..0a33154 --- /dev/null +++ b/modules/helpers/perftest-data-gen/install_files.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -x + +pwd + +cp target/*.csv ../../enterprise/server/jar/src/test/resources/perftest/ \ No newline at end of file
commit ee41bb1a5c7fc1bb4f61d672f9865c971b4e5724 Merge: d516c7c... fe3c4a4... Author: Heiko W. Rupp hwr@redhat.com Date: Thu Aug 19 10:36:41 2010 +0200
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit d516c7cc5eeb8c2d807ed1e11992d211b9dd50aa Merge: 768bdc1... 36b0828... Author: Heiko W. Rupp hwr@redhat.com Date: Wed Aug 18 16:53:36 2010 +0200
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 768bdc1f7984816df30d8468fd85d747b025be29 Merge: efc3d35... b53c54e... Author: Heiko W. Rupp hwr@redhat.com Date: Wed Aug 18 11:39:01 2010 +0200
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit efc3d3574cc27e586788d8372d6354d68db4237f Author: Heiko W. Rupp hwr@redhat.com Date: Tue Aug 17 15:57:53 2010 +0200
Add more tables, provide better output
diff --git a/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java b/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java index 5fcc229..4e0857e 100644 --- a/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java +++ b/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java @@ -43,7 +43,9 @@ public class DataGen {
private static final String[][] props = {// {"agents","RHQ_Agent","id,name,address,port,agenttoken,remote_endpoint"}, - {"plugins","RHQ_Plugin","id,name,display_name,version,amps_version"} + {"plugins","RHQ_Plugin","id,name,display_name,version,amps_version"}, + {"resourceTypes","RHQ_resource_type","id,name,category,plugin"}, // TODO parent / child types? + {"resources","RHQ_resource","id,uuid,resource_key,name,resource_type_id,parent_resource_id"} // TODO child resources? };
public static void main(String[] args) { @@ -83,10 +85,13 @@ public class DataGen { String columns = prop[2];
File agents = new File(TARGET + fileName + DOTCSV); - System.out.println("File: " + agents.getAbsolutePath()); + System.out.println("Writing file: " + agents.getAbsolutePath()); CSVWriter writer = new CSVWriter(new FileWriter(agents)); Statement stm = conn.createStatement(); - ResultSet rs = stm.executeQuery("SELECT " + columns + " FROM " + tableName); + String query = "SELECT " + columns + " FROM " + tableName; + System.out.println(" using query: [" + query + "]"); + System.out.flush(); + ResultSet rs = stm.executeQuery(query); writer.writeAll(rs,true); rs.close(); writer.close();
commit d8d9991b7f9985bd2eb7e107f180d1415706e8ae Merge: 686f2d7... 02a6eaf... Author: Heiko W. Rupp hwr@redhat.com Date: Tue Aug 17 14:38:06 2010 +0200
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 686f2d7aaf3701f7aaab6a8e20876de5c7e46bcf Author: Heiko W. Rupp hwr@redhat.com Date: Tue Aug 17 14:22:55 2010 +0200
Helper to generate the input data for table driven test setup
diff --git a/modules/helpers/perftest-data-gen/pom.xml b/modules/helpers/perftest-data-gen/pom.xml new file mode 100644 index 0000000..dceeb22 --- /dev/null +++ b/modules/helpers/perftest-data-gen/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd%22%3E + <parent> + <artifactId>rhq-helpers</artifactId> + <groupId>org.rhq.helpers</groupId> + <version>4.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <name>Perftest-data-gen</name> + <groupId>org.rhq.helpers</groupId> + <artifactId>perftest-data-gen</artifactId> + <version>4.0.0-SNAPSHOT</version> + <description>Create performance unit test csv files from database</description> + + + <dependencies> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>${commons-logging.version}</version> + </dependency> + + <dependency> + <groupId>net.sf.opencsv</groupId> + <artifactId>opencsv</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-core-dbutils</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>${postgresql.version}</version> + </dependency> + </dependencies> + + +</project> \ No newline at end of file diff --git a/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java b/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java new file mode 100644 index 0000000..5fcc229 --- /dev/null +++ b/modules/helpers/perftest-data-gen/src/main/java/org/rhq/etc/perftestDataGen/DataGen.java @@ -0,0 +1,96 @@ +/* + * 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.etc.perftestDataGen; + +import java.io.File; +import java.io.FileWriter; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +import au.com.bytecode.opencsv.CSVWriter; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import org.rhq.core.db.DbUtil; + +/** + * // TODO: Document this + * @author Heiko W. Rupp + */ +public class DataGen { + + private final Log log = LogFactory.getLog(DataGen.class); + private static final String TARGET = "target/"; + private static final String DOTCSV = ".csv"; + + private static final String[][] props = {// + {"agents","RHQ_Agent","id,name,address,port,agenttoken,remote_endpoint"}, + {"plugins","RHQ_Plugin","id,name,display_name,version,amps_version"} + }; + + public static void main(String[] args) { + + DataGen dg = new DataGen(); + + dg.run(args); + } + + private void run(String[] args) { + + if (args.length<3) { + System.err.println("Usage: DataGen jdbcurl user pass"); + return; + } + + + String url = args[0]; + String user = args[1]; + String pass = args[2]; + + try { + Connection conn = DbUtil.getConnection(url,user,pass); + + for (String[] prop : props) { + exportTable(conn, prop); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void exportTable(Connection conn, String[] prop) throws Exception { + + String fileName = prop[0]; + String tableName = prop[1]; + String columns = prop[2]; + + File agents = new File(TARGET + fileName + DOTCSV); + System.out.println("File: " + agents.getAbsolutePath()); + CSVWriter writer = new CSVWriter(new FileWriter(agents)); + Statement stm = conn.createStatement(); + ResultSet rs = stm.executeQuery("SELECT " + columns + " FROM " + tableName); + writer.writeAll(rs,true); + rs.close(); + writer.close(); + stm.close(); + + } +} diff --git a/modules/helpers/pom.xml b/modules/helpers/pom.xml index 8fa853a..a26b7f2 100644 --- a/modules/helpers/pom.xml +++ b/modules/helpers/pom.xml @@ -38,6 +38,7 @@ <module>pluginGen</module> <module>pluginAnnotations</module> <module>bundleGen</module> + <module>perftest-data-gen</module>
</modules>
commit 63b941dd6a0e954948c8a79e81d69cf388718d1c Author: Heiko W. Rupp hwr@redhat.com Date: Mon Aug 16 16:55:34 2010 +0200
More mvn:site related changes - add reports
diff --git a/pom.xml b/pom.xml index bc895da..c443bd7 100644 --- a/pom.xml +++ b/pom.xml @@ -1089,13 +1089,25 @@ <reporting> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jxr-plugin</artifactId> + <inherited>true</inherited> + </plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>2.3.1</version> + <configuration> + <xmlOutput>true</xmlOutput> + <onlyAnalyze>org.rhq.*,org.jboss.jopr.*</onlyAnalyze> + <effort>Max</effort> + <threshold>Default</threshold> + </configuration> + <inherited>true</inherited> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jxr-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jdepend-maven-plugin</artifactId> </plugin> <!-- <plugin> @@ -1111,6 +1123,25 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> </plugin> +<!-- + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>emma-maven-plugin</artifactId> + <version>1.0-alpha-2</version> + <inherited>true</inherited> + </plugin> +--> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + <version>2.4</version> + <inherited>true</inherited> + </plugin> + <plugin> + <!-- must be last plugin in the list --> + <groupId>org.codehaus.mojo</groupId> + <artifactId>dashboard-maven-plugin</artifactId> + </plugin> </plugins> </reporting>
@@ -1118,6 +1149,7 @@ <licenses> <license> <name>GPL</name> + <url>http://gnu.org</url> </license> </licenses> <developers>
rhq-commits@lists.fedorahosted.org