incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [40/58] [partial] Initial setup of new console
Date Tue, 08 Oct 2013 17:59:48 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/audits_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/audits_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/audits_controller_spec.rb
new file mode 100644
index 0000000..0edd539
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/audits_controller_spec.rb
@@ -0,0 +1,52 @@
+# 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.
+
+require 'spec_helper'
+
+describe AuditsController do
+  describe "actions" do
+    before do
+      # Universal setup
+      setup_tests
+    end
+
+    describe 'GET index' do
+      it "renders the index template" do
+        get :index
+        response.should render_template 'index'
+      end
+
+      it "grabs all audits within the last two days without given hours" do
+        Audit.should_receive(:recent).with(48, 0)
+        get :index
+      end
+
+      it "grabs all audits within the last hours given the from hours" do
+        Audit.should_receive(:recent).with(40, 0)
+        get :index, :from => 40
+      end
+
+      it "grabs all audits within the last hours given the to hours" do
+        Audit.should_receive(:recent).with(48, 10)
+        get :index, :to => 10
+      end
+
+      it "grabs all audits within the the given range of hours" do
+        Audit.should_receive(:recent).with(50, 20)
+        get :index, :from => 50, :to => 20
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/blur_controllers_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/blur_controllers_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/blur_controllers_controller_spec.rb
new file mode 100644
index 0000000..1bfaec0
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/blur_controllers_controller_spec.rb
@@ -0,0 +1,54 @@
+# 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.
+
+require 'spec_helper'
+
+describe BlurControllersController do
+  describe "actions" do
+    before do
+      # Universal setup
+      setup_tests
+
+      @blur_controller = FactoryGirl.create :blur_controller
+      BlurController.stub!(:find).and_return @blur_controller
+    end
+
+    describe 'DELETE destroy' do
+      before do
+        @blur_controller.stub!(:destroy)
+      end
+
+      it "destroys the controller" do
+        @blur_controller.stub!(:controller_status).and_return 0
+        @blur_controller.should_receive(:destroy)
+        delete :destroy, :id => @blur_controller.id, :format => :json
+      end
+
+      it "errors when the controller is enabled" do
+        expect {
+          @blur_controller.stub!(:controller_status).and_return 1
+          delete :destroy, :id => @blur_controller.id, :format => :json
+        }.to raise_error
+      end
+
+      it "logs the event when the controller is deleted" do
+        @blur_controller.stub!(:controller_status).and_return 0
+        @blur_controller.stub!(:destroyed?).and_return true
+        Audit.should_receive :log_event
+        delete :destroy, :id => @blur_controller.id, :format => :json
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/blur_queries_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/blur_queries_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/blur_queries_controller_spec.rb
new file mode 100644
index 0000000..fef96a8
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/blur_queries_controller_spec.rb
@@ -0,0 +1,104 @@
+# 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.
+
+require "spec_helper"
+
+describe BlurQueriesController do
+  describe "actions" do
+    before do
+      # Universal Setup
+      setup_tests
+
+      # Mock out the blur client
+      @client = mock(Blur::Blur::Client)
+      BlurThriftClient.stub!(:client).and_return(@client)
+
+      # Blur Query model
+      @blur_query = FactoryGirl.create :blur_query
+      # Stub chain for load and auth loading a specific query
+      @zookeeper.stub_chain(:blur_queries, :find).and_return(@blur_query)
+    end
+
+    describe "GET index" do
+      context "when an HTML request" do
+        it "should render the index template" do
+          get :index, :format => :html
+          response.should render_template :index
+        end
+      end
+    end
+
+    describe "GET refresh" do
+      before do
+        @blur_queries = FactoryGirl.create_list :blur_query, 3
+        @blur_queries.each do |query|
+          query.stub!(:summary).and_return Hash.new
+        end
+        @zookeeper.stub!(:refresh_queries).and_return @blur_queries
+      end
+
+      it "it retrieves the refresh_queries" do
+        @zookeeper.should_receive(:refresh_queries).with(kind_of(ActiveSupport::TimeWithZone))
+        get :refresh, :time_length => 1, :format => :json
+      end
+
+      it "it gets the summary on each of the queries" do
+        @blur_queries.each do |query|
+          query.should_receive(:summary).with(@user)
+        end
+        get :refresh, :time_length => 1, :format => :json
+      end
+
+      it "it should set the root to aadata for the data table lib" do
+        get :refresh, :time_length => 1, :format => :json
+        response.body.should include("aaData")
+      end
+    end
+
+    describe "GET show" do
+      it "should render the more_info partial when the request is html" do
+        get :show, :id => @blur_query.id, :format => :html
+        response.should render_template(:partial => '_show')
+      end
+
+      it "should render the query summary as json when the request is json" do
+        @blur_query.stub!(:summary).and_return Hash.new
+        get :show, :id => @blur_query.id, :format => :json
+      end
+    end
+
+    describe "PUT cancel" do
+      before do
+        BlurQuery.stub!(:find).and_return(@blur_query)
+        @blur_query.stub!(:cancel)
+      end
+
+      it "should cancel a running query if cancel param is true" do
+        @blur_query.should_receive(:cancel)
+        put :cancel, :id => @blur_query.id, :format => :html
+      end
+
+      it "should render the blur_query partial" do
+        put :cancel, :id => @blur_query.id, :format => :html
+        response.should render_template(:partial => '_blur_query')
+      end
+
+      it "should log an audit event when a query is canceled" do
+        Audit.should_receive :log_event
+        put :cancel, :id => @blur_query.id, :format => :html
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/blur_shards_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/blur_shards_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/blur_shards_controller_spec.rb
new file mode 100644
index 0000000..cf1848a
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/blur_shards_controller_spec.rb
@@ -0,0 +1,66 @@
+# 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.
+
+require 'spec_helper'
+
+describe BlurShardsController do
+  describe "actions" do
+    before do
+      # Universal setup
+      setup_tests
+
+      @blur_shard = FactoryGirl.create :blur_shard
+      BlurShard.stub!(:find).and_return @blur_shard
+    end
+
+    describe 'GET index' do
+      before do
+        @blur_shards = [@blur_shard]
+        BlurShard.stub!(:all).and_return @blur_shards
+      end
+
+      it "renders all shards as json" do
+        get :index, :format => :json
+        response.body.should == @blur_shards.to_json(:except => :cluster_id)
+      end
+    end
+
+    describe 'DELETE destroy' do
+      before do
+        @blur_shard.stub!(:destroy)
+      end
+
+      it "destroys the shard" do
+        @blur_shard.should_receive(:destroy)
+        @blur_shard.stub!(:shard_status).and_return 0
+        delete :destroy, :id => @blur_shard.id, :format => :json
+      end
+
+      it "errors when the shard is enabled" do
+        expect {
+          @blur_shard.stub!(:shard_status).and_return 1
+          delete :destroy, :id => @blur_shard.id, :format => :json
+        }.to raise_error
+      end
+
+      it "logs the event when the shard is deleted" do
+        @blur_shard.stub!(:shard_status).and_return 0
+        @blur_shard.stub!(:destroyed?).and_return true
+        Audit.should_receive :log_event
+        delete :destroy, :id => @blur_shard.id, :format => :json
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/blur_tables_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/blur_tables_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/blur_tables_controller_spec.rb
new file mode 100644
index 0000000..9c9a51f
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/blur_tables_controller_spec.rb
@@ -0,0 +1,178 @@
+# 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.
+
+require "spec_helper"
+
+describe BlurTablesController do
+  describe "actions" do
+    before(:each) do
+      # Uninversal Setup
+      setup_tests
+
+      # Models used for model chain
+      @client = mock(Blur::Blur::Client)
+      @blur_table = FactoryGirl.create :blur_table
+      @clusters = FactoryGirl.create_list :cluster, 3
+
+      # Setup the chain
+      @zookeeper.stub!(:clusters_with_query_status).and_return @clusters
+      controller.stub!(:thrift_client).and_return(@client)
+    end
+
+    describe "GET index" do
+      it "should call the before_filter on index" do
+        controller.should_receive :zookeepers
+        get :index, :format => :html
+      end
+
+      it "should assign @clusters to be the current zookeeper's clusters" do
+        get :index, :format => :html
+        assigns(:clusters).should == @clusters
+      end
+
+      it "should call can_update on each cluster" do
+        @zookeeper.should_receive(:clusters_with_query_status).with(@user)
+        get :index, :format => :html
+      end
+
+      it "should render the index template" do
+        get :index, :format => :html
+        response.should render_template "index"
+      end
+
+      it "should render the clusters as json" do
+        get :index, :format => :json
+        response.body.should == @clusters.to_json(:methods => [:blur_tables], :blur_tables => true)
+      end
+    end
+
+    describe "PUT enable" do
+      before(:each) do
+        @tables = [1, 2, 3]
+        BlurTable.stub(:find).and_return [@blur_table]
+        @blur_table.stub!(:enable)
+        @blur_table.stub!(:save)
+      end
+
+      it "should enable and update all the given tables" do
+        BlurTable.should_receive(:find).with @tables.collect{|id| id.to_s}
+        @blur_table.should_receive(:enable)
+        @blur_table.should_receive(:table_status=)
+        @blur_table.should_receive(:save)
+        put :enable, :tables => @tables, :format => :json
+      end
+
+      it "should log an audit for every table enabled" do
+        Audit.should_receive(:log_event)
+        put :enable, :tables => @tables, :format => :json
+      end
+    end
+
+    describe "PUT disable" do
+      before(:each) do
+        @tables = [1, 2, 3]
+        BlurTable.stub(:find).and_return [@blur_table]
+        BlurTable.stub!(:disable)
+        @blur_table.stub!(:save)
+      end
+
+      it "should disable and update all the given tables" do
+        BlurTable.should_receive(:find).with @tables.collect{|id| id.to_s}
+        @blur_table.should_receive(:disable)
+        @blur_table.should_receive(:table_status=)
+        @blur_table.should_receive(:save)
+        put :disable, :tables => @tables, :format => :json
+      end
+
+      it "should log an audit for every table disabled" do
+        Audit.should_receive(:log_event)
+        put :disable, :tables => @tables, :format => :json
+      end
+    end
+
+    describe "DELETE destroy" do
+      before(:each) do
+        @tables = [1, 2, 3]
+        BlurTable.stub(:find).and_return [@blur_table]
+        @blur_table.stub!(:blur_destroy)
+        BlurTable.stub!(:destroy)
+        @blur_table.stub!(:save)
+      end
+
+      it "should destroy all the given tables" do
+        @blur_table.should_receive(:blur_destroy)
+        delete :destroy, :tables => @tables, :format => :json
+      end
+
+      it "should set destroy index to true when the param is true" do
+        @blur_table.should_receive(:blur_destroy).at_least(:once).with(true, kind_of(String))
+        delete :destroy, :tables => @tables, :delete_index => 'true', :format => :json
+      end
+
+      it "should set destroy index to false when the param is not true" do
+        @blur_table.should_receive(:blur_destroy).at_least(:once).with(false, kind_of(String))
+        delete :destroy, :tables => @tables, :delete_index => 'not true', :format => :json
+      end
+
+      it "should log an audit for every table destroyed" do
+        Audit.should_receive(:log_event)
+        put :destroy, :tables => @tables, :format => :json
+      end
+
+      it "should forget all the given tables" do
+        BlurTable.should_receive(:destroy).with @tables.collect{|id| id.to_s}
+        delete :destroy, :tables => @tables, :format => :json
+      end
+    end
+
+    describe "GET terms" do
+      before :each do
+        BlurTable.stub(:find).and_return @blur_table
+        @blur_table.stub(:terms)
+      end
+
+      it "should render a json" do
+        get :terms, :format => :json, :id => @blur_table.id
+        response.content_type.should == 'application/json'
+      end
+    end
+
+    describe "GET hosts" do
+      it "should render the hosts as json" do
+        get :hosts, :format => :json, :id => @blur_table.id
+        response.body.should == @blur_table.hosts.to_json()
+      end
+    end
+
+    describe "GET schema" do
+      it "should render the schema as json" do
+        get :schema, :format => :json, :id => @blur_table.id
+        response.body.should == @blur_table.schema.to_json()
+      end
+    end
+
+    describe "PUT comment" do
+      before :each do
+        BlurTable.stub(:find).and_return @blur_table
+        @blur_table.stub(:save)
+      end
+
+      it "should change the comments in table" do
+        put :comment, :id => @blur_table.id, :comment => 'a comment', :format => :json
+        @blur_table.comments.should == 'a comment'
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/clusters_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/clusters_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/clusters_controller_spec.rb
new file mode 100644
index 0000000..c680efb
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/clusters_controller_spec.rb
@@ -0,0 +1,54 @@
+# 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.
+
+require 'spec_helper'
+
+describe ClustersController do
+  describe "actions" do
+    before do
+      # Universal setup
+      setup_tests
+
+      @cluster = FactoryGirl.create :cluster
+      Cluster.stub!(:find).and_return @cluster
+    end
+
+    describe 'DELETE destroy' do
+      before do
+        @cluster.stub!(:destroy)
+      end
+
+      it "destroys the cluster" do
+        @cluster.should_receive(:destroy)
+        @cluster.stub!(:cluster_status).and_return 0
+        delete :destroy, :id => @cluster.id, :format => :json
+      end
+
+      it "errors when the cluster is enabled" do
+        expect {
+          @cluster.stub!(:cluster_status).and_return 1
+          delete :destroy, :id => @cluster.id, :format => :json
+        }.to raise_error
+      end
+
+      it "logs the event when the cluster is deleted" do
+        @cluster.stub!(:cluster_status).and_return 0
+        @cluster.stub!(:destroyed?).and_return true
+        Audit.should_receive :log_event
+        delete :destroy, :id => @cluster.id, :format => :json
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/errors_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/errors_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/errors_controller_spec.rb
new file mode 100644
index 0000000..0d5de1b
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/errors_controller_spec.rb
@@ -0,0 +1,52 @@
+# 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.
+
+require 'spec_helper'
+
+describe ErrorsController do
+  describe 'actions' do
+    before(:each) do
+      setup_tests
+    end
+
+    it "renders a 404 page when the webpage is not found" do
+      page = stub(:code => 404)
+      expect {
+        visit '/page_that_does_not_exist' 
+      }.to raise_error ActionController::RoutingError
+    end
+  end
+
+  describe '404' do
+    it 'should render the 404 page' do
+      get :error_404
+      response.should render_template('error_404')
+    end
+  end
+
+  describe '422' do
+    it 'should render the 422 page' do
+      get :error_422
+      response.should render_template('error_422')
+    end
+  end
+
+  describe '500' do
+    it 'should render the 500 page' do
+      get :error_500
+      response.should render_template('error_500')
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/hdfs_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/hdfs_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/hdfs_controller_spec.rb
new file mode 100644
index 0000000..af30a2d
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/hdfs_controller_spec.rb
@@ -0,0 +1,300 @@
+# 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.
+
+require "spec_helper"
+
+describe HdfsController do
+  describe "actions" do
+    before(:each) do
+      # Universal setup
+      setup_tests
+
+      # Mock out the client connection to the hdfs
+      @hdfs_client = mock(HdfsThriftClient::Client)
+      HdfsThriftClient.stub!(:client).and_return(@hdfs_client)
+
+      # Create HDFS model
+      @hdfs = FactoryGirl.create :hdfs_with_stats
+      @hdfs_mult = [@hdfs]
+      Hdfs.stub!(:find).and_return(@hdfs)
+      Hdfs.stub!(:all).and_return(@hdfs_mult)
+      @file_strings = ["hdfs://file-location"]
+    end
+
+    describe "GET index" do
+      it "renders the index template when the format is html" do
+        get :index, :format => :html
+        response.should render_template "index"
+      end
+
+      it "renders the index template when the format is json" do
+        get :index, :format => :json
+        response.body.should == @hdfs_mult.to_json(:methods => [:most_recent_stats, :recent_stats])
+      end
+    end
+
+    describe "GET info" do
+      context "Hdfs Stat found" do
+        it "should populate the @hdfs_stat var" do
+          get :info, :id => @hdfs.id, :format => :html
+          assigns(:hdfs_stat).should == @hdfs.hdfs_stats.last
+        end
+
+        it "renders the info partial" do
+          get :info, :id => @hdfs.id, :format => :html
+          response.should render_template :partial => "_info"
+        end
+      end
+      context "Hdfs Stat not found" do
+        it "renders the the warning text" do
+          @hdfs.stub_chain(:hdfs_stats, :last).and_return(nil)
+          get :info, :id => @hdfs.id, :format => :html 
+          response.body.should include("Stats for hdfs ##{@hdfs.id} were not found")
+        end
+      end
+    end
+
+    describe "GET folder_info" do
+      before(:each) do
+        @hdfs_client.stub!(:stat).and_return('path')
+      end
+
+      it "assigns the correct instance variables" do
+        @hdfs_client.should_receive(:stat).with '/'
+        get :folder_info, :id => @hdfs.id, :fs_path => '/', :format => :html
+        assigns(:stat).should == 'path'
+      end
+
+      it "renders the folder_info template" do
+        HdfsThriftClient.should_receive(:client).with("#{@hdfs.host}:#{@hdfs.port}")
+        get :folder_info, :id => @hdfs.id, :fs_path => '/', :format => :html
+        response.should render_template :partial => "_folder_info"
+      end
+    end
+
+    describe "GET slow_folder_info" do
+      before(:each) do
+        @file_stats = [{:length => 1, :isdir => true}, {:length => 2, :isdir => false}]
+        @file_stats.each do |stat|
+          stat.stub!(:length).and_return(stat[:length])
+          stat.stub!(:isdir).and_return(stat[:isdir])
+        end
+        @hdfs_client.stub!(:ls).and_return(@file_stats)
+      end
+
+      it "renders the correct json" do
+        @hdfs_client.should_receive(:ls).with('/', true)
+        get :slow_folder_info, :id => @hdfs.id, :fs_path => '/', :format => :json
+        response.body.should == {:file_size => '3 Bytes', :file_count => 1, :folder_count => 1}.to_json
+      end
+    end
+
+    describe "GET expand" do
+      before(:each) do
+        @file_stats = [{:path => '1/2/3', :isdir => true}, {:path => '1/2/3/4', :isdir => false}]
+        @file_stats.each do |stat|
+          stat.stub!(:path).and_return(stat[:path])
+          stat.stub!(:isdir).and_return(stat[:isdir])
+        end
+        @hdfs_client.stub!(:ls).and_return(@file_stats)
+      end
+
+      it "assigns the correct instance variables with no path" do
+        @hdfs_client.should_receive(:ls).with('/')
+        get :expand, :id => @hdfs.id, :format => :html
+        assigns(:hdfs_id).should == @hdfs.id.to_s
+        assigns(:path).should == '/'
+        assigns(:children).should == [{'name' => '4', 'is_dir' => false}, {'name' => '3', 'is_dir' => true}, ]
+      end
+
+      it "assigns the correct instance variables with a given path" do
+        @hdfs_client.should_receive(:ls).with('/path/')
+        get :expand, :id => @hdfs.id, :fs_path => '/path', :format => :html
+        assigns(:hdfs_id).should == @hdfs.id.to_s
+        assigns(:path).should == '/path/'
+        assigns(:children).should == [{'name' => '4', 'is_dir' => false}, {'name' => '3', 'is_dir' => true}]
+      end
+
+      it "renders the expand partial" do
+        HdfsThriftClient.should_receive(:client).with("#{@hdfs.host}:#{@hdfs.port}")
+        get :expand, :id => @hdfs.id, :format => :html
+        response.should render_template :partial => '_expand'
+      end
+    end
+
+    describe "GET mkdir" do
+      before(:each) do
+        @hdfs_client.stub!(:mkdirs)
+      end
+
+      it "calls correct client method" do
+        @hdfs_client.should_receive(:mkdirs).with("/folder/")
+        get :mkdir, :id => @hdfs.id, :fs_path => '/', :folder => 'folder', :format => :json
+      end
+
+      it "renders an empty json object" do
+        HdfsThriftClient.should_receive(:client).with("#{@hdfs.host}:#{@hdfs.port}")
+        get :mkdir, :id => @hdfs.id, :fs_path => '/', :folder => 'folder', :format => :json
+        response.body.should == {}.to_json
+      end
+
+      it "logs an audit event" do
+        Audit.should_receive :log_event
+        get :mkdir, :id => @hdfs.id, :fs_path => '/', :folder => 'folder', :format => :json
+      end
+    end
+
+    describe "GET file_info" do
+      before(:each) do
+        @hdfs_client.stub!(:stat).and_return('stat')
+      end
+
+      it "calls correct client method" do
+        @hdfs_client.should_receive(:stat).with('/')
+        get :file_info, :id => @hdfs.id, :fs_path => '/', :format => :html
+      end
+
+      it "renders the correct template and sets the stat variable" do
+        HdfsThriftClient.should_receive(:client).with("#{@hdfs.host}:#{@hdfs.port}")
+        get :file_info, :id => @hdfs.id, :fs_path => '/', :format => :html
+        response.should render_template :partial => '_file_info'
+        assigns(:stat).should == 'stat'
+      end
+    end
+
+    describe "GET move_file" do
+      before(:each) do
+        @hdfs_client.stub!(:rename)
+      end
+
+      it "calls correct client method" do
+        @hdfs_client.should_receive(:rename).with('/test', '/folder/test')
+        get :move_file, :id => @hdfs.id, :from => '/test', :to => '/folder/', :format => :json
+      end
+
+      it "renders a blank json object" do
+        HdfsThriftClient.should_receive(:client).with("#{@hdfs.host}:#{@hdfs.port}")
+        get :move_file, :id => @hdfs.id, :from => '/test', :to => '/folder/', :format => :json
+        response.body.should == {}.to_json
+      end
+
+      it "logs an audit event" do
+        Audit.should_receive :log_event
+        get :move_file, :id => @hdfs.id, :from => '/test', :to => '/folder/', :format => :json
+      end
+    end
+
+    describe "GET delete_file" do
+      before(:each) do
+        @hdfs_client.stub!(:delete)
+      end
+
+      it "calls correct client method" do
+        @hdfs_client.should_receive(:delete).with('/path/', true)
+        get :delete_file, :id => @hdfs.id, :path => '/path/', :format => :json
+      end
+
+      it "renders a blank json object" do
+        HdfsThriftClient.should_receive(:client).with("#{@hdfs.host}:#{@hdfs.port}")
+        get :delete_file, :id => @hdfs.id, :path => '/path/', :format => :json
+        response.body.should == {}.to_json
+      end
+
+      it "logs an audit event" do
+        Audit.should_receive :log_event
+        get :delete_file, :id => @hdfs.id, :path => '/path/', :format => :json
+      end
+    end
+
+    describe "GET upload_form" do
+      it "renders the upload form template" do
+        get :upload_form
+        response.should render_template :partial => "_upload_form"
+      end
+    end
+
+    describe "POST upload" do
+      before(:each) do
+        @hdfs_client.stub(:put)
+      end
+
+      context "All the params are defined" do
+        before(:each) do
+          @upload = fixture_file_upload(Rails.root + 'spec/fixtures/test.png', 'image/png')
+          @path = "biz/bar/foo"
+          class << @upload
+            attr_reader :tempfile
+          end
+          class << @upload.tempfile
+            attr_accessor :size
+          end
+        end
+
+        it "accepts a file less than 25Mb in size" do
+          @upload.tempfile.size = 50
+          @hdfs_client.should_receive(:put).with(@upload.tempfile.path, @path + '/' + @upload.original_filename)
+          HdfsThriftClient.should_receive(:client).with("#{@hdfs.host}:#{@hdfs.port}")
+          post :upload, :path => @path, :id => 1, :upload => @upload, :format => :html
+          response.body.should render_template :partial => "_upload"
+        end
+
+        it "rejects a file greater than 25Mb in size" do
+          @upload.tempfile.size = 26220000
+          post :upload, :path => @path, :id => 1, :upload => @upload, :format => :html
+          response.body.should render_template :partial => "_upload"
+          assigns(:error).should_not be_blank
+        end
+
+        it "logs an audit event" do
+          @upload.tempfile.size = 50
+          Audit.should_receive :log_event
+          post :upload, :path => @path, :id => 1, :upload => @upload, :format => :html
+        end
+      end
+
+      context "Params are missing" do
+        it "sets the error instance variable" do
+          HdfsThriftClient.should_not_receive(:client).with("#{@hdfs.host}:#{@hdfs.port}")
+          post :upload, :format => :html
+          response.should render_template :partial => '_upload'
+          assigns(:error).should_not be_blank
+        end
+
+        it "raises an exception and sets the error variable" do
+          post :upload, :path => 'path', :id => 1, :upload => 'NOT A FILE', :format => :html
+          response.body.should render_template :partial => "_upload"
+          assigns(:error).should_not be_blank
+        end
+      end
+    end
+
+    describe "GET file_tree" do
+      before(:each) do
+        @hdfs_client.stub!(:folder_tree).and_return '{:tree => "branch"}'
+      end
+
+      it "assigns the correct instance variables and calls correct client method" do
+        @hdfs_client.should_receive(:folder_tree).with('/path/', 4)
+        get :file_tree, :id => @hdfs.id, :fs_path => '/path/', :format => :json
+      end
+
+      it "renders json" do
+        HdfsThriftClient.should_receive(:client).with("#{@hdfs.host}:#{@hdfs.port}")
+        get :file_tree, :id => @hdfs.id, :fs_path => '/path/', :format => :json
+        response.content_type.should == 'application/json'
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/hdfs_metrics_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/hdfs_metrics_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/hdfs_metrics_controller_spec.rb
new file mode 100644
index 0000000..f9e9c5d
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/hdfs_metrics_controller_spec.rb
@@ -0,0 +1,69 @@
+# 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.
+
+require 'spec_helper'
+
+describe HdfsMetricsController do
+  describe "actions" do
+    before(:each) do
+      # Universal Setup
+      setup_tests
+
+      @hdfs_index = FactoryGirl.create_list :hdfs, 2
+      Hdfs.stub(:all).and_return(@hdfs_index)
+      @hdfs = FactoryGirl.create :hdfs_with_stats
+    end
+
+    describe "GET index" do
+      it "should set @hdfs_index to Hdfs.All and render index" do
+        get :index
+        assigns(:hdfs_index).should == @hdfs_index
+        response.should render_template :index
+      end
+    end
+
+    describe "GET stats" do
+      it "with only id should return all within last minute" do
+        get :stats, :id => @hdfs.id, :stat_min => 1, :format => :json
+        assigns(:results).length.should == 1
+        response.content_type.should == 'application/json'
+      end
+
+      it "with only return the correct properties" do
+        get :stats, :id => @hdfs.id, :stat_min => 1, :format => :json
+        assigns(:results)[0].attribute_names.should == %w[id created_at present_capacity dfs_used_real live_nodes dead_nodes under_replicated corrupt_blocks missing_blocks]
+        response.content_type.should == 'application/json'
+      end
+
+      it "with stat_mins = 2 should return all within last 2 minutes" do
+        get :stats, :id => @hdfs.id, :stat_min => 2, :format => :json
+        assigns(:results).length.should == 2
+        response.content_type.should == 'application/json'
+      end
+
+      it "with stat_mins = 2 should return all within the previous minute" do
+        get :stats, :id => @hdfs.id, :stat_min => 2, :stat_max => 1, :format => :json
+        assigns(:results).length.should == 1
+        response.content_type.should == 'application/json'
+      end
+
+      it "with stat_id = @hdfs.hdfs_stats[1].id should return the last one" do
+        get :stats, :id => @hdfs.id, :stat_id => @hdfs.hdfs_stats[1].id, :format => :json
+        assigns(:results).length.should == 1
+        response.content_type.should == 'application/json'
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/preferences_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/preferences_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/preferences_controller_spec.rb
new file mode 100644
index 0000000..2fd35c2
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/preferences_controller_spec.rb
@@ -0,0 +1,58 @@
+# 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.
+
+require 'spec_helper'
+
+describe PreferencesController do
+  describe "actions" do
+    before(:each) do
+      # Universal Setup
+      setup_tests
+      
+      # Preference for the current user
+      @preference = FactoryGirl.create :preference
+      User.stub!(:find).and_return @user
+      Preference.stub(:find_by_pref_type_and_user_id).and_return(@preference)
+    end
+
+    describe "update" do
+      it "should find the preference" do
+        Preference.should_receive(:find_by_pref_type_and_user_id).with('column', @user.id.to_s)
+        @preference.stub!(:try)
+        put :update, :user_id => @user.id, :pref_type => 'column', :format => :json
+      end
+
+      it "should update the preference" do
+        Preference.should_receive(:find_by_pref_type_and_user_id).with('column', @user.id.to_s)
+        @preference.should_receive(:try).with(:update_attributes, :value => ['newCol'])
+        put :update, :user_id => @user.id, :pref_type => 'column', :value => ['newCol'], :format => :json
+      end
+
+      it "should update the preference name and value when it is a zookeeper" do
+        Preference.should_receive(:find_by_pref_type_and_user_id).with('zookeeper', @user.id.to_s)
+        @preference.should_receive(:try).with(:update_attributes,
+                                              {:value => 'test', :name => 'test'})
+        put :update, :user_id => @user.id, :pref_type => 'zookeeper',
+                      :value => 'test', :name => 'test', :format => :json
+      end
+
+      it "should render a blank json object" do
+        @preference.stub!(:try)
+        put :update, :user_id => @user.id, :pref_type => 'column', :format => :json
+        response.body.should == {}.to_json
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/search_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/search_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/search_controller_spec.rb
new file mode 100644
index 0000000..8d43efa
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/search_controller_spec.rb
@@ -0,0 +1,221 @@
+# 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.
+
+require "spec_helper"
+
+describe SearchesController do
+  describe "actions" do
+    before (:each) do
+      # Universal Setup
+      setup_tests
+    end
+
+    describe "index" do
+      before :each do
+        @blur_tables = FactoryGirl.create_list(:blur_table, 2)
+        @blur_table = @blur_tables[0]
+
+        @search = FactoryGirl.create :search
+        @user.stub_chain(:searches, :order).and_return [@search]
+      end
+
+      it "renders the show template" do
+        get :index, :format => :html
+        response.should render_template :index
+      end
+      
+      it "find and assign tables, and columns" do
+        @zookeeper.stub_chain(:blur_tables, :where, :order, :includes, :all).and_return(@blur_tables)
+        get :index, :format => :html
+        assigns(:blur_tables).should == @blur_tables
+        assigns(:blur_table).should == @blur_table
+        assigns(:columns).should == @blur_table.schema
+      end
+
+      describe "when no tables are available" do
+        it "find and assign tables and columns" do
+          @zookeeper.stub_chain(:blur_tables, :where, :order, :includes, :all).and_return []
+          get :index, :format => :html
+          assigns(:blur_tables).should == []
+          assigns(:blur_table).should be nil
+          assigns(:columns).should be nil
+        end
+      end
+    end
+    
+    describe "filters" do
+      before :each do 
+        @blur_table = FactoryGirl.create( :blur_table )
+        BlurTable.stub(:find).and_return @blur_table
+      end
+
+      it "renders the filters template" do
+        get :filters, :blur_table => @blur_table.id, :format => :json
+        response.content_type.should == 'application/json'
+      end
+
+      it "should find the new columns" do
+        BlurTable.should_receive(:find).with(@blur_table.id.inspect)
+        get :filters, :blur_table => @blur_table.id, :format => :json
+      end
+      
+      it "should return an empty array to columns when no blur table is selected" do
+        BlurTable.should_receive(:find).and_return(nil)
+        get :filters, :blur_table => @blur_table.id, :format => :json
+      end
+    end
+
+    describe "GET create" do
+      before :each do
+        @search     = FactoryGirl.create :search
+        @blur_table = FactoryGirl.create :blur_table
+        @user       = FactoryGirl.create :user
+        @preference = FactoryGirl.create :preference
+        @client = mock(Blur::Blur::Client)
+        Preference.stub(:find_or_create_by_user_id_and_pref_type).and_return(@preference)
+        BlurTable.stub(:find).and_return(@blur_table)
+        Search.stub(:new).and_return(@search)
+        Search.stub(:find).and_return(@search)
+        User.stub(:find).and_return(@user)
+        controller.stub(:current_user).and_return(@user)
+        results = mock 'blur_results', :totalResults => @search.fetch,
+                                       :realTime => 10,
+                                       :results => [create_blur_result(@search)]
+        @search.stub(:fetch_results).and_return(results)
+
+        # Set up association chain
+        @zookeeper  = FactoryGirl.create :zookeeper
+
+        # ApplicationController.current_zookeeper
+        Zookeeper.stub(:find_by_id).and_return(@zookeeper)
+        Zookeeper.stub!(:first).and_return(@zookeeper)
+        # Zookeeper.stub_chain(:order, :first).and_return @zookeeper
+      end
+
+      def create_blur_result(search)
+        ###### Hierarchy of Blur::BlurResults 8/10 #######
+        #blur_results     = mock 'results'          # Blur::BlurResults
+        #results          = []                      # Array
+        #result           = mock 'result'           # Blur::BlurResult
+        #fetch_result     = mock 'fetch_result'     # Blur::FetchResult
+        #fetch_row_result = mock 'fetch_row_result' # Blur::FetchRowResult
+        #row              = mock 'row'              # Blur::Row
+        #records          = []                      # Array
+        #record           = mock 'record'           # Blur::Record
+        #columns          = []                      # Array
+        #column           = mock 'column'           # Blur::Column
+        #
+
+        schema = search.columns_hash
+        column_families = []
+        schema.each_key do |column_family_name|
+          columns = []
+          schema[column_family_name].each do |column|
+            column = mock 'column', :name => column, :value => "value_1"
+            columns << column
+          end
+          column_family =  mock 'record', :recordId => rand(10000), :columns => columns, :family => column_family_name 
+          column_families << column_family
+        end
+
+        row = mock 'row', :records => column_families, :id => rand(10000)
+        fetch_row_result = mock 'fetch_row_result', :row => row
+        fetch_result     = mock 'fetch_result', :rowResult => fetch_row_result
+        blur_result      = mock 'result', :fetchResult => fetch_result
+      end
+
+      describe "when creating a new search" do
+        it "renders the create partial" do
+
+          get :create, :super_query  => @search.super_query,
+                       :record_only  => @search.record_only,
+                       :result_count => @search.fetch,
+                       :offset       => @search.offset,
+                       :query_string => @search.query,
+                       :column_data  => ["neighborhood", @search.column_object].flatten
+
+          response.should render_template "create"
+        end
+      end
+      it "assigns the @schema variable to hold the sorted column families and columns of the search" do
+        get :create, :search_id  => @search.id
+        assigns(:schema).keys.should == %w[ColumnFamily1 ColumnFamily2 ColumnFamily3]
+      end
+
+      it "correctly parses a result from blur" do
+        pending "Is there a better way to do this?"
+        get :create, :search_id  => @search.id
+        assigns(:results).should == ""
+      end
+      it "correctly sets the schema variable" do
+        pending "Is there a better way to do this?"
+        get :create, :search_id  => @search.id
+        assigns(:schema).should == "" 
+      end
+    end
+
+    describe "show" do
+      before(:each) do
+        @search = FactoryGirl.create :search
+        Search.stub(:new).and_return(@search)
+      end
+
+      it "renders the proper json for a search" do
+        Search.stub(:find).and_return(@search)
+        get :show, :id => @search.id, :format => :json
+        @return = @search.to_json(:methods => :column_object)
+        response.body.should == @return
+      end
+    end
+
+    describe "destroy" do
+      before(:each) do
+        @search = FactoryGirl.create :search
+        Search.stub(:new).and_return(@search)
+        Search.stub(:find).and_return(@search)
+        Search.stub(:destroy)
+        BlurTable.stub(:find)
+      end
+
+      it "renders the saved partial" do
+        delete :destroy, :id => @search.id
+        response.should render_template 'saved'
+      end
+
+      it "finds the correct table and deletes it from the DB" do
+        @search.should_receive(:destroy)
+        delete :destroy, :id => @search.id
+      end
+    end
+    
+    describe "save" do
+      before(:each) do
+      end
+
+      it "saves and renders the saved partial" do
+        BlurTable.stub(:find)
+        @search = FactoryGirl.create :search
+        @user.stub(:searches).and_return [@search]
+        @user.stub(:id).and_return [1]      
+        Search.stub(:find).and_return(@search)
+        Search.stub(:new).and_return @search
+        @search.stub(:save)
+        Search.should_receive(:new)
+        get :save, :column_data => ["family_table1", "column_table1_deptNo", "column_table1_moreThanOneDepartment", "column_table1_name"]
+        response.should render_template 'saved'
+      end
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/user_sessions_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/user_sessions_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/user_sessions_controller_spec.rb
new file mode 100644
index 0000000..43557c9
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/user_sessions_controller_spec.rb
@@ -0,0 +1,74 @@
+# 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.
+
+require 'spec_helper'
+
+describe UserSessionsController do
+  describe "actions" do
+    before(:each) do
+      # setup the tests
+      activate_authlogic
+      setup_tests
+
+      # usersessions specific
+      @user_session = UserSession.new({:username => @user.username, :password => @user.password, :commit => "Log In"})
+      @user_session.stub!(:user).and_return @user
+      controller.stub!(:current_user_session).and_return @user_session
+    end
+
+    describe "GET 'new'" do
+      it "assigns a new user_session as @user_session" do
+        UserSession.should_receive(:new).at_least(1).times.and_return(@user_session)
+        get :new, :format => :html
+        assigns(:user_session).should == (@user_session)
+      end
+
+      it "should render new view" do
+        get :new, :format => :html
+        response.should render_template :new
+      end
+    end
+
+    describe "POST create" do
+      it "assigns a new session to @user_session and saves successfully" do
+        UserSession.stub(:new).and_return @user_session
+        @user_session.should_receive(:save).and_return true
+        post :create, :user_session => {:username => @user.username, :password => @user.password, :commit => "Log In"}, :format => :html
+        assigns(:user_session).should be(@user_session)
+        response.should redirect_to(root_path)
+      end
+
+      it "assigns a new session to @user_session and saves unsuccessfully" do
+        UserSession.stub(:new).and_return @user_session
+        @user_session.should_receive(:save).and_return false
+        post :create, :user_session => {:username => @user.username, :password => @user.password, :commit => "Log In"}, :format => :html
+        response.should redirect_to(login_path)
+      end
+    end
+
+    describe "DELETE 'destroy'" do
+      it "finds and destroys current user session" do
+        @user_session.should_receive(:destroy)
+        delete :destroy, :format => :html
+      end
+
+      it "redirects to root_url with notice" do
+        delete :destroy, :format => :html
+        response.should redirect_to(login_path)
+        flash[:notice].should_not be_blank
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/users_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/users_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/users_controller_spec.rb
new file mode 100644
index 0000000..cbc6ae7
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/users_controller_spec.rb
@@ -0,0 +1,193 @@
+# 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.
+
+require 'spec_helper'
+
+describe UsersController do
+  describe "actions" do
+    before(:each) do
+      #Universal Setup
+      setup_tests
+
+      User.stub(:find).and_return @user
+    end
+
+    describe "GET index" do
+      it "should render index template" do
+        get :index
+        response.should render_template(:index)
+      end
+    end
+
+    describe "GET show" do
+      before(:each) do
+        @table = FactoryGirl.create_list :blur_table, 3
+        @user.stub(:saved_cols)
+        BlurTable.stub(:all).and_return(@table)
+      end
+
+      it "should find and assign user" do
+        User.should_receive(:find).with('id').and_return(@user)
+        get :show, :id => 'id'
+        assigns(:user).should == @user
+      end
+
+      it "should find and assign preferences" do
+        @user.should_receive(:column_preference).at_least(1).times
+        @user.should_receive(:zookeeper_preference).at_least(1).times
+        get :show, :id => 'id'
+        assigns(:column_preference).should == @user.column_preference
+        assigns(:zookeeper_preference).should == @user.zookeeper_preference
+      end
+
+      it "should find and create a list of all the table choices" do
+        get :show, :id => 'id'
+        assigns(:choices).should == ['ColumnFamily1', 'ColumnFamily2', 'ColumnFamily3']
+      end
+
+      it "should render show template" do
+        get :show, :id => 'id'
+        response.should render_template(:show)
+      end
+    end
+
+    describe "GET new" do
+      let(:user) { mock_model(User).as_null_object }
+
+      it "should create a new user" do
+        User.should_receive(:new).at_least(1).times.and_return(user)
+        get :new
+      end
+
+      it "should render new layout" do
+        get :new
+        response.should render_template(:new)
+      end
+    end
+
+
+    describe "POST create" do
+      before(:each) do
+        User.stub(:new).and_return(@user)
+        @valid_user = {
+          'username' => 'bob',
+          'email' => 'bob@example.com',
+          'password' => 'password',
+          'password_confirmation' => 'password'
+        }
+      end
+
+      it "creates a new user" do
+        User.should_receive(:new).with(@valid_user).and_return(@user)
+        post :create, :user => @valid_user
+      end
+
+      context "when the message saves successfully" do
+        it "redirects to the users path when it can? index users" do
+          @user.stub!(:save).and_return(true)
+          post :create
+          response.should redirect_to(users_path)
+        end
+
+        it "redirects to the user's page when it cannot? index users" do
+          @user.stub!(:save).and_return(true)
+          controller.stub!(:can?).and_return(false)
+          post :create
+          response.should redirect_to(@user)
+        end
+      end
+
+      context "when the message saves unsuccessfully" do
+        it "renders the new template" do
+          @user.stub!(:save).and_return(false)
+          post :create
+          response.should render_template(:new)
+        end
+      end
+    end
+
+    describe "GET edit" do
+      it "should find and assign the user" do
+        User.should_receive(:find).with('id').and_return(@user)
+        get :edit, :id => 'id'
+        assigns(:user).should == @user
+      end
+
+      it "should render the edit template" do
+        get :edit, :id => 'id'
+        response.should render_template(:edit)
+      end
+    end
+
+    describe "PUT update" do
+      it "should find and assign the user" do
+        User.should_receive(:find).with(@user.id.to_s)
+        put :update, :id => @user.id, :user => {:name => 'Bob'}
+        assigns(:user).should == @user
+      end
+
+      context "When updating the attributes succeeds" do
+        before(:each) do
+          @user.stub!(:update_attributes).and_return true
+        end
+
+        it "should redirect to the admin page and include notice when admin updates a user" do
+          controller.stub!(:can?).and_return(false)
+          put :update, :id => @user.id, :user => {:name => 'Bob'}
+          response.should redirect_to(@user)
+          flash[:notice].should_not be_blank
+        end
+
+        it "should redirect to the user and include notice when user updates himself" do
+          controller.stub!(:can?).and_return(true)
+          put :update, :id => @user.id, :user => {:name => 'Bob'}
+          response.should redirect_to users_path
+          flash[:notice].should_not be_blank
+        end
+      end
+
+      context "When updating the attributes fails" do
+        it "should render the edit template when update fails" do
+          @user.stub!(:update_attributes).and_return(false)
+          put :update, :id => @user.id, :user => {:name => 'Bob'}
+          response.should render_template(:edit)
+        end
+      end
+
+      it "should log an audit event" do
+        Audit.should_receive :log_event
+        put :update, :id => @user.id, :user => {:name => 'Bob'}
+      end
+    end
+
+    describe "DELETE destroy" do
+      it "should find and destroy the user" do
+        @user.should_receive(:destroy)
+        delete :destroy, :id => @user.id
+      end
+
+      it "should redirect to the users_path" do
+        delete :destroy, :id => @user.id
+        response.should redirect_to(users_path)
+      end
+
+      it "should log an audit event" do
+        Audit.should_receive :log_event
+        delete :destroy, :id => @user.id
+      end
+
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/controllers/zookeepers_controller_spec.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/controllers/zookeepers_controller_spec.rb b/contrib/blur-console-old/blur-admin/spec/controllers/zookeepers_controller_spec.rb
new file mode 100644
index 0000000..9c00e68
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/controllers/zookeepers_controller_spec.rb
@@ -0,0 +1,93 @@
+# 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.
+
+require 'spec_helper'
+
+describe ZookeepersController do
+  describe "actions" do
+    before do
+      # Universal setup
+      setup_tests
+
+      # Set up association chain
+      @zookeeper  = FactoryGirl.create :zookeeper
+      Zookeeper.stub!(:find).and_return @zookeeper
+    end
+
+    describe 'GET index' do
+      it "renders the index template" do
+        get :index, :format => :html
+        response.should render_template 'index'
+      end
+
+      it "should set the zookeeper when there is only one zookeeper" do
+        Zookeeper.stub!(:count).and_return 1
+        Zookeeper.stub!(:first).and_return @zookeeper
+        controller.stub!(:set_zookeeper_with_preference)
+        controller.should_receive(:set_zookeeper).with(@zookeeper.id)
+        get :index, :format => :html
+      end
+    end
+
+    describe 'GET show' do
+      it "renders the show_current view" do
+        get :show, :id => @zookeeper.id, :format => :html
+        response.should render_template :show
+      end
+
+      it "renders json when the format is json" do
+        get :show, :id => @zookeeper.id, :format => :json
+        response.body.should == @zookeeper.to_json(:methods => [:clusters, :blur_controllers])
+      end
+    end
+
+    describe 'GET long running queries' do
+      before :each do
+        @zookeeper.stub!(:long_running_queries)
+      end
+
+      it "it grabs the long_running_queries and renders a json object" do
+        @zookeeper.should_receive :long_running_queries
+        get :long_running_queries, :id => @zookeeper.id, :format => :json
+        response.content_type.should == 'application/json'
+      end
+    end
+    describe 'destroy zookeeper' do
+      before do
+        @zookeeper.stub!(:destroy)
+      end
+
+      it "destroys the zookeeper" do
+        @zookeeper.should_receive(:destroy)
+        @zookeeper.stub!(:zookeeper_status).and_return 0
+        delete :destroy, :id => @zookeeper.id, :format => :json
+      end
+
+      it "errors when the zookeeper is enabled" do
+        expect {
+          @zookeeper.stub!(:zookeeper_status).and_return 1
+          delete :destroy, :id => @zookeeper.id, :format => :json
+        }.to raise_error
+      end
+
+      it "logs the event when the zookeeper is deleted" do
+        @zookeeper.stub!(:zookeeper_status).and_return 0
+        @zookeeper.stub!(:destroyed?).and_return true
+        Audit.should_receive :log_event
+        delete :destroy, :id => @zookeeper.id, :format => :json
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/admin_setting.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/admin_setting.rb b/contrib/blur-console-old/blur-admin/spec/factories/admin_setting.rb
new file mode 100644
index 0000000..53d9e85
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/admin_setting.rb
@@ -0,0 +1,23 @@
+# 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.
+
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+  factory :admin_setting do
+    setting 'regex'
+    value   '.*'
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/audits.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/audits.rb b/contrib/blur-console-old/blur-admin/spec/factories/audits.rb
new file mode 100644
index 0000000..a602725
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/audits.rb
@@ -0,0 +1,25 @@
+# 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.
+
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+  factory :audit do
+    user            { FactoryGirl.create :user }
+    mutation        1
+    model_affected  1
+    action          "This is an action"
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/blur_controller.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/blur_controller.rb b/contrib/blur-console-old/blur-admin/spec/factories/blur_controller.rb
new file mode 100644
index 0000000..08e982a
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/blur_controller.rb
@@ -0,0 +1,22 @@
+# 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.
+
+FactoryGirl.define do
+  factory :blur_controller do
+    sequence (:node_name)     { |n| "Test Node ##{n}" }
+    controller_status                    { rand 3 }
+    blur_version              { "1.#{rand 10}.#{rand 10}" }
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/blur_queries.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/blur_queries.rb b/contrib/blur-console-old/blur-admin/spec/factories/blur_queries.rb
new file mode 100644
index 0000000..4e34da0
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/blur_queries.rb
@@ -0,0 +1,29 @@
+# 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.
+
+FactoryGirl.define do
+  factory :blur_query do
+    sequence(:query_string) {|n| "Blur Query ##{n} Query String"}
+    complete_shards         { rand 6 }
+    uuid                    { rand 10 ** 8 }
+    super_query_on          { true } # 75% chance
+    start                   { rand 10 ** 6 }
+    fetch_num               { rand 10 ** 6 }
+    userid                  { "Test User ##{rand 20}" }
+    times                   {{'shard' => { :cpuTime => 40, :realTime => 56, :setCpuTime => true, :setRealTime => true }}.to_json}
+    total_shards            { 5 }
+    state                   { rand 3 }
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/blur_tables.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/blur_tables.rb b/contrib/blur-console-old/blur-admin/spec/factories/blur_tables.rb
new file mode 100644
index 0000000..d5f43da
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/blur_tables.rb
@@ -0,0 +1,73 @@
+# 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.
+
+FactoryGirl.define do
+  factory :blur_table do
+    sequence(:table_name) { |n| "Test Blur Table ##{n}" }
+    current_size          { 10**12 + rand(999 * 10 ** 12) } #Between a terrabyte and a petabyte
+    query_usage           { rand 500 }                      #Queries per second
+    query_count           { rand 10 }
+    record_count          { 10**6 + rand(999 * 10 ** 6) }   #Between a million and a billion 
+    row_count             { 10**6 + rand(999 * 10 ** 6) }   #Between a million and a billion 
+    table_status                { 1 + rand(2) }
+    sequence(:table_uri)  { |n| "blur_table#{n}.blur.example.com" }
+    table_analyzer        'standard.table_analyzer'
+    comments              'comment'
+    cluster               { FactoryGirl.create(:cluster) }
+    table_schema          {[
+                            {
+                              "name" => 'ColumnFamily1',
+                              "columns" => [
+                                {"name" => 'Column1A'},
+                                {"name" => 'Column1B'},
+                                {"name" => 'Column1C'}
+                              ]
+                            },
+                            {
+                              "name" => 'ColumnFamily2',
+                              "columns" => [
+                                {"name" => 'Column2A'},
+                                {"name" => 'Column2B'},
+                                {"name" => 'Column2C'}
+                              ]
+                            },
+                            {
+                              "name" => 'ColumnFamily3',
+                              "columns" => [
+                                {"name" => 'Column3A'},
+                                {"name" => 'Column3B'},
+                                {"name" => 'Column3C'}
+                              ]
+                            }
+                          ].to_json}
+    server                {{  'Host1:101' => %w[shard-001 shard-002 shard-003],
+                              'Host2:102' => %w[shard-004 shard-005 shard-006]}.to_json}
+    ignore do
+      recursive_factor 3
+    end
+
+    factory :blur_table_with_blur_query do
+      after_create do |blur_table|
+        FactoryGirl.create_list(:blur_query, 1, :blur_table => blur_table)
+      end
+    end
+
+    factory :blur_table_with_blur_queries do
+      after_create do |blur_table, evaluator|
+        FactoryGirl.create_list(:blur_query, evaluator.recursive_factor, :blur_table => blur_table)
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/cluster.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/cluster.rb b/contrib/blur-console-old/blur-admin/spec/factories/cluster.rb
new file mode 100644
index 0000000..2f4f818
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/cluster.rb
@@ -0,0 +1,45 @@
+# 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.
+
+FactoryGirl.define do
+  factory :cluster do
+    sequence(:name)  { |n| "Test Cluster ##{n}" }
+    safe_mode        false
+    zookeeper_id     1
+    can_update       false
+
+    ignore do
+      recursive_factor 3
+    end
+
+    factory :cluster_with_shard do
+      after_create do |cluster|
+        FactoryGirl.create_list(:blur_shard, 1, :cluster => cluster)
+      end
+    end
+
+    factory :cluster_with_shards do
+      after_create do |cluster|
+        FactoryGirl.create_list(:blur_shard, 3, :cluster => cluster)
+      end
+    end
+
+    factory :cluster_with_shards_online do
+      after_create do |cluster|
+        FactoryGirl.create_list(:blur_shard, 3, :cluster => cluster, :shard_status => 1)
+      end
+    end
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/hdfs.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/hdfs.rb b/contrib/blur-console-old/blur-admin/spec/factories/hdfs.rb
new file mode 100644
index 0000000..e85ec71
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/hdfs.rb
@@ -0,0 +1,32 @@
+# 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.
+
+FactoryGirl.define do
+  factory :hdfs do
+    host { "nic-factory-hdfs.com" }
+    port { "9000" }
+    name { "factory_hdfs" }
+
+    ignore do
+      recursive_factor 3
+    end
+
+    factory :hdfs_with_stats do
+      after_create do |hdfs, evaluator|
+        FactoryGirl.create_list(:hdfs_stat, evaluator.recursive_factor, :hdfs => hdfs)
+      end
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/hdfs_stat.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/hdfs_stat.rb b/contrib/blur-console-old/blur-admin/spec/factories/hdfs_stat.rb
new file mode 100644
index 0000000..0b4afa3
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/hdfs_stat.rb
@@ -0,0 +1,31 @@
+# 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.
+
+FactoryGirl.define do
+  factory :hdfs_stat do
+    config_capacity       { 100000 + rand(10000) }
+    present_capacity      { config_capacity - rand(50000) }
+    dfs_used_real         { rand 50000 }
+    dfs_used_logical      { rand 50000 }
+    dfs_remaining         { present_capacity - dfs_used_real }
+    dfs_used_percent      { (present_capacity - dfs_used_real) / present_capacity }
+    under_replicated      { rand 5 }
+    corrupt_blocks        { rand 5 }
+    missing_blocks        { rand 5 }
+    total_nodes           { rand 5 }
+    dead_nodes            { rand 5 }
+    sequence(:created_at, 0) {|n| ((n % 3) + 0.9).minute.ago }
+  end
+end

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/license.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/license.rb b/contrib/blur-console-old/blur-admin/spec/factories/license.rb
new file mode 100644
index 0000000..4661396
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/license.rb
@@ -0,0 +1,24 @@
+# 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.
+
+FactoryGirl.define do
+  factory :license do
+    org             'NIC'
+    expires_date    { Date.today.months_ago(-2) }
+    issued_date     { Date.today.months_ago(6) }
+    node_overage    { 0 }
+    cluster_overage { 0 }
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/preference.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/preference.rb b/contrib/blur-console-old/blur-admin/spec/factories/preference.rb
new file mode 100644
index 0000000..1b08a14
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/preference.rb
@@ -0,0 +1,28 @@
+# 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.
+
+FactoryGirl.define do
+  factory :preference do
+    name      'column'
+    pref_type 'column'
+    value     ['ColumnFamily']
+  end
+
+  factory :zookeeper_pref, class:Preference do
+    name      '1'
+    pref_type 'zookeeper'
+    value     '1'
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/search.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/search.rb b/contrib/blur-console-old/blur-admin/spec/factories/search.rb
new file mode 100644
index 0000000..a6f5c83
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/search.rb
@@ -0,0 +1,30 @@
+# 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.
+
+FactoryGirl.define do
+  factory :search do
+    super_query     { rand(1) == 0 } # 50% chance
+    columns         { ["family_-sep-_ColumnFamily1", 
+                       "column_-sep-_ColumnFamily2_-sep-_Column2A",
+                       "column_-sep-_ColumnFamily2_-sep-_Column2B",
+                       "column_-sep-_ColumnFamily3_-sep-_Column3C"].to_json }
+    fetch           { rand 10 ** 6 }
+    offset          { rand 1 ** 5 }
+    sequence(:name) {|n| "Search #{n}"}
+    query           "employee.name:bob"
+    blur_table_id   { rand 10 ** 6 }
+    user_id         { rand 10 ** 6 }
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/688e9d08/contrib/blur-console-old/blur-admin/spec/factories/shard.rb
----------------------------------------------------------------------
diff --git a/contrib/blur-console-old/blur-admin/spec/factories/shard.rb b/contrib/blur-console-old/blur-admin/spec/factories/shard.rb
new file mode 100644
index 0000000..2ba2af9
--- /dev/null
+++ b/contrib/blur-console-old/blur-admin/spec/factories/shard.rb
@@ -0,0 +1,28 @@
+# 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.
+
+FactoryGirl.define do
+  factory :blur_shard do
+    blur_version              { "1.#{rand 10}.#{rand 10}" }
+    sequence (:node_name)     { |n| "Test Node ##{n}" }
+    shard_status                    { rand 3 }
+    
+    factory :shard_with_cluster do
+      after_create do |blur_shard|
+        FactoryGirl.create_list(:cluster, 1, :blur_shards => [blur_shard])
+      end
+    end
+  end
+end
\ No newline at end of file


Mime
View raw message