incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [19/50] [abbrv] Initial Blur Console commit.
Date Fri, 17 May 2013 03:24:46 GMT
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b5b86c7e/src/contrib/blur-console/blur-admin/lib/thrift/thrift_hadoop_file_system.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/lib/thrift/thrift_hadoop_file_system.rb b/src/contrib/blur-console/blur-admin/lib/thrift/thrift_hadoop_file_system.rb
new file mode 100644
index 0000000..75175a6
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/lib/thrift/thrift_hadoop_file_system.rb
@@ -0,0 +1,1188 @@
+#
+# Autogenerated by Thrift
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+
+require 'thrift'
+require 'hadoopfs_types'
+
+module ThriftHadoopFileSystem
+  class Client
+    include ::Thrift::Client
+
+    def setInactivityTimeoutPeriod(periodInSeconds)
+      send_setInactivityTimeoutPeriod(periodInSeconds)
+      recv_setInactivityTimeoutPeriod()
+    end
+
+    def send_setInactivityTimeoutPeriod(periodInSeconds)
+      send_message('setInactivityTimeoutPeriod', SetInactivityTimeoutPeriod_args, :periodInSeconds => periodInSeconds)
+    end
+
+    def recv_setInactivityTimeoutPeriod()
+      result = receive_message(SetInactivityTimeoutPeriod_result)
+      return
+    end
+
+    def shutdown(status)
+      send_shutdown(status)
+      recv_shutdown()
+    end
+
+    def send_shutdown(status)
+      send_message('shutdown', Shutdown_args, :status => status)
+    end
+
+    def recv_shutdown()
+      result = receive_message(Shutdown_result)
+      return
+    end
+
+    def create(path)
+      send_create(path)
+      return recv_create()
+    end
+
+    def send_create(path)
+      send_message('create', Create_args, :path => path)
+    end
+
+    def recv_create()
+      result = receive_message(Create_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'create failed: unknown result')
+    end
+
+    def createFile(path, mode, overwrite, bufferSize, block_replication, blocksize)
+      send_createFile(path, mode, overwrite, bufferSize, block_replication, blocksize)
+      return recv_createFile()
+    end
+
+    def send_createFile(path, mode, overwrite, bufferSize, block_replication, blocksize)
+      send_message('createFile', CreateFile_args, :path => path, :mode => mode, :overwrite => overwrite, :bufferSize => bufferSize, :block_replication => block_replication, :blocksize => blocksize)
+    end
+
+    def recv_createFile()
+      result = receive_message(CreateFile_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'createFile failed: unknown result')
+    end
+
+    def open(path)
+      send_open(path)
+      return recv_open()
+    end
+
+    def send_open(path)
+      send_message('open', Open_args, :path => path)
+    end
+
+    def recv_open()
+      result = receive_message(Open_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'open failed: unknown result')
+    end
+
+    def append(path)
+      send_append(path)
+      return recv_append()
+    end
+
+    def send_append(path)
+      send_message('append', Append_args, :path => path)
+    end
+
+    def recv_append()
+      result = receive_message(Append_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'append failed: unknown result')
+    end
+
+    def write(handle, data)
+      send_write(handle, data)
+      return recv_write()
+    end
+
+    def send_write(handle, data)
+      send_message('write', Write_args, :handle => handle, :data => data)
+    end
+
+    def recv_write()
+      result = receive_message(Write_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'write failed: unknown result')
+    end
+
+    def read(handle, offset, size)
+      send_read(handle, offset, size)
+      return recv_read()
+    end
+
+    def send_read(handle, offset, size)
+      send_message('read', Read_args, :handle => handle, :offset => offset, :size => size)
+    end
+
+    def recv_read()
+      result = receive_message(Read_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'read failed: unknown result')
+    end
+
+    def close(out)
+      send_close(out)
+      return recv_close()
+    end
+
+    def send_close(out)
+      send_message('close', Close_args, :out => out)
+    end
+
+    def recv_close()
+      result = receive_message(Close_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'close failed: unknown result')
+    end
+
+    def rm(path, recursive)
+      send_rm(path, recursive)
+      return recv_rm()
+    end
+
+    def send_rm(path, recursive)
+      send_message('rm', Rm_args, :path => path, :recursive => recursive)
+    end
+
+    def recv_rm()
+      result = receive_message(Rm_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'rm failed: unknown result')
+    end
+
+    def rename(path, dest)
+      send_rename(path, dest)
+      return recv_rename()
+    end
+
+    def send_rename(path, dest)
+      send_message('rename', Rename_args, :path => path, :dest => dest)
+    end
+
+    def recv_rename()
+      result = receive_message(Rename_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'rename failed: unknown result')
+    end
+
+    def mkdirs(path)
+      send_mkdirs(path)
+      return recv_mkdirs()
+    end
+
+    def send_mkdirs(path)
+      send_message('mkdirs', Mkdirs_args, :path => path)
+    end
+
+    def recv_mkdirs()
+      result = receive_message(Mkdirs_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'mkdirs failed: unknown result')
+    end
+
+    def exists(path)
+      send_exists(path)
+      return recv_exists()
+    end
+
+    def send_exists(path)
+      send_message('exists', Exists_args, :path => path)
+    end
+
+    def recv_exists()
+      result = receive_message(Exists_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'exists failed: unknown result')
+    end
+
+    def stat(path)
+      send_stat(path)
+      return recv_stat()
+    end
+
+    def send_stat(path)
+      send_message('stat', Stat_args, :path => path)
+    end
+
+    def recv_stat()
+      result = receive_message(Stat_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'stat failed: unknown result')
+    end
+
+    def listStatus(path)
+      send_listStatus(path)
+      return recv_listStatus()
+    end
+
+    def send_listStatus(path)
+      send_message('listStatus', ListStatus_args, :path => path)
+    end
+
+    def recv_listStatus()
+      result = receive_message(ListStatus_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'listStatus failed: unknown result')
+    end
+
+    def chmod(path, mode)
+      send_chmod(path, mode)
+      recv_chmod()
+    end
+
+    def send_chmod(path, mode)
+      send_message('chmod', Chmod_args, :path => path, :mode => mode)
+    end
+
+    def recv_chmod()
+      result = receive_message(Chmod_result)
+      raise result.ouch unless result.ouch.nil?
+      return
+    end
+
+    def chown(path, owner, group)
+      send_chown(path, owner, group)
+      recv_chown()
+    end
+
+    def send_chown(path, owner, group)
+      send_message('chown', Chown_args, :path => path, :owner => owner, :group => group)
+    end
+
+    def recv_chown()
+      result = receive_message(Chown_result)
+      raise result.ouch unless result.ouch.nil?
+      return
+    end
+
+    def setReplication(path, replication)
+      send_setReplication(path, replication)
+      recv_setReplication()
+    end
+
+    def send_setReplication(path, replication)
+      send_message('setReplication', SetReplication_args, :path => path, :replication => replication)
+    end
+
+    def recv_setReplication()
+      result = receive_message(SetReplication_result)
+      raise result.ouch unless result.ouch.nil?
+      return
+    end
+
+    def getFileBlockLocations(path, start, length)
+      send_getFileBlockLocations(path, start, length)
+      return recv_getFileBlockLocations()
+    end
+
+    def send_getFileBlockLocations(path, start, length)
+      send_message('getFileBlockLocations', GetFileBlockLocations_args, :path => path, :start => start, :length => length)
+    end
+
+    def recv_getFileBlockLocations()
+      result = receive_message(GetFileBlockLocations_result)
+      return result.success unless result.success.nil?
+      raise result.ouch unless result.ouch.nil?
+      raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getFileBlockLocations failed: unknown result')
+    end
+
+  end
+
+  class Processor
+    include ::Thrift::Processor
+
+    def process_setInactivityTimeoutPeriod(seqid, iprot, oprot)
+      args = read_args(iprot, SetInactivityTimeoutPeriod_args)
+      result = SetInactivityTimeoutPeriod_result.new()
+      @handler.setInactivityTimeoutPeriod(args.periodInSeconds)
+      write_result(result, oprot, 'setInactivityTimeoutPeriod', seqid)
+    end
+
+    def process_shutdown(seqid, iprot, oprot)
+      args = read_args(iprot, Shutdown_args)
+      result = Shutdown_result.new()
+      @handler.shutdown(args.status)
+      write_result(result, oprot, 'shutdown', seqid)
+    end
+
+    def process_create(seqid, iprot, oprot)
+      args = read_args(iprot, Create_args)
+      result = Create_result.new()
+      begin
+        result.success = @handler.create(args.path)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'create', seqid)
+    end
+
+    def process_createFile(seqid, iprot, oprot)
+      args = read_args(iprot, CreateFile_args)
+      result = CreateFile_result.new()
+      begin
+        result.success = @handler.createFile(args.path, args.mode, args.overwrite, args.bufferSize, args.block_replication, args.blocksize)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'createFile', seqid)
+    end
+
+    def process_open(seqid, iprot, oprot)
+      args = read_args(iprot, Open_args)
+      result = Open_result.new()
+      begin
+        result.success = @handler.open(args.path)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'open', seqid)
+    end
+
+    def process_append(seqid, iprot, oprot)
+      args = read_args(iprot, Append_args)
+      result = Append_result.new()
+      begin
+        result.success = @handler.append(args.path)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'append', seqid)
+    end
+
+    def process_write(seqid, iprot, oprot)
+      args = read_args(iprot, Write_args)
+      result = Write_result.new()
+      begin
+        result.success = @handler.write(args.handle, args.data)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'write', seqid)
+    end
+
+    def process_read(seqid, iprot, oprot)
+      args = read_args(iprot, Read_args)
+      result = Read_result.new()
+      begin
+        result.success = @handler.read(args.handle, args.offset, args.size)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'read', seqid)
+    end
+
+    def process_close(seqid, iprot, oprot)
+      args = read_args(iprot, Close_args)
+      result = Close_result.new()
+      begin
+        result.success = @handler.close(args.out)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'close', seqid)
+    end
+
+    def process_rm(seqid, iprot, oprot)
+      args = read_args(iprot, Rm_args)
+      result = Rm_result.new()
+      begin
+        result.success = @handler.rm(args.path, args.recursive)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'rm', seqid)
+    end
+
+    def process_rename(seqid, iprot, oprot)
+      args = read_args(iprot, Rename_args)
+      result = Rename_result.new()
+      begin
+        result.success = @handler.rename(args.path, args.dest)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'rename', seqid)
+    end
+
+    def process_mkdirs(seqid, iprot, oprot)
+      args = read_args(iprot, Mkdirs_args)
+      result = Mkdirs_result.new()
+      begin
+        result.success = @handler.mkdirs(args.path)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'mkdirs', seqid)
+    end
+
+    def process_exists(seqid, iprot, oprot)
+      args = read_args(iprot, Exists_args)
+      result = Exists_result.new()
+      begin
+        result.success = @handler.exists(args.path)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'exists', seqid)
+    end
+
+    def process_stat(seqid, iprot, oprot)
+      args = read_args(iprot, Stat_args)
+      result = Stat_result.new()
+      begin
+        result.success = @handler.stat(args.path)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'stat', seqid)
+    end
+
+    def process_listStatus(seqid, iprot, oprot)
+      args = read_args(iprot, ListStatus_args)
+      result = ListStatus_result.new()
+      begin
+        result.success = @handler.listStatus(args.path)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'listStatus', seqid)
+    end
+
+    def process_chmod(seqid, iprot, oprot)
+      args = read_args(iprot, Chmod_args)
+      result = Chmod_result.new()
+      begin
+        @handler.chmod(args.path, args.mode)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'chmod', seqid)
+    end
+
+    def process_chown(seqid, iprot, oprot)
+      args = read_args(iprot, Chown_args)
+      result = Chown_result.new()
+      begin
+        @handler.chown(args.path, args.owner, args.group)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'chown', seqid)
+    end
+
+    def process_setReplication(seqid, iprot, oprot)
+      args = read_args(iprot, SetReplication_args)
+      result = SetReplication_result.new()
+      begin
+        @handler.setReplication(args.path, args.replication)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'setReplication', seqid)
+    end
+
+    def process_getFileBlockLocations(seqid, iprot, oprot)
+      args = read_args(iprot, GetFileBlockLocations_args)
+      result = GetFileBlockLocations_result.new()
+      begin
+        result.success = @handler.getFileBlockLocations(args.path, args.start, args.length)
+      rescue ThriftIOException => ouch
+        result.ouch = ouch
+      end
+      write_result(result, oprot, 'getFileBlockLocations', seqid)
+    end
+
+  end
+
+  # HELPER FUNCTIONS AND STRUCTURES
+
+  class SetInactivityTimeoutPeriod_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PERIODINSECONDS = 1
+
+    FIELDS = {
+      PERIODINSECONDS => {:type => ::Thrift::Types::I64, :name => 'periodInSeconds'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class SetInactivityTimeoutPeriod_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+
+    FIELDS = {
+
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Shutdown_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    STATUS = 1
+
+    FIELDS = {
+      STATUS => {:type => ::Thrift::Types::I32, :name => 'status'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Shutdown_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+
+    FIELDS = {
+
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Create_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Create_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ThriftHandle},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class CreateFile_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+    MODE = 2
+    OVERWRITE = 3
+    BUFFERSIZE = 4
+    BLOCK_REPLICATION = 5
+    BLOCKSIZE = 6
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
+      MODE => {:type => ::Thrift::Types::I16, :name => 'mode'},
+      OVERWRITE => {:type => ::Thrift::Types::BOOL, :name => 'overwrite'},
+      BUFFERSIZE => {:type => ::Thrift::Types::I32, :name => 'bufferSize'},
+      BLOCK_REPLICATION => {:type => ::Thrift::Types::I16, :name => 'block_replication'},
+      BLOCKSIZE => {:type => ::Thrift::Types::I64, :name => 'blocksize'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class CreateFile_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ThriftHandle},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Open_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Open_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ThriftHandle},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Append_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Append_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ThriftHandle},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Write_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    HANDLE = 1
+    DATA = -1
+
+    FIELDS = {
+      HANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'handle', :class => ThriftHandle},
+      DATA => {:type => ::Thrift::Types::STRING, :name => 'data'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Write_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Read_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    HANDLE = 1
+    OFFSET = -1
+    SIZE = -2
+
+    FIELDS = {
+      HANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'handle', :class => ThriftHandle},
+      OFFSET => {:type => ::Thrift::Types::I64, :name => 'offset'},
+      SIZE => {:type => ::Thrift::Types::I32, :name => 'size'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Read_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Close_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    OUT = 1
+
+    FIELDS = {
+      OUT => {:type => ::Thrift::Types::STRUCT, :name => 'out', :class => ThriftHandle}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Close_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Rm_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+    RECURSIVE = 2
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
+      RECURSIVE => {:type => ::Thrift::Types::BOOL, :name => 'recursive'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Rm_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Rename_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+    DEST = 2
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
+      DEST => {:type => ::Thrift::Types::STRUCT, :name => 'dest', :class => Pathname}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Rename_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Mkdirs_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Mkdirs_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Exists_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Exists_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::BOOL, :name => 'success'},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Stat_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Stat_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => FileStatus},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class ListStatus_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class ListStatus_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => FileStatus}},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Chmod_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+    MODE = 2
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
+      MODE => {:type => ::Thrift::Types::I16, :name => 'mode'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Chmod_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    OUCH = 1
+
+    FIELDS = {
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Chown_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+    OWNER = 2
+    GROUP = 3
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
+      OWNER => {:type => ::Thrift::Types::STRING, :name => 'owner'},
+      GROUP => {:type => ::Thrift::Types::STRING, :name => 'group'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Chown_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    OUCH = 1
+
+    FIELDS = {
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class SetReplication_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+    REPLICATION = 2
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
+      REPLICATION => {:type => ::Thrift::Types::I16, :name => 'replication'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class SetReplication_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    OUCH = 1
+
+    FIELDS = {
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class GetFileBlockLocations_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    PATH = 1
+    START = 2
+    LENGTH = 3
+
+    FIELDS = {
+      PATH => {:type => ::Thrift::Types::STRUCT, :name => 'path', :class => Pathname},
+      START => {:type => ::Thrift::Types::I64, :name => 'start'},
+      LENGTH => {:type => ::Thrift::Types::I64, :name => 'length'}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class GetFileBlockLocations_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    SUCCESS = 0
+    OUCH = 1
+
+    FIELDS = {
+      SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRUCT, :class => BlockLocation}},
+      OUCH => {:type => ::Thrift::Types::STRUCT, :name => 'ouch', :class => ThriftIOException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+end
+

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b5b86c7e/src/contrib/blur-console/blur-admin/public/robots.txt
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/public/robots.txt b/src/contrib/blur-console/blur-admin/public/robots.txt
new file mode 100644
index 0000000..085187f
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/public/robots.txt
@@ -0,0 +1,5 @@
+# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
+#
+# To ban all spiders from the entire site uncomment the next two lines:
+# User-Agent: *
+# Disallow: /

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b5b86c7e/src/contrib/blur-console/blur-admin/script/rails
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/script/rails b/src/contrib/blur-console/blur-admin/script/rails
new file mode 100755
index 0000000..f8da2cf
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/script/rails
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
+
+APP_PATH = File.expand_path('../../config/application',  __FILE__)
+require File.expand_path('../../config/boot',  __FILE__)
+require 'rails/commands'

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/admin_settings_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/admin_settings_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/admin_settings_controller_spec.rb
new file mode 100644
index 0000000..5a8592a
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/admin_settings_controller_spec.rb
@@ -0,0 +1,45 @@
+require 'spec_helper'
+
+describe AdminSettingsController do
+  describe "actions" do
+    before do
+      # Universal setup
+      setup_tests
+    end
+
+    describe 'PUT update' do
+      it 'should create a new admin setting when a previous one DNE' do
+        initial_count = AdminSetting.all.length
+        put :update, :setting => 'regex'
+        AdminSetting.all.length.should == initial_count + 1
+      end
+
+      it 'should find an admin setting when a previous one exists' do
+        setting = FactoryGirl.create :admin_setting
+        initial_count = AdminSetting.all.length
+        AdminSetting.should_receive(:find_or_create_by_setting).with('regex').and_return(setting)
+        put :update, :setting => 'regex'
+        AdminSetting.all.length.should == initial_count
+      end
+
+      it 'should update the setting to the given value' do
+        setting = FactoryGirl.create :admin_setting
+        AdminSetting.should_receive(:find_or_create_by_setting).with('regex').and_return(setting)
+        put :update, :setting => 'regex', :value => 'test'
+        setting.value.should == 'test'
+      end
+
+      it 'should succeed with a given setting' do
+        expect {
+          put :update, :setting => 'regex'
+        }.to_not raise_error
+      end
+
+      it 'should fail when a setting is not given' do
+        expect {
+          put :update
+        }.to raise_error
+      end
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/application_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/application_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/application_controller_spec.rb
new file mode 100644
index 0000000..77fc00e
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/application_controller_spec.rb
@@ -0,0 +1,221 @@
+require 'spec_helper'
+
+describe ApplicationController do
+  describe "user actions" do
+    before do
+      # Set up the stubs and variables
+      setup_variables_and_stubs
+      # Set the ability (leave current user unset for testing purposes)
+      set_ability
+
+      activate_authlogic
+
+      @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
+
+    it "Current user should grab the current user session and set the current user" do
+      controller.should_receive(:current_user_session)
+      controller.current_user
+      assigns(:current_user).should == @user
+    end
+
+    it "help should render the help menu with the given tab" do 
+      get 'help', :tab => 'search'
+      assigns(:tab).should == 'search'
+      response.should render_template :partial => "layouts/_help_menu"
+    end
+
+    it "the license action should set the @license variable" do
+      License.stub!(:first).and_return 'License'
+      controller.license
+      assigns(:license).should == 'License'
+    end
+
+    describe "zookeeper preference" do
+      it "should grab the current users preference" do
+        controller.should_receive(:current_user).and_return @user
+        controller.send(:set_zookeeper_with_preference)
+      end
+
+      it "should do nothing if the default pref is chosen" do
+        zookeeper_pref = FactoryGirl.create(:zookeeper_pref, :name => 0)
+        @user.stub!(:zookeeper_preference).and_return(zookeeper_pref)
+        Zookeeper.should_not_receive(:find_by_id)
+        controller.send(:set_zookeeper_with_preference)
+      end
+
+      it "should set the zookeeper if the pref isnt the default and it exists" do
+        controller.should_receive(:set_zookeeper).with @user.zookeeper_preference.value
+        Zookeeper.stub!(:find_by_id).and_return true
+        controller.send(:set_zookeeper_with_preference)
+      end
+
+      it "should error and reset your preference when the zookeeper no longer exists" do
+        zookeeper_pref = FactoryGirl.create(:zookeeper_pref)
+        @user.stub!(:zookeeper_preference).and_return(zookeeper_pref)
+        Zookeeper.stub!(:find_by_id).and_return nil
+        zookeeper_pref.should_receive(:name=)
+        zookeeper_pref.should_receive(:save)
+        controller.send(:set_zookeeper_with_preference)
+        controller.flash[:error].should_not be_empty
+      end
+    end
+  end
+
+  describe "Current Zookeeper" do 
+    before do 
+      @zookeeper = FactoryGirl.create :zookeeper
+      Zookeeper.stub!(:find_by_id).and_return @zookeeper
+    end
+
+    it "should set the zookeeper to the zookeeper id when it is given" do 
+      Zookeeper.should_receive(:find_by_id).with(@zookeeper.id)
+      controller.params[:zookeeper_id] = @zookeeper.id
+      controller.should_receive(:set_zookeeper).with @zookeeper.id
+      zookeeper = controller.current_zookeeper
+      assigns(:current_zookeeper).should == @zookeeper
+      zookeeper.should == @zookeeper
+    end
+
+    it "should set the zookeeper to the zookeeper id in the session when there isnt an id" do 
+      Zookeeper.should_receive(:find_by_id).with(@zookeeper.id)
+      controller.session[:current_zookeeper_id] = @zookeeper.id
+      zookeeper = controller.current_zookeeper
+      assigns(:current_zookeeper).should == @zookeeper
+      zookeeper.should == @zookeeper
+    end
+
+    it "should redirect to the root page when it doesnt find a zookeeper" do 
+      Zookeeper.stub!(:find_by_id).and_return nil
+      controller.stub! :redirect_to
+      controller.should_receive(:redirect_to).with '/'
+      controller.current_zookeeper
+    end
+
+    it "should render a conflict when the request is xhr and it doesnt find a zookeeper" do 
+      Zookeeper.stub!(:find_by_id).and_return nil
+      controller.request.stub!(:xhr?).and_return true
+      controller.stub! :render
+      controller.should_receive(:render).with({:status=>:conflict, :text=>"No Current Zookeeper"})
+      controller.current_zookeeper
+    end
+  end
+
+  describe 'Enable Authorization: Visiting a page without authorization' do
+    it "without a current_user" do
+      get 'help', :tab => 'search'
+      response.should redirect_to(login_path)
+    end
+
+    it "with a current user and no ability to view the root page redirects to logout_url" do 
+      @user = FactoryGirl.create :user, :roles => []
+      controller.stub!(:current_user).and_return(@user)
+      get 'help', :tab => 'search'
+      response.should redirect_to(logout_url)
+    end
+
+    it "with a current user and ability to view the root page redirects to index zookeeper" do 
+      @user = FactoryGirl.create :user, :roles => []
+      controller.stub!(:current_user).and_return(@user)
+      controller.stub!(:can?).and_return(true)
+      get 'help', :tab => 'search'
+      response.should redirect_to(root_url)
+    end
+  end
+
+  describe "private methods" do 
+    it "set_zookeeper should set the zookeeper if the id is new" do 
+      controller.session[:current_zookeeper_id] = 2
+      controller.session.should_receive :[]=
+      controller.send(:set_zookeeper, '1')
+    end
+
+    it "set_zookeeper should not set the zookeeper if the id is new" do 
+      controller.session[:current_zookeeper_id] = 1
+      controller.session.should_not_receive :[]=
+      controller.send(:set_zookeeper, '1')
+    end
+  end
+
+  describe "lock down api" do 
+    describe "format" do
+      it "should be set to html if the format is blank" do 
+        respond = {:html => {}}
+        respond.should_receive(:[]).with(:html).and_return({})
+        controller.stub!(:mimes_for_respond_to).and_return(respond)
+        controller.send(:lock_down_api)
+      end
+
+      it "should be set to the given format when it is specified" do 
+        controller.params[:format] = 'json'
+        respond = {:json => {}}
+        respond.should_receive(:[]).with(:json).and_return({})
+        controller.stub!(:mimes_for_respond_to).and_return(respond)
+        controller.send(:lock_down_api)
+      end
+
+      it "should raise an error when there are no accepted actions" do 
+        respond = {:html => nil}
+        controller.stub!(:mimes_for_respond_to).and_return(respond)
+        expect {
+          controller.send(:lock_down_api)
+        }.to raise_error "Unaccepted Format for this Action!"
+      end
+    end
+
+    describe "only block" do
+      it "should not raise an error when the current action is present" do
+        controller.params[:action] = :index
+        respond = {:html => {}}
+        respond.stub!(:[]).and_return({:only => [:index]})
+        controller.stub!(:mimes_for_respond_to).and_return(respond)
+        expect {
+          controller.send(:lock_down_api)
+        }.to_not raise_error
+      end
+
+      it "should raise an error when the current action is in the not present" do
+        controller.params[:action] = :index
+        respond = {:html => {}}
+        respond.stub!(:[]).and_return({:only => [:show]})
+        controller.stub!(:mimes_for_respond_to).and_return(respond)
+        expect {
+          controller.send(:lock_down_api)
+        }.to raise_error "Unaccepted Format for this Action!"
+      end
+    end
+
+    describe "except block" do
+      it "should raise an error when the current action is present" do
+        controller.params[:action] = :index
+        respond = {:html => {}}
+        respond.stub!(:[]).and_return({:except => [:index]})
+        controller.stub!(:mimes_for_respond_to).and_return(respond)
+        expect {
+          controller.send(:lock_down_api)
+        }.to raise_error
+      end
+
+      it "should raise an error when the current action is in the not present" do
+        controller.params[:action] = :index
+        respond = {:html => {}}
+        respond.stub!(:[]).and_return({:except => [:show]})
+        controller.stub!(:mimes_for_respond_to).and_return(respond)
+        expect {
+          controller.send(:lock_down_api)
+        }.to_not raise_error "Unaccepted Format for this Action!"
+      end
+    end
+
+    it "should not error when the action is present" do
+      controller.params[:action] = :index
+        respond = {:html => {}}
+        controller.stub!(:mimes_for_respond_to).and_return(respond)
+        expect {
+          controller.send(:lock_down_api)
+        }.to_not raise_error "Unaccepted Format for this Action!"
+    end
+  end
+end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/audits_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/audits_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/audits_controller_spec.rb
new file mode 100644
index 0000000..18c95ab
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/audits_controller_spec.rb
@@ -0,0 +1,37 @@
+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/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/blur_controllers_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/blur_controllers_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/blur_controllers_controller_spec.rb
new file mode 100644
index 0000000..06c4eeb
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/blur_controllers_controller_spec.rb
@@ -0,0 +1,39 @@
+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/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/blur_queries_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/blur_queries_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/blur_queries_controller_spec.rb
new file mode 100644
index 0000000..a0106f8
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/blur_queries_controller_spec.rb
@@ -0,0 +1,89 @@
+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/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/blur_shards_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/blur_shards_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/blur_shards_controller_spec.rb
new file mode 100644
index 0000000..fa7acfe
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/blur_shards_controller_spec.rb
@@ -0,0 +1,51 @@
+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/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/blur_tables_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/blur_tables_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/blur_tables_controller_spec.rb
new file mode 100644
index 0000000..eb100fb
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/blur_tables_controller_spec.rb
@@ -0,0 +1,163 @@
+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/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/clusters_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/clusters_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/clusters_controller_spec.rb
new file mode 100644
index 0000000..6423521
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/clusters_controller_spec.rb
@@ -0,0 +1,39 @@
+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/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/errors_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/errors_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/errors_controller_spec.rb
new file mode 100644
index 0000000..3a8f2a5
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/errors_controller_spec.rb
@@ -0,0 +1,37 @@
+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/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/hdfs_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/hdfs_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/hdfs_controller_spec.rb
new file mode 100644
index 0000000..1071482
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/hdfs_controller_spec.rb
@@ -0,0 +1,285 @@
+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/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/hdfs_metrics_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/hdfs_metrics_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/hdfs_metrics_controller_spec.rb
new file mode 100644
index 0000000..702fb22
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/hdfs_metrics_controller_spec.rb
@@ -0,0 +1,54 @@
+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/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/preferences_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/preferences_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/preferences_controller_spec.rb
new file mode 100644
index 0000000..537e8d4
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/preferences_controller_spec.rb
@@ -0,0 +1,43 @@
+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/b5b86c7e/src/contrib/blur-console/blur-admin/spec/controllers/search_controller_spec.rb
----------------------------------------------------------------------
diff --git a/src/contrib/blur-console/blur-admin/spec/controllers/search_controller_spec.rb b/src/contrib/blur-console/blur-admin/spec/controllers/search_controller_spec.rb
new file mode 100644
index 0000000..8c0c5ca
--- /dev/null
+++ b/src/contrib/blur-console/blur-admin/spec/controllers/search_controller_spec.rb
@@ -0,0 +1,206 @@
+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


Mime
View raw message