bosdk 1.0.1-universal-java-1.6 → 1.0.2-universal-java-1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/bosdk.gemspec +3 -1
- data/lib/bosdk.rb +2 -0
- data/lib/bosdk/enterprise_session.rb +9 -1
- data/lib/bosdk/webi_report_engine.rb +22 -0
- data/spec/enterprise_session_spec.rb +37 -10
- data/spec/webi_report_engine_spec.rb +33 -0
- metadata +4 -2
data/README.rdoc
CHANGED
data/bosdk.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "bosdk"
|
3
|
-
s.version = "1.0.
|
3
|
+
s.version = "1.0.2"
|
4
4
|
|
5
5
|
s.author = "Shane Emmons"
|
6
6
|
s.description = "A JRuby wrapper for the Business Objects Java SDK"
|
@@ -10,8 +10,10 @@ Gem::Specification.new do |s|
|
|
10
10
|
"lib/bosdk.rb",
|
11
11
|
"lib/bosdk/enterprise_session.rb",
|
12
12
|
"lib/bosdk/info_object.rb",
|
13
|
+
"lib/bosdk/webi_report_engine.rb",
|
13
14
|
"spec/enterprise_session_spec.rb",
|
14
15
|
"spec/info_object_spec.rb",
|
16
|
+
"spec/webi_report_engine_spec.rb",
|
15
17
|
]
|
16
18
|
|
17
19
|
s.homepage = "http://semmons99.github.com/bosdk"
|
data/lib/bosdk.rb
CHANGED
@@ -24,9 +24,11 @@ include Java
|
|
24
24
|
Dir.glob(ENV["BOE_JAVA_LIB"] + "/*.jar").each{|jar| require jar}
|
25
25
|
include_class "com.crystaldecisions.sdk.framework.CrystalEnterprise"
|
26
26
|
include_class "com.crystaldecisions.sdk.uri.PagingQueryOptions"
|
27
|
+
include_class "com.businessobjects.rebean.wi.ReportEngines"
|
27
28
|
|
28
29
|
require 'bosdk/enterprise_session'
|
29
30
|
require 'bosdk/info_object'
|
31
|
+
require 'bosdk/webi_report_engine'
|
30
32
|
|
31
33
|
module BOSDK
|
32
34
|
# A closure over EnterpriseSession
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'bosdk/info_object'
|
2
|
+
require 'bosdk/webi_report_engine'
|
2
3
|
|
3
4
|
module BOSDK
|
4
5
|
# Creates a wrapper around the Business Objects Java SDK.
|
@@ -13,10 +14,11 @@ module BOSDK
|
|
13
14
|
# EnterpriseSession.new('cms', 'Administrator', '')
|
14
15
|
#
|
15
16
|
# Automatically calls disconnect when cleaned up.
|
16
|
-
def initialize(cms, username, password)
|
17
|
+
def initialize(cms, username, password, options = Hash.new)
|
17
18
|
@session = CrystalEnterprise.getSessionMgr.logon(username, password, cms, 'secEnterprise')
|
18
19
|
@infostore = @session.getService('', 'InfoStore')
|
19
20
|
@connected = true
|
21
|
+
@locale = options[:locale] || 'en_US'
|
20
22
|
|
21
23
|
at_exit { disconnect }
|
22
24
|
end
|
@@ -45,5 +47,11 @@ module BOSDK
|
|
45
47
|
sql = stmt.match(/^(path|query|cuid):\/\//i) ? path_to_sql(stmt) : stmt
|
46
48
|
@infostore.query(sql).map{|o| InfoObject.new(o)}
|
47
49
|
end
|
50
|
+
|
51
|
+
# Open a Webi document from the provided docid
|
52
|
+
def open_webi(docid)
|
53
|
+
@webi_report_engine ||= WebiReportEngine.new(@session, @locale)
|
54
|
+
@webi_report_engine.open(docid)
|
55
|
+
end
|
48
56
|
end
|
49
57
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module BOSDK
|
2
|
+
# Creates a wrapper around a Webi based ReportEngine.
|
3
|
+
class WebiReportEngine
|
4
|
+
# The underlying ReportEngine.
|
5
|
+
attr_reader :webi_report_engine
|
6
|
+
|
7
|
+
# Creates a new ReportEngine using the provided EnterpriseSession and an
|
8
|
+
# optional locale setting.
|
9
|
+
# WebiReportEngine.new(enterprise_session)
|
10
|
+
def initialize(enterprise_session, locale = "en_US")
|
11
|
+
report_engines = enterprise_session.getService("ReportEngines")
|
12
|
+
@webi_report_engine = report_engines.getService(ReportEngines::ReportEngineType::WI_REPORT_ENGINE)
|
13
|
+
@webi_report_engine.setLocale(locale)
|
14
|
+
#enterprise_session.setAttribute("widReportEngine", @webi_report_engine)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Opens the webi document specified by the docid.
|
18
|
+
def open(docid)
|
19
|
+
@webi_report_engine.openDocument(docid)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,29 +1,27 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
include Java
|
3
|
-
Dir.glob(ENV["BOE_JAVA_LIB"] + "/*.jar").each {|jar| require jar}
|
4
|
-
include_class "com.crystaldecisions.sdk.framework.CrystalEnterprise"
|
5
|
-
include_class "com.crystaldecisions.sdk.uri.PagingQueryOptions"
|
6
|
-
|
7
2
|
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
|
8
3
|
require 'bosdk/enterprise_session'
|
9
4
|
|
10
5
|
module BOSDK
|
11
6
|
describe EnterpriseSession do
|
12
7
|
before(:each) do
|
13
|
-
# mocks
|
14
8
|
@session_mgr = mock("ISessionMgr").as_null_object
|
15
9
|
@session = mock("IEnterpriseSession").as_null_object
|
16
10
|
@infostore = mock("IInfoStore").as_null_object
|
17
11
|
@infoobjects = mock("IInfoObjects").as_null_object
|
18
12
|
|
19
|
-
|
20
|
-
CrystalEnterprise.should_receive(:getSessionMgr).and_return(@session_mgr)
|
21
|
-
@session_mgr.should_receive(:logon).
|
22
|
-
@session.should_receive(:getService).
|
13
|
+
class CrystalEnterprise; end
|
14
|
+
CrystalEnterprise.should_receive(:getSessionMgr).at_least(1).with.and_return(@session_mgr)
|
15
|
+
@session_mgr.should_receive(:logon).at_least(1).with('Administrator', '', 'cms', 'secEnterprise').and_return(@session)
|
16
|
+
@session.should_receive(:getService).at_least(1).with('', 'InfoStore').and_return(@infostore)
|
23
17
|
|
24
18
|
@es = EnterpriseSession.new('cms', 'Administrator', '')
|
25
19
|
end
|
26
20
|
|
21
|
+
specify "#new should accept an optional locale setting" do
|
22
|
+
EnterpriseSession.new('cms', 'Administrator', '', :locale => 'en_CA')
|
23
|
+
end
|
24
|
+
|
27
25
|
specify "#connected? returns 'true' when connected to a CMS" do
|
28
26
|
@es.connected?.should be_true
|
29
27
|
end
|
@@ -54,6 +52,7 @@ module BOSDK
|
|
54
52
|
|
55
53
|
@stateless_page_info = mock("IStatelessPageInfo").as_null_object
|
56
54
|
|
55
|
+
class PagingQueryOptions; end
|
57
56
|
PagingQueryOptions.should_receive(:new).once.with
|
58
57
|
@infostore.should_receive(:getStatelessPageInfo).once.with(path_query, nil).and_return(@stateless_page_info)
|
59
58
|
@stateless_page_info.should_receive(:getPageSQL).once.with.and_return(stmt)
|
@@ -97,5 +96,33 @@ module BOSDK
|
|
97
96
|
|
98
97
|
@es.query(path_query)
|
99
98
|
end
|
99
|
+
|
100
|
+
specify "#open_webi should create a WebiReportEngine and call #open" do
|
101
|
+
@webi_report_engine = mock("WebiReportEngine").as_null_object
|
102
|
+
class WebiReportEngine; end
|
103
|
+
WebiReportEngine.should_receive(:new).once.with(@session, 'en_US').and_return(@webi_report_engine)
|
104
|
+
@webi_report_engine.should_receive(:open).once.with("1234")
|
105
|
+
|
106
|
+
@es.open_webi("1234")
|
107
|
+
end
|
108
|
+
|
109
|
+
specify "#open_webi should only create a WebiReportEngine once" do
|
110
|
+
@webi_report_engine = mock("WebiReportEngine").as_null_object
|
111
|
+
class WebiReportEngine; end
|
112
|
+
WebiReportEngine.should_receive(:new).once.with(@session, 'en_US').and_return(@webi_report_engine)
|
113
|
+
@webi_report_engine.should_receive(:open).twice.with("1234")
|
114
|
+
|
115
|
+
2.times{@es.open_webi("1234")}
|
116
|
+
end
|
117
|
+
|
118
|
+
specify "#open_webi should pass any specified locale" do
|
119
|
+
@webi_report_engine = mock("WebiReportEngine").as_null_object
|
120
|
+
class WebiReportEngine; end
|
121
|
+
WebiReportEngine.should_receive(:new).once.with(@session, 'en_CA').and_return(@webi_report_engine)
|
122
|
+
@webi_report_engine.should_receive(:open).once.with("1234")
|
123
|
+
|
124
|
+
es = EnterpriseSession.new('cms', 'Administrator', '', :locale => 'en_CA')
|
125
|
+
es.open_webi("1234")
|
126
|
+
end
|
100
127
|
end
|
101
128
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
|
3
|
+
require 'bosdk/webi_report_engine'
|
4
|
+
|
5
|
+
module BOSDK
|
6
|
+
describe WebiReportEngine do
|
7
|
+
before(:each) do
|
8
|
+
@enterprise_session = mock("EnterpriseSession").as_null_object
|
9
|
+
@report_engines = mock("ReportEngines").as_null_object
|
10
|
+
@webi_report_engine = mock("ReportEngine").as_null_object
|
11
|
+
|
12
|
+
@enterprise_session.should_receive(:getService).at_least(1).with("ReportEngines").and_return(@report_engines)
|
13
|
+
module ReportEngines; module ReportEngineType; module WI_REPORT_ENGINE; end; end; end
|
14
|
+
@report_engines.should_receive(:getService).at_least(1).with(ReportEngines::ReportEngineType::WI_REPORT_ENGINE).and_return(@webi_report_engine)
|
15
|
+
@webi_report_engine.should_receive(:setLocale).at_least(1).with("en_US")
|
16
|
+
#@enterprise_session.should_receive(:setAttribute).at_least(1).with("widReportEngine", @webi_report_engine)
|
17
|
+
|
18
|
+
@wre = WebiReportEngine.new(@enterprise_session)
|
19
|
+
end
|
20
|
+
|
21
|
+
specify "#new should allow you to set the locale" do
|
22
|
+
@webi_report_engine.should_receive(:setLocale).once.with("en_CA")
|
23
|
+
|
24
|
+
WebiReportEngine.new(@enterprise_session, "en_CA")
|
25
|
+
end
|
26
|
+
|
27
|
+
specify "#open should call the underlying #openDocument with the supplied docid" do
|
28
|
+
@webi_report_engine.should_receive(:openDocument).once.with("1234")
|
29
|
+
|
30
|
+
@wre.open("1234")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: universal-java-1.6
|
6
6
|
authors:
|
7
7
|
- Shane Emmons
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01
|
12
|
+
date: 2010-02-01 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -29,8 +29,10 @@ files:
|
|
29
29
|
- lib/bosdk.rb
|
30
30
|
- lib/bosdk/enterprise_session.rb
|
31
31
|
- lib/bosdk/info_object.rb
|
32
|
+
- lib/bosdk/webi_report_engine.rb
|
32
33
|
- spec/enterprise_session_spec.rb
|
33
34
|
- spec/info_object_spec.rb
|
35
|
+
- spec/webi_report_engine_spec.rb
|
34
36
|
has_rdoc: true
|
35
37
|
homepage: http://semmons99.github.com/bosdk
|
36
38
|
licenses: []
|