Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove deprecated session store; see https://github.com/frank06/conne…

  • Loading branch information...
commit 2bba728b4b52819775b6075265fe31d6de71dafa 1 parent c9554c8
Francisco Treacy authored
View
1  Cakefile
@@ -26,7 +26,6 @@ task 'test', 'Test the app', (options) ->
'spec/test_mapper.coffee'
'spec/test_meta.coffee'
# 'spec/test_test_server.coffee'
- # 'spec/test_session_store.coffee'
]
args.unshift '--spec' if options.spec
View
79 spec/test_session_store.coffee
@@ -1,79 +0,0 @@
-vows = require 'vows'
-assert = require 'assert'
-riak = require('../src/index')
-db = riak.getClient({ api: 'http', port: 9000, debug: false })
-store = riak.getSessionStore({client: db})
-testServer = new riak.TestServer(binDir: process.env['RIAKJS_BIN_DIR'])
-sys = require 'sys'
-
-suite = vows.describe "Riak Connect Session Store"
-
-suite.addBatch
- 'setup':
- topic: ->
- testServer.prepare =>
- testServer.start @callback
- undefined
- 'works': ->
- assert.isTrue testServer.started
-
-suite.addBatch
- 'storing a session':
- topic: ->
- testServer.clear =>
- store.set 'frank', {user:"frank06"}, @callback
- undefined
- 'succeeds': (err, data, meta) ->
- assert.ok !err
- 'then retrieving the stored session':
- topic: ->
- store.get 'frank', @callback
- undefined
- 'succeeds': (err, data) ->
- assert.ok !err
- assert.deepEqual data, {user:"frank06"}
- 'then destroying the session':
- topic: ->
- store.destroy 'frank', @callback
- undefined
- 'succeeds': (err) ->
- assert.ok !err
- 'makes the session unavailable':
- topic: ->
- store.get 'frank', @callback
- undefined
- 'successfully': (err, data) ->
- assert.isUndefined err
- assert.isUndefined data
-
-suite.addBatch
- 'retrieving all sessions':
- topic: ->
- testServer.clear =>
- store.set 'frank', {user:'frank06'}, =>
- store.set 'rick', {user:'technoweenie'}, =>
- store.all @callback
- undefined
- 'finds all sessions': (sessions) ->
- assert.equal sessions.length, 2
-
-suite.addBatch
- 'counting existing sessions':
- topic: ->
- testServer.clear =>
- store.set 'frank', {user:'frank06'}, =>
- store.set 'rick', {user:'technoweenie'}, =>
- store.length @callback
- undefined
- 'returns a count': (count) ->
- assert.equal count, 2
-
-suite.addBatch
- 'teardown':
- topic: ->
- testServer.stop @callback
- undefined
- 'works': ->
- assert.ok !testServer.started
-
-suite.export module
View
5 src/index.coffee
@@ -42,7 +42,4 @@ module.exports.__defineGetter__ 'ProtobufPool', ->
@_pbcPool ||= require './protobuf'
module.exports.__defineGetter__ 'TestServer', ->
- @_testServer ||= require './test_server'
-
-module.exports.__defineGetter__ 'SessionStore', ->
- @_sessionStore ||= require './session_store'
+ @_testServer ||= require './test_server'
View
39 src/session_store.coffee
@@ -1,39 +0,0 @@
-{Store} = require('connect').session
-
-Store.prototype.constructor = Store
-
-class SessionStore extends Store
- constructor: (options) ->
- super options
- @client = options.client
- @bucket = options.bucket || '_sessions'
-
- set: (sid, sess, cb) ->
- @client.save @bucket, sid, sess, cb
-
- get: (sid, cb) ->
- @client.get @bucket, sid, (err, data, meta) ->
- if err?
-
- if meta.statusCode >= 400 && meta.statusCode < 500
- err.errno = process.ENOENT
-
- cb() if cb
- else
- cb(null, data) if cb
-
- destroy: (sid, cb) ->
- @client.remove @bucket, sid, cb
-
- all: (cb) ->
- @client.getAll @bucket, (err, sessions) ->
- if err
- cb(err, null) if cb
- else
- cb(null, sessions.map((i) -> i.data)) if cb
-
- length: (cb) ->
- @client.count @bucket, cb
-
-
-module.exports = SessionStore
Please sign in to comment.
Something went wrong with that request. Please try again.