fmq 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestFreeMessageQueue < Test::Unit::TestCase
4
+ TEST_URL = "http://localhost:5884/fmq_test/test1"
5
+ TEST_REQUEST = 'X' * 1200 # 1.2 KB
6
+
7
+ def setup
8
+ @queue = FreeMessageQueue::ClientQueue.new(TEST_URL)
9
+ end
10
+
11
+ def test_post_and_get_message
12
+ 5.times do |t|
13
+ @queue.put(TEST_REQUEST + t.to_s)
14
+ end
15
+
16
+ assert_equal 5, @queue.size
17
+ assert_equal TEST_REQUEST.size * 5 + 5, @queue.bytes
18
+
19
+ 5.times do |t|
20
+ assert_equal TEST_REQUEST + t.to_s, @queue.poll()
21
+ end
22
+
23
+ assert_equal 0, @queue.size
24
+ assert_equal 0, @queue.bytes
25
+ end
26
+ end
@@ -0,0 +1,47 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestFreeMessageQueue < Test::Unit::TestCase
4
+ def setup
5
+ #@queue = FreeMessageQueue::LinkedQueue.new
6
+ @queue = FreeMessageQueue::SyncronizedQueue.new
7
+ end
8
+
9
+ def test_basic_get_poll
10
+ assert_nil @queue.poll
11
+ assert_equal 0, @queue.size
12
+ assert @queue.put(nil) == false
13
+ assert_nil @queue.poll
14
+ td_1 = "asdasd"
15
+ assert @queue.put(td_1)
16
+ assert_equal 1, @queue.size
17
+ assert_equal td_1, @queue.poll.data
18
+ end
19
+
20
+ def test_n_items
21
+ n = 20
22
+ byte_size = 0
23
+ n.times { |t| byte_size += t.size }
24
+
25
+ assert_equal 0, @queue.bytes
26
+ assert_nil @queue.poll
27
+ n.times do |i|
28
+ assert @queue.put(i)
29
+ end
30
+ assert_equal byte_size, @queue.bytes
31
+ assert_equal n, @queue.size
32
+ n.times do |i|
33
+ assert_equal i, @queue.poll.data
34
+ end
35
+ assert_equal 0, @queue.bytes
36
+ assert_nil @queue.poll
37
+ end
38
+
39
+ def test_queue_bytes
40
+ @queue.put("XX" * 40)
41
+ @queue.put("X" * 40)
42
+ @queue.put("XX888" * 40)
43
+ assert_equal 2*40+40+5*40, @queue.bytes
44
+ @queue.clear
45
+ assert_equal 0, @queue.bytes
46
+ end
47
+ end
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/fmq'
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fmq
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Vincent Landgraf
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-06-23 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: The project implements a queue system with a server and some client apis. This project wants to be a fast and lightweight implementation with most of the features of MQS or ActiveMQ.
17
+ email:
18
+ - fmq-3z@gmx.net
19
+ executables:
20
+ - fmq
21
+ extensions: []
22
+
23
+ extra_rdoc_files: []
24
+
25
+ files:
26
+ - bin/fmq
27
+ - default-server/admin-interface/images/logo.png
28
+ - default-server/admin-interface/index.html
29
+ - default-server/admin-interface/prototype.js
30
+ - default-server/config.yml
31
+ - default-server/queues/my_test.rb
32
+ - lib/fmq.rb
33
+ - lib/fmq/client.rb
34
+ - lib/fmq/boot.rb
35
+ - lib/fmq/mongrel_server.rb
36
+ - lib/fmq/queue_manager.rb
37
+ - lib/fmq/queues/admin.rb
38
+ - lib/fmq/queues/file.rb
39
+ - lib/fmq/queues/linked.rb
40
+ - lib/fmq/queues/load_balanced.rb
41
+ - lib/fmq/queues/syncronized.rb
42
+ - lib/fmq/version.rb
43
+ - setup.rb
44
+ has_rdoc: true
45
+ homepage: http://fmq.rubyforge.org
46
+ post_install_message: |-
47
+ ================================================================================
48
+ For more information on Free Message Queue (FMQ), see http://fmq.rubyforge.org
49
+ ================================================================================
50
+ rdoc_options:
51
+ - --main
52
+ - README.txt
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: "0"
66
+ version:
67
+ requirements: []
68
+
69
+ rubyforge_project: fmq
70
+ rubygems_version: 1.0.1
71
+ signing_key:
72
+ specification_version: 2
73
+ summary: The project implements a queue system with a server and some client apis. This project wants to be a fast and lightweight implementation with most of the features of MQS or ActiveMQ.
74
+ test_files:
75
+ - test/test_fmq_client.rb
76
+ - test/test_fmq_queue.rb
77
+ - test/test_helper.rb