caterpillar 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,13 +6,15 @@ class RailsTaskTest < Caterpillar::TestCase
6
6
  def test_generated_rails_project
7
7
  project_name = 'caterpillar_rails_test'
8
8
 
9
- # Rake::Task['rails'].execute(project_name)
10
9
  `ruby -S caterpillar rails #{project_name}`
11
10
  assert FileTest.directory? project_name
12
11
  assert File.read("#{project_name}/config/environment.rb") =~ /caterpillar/
13
12
  assert FileTest.directory? "#{project_name}/vendor/plugins/caterpillar-#{Caterpillar::VERSION}"
13
+ assert FileTest.exists? "#{project_name}/app/views/layouts/application.html.erb"
14
14
  assert FileTest.exists? "#{project_name}/config/warble.rb"
15
+ assert File.read("#{project_name}/config/warble.rb") =~ /#{project_name}-portlet/
15
16
  assert FileTest.exists? "#{project_name}/config/portlets.rb"
17
+ assert File.read("#{project_name}/config/portlets.rb") =~ /#{project_name}-portlet/
16
18
  FileUtils.rm_rf project_name
17
19
  end
18
20
 
data/test/xml_test.rb CHANGED
@@ -19,41 +19,37 @@ class XmlTest < Caterpillar::TestCase # :nodoc:
19
19
  }
20
20
  end
21
21
 
22
- def test_portlet_template
22
+ def test_portlet_elements
23
23
  portlet = {
24
24
  :name => "some name",
25
25
  :title => "some title",
26
26
  :servlet => "Test",
27
27
  :path => "/test/path"
28
28
  }
29
-
29
+
30
30
  session = {
31
31
  :key => '_test_session',
32
32
  :secret => 'XXX'
33
33
  }
34
-
35
- xml = Caterpillar::Portlet.template(portlet)
36
- assert_not_nil xml
37
- assert !xml.empty?
38
34
 
35
+ xml = Caterpillar::Portlet.portlet_element(portlet).to_s
39
36
  assert xml[/#{portlet[:name]}/]
40
37
  assert xml[/#{portlet[:title]}/]
41
- assert xml[/#{portlet[:servlet]}/]
42
- assert xml[/#{portlet[:path]}/]
43
38
  assert !xml[/secret/]
44
39
 
45
- xml = Caterpillar::Portlet.template(portlet,session)
46
- assert_not_nil xml
47
- assert !xml.empty?
48
-
40
+ xml = Caterpillar::Portlet.portlet_element(portlet,session).to_s
49
41
  assert xml[/#{session[:secret]}/], 'No secret'
42
+
43
+ xml = Caterpillar::Portlet.filter_element(portlet).to_s
44
+ assert xml[/#{portlet[:servlet]}/]
45
+ assert xml[/#{portlet[:path]}/]
50
46
  end
51
47
 
52
48
  def test_session_key
53
49
  key = Caterpillar::Security.get_session_key
54
50
  assert_not_nil key
55
51
  end
56
-
52
+
57
53
  def test_secret
58
54
  secret = Caterpillar::Security.get_secret
59
55
  assert_not_nil secret
@@ -93,7 +89,6 @@ class XmlTest < Caterpillar::TestCase # :nodoc:
93
89
  @liferay_tld_table.each_pair do |version,tld|
94
90
  @config.container.version = version
95
91
  xml = @config.container.portletapp_xml(@portlets)
96
-
97
92
  assert xml[/liferay-portlet-app.*#{tld}/],
98
93
  'Failed to create DTD with proper version; liferay %s' % version
99
94
 
@@ -108,5 +103,80 @@ class XmlTest < Caterpillar::TestCase # :nodoc:
108
103
  assert doc.validate(dtd)
109
104
  end
110
105
  end
106
+
107
+ def test_public_render_parameters_xml
108
+ doc = REXML::Document.new
109
+ doc << REXML::XMLDecl.new('1.0', 'utf-8')
110
+ app = REXML::Element.new('portlet-app', doc)
111
+ app.attributes['version'] = '2.0'
112
+ app.attributes['xmlns'] = 'http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
113
+ app.attributes['xmlns:xsi'] = 'http://www.w3.org/2001/XMLSchema-instance'
114
+ app.attributes['xsi:schemaLocation'] = 'http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd'
115
+
116
+ portlet = {
117
+ :name => "test_portlet",
118
+ :path => "/test/path",
119
+ :public_render_parameters => [:tag, :folksonomy]
120
+ }
121
+
122
+ element = Caterpillar::Portlet.portlet_element(portlet, nil, app)
123
+ xml = element.to_s
124
+ assert_not_nil xml
125
+ assert !xml.empty?
126
+
127
+ assert xml[/#{portlet[:name]}/]
128
+ assert xml[/#{portlet[:title]}/]
129
+ assert xml[/#{portlet[:servlet]}/]
130
+ assert !xml[/secret/]
131
+
132
+ element = Caterpillar::Portlet.portlet_element(portlet, nil, app)
133
+ xml = element.to_s
134
+ assert_not_nil xml
135
+ assert !xml.empty?
136
+
137
+ portlet[:public_render_parameters].each do |param|
138
+ assert xml[/#{param}/]
139
+ end
140
+
141
+ assert xml[/<supported-public-render-parameter>/]
142
+ assert app.to_s[/<public-render-parameter>/]
143
+ end
111
144
 
112
145
  end
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caterpillar
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 3
9
- - 1
10
- version: 1.3.1
8
+ - 4
9
+ - 0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mikael Lammentausta
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-15 00:00:00 +03:00
18
+ date: 2010-06-14 00:00:00 +03:00
19
19
  default_executable: caterpillar
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -35,7 +35,7 @@ dependencies:
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- name: libxml-ruby
38
+ name: jrexml
39
39
  prerelease: false
40
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
41
  none: false
@@ -78,6 +78,7 @@ files:
78
78
  - Rakefile
79
79
  - init.rb
80
80
  - install.rb
81
+ - portlets-config.rb
81
82
  - lib/caterpillar/config.rb
82
83
  - lib/caterpillar/helpers/liferay.rb
83
84
  - lib/caterpillar/liferay.rb
@@ -90,8 +91,7 @@ files:
90
91
  - lib/caterpillar/usage.rb
91
92
  - lib/caterpillar/util.rb
92
93
  - lib/caterpillar.rb
93
- - lib/java/rails-portlet-0.10.0.jar
94
- - lib/java/rails-portlet-0.6.0.jar
94
+ - lib/java/rails-portlet-0.10.1.jar
95
95
  - lib/rails_gem_chooser.rb
96
96
  - lib/web/portlet.rb
97
97
  - generators/caterpillar/caterpillar_generator.rb
@@ -105,6 +105,8 @@ files:
105
105
  - generators/caterpillar/templates/javascripts/portlet_test_bench/main.js
106
106
  - generators/caterpillar/templates/stylesheets/portlet_test_bench/main.css
107
107
  - generators/caterpillar/USAGE
108
+ - generators/html_template/html_template_generator.rb
109
+ - generators/html_template/templates/application.html.erb
108
110
  - views/caterpillar/_navigation.html.erb
109
111
  - views/layouts/caterpillar.html.erb
110
112
  - portlet_test_bench/controllers/caterpillar/application.rb
@@ -138,7 +140,6 @@ files:
138
140
  - portlet_test_bench/views/caterpillar/js/prototype.html.erb
139
141
  - portlet_test_bench/views/caterpillar/js/scriptaculous.html.erb
140
142
  - portlet_test_bench/views/caterpillar/js/simple.html.erb
141
- - portlet_test_bench/views/caterpillar/junit/basic_tags.html.erb
142
143
  - portlet_test_bench/views/caterpillar/junit/css.html.erb
143
144
  - portlet_test_bench/views/caterpillar/junit/doctype_html4_strict.html.erb
144
145
  - portlet_test_bench/views/caterpillar/junit/doctype_html5.html.erb
@@ -149,6 +150,8 @@ files:
149
150
  - portlet_test_bench/views/caterpillar/junit/doctype_xhtml11.html.erb
150
151
  - portlet_test_bench/views/caterpillar/junit/form.html.erb
151
152
  - portlet_test_bench/views/caterpillar/junit/http_post.html.erb
153
+ - portlet_test_bench/views/caterpillar/junit/images.html.erb
154
+ - portlet_test_bench/views/caterpillar/junit/links.html.erb
152
155
  - portlet_test_bench/views/caterpillar/junit/post_and_redirect.html.erb
153
156
  - portlet_test_bench/views/caterpillar/junit/target1.html.erb
154
157
  - portlet_test_bench/views/caterpillar/junit/xhr.html.erb
Binary file