mondrian-olap 0.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/.rspec +2 -0
  2. data/Changelog.md +60 -0
  3. data/Gemfile +21 -0
  4. data/LICENSE-Mondrian.html +259 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +302 -0
  7. data/RUNNING_TESTS.rdoc +66 -0
  8. data/Rakefile +48 -0
  9. data/VERSION +1 -0
  10. data/lib/mondrian-olap.rb +1 -0
  11. data/lib/mondrian/jars/commons-collections-3.1.jar +0 -0
  12. data/lib/mondrian/jars/commons-dbcp-1.2.1.jar +0 -0
  13. data/lib/mondrian/jars/commons-logging-1.0.4.jar +0 -0
  14. data/lib/mondrian/jars/commons-math-1.0.jar +0 -0
  15. data/lib/mondrian/jars/commons-pool-1.2.jar +0 -0
  16. data/lib/mondrian/jars/commons-vfs-1.0.jar +0 -0
  17. data/lib/mondrian/jars/eigenbase-properties.jar +0 -0
  18. data/lib/mondrian/jars/eigenbase-resgen.jar +0 -0
  19. data/lib/mondrian/jars/eigenbase-xom.jar +0 -0
  20. data/lib/mondrian/jars/javacup.jar +0 -0
  21. data/lib/mondrian/jars/log4j-1.2.8.jar +0 -0
  22. data/lib/mondrian/jars/log4j.properties +5 -0
  23. data/lib/mondrian/jars/mondrian.jar +0 -0
  24. data/lib/mondrian/jars/olap4j.jar +0 -0
  25. data/lib/mondrian/olap.rb +17 -0
  26. data/lib/mondrian/olap/connection.rb +201 -0
  27. data/lib/mondrian/olap/cube.rb +297 -0
  28. data/lib/mondrian/olap/error.rb +57 -0
  29. data/lib/mondrian/olap/query.rb +342 -0
  30. data/lib/mondrian/olap/result.rb +264 -0
  31. data/lib/mondrian/olap/schema.rb +378 -0
  32. data/lib/mondrian/olap/schema_element.rb +153 -0
  33. data/lib/mondrian/olap/schema_udf.rb +282 -0
  34. data/mondrian-olap.gemspec +128 -0
  35. data/spec/connection_role_spec.rb +130 -0
  36. data/spec/connection_spec.rb +72 -0
  37. data/spec/cube_spec.rb +318 -0
  38. data/spec/fixtures/MondrianTest.xml +134 -0
  39. data/spec/fixtures/MondrianTestOracle.xml +134 -0
  40. data/spec/mondrian_spec.rb +53 -0
  41. data/spec/query_spec.rb +807 -0
  42. data/spec/rake_tasks.rb +260 -0
  43. data/spec/schema_definition_spec.rb +1249 -0
  44. data/spec/spec_helper.rb +134 -0
  45. data/spec/support/matchers/be_like.rb +24 -0
  46. metadata +278 -0
@@ -0,0 +1,134 @@
1
+ require "rubygems"
2
+ require "bundler"
3
+ Bundler.setup(:default, :development)
4
+
5
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
6
+
7
+ require 'rspec'
8
+ require 'active_record'
9
+
10
+ DATABASE_HOST = ENV['DATABASE_HOST'] || 'localhost'
11
+ DATABASE_USER = ENV['DATABASE_USER'] || 'mondrian_test'
12
+ DATABASE_PASSWORD = ENV['DATABASE_PASSWORD'] || 'mondrian_test'
13
+ DATABASE_NAME = ENV['DATABASE_NAME'] || 'mondrian_test'
14
+ DATABASE_INSTANCE = ENV['DATABASE_INSTANCE']
15
+ MONDRIAN_DRIVER = ENV['MONDRIAN_DRIVER'] || 'mysql'
16
+
17
+ case MONDRIAN_DRIVER
18
+ when 'mysql'
19
+ require 'jdbc/mysql'
20
+ JDBC_DRIVER = 'com.mysql.jdbc.Driver'
21
+ when 'postgresql'
22
+ require 'jdbc/postgres'
23
+ JDBC_DRIVER = 'org.postgresql.Driver'
24
+ when 'oracle'
25
+ require 'active_record/connection_adapters/oracle_enhanced_adapter'
26
+ DATABASE_NAME = ENV['DATABASE_NAME'] || 'orcl'
27
+ CATALOG_FILE = File.expand_path('../fixtures/MondrianTestOracle.xml', __FILE__)
28
+ when 'mssql'
29
+ require 'jdbc/jtds'
30
+ JDBC_DRIVER = 'net.sourceforge.jtds.jdbc.Driver'
31
+ when 'sqlserver'
32
+ JDBC_DRIVER = 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
33
+ when 'luciddb'
34
+ require 'jdbc/luciddb'
35
+ CATALOG_FILE = File.expand_path('../fixtures/MondrianTestOracle.xml', __FILE__)
36
+
37
+ # Hack to disable :text type for LucidDB
38
+ require 'arjdbc/jdbc/type_converter'
39
+ ActiveRecord::ConnectionAdapters::JdbcTypeConverter::AR_TO_JDBC_TYPES.delete(:text)
40
+
41
+ # patches for LucidDB minimal AR support
42
+ require 'arjdbc/jdbc/adapter'
43
+ ActiveRecord::ConnectionAdapters::JdbcAdapter.class_eval do
44
+ def modify_types(tp)
45
+ # mapping of ActiveRecord data types to LucidDB data types
46
+ # data will be imported into LucidDB therefore primary key is defined as simple integer field
47
+ tp[:primary_key] = "INT"
48
+ tp[:integer] = "INT"
49
+ end
50
+ # by default LucidDB stores table and column names in uppercase
51
+ def quote_table_name(name)
52
+ "\"#{name.to_s.upcase}\""
53
+ end
54
+ def quote_column_name(name)
55
+ "\"#{name.to_s.upcase}\""
56
+ end
57
+ end
58
+ JDBC_DRIVER = 'org.luciddb.jdbc.LucidDbClientDriver'
59
+ DATABASE_USER.upcase! if DATABASE_USER == 'mondrian_test'
60
+ DATABASE_NAME = nil
61
+ DATABASE_SCHEMA = ENV['DATABASE_SCHEMA'] || 'mondrian_test'
62
+ end
63
+
64
+ puts "==> Using #{MONDRIAN_DRIVER} driver"
65
+
66
+ require 'mondrian/olap'
67
+ require 'support/matchers/be_like'
68
+
69
+ RSpec.configure do |config|
70
+ config.include Matchers
71
+ end
72
+
73
+ CATALOG_FILE = File.expand_path('../fixtures/MondrianTest.xml', __FILE__) unless defined?(CATALOG_FILE)
74
+
75
+ CONNECTION_PARAMS = {
76
+ :driver => MONDRIAN_DRIVER,
77
+ :host => DATABASE_HOST,
78
+ :database => DATABASE_NAME,
79
+ :username => DATABASE_USER,
80
+ :password => DATABASE_PASSWORD
81
+ }
82
+
83
+ case MONDRIAN_DRIVER
84
+ when 'oracle'
85
+ AR_CONNECTION_PARAMS = {
86
+ :adapter => 'oracle_enhanced',
87
+ :host => CONNECTION_PARAMS[:host],
88
+ :database => CONNECTION_PARAMS[:database],
89
+ :username => CONNECTION_PARAMS[:username],
90
+ :password => CONNECTION_PARAMS[:password]
91
+ }
92
+ when 'luciddb'
93
+ CONNECTION_PARAMS[:database] = nil
94
+ CONNECTION_PARAMS[:database_schema] = DATABASE_SCHEMA
95
+ AR_CONNECTION_PARAMS = {
96
+ :adapter => 'jdbc',
97
+ :driver => JDBC_DRIVER,
98
+ :url => "jdbc:#{MONDRIAN_DRIVER}:http://#{CONNECTION_PARAMS[:host]};schema=#{CONNECTION_PARAMS[:database_schema]}",
99
+ :username => CONNECTION_PARAMS[:username],
100
+ :password => CONNECTION_PARAMS[:password]
101
+ }
102
+ when 'mssql'
103
+ url = "jdbc:jtds:sqlserver://#{CONNECTION_PARAMS[:host]}/#{CONNECTION_PARAMS[:database]}"
104
+ url << ";instance=#{DATABASE_INSTANCE}" if DATABASE_INSTANCE
105
+ AR_CONNECTION_PARAMS = {
106
+ :adapter => 'jdbc',
107
+ :driver => JDBC_DRIVER,
108
+ :url => url,
109
+ :username => CONNECTION_PARAMS[:username],
110
+ :password => CONNECTION_PARAMS[:password]
111
+ }
112
+ when 'sqlserver'
113
+ url = "jdbc:sqlserver://#{CONNECTION_PARAMS[:host]};databaseName=#{CONNECTION_PARAMS[:database]};"
114
+ url << ";instanceName=#{DATABASE_INSTANCE}" if DATABASE_INSTANCE
115
+ AR_CONNECTION_PARAMS = {
116
+ :adapter => 'jdbc',
117
+ :driver => JDBC_DRIVER,
118
+ :url => url,
119
+ :username => CONNECTION_PARAMS[:username],
120
+ :password => CONNECTION_PARAMS[:password]
121
+ }
122
+ else
123
+ AR_CONNECTION_PARAMS = {
124
+ :adapter => 'jdbc',
125
+ :driver => JDBC_DRIVER,
126
+ :url => "jdbc:#{MONDRIAN_DRIVER}://#{CONNECTION_PARAMS[:host]}/#{CONNECTION_PARAMS[:database]}",
127
+ :username => CONNECTION_PARAMS[:username],
128
+ :password => CONNECTION_PARAMS[:password]
129
+ }
130
+ end
131
+
132
+ CONNECTION_PARAMS_WITH_CATALOG = CONNECTION_PARAMS.merge(:catalog => CATALOG_FILE)
133
+
134
+ ActiveRecord::Base.establish_connection(AR_CONNECTION_PARAMS)
@@ -0,0 +1,24 @@
1
+ module Matchers
2
+ class BeLike
3
+ def initialize(expected)
4
+ @expected = expected.gsub(/>\s*\n\s*/, '> ').gsub(/\s+/, ' ').strip
5
+ end
6
+
7
+ def matches?(actual)
8
+ @actual = actual.gsub(/>\s*\n\s*/, '> ').gsub(/\s+/, ' ').strip
9
+ @expected == @actual
10
+ end
11
+
12
+ def failure_message
13
+ "expected\n#{@actual}\nto be like\n#{@expected}"
14
+ end
15
+
16
+ def negative_failure_message
17
+ "expected\n#{@actual}\nto be unlike\n#{@expected}"
18
+ end
19
+ end
20
+
21
+ def be_like(expected)
22
+ BeLike.new(expected)
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,278 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mondrian-olap
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.4.0
6
+ platform: java
7
+ authors:
8
+ - Raimonds Simanovskis
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-12-03 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: nokogiri
17
+ version_requirements: &id001 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 1.5.0
23
+ requirement: *id001
24
+ prerelease: false
25
+ type: :runtime
26
+ - !ruby/object:Gem::Dependency
27
+ name: jruby-openssl
28
+ version_requirements: &id002 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ requirement: *id002
35
+ prerelease: false
36
+ type: :development
37
+ - !ruby/object:Gem::Dependency
38
+ name: jeweler
39
+ version_requirements: &id003 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 1.8.3
45
+ requirement: *id003
46
+ prerelease: false
47
+ type: :development
48
+ - !ruby/object:Gem::Dependency
49
+ name: rdoc
50
+ version_requirements: &id004 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ requirement: *id004
57
+ prerelease: false
58
+ type: :development
59
+ - !ruby/object:Gem::Dependency
60
+ name: rspec
61
+ version_requirements: &id005 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: "2.10"
67
+ requirement: *id005
68
+ prerelease: false
69
+ type: :development
70
+ - !ruby/object:Gem::Dependency
71
+ name: autotest
72
+ version_requirements: &id006 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: "0"
78
+ requirement: *id006
79
+ prerelease: false
80
+ type: :development
81
+ - !ruby/object:Gem::Dependency
82
+ name: jdbc-mysql
83
+ version_requirements: &id007 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: "0"
89
+ requirement: *id007
90
+ prerelease: false
91
+ type: :development
92
+ - !ruby/object:Gem::Dependency
93
+ name: jdbc-postgres
94
+ version_requirements: &id008 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: "0"
100
+ requirement: *id008
101
+ prerelease: false
102
+ type: :development
103
+ - !ruby/object:Gem::Dependency
104
+ name: jdbc-luciddb
105
+ version_requirements: &id009 !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: "0"
111
+ requirement: *id009
112
+ prerelease: false
113
+ type: :development
114
+ - !ruby/object:Gem::Dependency
115
+ name: jdbc-jtds
116
+ version_requirements: &id010 !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: "0"
122
+ requirement: *id010
123
+ prerelease: false
124
+ type: :development
125
+ - !ruby/object:Gem::Dependency
126
+ name: activerecord
127
+ version_requirements: &id011 !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - "="
131
+ - !ruby/object:Gem::Version
132
+ version: 3.2.8
133
+ requirement: *id011
134
+ prerelease: false
135
+ type: :development
136
+ - !ruby/object:Gem::Dependency
137
+ name: activerecord-jdbc-adapter
138
+ version_requirements: &id012 !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - "="
142
+ - !ruby/object:Gem::Version
143
+ version: 1.2.2
144
+ requirement: *id012
145
+ prerelease: false
146
+ type: :development
147
+ - !ruby/object:Gem::Dependency
148
+ name: activerecord-oracle_enhanced-adapter
149
+ version_requirements: &id013 !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: "0"
155
+ requirement: *id013
156
+ prerelease: false
157
+ type: :development
158
+ - !ruby/object:Gem::Dependency
159
+ name: coffee-script
160
+ version_requirements: &id014 !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ~>
164
+ - !ruby/object:Gem::Version
165
+ version: 2.2.0
166
+ requirement: *id014
167
+ prerelease: false
168
+ type: :development
169
+ - !ruby/object:Gem::Dependency
170
+ name: therubyrhino
171
+ version_requirements: &id015 !ruby/object:Gem::Requirement
172
+ none: false
173
+ requirements:
174
+ - - ~>
175
+ - !ruby/object:Gem::Version
176
+ version: 1.73.1
177
+ requirement: *id015
178
+ prerelease: false
179
+ type: :development
180
+ - !ruby/object:Gem::Dependency
181
+ name: pry
182
+ version_requirements: &id016 !ruby/object:Gem::Requirement
183
+ none: false
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: "0"
188
+ requirement: *id016
189
+ prerelease: false
190
+ type: :development
191
+ description: |
192
+ JRuby gem for performing multidimensional queries of relational database data using Mondrian OLAP Java library
193
+
194
+ email: raimonds.simanovskis@gmail.com
195
+ executables: []
196
+
197
+ extensions: []
198
+
199
+ extra_rdoc_files:
200
+ - README.md
201
+ files:
202
+ - .rspec
203
+ - Changelog.md
204
+ - Gemfile
205
+ - LICENSE-Mondrian.html
206
+ - LICENSE.txt
207
+ - README.md
208
+ - RUNNING_TESTS.rdoc
209
+ - Rakefile
210
+ - VERSION
211
+ - lib/mondrian-olap.rb
212
+ - lib/mondrian/jars/commons-collections-3.1.jar
213
+ - lib/mondrian/jars/commons-dbcp-1.2.1.jar
214
+ - lib/mondrian/jars/commons-logging-1.0.4.jar
215
+ - lib/mondrian/jars/commons-math-1.0.jar
216
+ - lib/mondrian/jars/commons-pool-1.2.jar
217
+ - lib/mondrian/jars/commons-vfs-1.0.jar
218
+ - lib/mondrian/jars/eigenbase-properties.jar
219
+ - lib/mondrian/jars/eigenbase-resgen.jar
220
+ - lib/mondrian/jars/eigenbase-xom.jar
221
+ - lib/mondrian/jars/javacup.jar
222
+ - lib/mondrian/jars/log4j-1.2.8.jar
223
+ - lib/mondrian/jars/log4j.properties
224
+ - lib/mondrian/jars/mondrian.jar
225
+ - lib/mondrian/jars/olap4j.jar
226
+ - lib/mondrian/olap.rb
227
+ - lib/mondrian/olap/connection.rb
228
+ - lib/mondrian/olap/cube.rb
229
+ - lib/mondrian/olap/error.rb
230
+ - lib/mondrian/olap/query.rb
231
+ - lib/mondrian/olap/result.rb
232
+ - lib/mondrian/olap/schema.rb
233
+ - lib/mondrian/olap/schema_element.rb
234
+ - lib/mondrian/olap/schema_udf.rb
235
+ - mondrian-olap.gemspec
236
+ - spec/connection_role_spec.rb
237
+ - spec/connection_spec.rb
238
+ - spec/cube_spec.rb
239
+ - spec/fixtures/MondrianTest.xml
240
+ - spec/fixtures/MondrianTestOracle.xml
241
+ - spec/mondrian_spec.rb
242
+ - spec/query_spec.rb
243
+ - spec/rake_tasks.rb
244
+ - spec/schema_definition_spec.rb
245
+ - spec/spec_helper.rb
246
+ - spec/support/matchers/be_like.rb
247
+ homepage: http://github.com/rsim/mondrian-olap
248
+ licenses: []
249
+
250
+ post_install_message:
251
+ rdoc_options: []
252
+
253
+ require_paths:
254
+ - lib
255
+ required_ruby_version: !ruby/object:Gem::Requirement
256
+ none: false
257
+ requirements:
258
+ - - ">="
259
+ - !ruby/object:Gem::Version
260
+ hash: 2
261
+ segments:
262
+ - 0
263
+ version: "0"
264
+ required_rubygems_version: !ruby/object:Gem::Requirement
265
+ none: false
266
+ requirements:
267
+ - - ">="
268
+ - !ruby/object:Gem::Version
269
+ version: "0"
270
+ requirements: []
271
+
272
+ rubyforge_project:
273
+ rubygems_version: 1.8.24
274
+ signing_key:
275
+ specification_version: 3
276
+ summary: JRuby API for Mondrian OLAP Java library
277
+ test_files: []
278
+