You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2011/10/02 05:37:40 UTC

svn commit: r1178114 - in /openejb/trunk/sandbox/jirareports: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/openejb/ src/main/java/org/apache/openejb/tools/ src/main/java/org/apache/openejb/tools...

Author: dblevins
Date: Sun Oct  2 03:37:40 2011
New Revision: 1178114

URL: http://svn.apache.org/viewvc?rev=1178114&view=rev
Log:
some tool i hacked up a few weeks ago and forgot to check in

Added:
    openejb/trunk/sandbox/jirareports/pom.xml
      - copied, changed from r1165158, openejb/trunk/sandbox/tools/pom.xml
    openejb/trunk/sandbox/jirareports/src/
    openejb/trunk/sandbox/jirareports/src/main/
    openejb/trunk/sandbox/jirareports/src/main/java/
    openejb/trunk/sandbox/jirareports/src/main/java/org/
    openejb/trunk/sandbox/jirareports/src/main/java/org/apache/
    openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/
    openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/
    openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/
    openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Entry.java
    openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Log.java
    openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/PatchReport.java
    openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Pipe.java
    openejb/trunk/sandbox/jirareports/src/main/resources/
    openejb/trunk/sandbox/jirareports/src/main/resources/patches.vm
Modified:
    openejb/trunk/sandbox/jirareports/jira_report.sh

Modified: openejb/trunk/sandbox/jirareports/jira_report.sh
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/jirareports/jira_report.sh?rev=1178114&r1=1178113&r2=1178114&view=diff
==============================================================================
--- openejb/trunk/sandbox/jirareports/jira_report.sh (original)
+++ openejb/trunk/sandbox/jirareports/jira_report.sh Sun Oct  2 03:37:40 2011
@@ -1,6 +1,6 @@
 #!/usr/local/bin/bash
 
-java=/usr/local/bin/java
+#java=/usr/local/bin/java
 swizzle=$HOME/swizzle-jirareport-1.6.2-SNAPSHOT-dep.jar
 
 template=${1?Specify a template name}
@@ -9,11 +9,26 @@ name=${3?Specify the name of the project
 to=${4?Specify the address to where the report should be sent}
 url=${5:-jira}
 
-$java -jar $swizzle $1 \
+java -cp target/jirareports-1.0-SNAPSHOT.jar \
+    org.apache.openejb.tools.patches.PatchReport \
     -DserverUrl=https://issues.apache.org/$url/ \
     -DprojectId=$id -DprojectName=$name \
     -Demail=true \
     -Dfrom=dblevins@apache.org \
     -Dto=$to \
     -Dusername=jirareport \
-    -Dpassword=ampad | /usr/sbin/sendmail -it
+    -Dpassword=ampad
+#    org.codehaus.swizzle.jirareport.Main  patches.vm
+#    org.apache.openejb.tools.patches.PatchReport
+#    | /usr/sbin/sendmail -it
+#mvn -Dtest=skip exec:java -Dexec.mainClass=org.apache.openejb.tools.patches.PatchReport \
+#    -DserverUrl=https://issues.apache.org/$url/ \
+#    -DprojectId=$id -DprojectName=$name \
+#    -Demail=true \
+#    -Dfrom=dblevins@apache.org \
+#    -Dto=$to \
+#    -Dusername=jirareport \
+#    -Dpassword=ampad
+##    org.codehaus.swizzle.jirareport.Main  patches.vm
+##    org.apache.openejb.tools.patches.PatchReport
+##    | /usr/sbin/sendmail -it

Copied: openejb/trunk/sandbox/jirareports/pom.xml (from r1165158, openejb/trunk/sandbox/tools/pom.xml)
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/jirareports/pom.xml?p2=openejb/trunk/sandbox/jirareports/pom.xml&p1=openejb/trunk/sandbox/tools/pom.xml&r1=1165158&r2=1178114&rev=1178114&view=diff
==============================================================================
--- openejb/trunk/sandbox/tools/pom.xml (original)
+++ openejb/trunk/sandbox/jirareports/pom.xml Sun Oct  2 03:37:40 2011
@@ -26,14 +26,14 @@
   <parent>
     <groupId>org.apache</groupId>
     <artifactId>apache</artifactId>
-    <version>7</version>
+    <version>10</version>
   </parent>
 
   <groupId>org.apache.openejb.tools</groupId>
-  <artifactId>tools</artifactId>
+  <artifactId>jirareports</artifactId>
   <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>
-  <name>OpenEJB Tools</name>
+  <name>OpenEJB Tools :: Jira Reports</name>
 
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -75,72 +75,12 @@
       <scope>test</scope>
     </dependency>
 
-    <!--  SignPost Dependencies For Signing requests -->
     <dependency>
-      <groupId>oauth.signpost</groupId>
-      <artifactId>signpost-core</artifactId>
-      <version>1.2</version>
-      <scope>compile</scope>
+      <groupId>org.codehaus.swizzle</groupId>
+      <artifactId>swizzle-jirareport</artifactId>
+      <version>1.6.1</version>
     </dependency>
 
-    <dependency>
-      <groupId>oauth.signpost</groupId>
-      <artifactId>signpost-commonshttp4</artifactId>
-      <version>1.2.1.1</version>
-    </dependency>
-
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-core</artifactId>
-      <version>3.0.5.RELEASE</version>
-    </dependency>
-
-    <!--  Apache commons compatible with signpost -->
-    <dependency>
-      <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpclient</artifactId>
-      <version>4.1.1</version>
-      <scope>compile</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpcore</artifactId>
-      <version>4.1.1</version>
-      <scope>compile</scope>
-    </dependency>
-
-    <!-- For Parsing JSON response -->
-    <dependency>
-      <groupId>org.codehaus.jackson</groupId>
-      <artifactId>jackson-mapper-asl</artifactId>
-      <version>1.6.4</version>
-      <scope>compile</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>log4j</groupId>
-      <artifactId>log4j</artifactId>
-      <version>1.2.16</version>
-    </dependency>
-
-    <!-- markdown 2 html -->
-    <dependency>
-      <groupId>org.markdownj</groupId>
-      <artifactId>markdownj</artifactId>
-      <version>0.3.0-1.0.2b4</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>1.3.2</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.velocity</groupId>
-      <artifactId>velocity</artifactId>
-      <version>1.7</version>
-    </dependency>
   </dependencies>
 
 </project>

Added: openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Entry.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Entry.java?rev=1178114&view=auto
==============================================================================
--- openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Entry.java (added)
+++ openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Entry.java Sun Oct  2 03:37:40 2011
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.tools.patches;
+
+import com.sun.org.apache.regexp.internal.RE;
+import org.codehaus.swizzle.jira.MapObject;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import java.util.Date;
+import java.util.Map;
+
+/**
+* @version $Rev$ $Date$
+*/
+@XmlAccessorType(XmlAccessType.PROPERTY)
+public class Entry extends MapObject {
+
+    public Entry() {
+    }
+
+    public Entry(Map data) {
+        super(data);
+    }
+
+    public String getMessage() {
+        return getString("message");
+    }
+
+    @XmlElement(name = "msg")
+    public void setMessage(String message) {
+        setString("message", message);
+    }
+
+    public long getRevision() {
+        return getLong("revision");
+    }
+
+    @XmlAttribute
+    public void setRevision(long revision) {
+        setLong("revision", revision);
+    }
+
+    public Date getDate() {
+        return getDate("date");
+    }
+
+    @XmlElement
+    public void setDate(Date date) {
+        setDate("date", date);
+    }
+
+    public String getAuthor() {
+        return getString("author");
+    }
+
+    @XmlElement
+    public void setAuthor(String author) {
+        setString("author", author);
+    }
+    
+    protected long getLong(String key) {
+        String value = getString(key);
+        if (value == null) return 0;
+        return Long.parseLong(value);
+    }
+
+    protected void setLong(String key, long value) {
+        fields.put(key, Long.toString(value));
+    }
+
+}

Added: openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Log.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Log.java?rev=1178114&view=auto
==============================================================================
--- openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Log.java (added)
+++ openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Log.java Sun Oct  2 03:37:40 2011
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.tools.patches;
+
+import org.codehaus.swizzle.jira.MapObject;
+import org.codehaus.swizzle.jira.MapObjectList;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+* @version $Rev$ $Date$
+*/
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlRootElement(name = "log")
+public class Log extends MapObject {
+
+    @XmlElement(name = "logentry")
+    private List<Entry> entries = new MapObjectList<Entry>();
+
+    public Log() {
+    }
+
+    public Log(Map data) {
+        super(data);
+    }
+
+    public List<Entry> getEntries() {
+        return entries;
+    }
+}

Added: openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/PatchReport.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/PatchReport.java?rev=1178114&view=auto
==============================================================================
--- openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/PatchReport.java (added)
+++ openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/PatchReport.java Sun Oct  2 03:37:40 2011
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.tools.patches;
+
+import org.codehaus.swizzle.jira.MapObjectList;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PatchReport {
+
+    public static void main(String[] args) throws Throwable {
+        System.setProperty("template", "patches.vm");
+        org.codehaus.swizzle.jirareport.Main.main(args);
+    }
+
+    public List getList() {
+        return new MapObjectList();
+    }
+
+    public Map<String, Log> patches(String svnurl) throws Exception {
+        //svn log --xml "-rHEAD:{2010-01-01}"
+
+        final String[] args = {"svn", "log", "--xml", "-rHEAD:{2010-06-01}", svnurl};
+        final Process process = Runtime.getRuntime().exec(args);
+        Pipe.out(process);
+        Pipe.err(process);
+
+        final JAXBContext context = JAXBContext.newInstance(Log.class);
+        final Unmarshaller unmarshaller = context.createUnmarshaller();
+
+        final Log log = (Log) unmarshaller.unmarshal(process.getInputStream());
+
+        Map<String, Log> patches = new HashMap<String, Log>();
+
+        for (Entry entry : log.getEntries()) {
+            final String message = entry.getMessage().toLowerCase();
+
+            final boolean matches = message.contains("patch") || message.contains("submitted") || message.contains("fix from ");
+            if (!matches) continue;
+
+            Log authorLog = patches.get(entry.getAuthor());
+            if (authorLog == null) {
+                authorLog = new Log();
+                patches.put(entry.getAuthor(), authorLog);
+            }
+
+            authorLog.getEntries().add(entry);
+        }
+
+        return patches;
+    }
+
+    public Date ago(int i) {
+        return new Date(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(i));
+    }
+}

Added: openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Pipe.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Pipe.java?rev=1178114&view=auto
==============================================================================
--- openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Pipe.java (added)
+++ openejb/trunk/sandbox/jirareports/src/main/java/org/apache/openejb/tools/patches/Pipe.java Sun Oct  2 03:37:40 2011
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.tools.patches;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public final class Pipe implements Runnable {
+
+    private final InputStream in;
+    private final OutputStream out;
+
+    public Pipe(InputStream in, OutputStream out) {
+        this.in = in;
+        this.out = out;
+    }
+
+    public static void pipe(Process process) {
+        in(process);
+        err(process);
+        out(process);
+    }
+
+    public static void out(Process process) {
+        pipe(System.in, process.getOutputStream());
+    }
+
+    public static void err(Process process) {
+        pipe(process.getErrorStream(), System.err);
+    }
+
+    public static void in(Process process) {
+        pipe(process.getInputStream(), System.out);
+    }
+
+    public static void pipe(InputStream in, OutputStream out) {
+        final Thread thread = new Thread(new Pipe(in, out));
+        thread.setDaemon(true);
+        thread.start();
+    }
+
+    public void run() {
+        try {
+            int i = -1;
+
+            byte[] buf = new byte[1024];
+
+            while ((i = in.read(buf)) != -1) {
+                out.write(buf, 0, i);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Added: openejb/trunk/sandbox/jirareports/src/main/resources/patches.vm
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/jirareports/src/main/resources/patches.vm?rev=1178114&view=auto
==============================================================================
--- openejb/trunk/sandbox/jirareports/src/main/resources/patches.vm (added)
+++ openejb/trunk/sandbox/jirareports/src/main/resources/patches.vm Sun Oct  2 03:37:40 2011
@@ -0,0 +1,82 @@
+#set( $void = $params.required( "serverUrl" , "https?://.+", "the base URL where jira is available, no trailing slash" ) )
+#set( $void = $params.required( "projectId" , "[0-9]+", "the numeric id the project" ) )
+#set( $void = $params.required( "projectName" , ".+", "the display name the project" ) )
+#if ( $email == "true" )
+#set( $void = $params.required( "to" , ".+", "the email 'To' address" ) )
+#set( $void = $params.required( "from" , ".+", "the email 'From' address" ) )
+#end
+#set( $void = $params.validate() )
+##
+#set( $url = "${serverUrl}/secure/IssueNavigator.jspa?view=rss&&pid=${projectId}&status=1&tempMax=1000&reset=true&decorator=none" )
+#set( $jirarss = $rss.fetch( $url ) )
+#set( $issues = $jirarss.fillAttachments() )
+#set( $void = $date.format("yyyy-MM-dd") )
+##
+#foreach( $issue in $issues )
+#set( $issue.attributes.totalAttachments = $issue.attachments.size() )
+#end
+#set( $issues = $issues.greater("@totalAttachments", 0) )
+#foreach( $issue in $issues )
+#set( $issue.attributes.firstPatch = $issue.attachments.min("created").created )
+#end
+##  Patches in SVN
+#set( $u = $utils.load("org.apache.openejb.tools.patches.PatchReport") )
+#set( $patches = $u.patches("https://svn.apache.org/repos/asf/openejb") )
+#set( $list = $u.list )
+#set ( $year = 0 )
+#set ( $quarter = 0 )
+#foreach( $e in $patches.entrySet() )
+#set( $e.value.attributes.author = $e.key )
+#set( $e.value.attributes.patches = $e.value.entries.size() )
+#set( $e.value.attributes.quarter = $e.value.entries.greater("date", $u.ago(90)).size() )
+#set( $e.value.attributes.year = $e.value.entries.greater("date", $u.ago(365)).size() )
+#set ( $year = $year + $e.value.attributes.year )
+#set ( $quarter = $quarter + $e.value.attributes.quarter )
+#set( $z = $list.add( $e.value ) )
+#end
+##
+#if ( $email == "true" )
+TO: $to
+FROM: $from
+SUBJECT: $issues.size() patches in the queue ($date)
+
+#end
+
+$projectName - $date.as("EEEE, MMMM d, yyyy")
+
+# Committed to SVN
+
+  Patches Applied
+
+   - $quarter this quarter
+   - $year this year
+
+  Committers Applying Patches
+
+  - Recently (90 days)
+
+#foreach( $item in $list.greater("@quarter", 0).descending("@quarter") )
+      - $item.attributes.author  $item.attributes.quarter
+#end
+
+  - This year (12 months)
+
+#foreach( $item in $list.greater("@year", 0).descending("@year") )
+      - $item.attributes.author  $item.attributes.year
+#end
+
+# Submitted to JIRA (unapplied)
+
+  $issues.size() Open Issues with Attachments
+
+  (sorted oldest to newest)
+
+#foreach( $issue in $issues.sort("@firstPatch") )
+    [$issue.key] $issue.summary
+      $date.format($issue.created)  $issue.reporter   $issue.type
+#foreach ( $attachment in $issue.attachments.sort("created") )
+      $date.format($attachment.created)  $attachment.author   $attachment.url
+#end
+      $issue.link
+
+#end