hashdot-test-daemon 1.1.0-java

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.
data/History.rdoc ADDED
@@ -0,0 +1,6 @@
1
+ === 1.1.0 (2010-3-7)
2
+ * Upgrade slf4j/logback dependencies
3
+ * Set gem platform to java
4
+
5
+ === 1.0.0 (2010-2-13)
6
+ * Initial version
data/Manifest.txt ADDED
@@ -0,0 +1,9 @@
1
+ Manifest.txt
2
+ README.rdoc
3
+ History.rdoc
4
+ Rakefile
5
+ init/hashdot-test-daemon
6
+ bin/hashdot-test-fg
7
+ lib/hashdot-test-daemon/base.rb
8
+ lib/hashdot-test-daemon.rb
9
+ test/test_daemon.rb
data/README.rdoc ADDED
@@ -0,0 +1,25 @@
1
+ = hashdot-daemon
2
+
3
+ * http://github.com/dekellum/hashdot-test-daemon
4
+ * http://gravitext.com/#vblog
5
+ * http://hashdot.sourceforge.net/
6
+
7
+ == Description
8
+
9
+ Sample/test hashdot launched daemon packaged as gem.
10
+
11
+ == License
12
+
13
+ Copyright (c) 2010 David Kellum
14
+
15
+ Licensed under the Apache License, Version 2.0 (the "License"); you
16
+ may not use this file except in compliance with the License. You
17
+ may obtain a copy of the License at:
18
+
19
+ http://www.apache.org/licenses/LICENSE-2.0
20
+
21
+ Unless required by applicable law or agreed to in writing, software
22
+ distributed under the License is distributed on an "AS IS" BASIS,
23
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
24
+ implied. See the License for the specific language governing
25
+ permissions and limitations under the License.
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ # -*- ruby -*-
2
+ #--
3
+ # Copyright (C) 2010 David Kellum
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
6
+ # may not use this file except in compliance with the License. You
7
+ # may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
+ # implied. See the License for the specific language governing
15
+ # permissions and limitations under the License.
16
+ #++
17
+
18
+ $LOAD_PATH << './lib'
19
+ require 'hashdot-test-daemon/base'
20
+
21
+ require 'rubygems'
22
+ gem 'rjack-tarpit', '~> 1.2.0'
23
+ require 'rjack-tarpit'
24
+
25
+ t = RJack::TarPit.new( 'hashdot-test-daemon',
26
+ Hashdot::Daemon::VERSION,
27
+ :java_platform )
28
+
29
+ t.specify do |h|
30
+ h.developer( "David Kellum", "dek-oss@gravitext.com" )
31
+ h.extra_deps += [ [ 'rjack-slf4j', '~> 1.5.11' ],
32
+ [ 'rjack-logback', '~> 0.9.18' ] ]
33
+ end
34
+
35
+ task :check_init_versions do
36
+ t.test_line_match( 'init/hashdot-test-daemon',
37
+ /^gem.+#{t.name}/, /= #{t.version}/ )
38
+ end
39
+ task :check_history_version do
40
+ t.test_line_match( 'History.rdoc', /^==/, / #{t.version} / )
41
+ end
42
+ task :check_history_date do
43
+ t.test_line_match( 'History.rdoc', /^==/, /\([0-9\-]+\)$/ )
44
+ end
45
+
46
+ task :gem => [ :check_init_versions, :check_history_version ]
47
+ task :tag => [ :check_init_versions, :check_history_version, :check_history_date ]
48
+ task :push => [ :check_init_versions, :check_history_version, :check_history_date ]
49
+
50
+ t.define_tasks
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env jruby
2
+ #-*- ruby -*-
3
+ #. hashdot.vm.options += -Xmx64m
4
+ #. hashdot.vm.options += -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
5
+ #
6
+ # Note: Above VM options not honored through gem installed bin wrappers
7
+
8
+ require 'rubygems'
9
+
10
+ $LOAD_PATH.unshift File.join( File.dirname(__FILE__), "..", "lib" )
11
+
12
+ require 'rjack-logback'
13
+ RJack::Logback.config_console( :full => true, :thread => true )
14
+
15
+ require 'hashdot-test-daemon'
16
+ Hashdot::Daemon::Runner.new.run
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env jruby
2
+ #-*- ruby -*-
3
+ #. hashdot.profile += daemon
4
+ #. hashdot.pid_file = ./hashdot-test-daemon.pid
5
+ #. hashdot.io_redirect.file = ./hashdot-test-daemon.log
6
+ #. hashdot.vm.options += -Xmx64m
7
+ #. hashdot.vm.options += -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
8
+
9
+ require 'rubygems'
10
+ gem( "hashdot-test-daemon", "= 1.1.0" )
11
+
12
+ require 'rjack-logback'
13
+ RJack::Logback.config_console( :full => true, :thread => true )
14
+
15
+ require 'hashdot-test-daemon'
16
+ Hashdot::Daemon::Runner.new.run
@@ -0,0 +1,66 @@
1
+ #--
2
+ # Copyright (C) 2009-2010 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You
6
+ # may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ require 'hashdot-test-daemon/base'
18
+
19
+ require 'rjack-slf4j'
20
+ require 'java'
21
+
22
+ module Hashdot
23
+
24
+ module Daemon
25
+
26
+ # The mock service
27
+ class Runner
28
+ include RJack
29
+ def initialize
30
+ @log = SLF4J[self.class]
31
+ @log.info "Initialized hashdot-daemon (VERSION = #{VERSION})"
32
+ @log.info "SLF4J::VERSION = #{SLF4J::VERSION}"
33
+ ShutdownHandler.register
34
+ end
35
+
36
+ def run
37
+ loop do
38
+ i = 2 * rand
39
+ @log.info { "Sleep #{i}" }
40
+ sleep i
41
+ if rand(100) == 0
42
+ cause = rand(3) == 0 ? "KILL" : "TERM"
43
+ @log.info { "Unexpected #{cause}" }
44
+ Process.kill( cause, 0 )
45
+ break
46
+ end
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ class ShutdownHandler
53
+ Thread = Java::java.lang.Thread
54
+ Runtime = Java::java.lang.Runtime
55
+ include Java::java.lang.Runnable
56
+ def run
57
+ SLF4J[self.class].info "Shutting down (sleep 3)"
58
+ sleep 3.0
59
+ end
60
+
61
+ def self.register
62
+ Runtime::runtime.add_shutdown_hook( Thread.new( new ) )
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,21 @@
1
+ #--
2
+ # Copyright (C) 2009-2010 David Kellum
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
5
+ # may not use this file except in compliance with the License. You
6
+ # may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13
+ # implied. See the License for the specific language governing
14
+ # permissions and limitations under the License.
15
+ #++
16
+
17
+ module Hashdot
18
+ module Daemon
19
+ VERSION = "1.1.0"
20
+ end
21
+ end
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env jruby
2
+ #.hashdot.profile += jruby-shortlived
3
+ #--
4
+ # Copyright (C) 2010 David Kellum
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License"); you
7
+ # may not use this file except in compliance with the License. You
8
+ # may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
+ # implied. See the License for the specific language governing
16
+ # permissions and limitations under the License.
17
+ #++
18
+
19
+ TEST_DIR = File.dirname(__FILE__)
20
+
21
+ $LOAD_PATH.unshift File.join( TEST_DIR, "..", "lib" )
22
+
23
+ require 'rubygems'
24
+
25
+ require 'rjack-logback'
26
+ require 'hashdot-test-daemon'
27
+ require 'test/unit'
28
+
29
+ RJack::Logback.config_console
30
+
31
+ class TestDaemon < Test::Unit::TestCase
32
+ include Hashdot::Daemon
33
+ def test_daemon
34
+ assert Runner.new
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hashdot-test-daemon
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: java
6
+ authors:
7
+ - David Kellum
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-03-07 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rjack-slf4j
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: 1.5.11
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rjack-logback
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.18
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rjack-tarpit
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.2.0
44
+ version:
45
+ description: Sample/test hashdot launched daemon packaged as gem.
46
+ email:
47
+ - dek-oss@gravitext.com
48
+ executables:
49
+ - hashdot-test-fg
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - Manifest.txt
54
+ - README.rdoc
55
+ - History.rdoc
56
+ files:
57
+ - Manifest.txt
58
+ - README.rdoc
59
+ - History.rdoc
60
+ - Rakefile
61
+ - init/hashdot-test-daemon
62
+ - bin/hashdot-test-fg
63
+ - lib/hashdot-test-daemon/base.rb
64
+ - lib/hashdot-test-daemon.rb
65
+ - test/test_daemon.rb
66
+ has_rdoc: true
67
+ homepage: http://github.com/dekellum/hashdot-test-daemon
68
+ licenses: []
69
+
70
+ post_install_message:
71
+ rdoc_options:
72
+ - --main
73
+ - README.rdoc
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ version:
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
87
+ version:
88
+ requirements: []
89
+
90
+ rubyforge_project: hashdot-test-daemon
91
+ rubygems_version: 1.3.5
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: Sample/test hashdot launched daemon packaged as gem.
95
+ test_files:
96
+ - test/test_daemon.rb