rubeus 0.0.7-java → 0.0.8-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,24 +1,16 @@
1
1
  require 'test/unit'
2
2
  require 'rubygems'
3
3
  require 'rubeus'
4
+ require 'test/rubeus/extensions/java/sql/test_sql_helper'
4
5
 
5
6
  # Test for result_set.rb
6
7
  class TestResultSet < Test::Unit::TestCase
7
- # setup method
8
+ include TestSqlHelper
9
+
8
10
  def setup
9
- @con = Rubeus::Jdbc::DriverManager.connect("jdbc:derby:test_db;create = true", "", "")
10
-
11
- # Drop test table
12
- begin
13
- @con.statement do |stmt|
14
- stmt.execute_update("DROP TABLE TEST")
15
- end
16
- rescue
17
- # table test is already exist
18
- end
19
-
11
+ setup_connection
20
12
  @con.statement do |stmt|
21
- stmt.execute_update("CREATE TABLE TEST (ID INT, NAME CHAR(10))")
13
+ create_table_after_drop("CREATE TABLE TEST (ID INT, NAME CHAR(10))", stmt)
22
14
  stmt.execute_update("INSERT INTO TEST VALUES(1, 'row1')")
23
15
  stmt.execute_update("INSERT INTO TEST VALUES(2, 'row2')")
24
16
  end
@@ -30,7 +22,6 @@ class TestResultSet < Test::Unit::TestCase
30
22
  rs.each do |rsNext|
31
23
  assert_equal(i, rsNext.get_int("ID"))
32
24
  assert_equal("row#{i} ", rsNext.get_string("NAME"))
33
-
34
25
  i += 1
35
26
  end
36
27
  end
@@ -42,7 +33,6 @@ class TestResultSet < Test::Unit::TestCase
42
33
  rs.each_array do |rsNext|
43
34
  assert_equal(i, rsNext[0])
44
35
  assert_equal("row#{i} ", rsNext[1])
45
-
46
36
  i += 1
47
37
  end
48
38
  end
@@ -54,14 +44,12 @@ class TestResultSet < Test::Unit::TestCase
54
44
  rs.each_hash do |rsNext|
55
45
  assert_equal(i, rsNext["ID"])
56
46
  assert_equal("row#{i} ", rsNext["NAME"])
57
-
58
47
  i += 1
59
48
  end
60
49
  end
61
50
  end
62
51
 
63
52
  def teardown
64
- @con.close
53
+ teardown_connection
65
54
  end
66
55
  end
67
-
@@ -1,25 +1,15 @@
1
1
  require 'test/unit'
2
2
  require 'rubygems'
3
3
  require 'rubeus'
4
+ require 'test/rubeus/extensions/java/sql/test_sql_helper'
4
5
 
5
6
  # Test for result_set_meta_data.rb
6
7
  class TestResultSetMetaData < Test::Unit::TestCase
7
- # setup method
8
- def setup
9
- @con = Rubeus::Jdbc::DriverManager.connect("jdbc:derby:test_db;create = true", "", "")
10
-
11
- # Drop test table
12
- begin
13
- @con.statement do |stmt|
14
- stmt.execute_update("DROP TABLE TEST")
15
- end
16
- rescue
17
- # table test is already exist
18
- end
8
+ include TestSqlHelper
19
9
 
20
- @con.statement do |stmt|
21
- stmt.execute_update("CREATE TABLE TEST (ID INT, NAME CHAR(10))")
22
- end
10
+ def setup
11
+ setup_connection
12
+ create_table_after_drop("CREATE TABLE TEST (ID INT, NAME CHAR(10))")
23
13
  end
24
14
 
25
15
  def test_each_without_block
@@ -115,7 +105,7 @@ class TestResultSetMetaData < Test::Unit::TestCase
115
105
  end
116
106
 
117
107
  def teardown
118
- @con.close
108
+ teardown_connection
119
109
  end
120
110
  end
121
111
 
@@ -0,0 +1,43 @@
1
+ module TestSqlHelper
2
+ def setup_connection
3
+ @con = Rubeus::Jdbc::DriverManager.connect("jdbc:derby:test_db;create = true", "", "")
4
+ end
5
+
6
+ def teardown_connection
7
+ @con.close
8
+ end
9
+
10
+ def close_if_no_statement(statement = nil)
11
+ must_be_closed = statement.nil?
12
+ statement ||= @con.create_statement
13
+ begin
14
+ yield(statement)
15
+ ensure
16
+ statement.close if must_be_closed
17
+ end
18
+ end
19
+
20
+ def drop_table_if_exist(table_name, statement = nil)
21
+ close_if_no_statement(statement) do |stmt|
22
+ begin
23
+ stmt.execute_update("DROP TABLE #{table_name}")
24
+ rescue
25
+ # the table doesn't exist but do nothing
26
+ end
27
+ end
28
+ end
29
+
30
+ def create_table_after_drop(create_ddl, statement = nil)
31
+ create_ddls = create_ddl.split(/\;/mi).map{|ddl| ddl.strip }.select{|ddl| !(ddl.nil? || ddl.empty?) }
32
+ table_names = create_ddls.map{|ddl| ddl.scan(/^\s*CREATE TABLE\s+?(.+?)[\s\($]/mi)}
33
+ close_if_no_statement(statement) do |stmt|
34
+ table_names.reverse.each do |table_name|
35
+ drop_table_if_exist(table_name, stmt)
36
+ end
37
+ create_ddls.each do |ddl|
38
+ stmt.execute_update(ddl)
39
+ end
40
+ end
41
+ end
42
+
43
+ end
@@ -1,12 +1,14 @@
1
1
  require 'test/unit'
2
2
  require 'rubygems'
3
3
  require 'rubeus'
4
+ require 'test/rubeus/extensions/java/sql/test_sql_helper'
4
5
 
5
6
  # Test for statement.rb
6
7
  class TestStatement < Test::Unit::TestCase
7
- # setup method
8
+ include TestSqlHelper
9
+
8
10
  def setup
9
- @con = Rubeus::Jdbc::DriverManager.connect("jdbc:derby:test_db;create = true", "", "")
11
+ setup_connection
10
12
  end
11
13
 
12
14
  def test_query
@@ -37,7 +39,7 @@ class TestStatement < Test::Unit::TestCase
37
39
  end
38
40
 
39
41
  def teardown
40
- @con.close
42
+ teardown_connection
41
43
  end
42
44
  end
43
45
 
metadata CHANGED
@@ -1,141 +1,154 @@
1
1
  --- !ruby/object:Gem::Specification
2
+ name: rubeus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
5
+ platform: java
6
+ authors:
7
+ - Takeshi Akima
8
+ autorequire: rubeus
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-26 00:00:00 +09:00
13
+ default_executable: jirb_rubeus
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activesupport
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.1.2
24
+ version:
25
+ description:
26
+ email: rubeus@googlegroups.com
27
+ executables:
28
+ - jirb_rubeus
29
+ - jirb_rubeus.bat
2
30
  extensions: []
3
31
 
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - Rakefile
36
+ - rmaven.yml
37
+ - bin/jirb_rubeus
38
+ - bin/jirb_rubeus.bat
39
+ - lib/rubeus.rb
40
+ - lib/rubeus/awt.rb
41
+ - lib/rubeus/component_loader.rb
42
+ - lib/rubeus/extensions.rb
43
+ - lib/rubeus/jdbc.rb
44
+ - lib/rubeus/swing.rb
45
+ - lib/rubeus/util.rb
46
+ - lib/rubeus/verboseable.rb
47
+ - lib/rubeus/awt/attributes.rb
48
+ - lib/rubeus/awt/event.rb
49
+ - lib/rubeus/awt/nestable.rb
50
+ - lib/rubeus/awt/setters.rb
51
+ - lib/rubeus/extensions/java.rb
52
+ - lib/rubeus/extensions/javax.rb
53
+ - lib/rubeus/extensions/java/awt.rb
54
+ - lib/rubeus/extensions/java/sql.rb
55
+ - lib/rubeus/extensions/java/awt/component.rb
56
+ - lib/rubeus/extensions/java/awt/container.rb
57
+ - lib/rubeus/extensions/java/awt/dimension.rb
58
+ - lib/rubeus/extensions/java/sql/connection.rb
59
+ - lib/rubeus/extensions/java/sql/database_meta_data.rb
60
+ - lib/rubeus/extensions/java/sql/driver_manager.rb
61
+ - lib/rubeus/extensions/java/sql/result_set.rb
62
+ - lib/rubeus/extensions/java/sql/result_set_meta_data.rb
63
+ - lib/rubeus/extensions/java/sql/statement.rb
64
+ - lib/rubeus/extensions/javax/swing.rb
65
+ - lib/rubeus/extensions/javax/swing/box_layout.rb
66
+ - lib/rubeus/extensions/javax/swing/j_applet.rb
67
+ - lib/rubeus/extensions/javax/swing/j_component.rb
68
+ - lib/rubeus/extensions/javax/swing/j_frame.rb
69
+ - lib/rubeus/extensions/javax/swing/j_panel.rb
70
+ - lib/rubeus/extensions/javax/swing/j_scroll_pane.rb
71
+ - lib/rubeus/extensions/javax/swing/j_split_pane.rb
72
+ - lib/rubeus/extensions/javax/swing/j_tabbed_pane.rb
73
+ - lib/rubeus/extensions/javax/swing/j_table.rb
74
+ - lib/rubeus/extensions/javax/swing/j_text_field.rb
75
+ - lib/rubeus/extensions/javax/swing/j_window.rb
76
+ - lib/rubeus/extensions/javax/swing/timer.rb
77
+ - lib/rubeus/extensions/javax/swing/table/default_table_model.rb
78
+ - lib/rubeus/extensions/javax/swing/table/readonlyable_table_model.rb
79
+ - lib/rubeus/jdbc/closeable_resource.rb
80
+ - lib/rubeus/jdbc/column.rb
81
+ - lib/rubeus/jdbc/foreign_key.rb
82
+ - lib/rubeus/jdbc/index.rb
83
+ - lib/rubeus/jdbc/meta_element.rb
84
+ - lib/rubeus/jdbc/primary_key.rb
85
+ - lib/rubeus/jdbc/result_set_column.rb
86
+ - lib/rubeus/jdbc/table.rb
87
+ - lib/rubeus/util/name_access_array.rb
88
+ - lib/rubeus.jar
89
+ - examples/jdbc_example.rb
90
+ - examples/notepad.rb
91
+ - examples/rubeus_swing_example01.rb
92
+ - examples/rubeus_swing_example01_with_class.rb
93
+ - examples/rubeus_swing_example02.rb
94
+ - examples/rubeus_swing_example03.rb
95
+ - examples/nyanco_viewer/nyanco_disp_label.rb
96
+ - examples/nyanco_viewer/nyanco_viewer_rubeus.rb
97
+ - examples/notepad.rtf
98
+ - examples/nyanco_viewer/nekobean_s.png
99
+ - test/test_all.rb
100
+ - test/rubeus/test_extensions.rb
101
+ - test/rubeus/awt/test_attributes.rb
102
+ - test/rubeus/awt/test_event.rb
103
+ - test/rubeus/awt/test_nestable.rb
104
+ - test/rubeus/awt/test_setter.rb
105
+ - test/rubeus/extensions/java/awt/test_dimension.rb
106
+ - test/rubeus/extensions/java/sql/test_connection.rb
107
+ - test/rubeus/extensions/java/sql/test_database_meta_data.rb
108
+ - test/rubeus/extensions/java/sql/test_driver_manager.rb
109
+ - test/rubeus/extensions/java/sql/test_result_set.rb
110
+ - test/rubeus/extensions/java/sql/test_result_set_meta_data.rb
111
+ - test/rubeus/extensions/java/sql/test_sql_helper.rb
112
+ - test/rubeus/extensions/java/sql/test_statement.rb
113
+ - test/rubeus/extensions/javax/swing/test_box_layout.rb
114
+ - test/rubeus/extensions/javax/swing/test_j_component.rb
115
+ - test/rubeus/extensions/javax/swing/test_j_frame.rb
116
+ - test/rubeus/extensions/javax/swing/test_j_panel.rb
117
+ - test/rubeus/extensions/javax/swing/test_j_scroll_pane.rb
118
+ - test/rubeus/extensions/javax/swing/test_j_split_pane.rb
119
+ - test/rubeus/extensions/javax/swing/test_j_tabbed_pane.rb
120
+ - test/rubeus/extensions/javax/swing/test_j_table.rb
121
+ - test/rubeus/extensions/javax/swing/test_j_text_field.rb
122
+ - test/rubeus/extensions/javax/swing/test_timer.rb
123
+ - test/rubeus/extensions/javax/swing/table/test_default_table_model.rb
124
+ - test/rubeus/extensions/javax/swing/table/test_default_table_model/nhk_words.xml
125
+ has_rdoc: true
4
126
  homepage: http://code.google.com/p/rubeus/
5
- executables:
6
- - jirb_rubeus
7
- - jirb_rubeus.bat
8
- version: !ruby/object:Gem::Version
9
- version: 0.0.7
127
+ licenses: []
128
+
10
129
  post_install_message:
11
- date: 2008-11-21 15:00:00 +00:00
12
- files:
13
- - Rakefile
14
- - rmaven.yml
15
- - bin/jirb_rubeus
16
- - bin/jirb_rubeus.bat
17
- - lib/rubeus.rb
18
- - lib/rubeus/awt.rb
19
- - lib/rubeus/component_loader.rb
20
- - lib/rubeus/extensions.rb
21
- - lib/rubeus/jdbc.rb
22
- - lib/rubeus/swing.rb
23
- - lib/rubeus/verboseable.rb
24
- - lib/rubeus/awt/attributes.rb
25
- - lib/rubeus/awt/event.rb
26
- - lib/rubeus/awt/nestable.rb
27
- - lib/rubeus/awt/setters.rb
28
- - lib/rubeus/extensions/java.rb
29
- - lib/rubeus/extensions/javax.rb
30
- - lib/rubeus/extensions/java/awt.rb
31
- - lib/rubeus/extensions/java/sql.rb
32
- - lib/rubeus/extensions/java/awt/component.rb
33
- - lib/rubeus/extensions/java/awt/container.rb
34
- - lib/rubeus/extensions/java/awt/dimension.rb
35
- - lib/rubeus/extensions/java/sql/connection.rb
36
- - lib/rubeus/extensions/java/sql/driver_manager.rb
37
- - lib/rubeus/extensions/java/sql/result_set.rb
38
- - lib/rubeus/extensions/java/sql/result_set_meta_data.rb
39
- - lib/rubeus/extensions/java/sql/statement.rb
40
- - lib/rubeus/extensions/javax/swing.rb
41
- - lib/rubeus/extensions/javax/swing/box_layout.rb
42
- - lib/rubeus/extensions/javax/swing/j_applet.rb
43
- - lib/rubeus/extensions/javax/swing/j_component.rb
44
- - lib/rubeus/extensions/javax/swing/j_frame.rb
45
- - lib/rubeus/extensions/javax/swing/j_panel.rb
46
- - lib/rubeus/extensions/javax/swing/j_scroll_pane.rb
47
- - lib/rubeus/extensions/javax/swing/j_split_pane.rb
48
- - lib/rubeus/extensions/javax/swing/j_tabbed_pane.rb
49
- - lib/rubeus/extensions/javax/swing/j_table.rb
50
- - lib/rubeus/extensions/javax/swing/j_text_field.rb
51
- - lib/rubeus/extensions/javax/swing/j_window.rb
52
- - lib/rubeus/extensions/javax/swing/timer.rb
53
- - lib/rubeus/extensions/javax/swing/table/default_table_model.rb
54
- - lib/rubeus/extensions/javax/swing/table/readonlyable_table_model.rb
55
- - lib/rubeus/jdbc/closeable_resource.rb
56
- - lib/rubeus/jdbc/column.rb
57
- - lib/rubeus.jar
58
- - examples/jdbc_example.rb
59
- - examples/notepad.rb
60
- - examples/rubeus_swing_example01.rb
61
- - examples/rubeus_swing_example01_with_class.rb
62
- - examples/rubeus_swing_example02.rb
63
- - examples/rubeus_swing_example03.rb
64
- - examples/nyanco_viewer/nyanco_disp_label.rb
65
- - examples/nyanco_viewer/nyanco_viewer_rubeus.rb
66
- - examples/notepad.rtf
67
- - examples/nyanco_viewer/nekobean_s.png
68
- - test/test_all.rb
69
- - test/rubeus/test_extensions.rb
70
- - test/rubeus/awt/test_attributes.rb
71
- - test/rubeus/awt/test_event.rb
72
- - test/rubeus/awt/test_nestable.rb
73
- - test/rubeus/awt/test_setter.rb
74
- - test/rubeus/extensions/java/awt/test_dimension.rb
75
- - test/rubeus/extensions/java/sql/test_connection.rb
76
- - test/rubeus/extensions/java/sql/test_driver_manager.rb
77
- - test/rubeus/extensions/java/sql/test_result_set.rb
78
- - test/rubeus/extensions/java/sql/test_result_set_meta_data.rb
79
- - test/rubeus/extensions/java/sql/test_statement.rb
80
- - test/rubeus/extensions/javax/swing/test_box_layout.rb
81
- - test/rubeus/extensions/javax/swing/test_j_component.rb
82
- - test/rubeus/extensions/javax/swing/test_j_frame.rb
83
- - test/rubeus/extensions/javax/swing/test_j_panel.rb
84
- - test/rubeus/extensions/javax/swing/test_j_scroll_pane.rb
85
- - test/rubeus/extensions/javax/swing/test_j_split_pane.rb
86
- - test/rubeus/extensions/javax/swing/test_j_tabbed_pane.rb
87
- - test/rubeus/extensions/javax/swing/test_j_table.rb
88
- - test/rubeus/extensions/javax/swing/test_j_text_field.rb
89
- - test/rubeus/extensions/javax/swing/test_timer.rb
90
- - test/rubeus/extensions/javax/swing/table/test_default_table_model.rb
91
- - test/rubeus/extensions/javax/swing/table/test_default_table_model/nhk_words.xml
92
- rubygems_version: 1.3.1
93
130
  rdoc_options: []
94
131
 
95
- signing_key:
96
- cert_chain: []
97
-
98
- name: rubeus
99
- has_rdoc: false
100
- platform: java
101
- summary: Rubeus provides you an easy access to Java objects from Ruby scripts on JRuby
102
- default_executable: jirb_rubeus
103
- bindir: bin
104
- required_rubygems_version: !ruby/object:Gem::Requirement
105
- version:
106
- requirements:
107
- - - '>='
108
- - !ruby/object:Gem::Version
109
- version: "0"
132
+ require_paths:
133
+ - lib
110
134
  required_ruby_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: "0"
111
139
  version:
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
141
  requirements:
113
- - - '>='
114
- - !ruby/object:Gem::Version
115
- version: "0"
116
- require_paths:
117
- - lib
118
- specification_version: 2
119
- test_files: []
120
-
121
- dependencies:
122
- - !ruby/object:Gem::Dependency
123
- type: :runtime
124
- name: activesupport
125
- version_requirement:
126
- version_requirements: !ruby/object:Gem::Requirement
127
- version:
128
- requirements:
129
- - - "="
142
+ - - ">="
130
143
  - !ruby/object:Gem::Version
131
- version: 2.1.2
132
- description:
133
- email: rubeus@googlegroups.com
134
- authors:
135
- - Takeshi Akima
136
- extra_rdoc_files: []
137
-
144
+ version: "0"
145
+ version:
138
146
  requirements:
139
- - none
147
+ - none
140
148
  rubyforge_project: rubybizcommons
141
- autorequire: rubeus
149
+ rubygems_version: 1.3.5
150
+ signing_key:
151
+ specification_version: 3
152
+ summary: Rubeus provides you an easy access to Java objects from Ruby scripts on JRuby
153
+ test_files: []
154
+