Permalink
Browse files

Switch to swank-clojure-project structure, but tests are still failing

  • Loading branch information...
mudphone committed Dec 15, 2009
1 parent 4c01d96 commit c03ff2437d596c52abeebf67813f00cfe3d31f5a
View
@@ -4,4 +4,4 @@
.project
logs/*
output/*
-lib/java/hbase-site.xml
+lib/hbase-site.xml
View
@@ -7,8 +7,8 @@ if [ -z "${HBASE_RUNNER_HOME}" ]; then
fi
# You can probably leave the rest alone:
-CLOJURE_DIR="${HBASE_RUNNER_HOME}/lib/java"
-CP_JARS="${CLOJURE_DIR}/*"
+LIB_DIR="${HBASE_RUNNER_HOME}/lib"
+CP_JARS="${LIB_DIR}/*"
CP="${CP_JARS}:${HBASE_RUNNER_HOME}/src"
# Add extra classpath, if any -- for example the location of hbase-site.xml.
View
@@ -1,2 +1,2 @@
-(use 'mudphone.hbase-runner.hbase-repl)
+(use 'hbase-runner.hbase-repl)
(use 'clojure.contrib.pprint)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,5 +1,5 @@
-(ns mudphone.hbase-runner.config.hbase-runner
- (:use mudphone.hbase-runner.utils.file))
+(ns hbase-runner.config.hbase-runner
+ (:use hbase-runner.utils.file))
(def *hbase-runner-config*
(let [hbase-runner-home (or (System/getenv "HBASE_RUNNER_HOME")
@@ -1,14 +1,14 @@
-(ns mudphone.hbase-runner.hbase-repl
+(ns hbase-runner.hbase-repl
(:import [java.io File])
(:import [org.apache.hadoop.hbase HBaseConfiguration HConstants])
(:import [org.apache.hadoop.hbase.client HBaseAdmin HTable Scan])
(:require [clojure.contrib [str-utils :as str-utils]])
- (:use mudphone.hbase-runner.config.hbase-runner)
- (:use mudphone.hbase-runner.utils.clojure)
- (:use mudphone.hbase-runner.utils.file)
- (:use mudphone.hbase-runner.utils.find)
- (:use mudphone.hbase-runner.utils.create)
- (:use mudphone.hbase-runner.utils.truncate)
+ (:use hbase-runner.config.hbase-runner)
+ (:use hbase-runner.utils.clojure)
+ (:use hbase-runner.utils.file)
+ (:use hbase-runner.utils.find)
+ (:use hbase-runner.utils.create)
+ (:use hbase-runner.utils.truncate)
(:use clojure.contrib.pprint))
(defn set-current-table-ns [current-ns]
@@ -20,7 +20,7 @@
current-ns
(hbr*default-table-ns))))
-(defn- read-conn-config []
+(defn read-conn-config []
(let [config-file (str (hbr*config-dir) "/connections.clj")]
(try
(load-file config-file)
@@ -30,7 +30,7 @@
config-file)
(System/exit 1)))))
-(defn- hbase-configuration
+(defn hbase-configuration
([]
(hbase-configuration :default))
([system]
@@ -43,6 +43,7 @@
(throw (Exception. "No matching system config.")))
(let [merged-config (merge
(:default user-configs) (system user-configs))
+ _ (pprint merged-config)
hbase-config (HBaseConfiguration.)]
(doto hbase-config
(.setInt "hbase.client.retries.number"
@@ -53,15 +54,22 @@
(:hbase.master merged-config))
(.set "hbase.zookeeper.quorum"
(:hbase.zookeeper.quorum merged-config))
- (.setBoolean "hbase.cluster.distributed"
- (:hbase.cluster.distributed merged-config))
- (.set "hbase.rootdir"
- (:hbase.rootdir merged-config))
- ))))))
+ )
+ (if (:hbase.cluster.distribued merged-config)
+ (doto hbase-config
+ (.setBoolean "hbase.cluster.distributed"
+ (:hbase.cluster.distributed merged-config))
+ (.set "hbase.rootdir"
+ (:hbase.rootdir merged-config)))
+ )
+ hbase-config)))))
(declare *HBaseConfiguration*)
-(defn- hbase-admin []
- (HBaseAdmin. *HBaseConfiguration*))
+(defn hbase-admin []
+ (println "Before hbase-admin")
+ (pprint *HBaseConfiguration*)
+ (HBaseAdmin. *HBaseConfiguration*)
+ (println "After hbase-admin"))
(defn print-current-settings []
(println "HBase Runner Home is:" (hbr*hbase-runner-home))
@@ -89,7 +97,9 @@
([system table-ns]
(set-current-table-ns table-ns)
(def *HBaseConfiguration* (hbase-configuration system))
+ (println "After HBaseConfig")
(def *HBaseAdmin* (hbase-admin))
+ (println "After HBaseAdmin")
(dosync
(alter *hbase-runner-config* assoc :system system))
(print-current-settings)))
@@ -1,7 +1,7 @@
-(ns mudphone.hbase-runner.spec-helper
+(ns hbase-runner.spec-helper
(:require [clojure.contrib.java-utils :as java-utils])
(:import [org.apache.hadoop.hbase HTableDescriptor])
- (:use mudphone.hbase-runner.hbase-repl))
+ (:use hbase-runner.hbase-repl))
(defn create-table-if-does-not-exist [table-name]
(if-not (table-exists? table-name)
@@ -1,4 +1,4 @@
-(ns mudphone.hbase-runner.utils.clojure
+(ns hbase-runner.utils.clojure
(:import (java.io PushbackReader StringReader)))
(defn read-clojure-str [object-str]
@@ -1,8 +1,8 @@
-(ns mudphone.hbase-runner.utils.create
+(ns hbase-runner.utils.create
(:import [org.apache.hadoop.hbase HColumnDescriptor HTableDescriptor])
(:import [org.apache.hadoop.hbase.client HTable])
- (:use mudphone.hbase-runner.utils.clojure)
- (:use mudphone.hbase-runner.utils.file))
+ (:use hbase-runner.utils.clojure)
+ (:use hbase-runner.utils.file))
(defn- compression-name-for [hcolumn-descriptor]
(.getName (.getCompression hcolumn-descriptor)))
@@ -1,7 +1,7 @@
-(ns mudphone.hbase-runner.utils.file
+(ns hbase-runner.utils.file
(:import (java.io BufferedReader BufferedWriter File FileInputStream FileWriter InputStreamReader)
(org.apache.commons.io FileUtils))
- (:use mudphone.hbase-runner.utils.clojure)
+ (:use hbase-runner.utils.clojure)
(:use clojure.contrib.pprint)
(:require [clojure.contrib.str-utils2 :as su2]))
@@ -1,4 +1,4 @@
-(ns mudphone.hbase-runner.utils.find)
+(ns hbase-runner.utils.find)
(defn is-in-table-ns [table-ns table-name]
(not (nil? (re-find (re-pattern (str "^" table-ns)) table-name))))
@@ -1,4 +1,4 @@
-(ns mudphone.hbase-runner.utils.truncate
+(ns hbase-runner.utils.truncate
(:use clojure.contrib.pprint))
(defn filter-truncated [results]
@@ -1,9 +1,9 @@
-(ns mudphone.hbase-runner-spec
+(ns hbase-runner.hbase-repl-spec
(:require [clojure.contrib.java-utils :as java-utils])
(:use [clojure.test :only [run-tests deftest is]])
- (:use mudphone.hbase-runner.config.hbase-runner)
- (:use mudphone.hbase-runner.spec-helper)
- (:use mudphone.hbase-runner.hbase-repl))
+ (:use hbase-runner.config.hbase-runner)
+ (:use hbase-runner.spec-helper)
+ (:use hbase-runner.hbase-repl))
(deftest current-table-ns-test
(is (= "hbr_spec" (current-table-ns))))
View
@@ -1,7 +1,6 @@
-;; (use 'mudphone.hbase-runner.hbase-repl)
(def completions
(reduce concat (map (fn [p] (keys (ns-publics (find-ns p))))
- '(clojure.core clojure.set clojure.xml clojure.zip mudphone.hbase-runner.hbase-repl))))
+ '(clojure.core clojure.set clojure.xml clojure.zip hbase-runner.hbase-repl))))
(with-open [f (java.io.BufferedWriter. (java.io.FileWriter. (str (System/getenv "HOME") "/.clj_completions")))]
(.write f (apply str (interleave completions (repeat "\n")))))
View
@@ -1,9 +1,9 @@
-(ns mudphone.hbase-runner-spec
- (:use mudphone.hbase-runner.hbase-repl))
+(ns hbase-runner.hbase-repl-spec
+ (:use hbase-runner.hbase-repl))
(start-hbase-repl :test "hbr_spec")
-(load-file "src/mudphone/hbase_runner/spec_helper.clj")
-(load-file "spec/mudphone/hbase_runner/hbase_repl_spec.clj")
+(load-file "src/hbase_runner/spec_helper.clj")
+(load-file "test/hbase_runner/hbase_repl_spec.clj")
(run-tests)

0 comments on commit c03ff24

Please sign in to comment.