You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by ad...@apache.org on 2014/04/26 20:00:26 UTC

svn commit: r1590265 - in /labs/panopticon: src/asf/utils/ tests/ tests/data/test.apache.org/ tests/data/test.apache.org/dev/ tests/data/test.apache.org/dev/archive/ tests/data/test.apache.org/dev/archive/4/

Author: adc
Date: Sat Apr 26 18:00:25 2014
New Revision: 1590265

URL: http://svn.apache.org/r1590265
Log:
Handy ezmlm wrapper class

Added:
    labs/panopticon/src/asf/utils/ezmlm.py
    labs/panopticon/tests/data/test.apache.org/
    labs/panopticon/tests/data/test.apache.org/dev/
    labs/panopticon/tests/data/test.apache.org/dev/archive/
    labs/panopticon/tests/data/test.apache.org/dev/archive/4/
    labs/panopticon/tests/data/test.apache.org/dev/archive/4/08   (with props)
    labs/panopticon/tests/data/test.apache.org/dev/archive/4/index   (with props)
    labs/panopticon/tests/data/test.apache.org/dev/num
    labs/panopticon/tests/test_ezmlm.py

Added: labs/panopticon/src/asf/utils/ezmlm.py
URL: http://svn.apache.org/viewvc/labs/panopticon/src/asf/utils/ezmlm.py?rev=1590265&view=auto
==============================================================================
--- labs/panopticon/src/asf/utils/ezmlm.py (added)
+++ labs/panopticon/src/asf/utils/ezmlm.py Sat Apr 26 18:00:25 2014
@@ -0,0 +1,87 @@
+#
+# 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.
+#
+""" A class for interacting with EZMLM
+"""
+import logging
+import os
+
+from asf.utils.execute import execute
+
+
+log = logging.getLogger(__name__)
+
+
+class Ezmlm(object):
+    def __init__(self, list_dir):
+        self.list_dir = list_dir
+
+    @property
+    def num_messages(self):
+        with open(os.path.join(self.list_dir, 'num')) as f:
+            content = f.readlines()
+            num, size = content[0].split(':')
+            return num
+
+    @property
+    def subscribers(self):
+        stdout, stderr = execute('ezmlm-list %s' % self.list_dir)
+
+        subscribers = set()
+        for line in stdout.readlines():
+            subscribers.add(line.strip())
+
+        return subscribers
+
+    @property
+    def moderators(self):
+        stdout, stderr = execute('ezmlm-list %s mod' % self.list_dir)
+        moderators = set()
+        for line in stdout.readlines():
+            moderators.add(line.strip())
+
+        return moderators
+
+    def add_subscriber(self, subscriber):
+        if subscriber in self.subscribers:
+            log.warning('Subscriber %s already in list')
+        else:
+            execute('ezmlm-sub %s %s' % (self.list_dir, subscriber))
+
+    def remove_subscriber(self, subscriber):
+        if subscriber not in self.subscribers:
+            log.warning('Subscriber %s not in list')
+        else:
+            execute('ezmlm-unsub %s %s' % (self.list_dir, subscriber))
+
+    def add_moderator(self, moderator):
+        if moderator in self.moderators:
+            log.warning('Subscriber %s already in list')
+        else:
+            execute('ezmlm-sub %s mod %s' % (self.list_dir, moderator))
+
+    def remove_moderator(self, moderator):
+        if moderator not in self.moderators:
+            log.warning('Subscriber %s not in list')
+        else:
+            execute('ezmlm-unsub %s mod %s' % (self.list_dir, moderator))
+
+    def path_to_archived_message(self, number):
+        m = str(number / 100)
+        n = str(number % 10).zfill(2)
+        return os.path.join(self.list_dir, 'archive', m, n)

Added: labs/panopticon/tests/data/test.apache.org/dev/archive/4/08
URL: http://svn.apache.org/viewvc/labs/panopticon/tests/data/test.apache.org/dev/archive/4/08?rev=1590265&view=auto
==============================================================================
--- labs/panopticon/tests/data/test.apache.org/dev/archive/4/08 (added)
+++ labs/panopticon/tests/data/test.apache.org/dev/archive/4/08 Sat Apr 26 18:00:25 2014
@@ -0,0 +1,81 @@
+Return-Path: <ji...@apache.org>
+Delivered-To: mailing list dev@mrql.incubator.apache.org
+Received: (qmail 96806 invoked by uid 99); 17 Apr 2014 12:16:40 -0000
+Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136)
+    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Apr 2014 12:16:40 +0000
+X-ASF-Spam-Status: No, hits=-2001.0 required=5.0
+	tests=ALL_TRUSTED,RP_MATCHES_RCVD
+X-Spam-Check-By: apache.org
+Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3)
+    by apache.org (qpsmtpd/0.29) with SMTP; Thu, 17 Apr 2014 12:16:38 +0000
+Received: (qmail 95185 invoked by uid 99); 17 Apr 2014 12:16:18 -0000
+Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28)
+    by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Apr 2014 12:16:18 +0000
+Date: Thu, 17 Apr 2014 12:16:18 +0000 (UTC)
+From: "Leonidas Fegaras (JIRA)" <ji...@apache.org>
+To: dev@mrql.incubator.apache.org
+Message-ID: <JI...@arcas>
+In-Reply-To: <JI...@arcas>
+References: <JI...@arcas>
+Subject: [jira] [Commented] (MRQL-34) Introduce junit for testing
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf-8
+Content-Transfer-Encoding: 7bit
+X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394
+X-Virus-Checked: Checked by ClamAV on apache.org
+
+
+    [ https://issues.apache.org/jira/browse/MRQL-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13972865#comment-13972865 ] 
+
+Leonidas Fegaras commented on MRQL-34:
+--------------------------------------
+
+I don't know your code, but if I have :
+
+	public void setUp() throws Exception {
+            Config.compile_functional_arguments = false;
+            createEvaluator();
+            Translator.global_reset();
+	}
+
+I get the following errors:
+
+Tests in error: 
+  testCore1ArrayPlus(org.apache.mrql.MapReduceEvaluatorInMemoryTest)
+  testCore1TupleIndex(org.apache.mrql.MapReduceEvaluatorInMemoryTest)
+  testCore1Cast(org.apache.mrql.MapReduceEvaluatorInMemoryTest)
+  testCore1Math(org.apache.mrql.MapReduceEvaluatorInMemoryTest)
+  testCore1Variable(org.apache.mrql.MapReduceEvaluatorInMemoryTest)
+  testCore1Array(org.apache.mrql.MapReduceEvaluatorInMemoryTest)
+  testCore1Range(org.apache.mrql.MapReduceEvaluatorInMemoryTest)
+
+Tests run: 54, Failures: 0, Errors: 7, Skipped: 0
+
+If I remove createEvaluator(), I will get:
+
+Tests run: 54, Failures: 0, Errors: 0, Skipped: 0
+
+
+> Introduce junit for testing
+> ---------------------------
+>
+>                 Key: MRQL-34
+>                 URL: https://issues.apache.org/jira/browse/MRQL-34
+>             Project: MRQL
+>          Issue Type: Improvement
+>            Reporter: Lee moon soo
+>         Attachments: MRQL-34.patch, MRQL-34_a.patch, MRQL-34_b.patch
+>
+>
+> MRQL has testcase and it's run as java standalone application by org.apache.mrql.Test. 
+> The Test class Invoked by maven antrun plugin at test phase
+> and then load the queries and generate result and compare with the previous result (if result exists)
+> If junit runs those test case instead of antrun, it'll give some advantages
+> 1. More common ways to adding / running test in Java
+> 2. Once CI is setup, junit produces information for CI about details of test.
+
+
+
+--
+This message was sent by Atlassian JIRA
+(v6.2#6252)

Propchange: labs/panopticon/tests/data/test.apache.org/dev/archive/4/08
------------------------------------------------------------------------------
    svn:executable = *

Added: labs/panopticon/tests/data/test.apache.org/dev/archive/4/index
URL: http://svn.apache.org/viewvc/labs/panopticon/tests/data/test.apache.org/dev/archive/4/index?rev=1590265&view=auto
==============================================================================
--- labs/panopticon/tests/data/test.apache.org/dev/archive/4/index (added)
+++ labs/panopticon/tests/data/test.apache.org/dev/archive/4/index Sat Apr 26 18:00:25 2014
@@ -0,0 +1,18 @@
+400: bmhnpolbbpihjaigabof [jira] [Commented] (MRQL-34) Introduce junit for testing
+	15 Apr 2014 12:52:42 -0000;ahkogdgablboceeehech Leonidas Fegaras (JIRA)
+401: gfalnpodfbeecihloegj [jira] [Updated] (MRQL-34) Introduce junit for testing
+	15 Apr 2014 13:08:41 -0000;ahkogdgablboceeehech Lee moon soo (JIRA)
+402: nmpgildpjiljjlngcnib [ANNOUNCE] Moon Soo Lee joins the MRQL PPMC
+	16 Apr 2014 15:26:25 -0000;cfcbmfjaijopkjbelhpb Leonidas Fegaras
+403: nmpgildpjiljjlngcnib Re: [ANNOUNCE] Moon Soo Lee joins the MRQL PPMC
+	16 Apr 2014 15:57:35 -0000;ecmdfphkipfchbecnfji Alan Cabrera
+404: bmhnpolbbpihjaigabof [jira] [Commented] (MRQL-34) Introduce junit for testing
+	16 Apr 2014 17:02:36 -0000;ahkogdgablboceeehech Leonidas Fegaras (JIRA)
+405: nmpgildpjiljjlngcnib Re: [ANNOUNCE] Moon Soo Lee joins the MRQL PPMC
+	16 Apr 2014 21:34:08 -0000;emlclnginomajhdnpocd Edward J. Yoon
+406: nmpgildpjiljjlngcnib Re: [ANNOUNCE] Moon Soo Lee joins the MRQL PPMC
+	16 Apr 2014 23:22:40 -0000;gilpnhfofieiojbhhiaf moon soo Lee
+407: bmhnpolbbpihjaigabof [jira] [Commented] (MRQL-34) Introduce junit for testing
+	17 Apr 2014 10:17:46 -0000;ahkogdgablboceeehech Lee moon soo (JIRA)
+408: bmhnpolbbpihjaigabof [jira] [Commented] (MRQL-34) Introduce junit for testing
+	17 Apr 2014 12:16:40 -0000;ahkogdgablboceeehech Leonidas Fegaras (JIRA)

Propchange: labs/panopticon/tests/data/test.apache.org/dev/archive/4/index
------------------------------------------------------------------------------
    svn:executable = *

Added: labs/panopticon/tests/data/test.apache.org/dev/num
URL: http://svn.apache.org/viewvc/labs/panopticon/tests/data/test.apache.org/dev/num?rev=1590265&view=auto
==============================================================================
--- labs/panopticon/tests/data/test.apache.org/dev/num (added)
+++ labs/panopticon/tests/data/test.apache.org/dev/num Sat Apr 26 18:00:25 2014
@@ -0,0 +1 @@
+408:3733

Added: labs/panopticon/tests/test_ezmlm.py
URL: http://svn.apache.org/viewvc/labs/panopticon/tests/test_ezmlm.py?rev=1590265&view=auto
==============================================================================
--- labs/panopticon/tests/test_ezmlm.py (added)
+++ labs/panopticon/tests/test_ezmlm.py Sat Apr 26 18:00:25 2014
@@ -0,0 +1,33 @@
+#
+# 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.
+#
+import os
+
+from nose.tools import assert_equals
+
+from asf.utils.ezmlm import Ezmlm
+
+
+def test_num_messages():
+    ezmlm = Ezmlm(os.path.join(os.path.dirname(__file__), 'data', 'test.apache.org', 'dev'))
+    assert_equals(408, int(ezmlm.num_messages))
+
+def test_path_to_archived_message():
+    ezmlm = Ezmlm(os.path.join(os.path.dirname(__file__), 'data', 'test.apache.org', 'dev'))
+    assert_equals(os.path.join(os.path.dirname(__file__), 'data', 'test.apache.org', 'dev', 'archive', '4', '08'),
+                  ezmlm.path_to_archived_message(408))



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org