[
https://issues.apache.org/jira/browse/STORM-515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15220712#comment-15220712
]
ASF GitHub Bot commented on STORM-515:
--------------------------------------
Github user knusbaum commented on a diff in the pull request:
https://github.com/apache/storm/pull/1262#discussion_r58132657
--- Diff:
examples/storm-starter/test/clj/org/apache/storm/starter/clj/bolts_test.clj ---
@@ -0,0 +1,115 @@
+;; 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.
+(ns org.apache.storm.starter.clj.bolts-test
+ (:require [clojure.test :refer :all]
+ [org.apache.storm.starter.clj.word-count :refer [word-count
split-sentence]]
+ [org.apache.storm.starter.clj.exclamation :refer
[exclamation-bolt]]
+ [org.apache.storm.starter.clj.bolts :refer
+ [rolling-count-bolt intermediate-rankings-bolt
total-rankings-bolt]]
+ [org.apache.storm [testing :refer :all]])
+ (:import [org.apache.storm Constants]
+ [org.apache.storm.task OutputCollector IOutputCollector]
+ [org.apache.storm.starter.tools Rankable]
+ [org.apache.storm.tuple Tuple]))
+
+(defmacro test-with-tuple [[bolt tuples] & body]
+ `(let [bolt# ~bolt
+ tuples# (atom [])]
+ (.prepare bolt# {} nil (OutputCollector.
+ (reify IOutputCollector
+ (emit [_ _ _ tuple#]
+ (swap! tuples# conj tuple#))
+ (ack [_ input]))))
+ (if (vector? ~tuples)
+ (doseq [t# ~tuples]
+ (.execute bolt# t#))
+ (.execute bolt# ~tuples))
+ (let [~'tuples @tuples#]
--- End diff --
`~'tuples` evaluates to `tuples` This makes the macro unhygienic.
> Clojure documentation and examples
> ----------------------------------
>
> Key: STORM-515
> URL: https://issues.apache.org/jira/browse/STORM-515
> Project: Apache Storm
> Issue Type: Improvement
> Components: documentation, examples
> Affects Versions: 0.9.2-incubating
> Reporter: Dmitri Sotnikov
> Labels: newbie
>
> Clojure storm-starter example is extremely basic
> (https://github.com/apache/storm/blob/master/examples/storm-starter/src/clj/storm/starter/clj/word_count.clj)
> and doesn't demonstrate many use cases.
> Clojure documentation page
> (http://storm.incubator.apache.org/documentation/Clojure-DSL.html) has
> unreadable code samples, and glosses over many details in how bolts are
> setup, how to initialize parametarized bolts, where the requires such as
> execute come from, and so on.
> It would be nice to see clear documentation with properly documented examples
> for each of the use cases.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)