trinidad 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.9.1 (2010-05-09)
2
+
3
+ * Move all configuration logic to a Lifecycle listener:
4
+ - Keeps the initial configuration so the provided web xml files are no more needed.
5
+ - Avoids workarounds in the hotdeploy extension.
6
+ * Disable more Tomcat's default behaviours. Process Tlds is also disabled.
7
+ * Allow to specify webapp extensions in the extensions root section.
8
+
1
9
  == 0.9.0 (2010-04-28)
2
10
 
3
11
  * Tomcat updated to version 6.0.26, added constant to get its version.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.9.1
@@ -3,7 +3,9 @@ module Trinidad
3
3
  def self.configure_webapp_extensions(extensions, tomcat, app_context)
4
4
  if extensions
5
5
  extensions.each do |name, options|
6
- extension(name, 'WebAppExtension', options).configure(tomcat, app_context)
6
+ if extension = extension(name, 'WebAppExtension', options)
7
+ extension.configure(tomcat, app_context)
8
+ end
7
9
  end
8
10
  end
9
11
  end
@@ -11,9 +13,10 @@ module Trinidad
11
13
  def self.configure_server_extensions(extensions, tomcat)
12
14
  if extensions
13
15
  extensions.each do |name, options|
14
- extension = extension(name, 'ServerExtension', options)
15
- configured_tomcat = extension.configure(tomcat)
16
- tomcat = configured_tomcat if extension.override_tomcat?
16
+ if extension = extension(name, 'ServerExtension', options)
17
+ configured_tomcat = extension.configure(tomcat)
18
+ tomcat = configured_tomcat if extension.override_tomcat?
19
+ end
17
20
  end
18
21
  end
19
22
  tomcat
@@ -22,7 +25,9 @@ module Trinidad
22
25
  def self.configure_options_extensions(extensions, parser, default_options)
23
26
  if extensions
24
27
  extensions.each do |name, options|
25
- extension(name, 'OptionsExtension', options).configure(parser, default_options)
28
+ if extension = extension(name, 'OptionsExtension', options)
29
+ extension.configure(parser, default_options)
30
+ end
26
31
  end
27
32
  end
28
33
  end
@@ -30,7 +35,8 @@ module Trinidad
30
35
  def self.extension(name, type, options)
31
36
  class_name = (name.to_s.camelize << type).to_sym
32
37
  load_extension(name) unless const_defined?(class_name)
33
- const_get(class_name).new(options)
38
+ clazz = const_get(class_name) rescue nil
39
+ clazz.new(options) if clazz
34
40
  end
35
41
 
36
42
  def self.load_extension(name)
@@ -1,19 +1,16 @@
1
1
  module Trinidad
2
2
  class RackupWebApp < WebApp
3
3
 
4
- def add_init_params
4
+ def init_params
5
5
  super
6
- add_parameter_unless_exist('rackup', rackup_script)
6
+ add_parameter_unless_exist 'rackup', rackup_script
7
+ @params
7
8
  end
8
9
 
9
- def context_listener
10
- 'org.jruby.rack.RackServletContextListener'
11
- end
10
+ def context_listener; 'org.jruby.rack.RackServletContextListener'; end
12
11
 
13
12
  def rackup_script
14
- IO.read(File.join(@app[:web_app_dir], @app[:rackup]))
13
+ File.read(File.join(web_app_dir, rackup))
15
14
  end
16
-
17
- def provided_web_xml; 'rackup_web.xml'; end
18
15
  end
19
16
  end
@@ -1,16 +1,13 @@
1
1
  module Trinidad
2
2
  class RailsWebApp < WebApp
3
3
 
4
- def add_init_params
4
+ def init_params
5
5
  super
6
- add_parameter_unless_exist('rails.env', environment.to_s)
7
- add_parameter_unless_exist('rails.root', '/')
6
+ add_parameter_unless_exist 'rails.env', environment.to_s
7
+ add_parameter_unless_exist 'rails.root', '/'
8
+ @params
8
9
  end
9
10
 
10
- def context_listener
11
- 'org.jruby.rack.rails.RailsServletContextListener'
12
- end
13
-
14
- def provided_web_xml; 'rails_web.xml'; end
11
+ def context_listener; 'org.jruby.rack.rails.RailsServletContextListener'; end
15
12
  end
16
13
  end
@@ -36,6 +36,7 @@ module Trinidad
36
36
  @tomcat.host.app_base = Dir.pwd
37
37
  enable_naming
38
38
 
39
+ add_http_connector if http_configured?
39
40
  add_ssl_connector if ssl_enabled?
40
41
  add_ajp_connector if ajp_enabled?
41
42
 
@@ -50,15 +51,10 @@ module Trinidad
50
51
  app_context = @tomcat.addWebapp(app_config[:context_path], app_config[:web_app_dir])
51
52
  remove_defaults(app_context)
52
53
 
53
- web_app = WebApp.create(app_context, @config, app_config)
54
+ web_app = WebApp.create(@config, app_config)
54
55
 
55
- web_app.load_default_web_xml
56
- web_app.configure_rack
57
- web_app.configure_extensions(@tomcat)
58
- web_app.add_context_loader
59
- web_app.add_init_params
60
-
61
- web_app.add_rack_context_listener
56
+ Trinidad::Extensions.configure_webapp_extensions(web_app.extensions, @tomcat, app_context)
57
+ app_context.add_lifecycle_listener(WebAppLifecycleListener.new(web_app))
62
58
  end
63
59
  end
64
60
 
@@ -71,11 +67,14 @@ module Trinidad
71
67
  connector.secure = opts.delete(:secure) || false
72
68
  connector.port = opts.delete(:port).to_i
73
69
 
70
+ connector.protocol_handler_class_name = opts.delete(:protocol_handler) if opts[:protocol_handler]
71
+
74
72
  opts.each do |key, value|
75
73
  connector.setProperty(key.to_s, value.to_s)
76
74
  end
77
75
 
78
76
  @tomcat.getService().addConnector(connector)
77
+ connector
79
78
  end
80
79
 
81
80
  def add_ajp_connector
@@ -95,6 +94,15 @@ module Trinidad
95
94
  create_default_keystore(options) unless File.exist?(options[:keystore])
96
95
  end
97
96
 
97
+ def add_http_connector
98
+ options = @config[:http]
99
+ options[:port] = @config[:port]
100
+ options[:protocol_handler] = 'org.apache.coyote.http11.Http11NioProtocol' if options[:nio]
101
+
102
+ connector = add_service_connector(options)
103
+ @tomcat.connector = connector
104
+ end
105
+
98
106
  def ssl_enabled?
99
107
  @config.has_key?(:ssl)
100
108
  end
@@ -103,6 +111,10 @@ module Trinidad
103
111
  @config.has_key?(:ajp)
104
112
  end
105
113
 
114
+ def http_configured?
115
+ @config.has_key?(:http)
116
+ end
117
+
106
118
  def create_default_keystore(config)
107
119
  keystore_file = java.io.File.new(config[:keystore])
108
120
 
@@ -166,6 +178,12 @@ module Trinidad
166
178
 
167
179
  jsp_servlet = app_context.find_child('jsp')
168
180
  app_context.remove_child(jsp_servlet) if jsp_servlet
181
+
182
+ app_context.remove_servlet_mapping('/')
183
+ app_context.remove_servlet_mapping('*.jspx')
184
+ app_context.remove_servlet_mapping('*.jsp')
185
+
186
+ app_context.process_tlds = false
169
187
  end
170
188
  end
171
189
  end
@@ -1,118 +1,81 @@
1
1
  module Trinidad
2
2
  class WebApp
3
- attr_reader :context, :config
3
+ attr_reader :config, :app_config, :class_loader, :servlet
4
4
 
5
- def self.create(context, config, app)
6
- app.has_key?(:rackup) ? RackupWebApp.new(context, config, app) : RailsWebApp.new(context, config, app)
5
+ def self.create(config, app_config)
6
+ app_config.has_key?(:rackup) ? RackupWebApp.new(config, app_config) : RailsWebApp.new(config, app_config)
7
7
  end
8
8
 
9
- def initialize(context, config, app)
10
- @context = context
9
+ def initialize(config, app_config, servlet_class = 'org.jruby.rack.RackServlet', servlet_name = 'RackServlet')
11
10
  @config = config
12
- @app = app
11
+ @app_config = app_config
13
12
 
14
13
  @class_loader = org.jruby.util.JRubyClassLoader.new(JRuby.runtime.jruby_class_loader)
14
+ @servlet = {:class => servlet_class, :name => servlet_name} unless rack_servlet_configured?
15
15
  end
16
16
 
17
- def configure_rack(servlet_class = 'org.jruby.rack.RackServlet', servlet_name = 'RackServlet')
18
- unless rack_configured?
19
- wrapper = @context.createWrapper()
20
- wrapper.setServletClass(servlet_class)
21
- wrapper.setName(servlet_name)
22
-
23
- @context.addChild(wrapper)
24
- @context.addServletMapping('/*', servlet_name)
25
- end
17
+ def rack_listener
18
+ context_listener unless rack_listener_configured?
26
19
  end
27
20
 
28
- def add_context_loader
29
- add_application_libs(@class_loader)
30
- add_application_classes(@class_loader)
31
-
32
- loader = Trinidad::Tomcat::WebappLoader.new(@class_loader)
33
-
34
- loader.container = @context
35
- @context.loader = loader
21
+ def init_params
22
+ @params ||= {}
23
+ add_parameter_unless_exist 'jruby.min.runtimes', jruby_min_runtimes.to_s
24
+ add_parameter_unless_exist 'jruby.max.runtimes', jruby_max_runtimes.to_s
25
+ add_parameter_unless_exist 'jruby.initial.runtimes', jruby_min_runtimes.to_s
26
+ add_parameter_unless_exist 'public.root', File.join('/', public_root)
27
+ @params
36
28
  end
37
29
 
38
- def add_init_params
39
- add_parameter_unless_exist('jruby.min.runtimes', jruby_min_runtimes.to_s)
40
- add_parameter_unless_exist('jruby.max.runtimes', jruby_max_runtimes.to_s)
41
- add_parameter_unless_exist('jruby.initial.runtimes', jruby_min_runtimes.to_s)
42
- add_parameter_unless_exist('public.root', File.join('/', public_root))
43
- end
44
-
45
- def add_rack_context_listener
46
- unless rack_listener_configured?
47
- @context.addApplicationListener(context_listener)
30
+ def default_deployment_descriptor
31
+ @deployment_descriptor ||= if default_web_xml
32
+ file = File.expand_path(File.join(web_app_dir, default_web_xml))
33
+ File.exist?(file) ? file : nil
48
34
  end
49
35
  end
50
36
 
51
- def add_application_libs(class_loader)
52
- resources_dir = File.join(@app[:web_app_dir], libs_dir, '**', '*.jar')
53
-
54
- Dir[resources_dir].each do |resource|
55
- class_loader.addURL(java.io.File.new(resource).to_url)
56
- end
57
- end
58
-
59
- def add_application_classes(class_loader)
60
- resources_dir = File.join(@app[:web_app_dir], classes_dir)
61
- class_loader.addURL(java.io.File.new(resources_dir).to_url)
62
- end
63
-
64
- def load_default_web_xml
65
- file = File.expand_path(File.join(@app[:web_app_dir], default_web_xml))
66
- file = File.expand_path("../#{provided_web_xml}", __FILE__) unless File.exist?(file)
67
-
68
- @context.setDefaultWebXml(file)
69
-
70
- context_config = Trinidad::Tomcat::ContextConfig.new
71
- context_config.setDefaultWebXml(file)
72
-
73
- @context.addLifecycleListener(context_config)
74
- end
75
-
76
- def rack_configured?
77
- return false if @context.getDefaultWebXml().nil?
78
-
79
- web_xml = IO.read(@context.getDefaultWebXml()).gsub(/\s+/, '')
80
-
81
- return web_xml.include?('<servlet-class>org.jruby.rack.RackServlet') ||
82
- web_xml.include?('<filter-class>org.jruby.rack.RackFilter')
37
+ def rack_servlet_configured?
38
+ !!(web_xml && (web_xml.include?('<servlet-class>org.jruby.rack.RackServlet') ||
39
+ web_xml.include?('<filter-class>org.jruby.rack.RackFilter')))
83
40
  end
84
41
 
85
42
  def rack_listener_configured?
86
- return false if @context.getDefaultWebXml().nil?
87
-
88
- web_xml = IO.read(@context.getDefaultWebXml()).gsub(/\s+/, '')
89
-
90
- return web_xml.include?("<listener-class>#{context_listener}")
43
+ !!(web_xml && web_xml.include?("<listener-class>#{context_listener}"))
91
44
  end
92
45
 
93
46
  def public_root
94
- @context.findParameter('public.root') || @app[:public] || @config[:public] || 'public'
47
+ @app_config[:public] || @config[:public] || 'public'
95
48
  end
96
49
 
97
- %w{libs_dir classes_dir default_web_xml environment jruby_min_runtimes jruby_max_runtimes}.each do |method_name|
50
+ %w{web_app_dir libs_dir classes_dir default_web_xml environment jruby_min_runtimes jruby_max_runtimes rackup}.each do |method_name|
98
51
  define_method method_name do
99
52
  sym = method_name.to_sym
100
- @app[sym] || @config[sym]
53
+ @app_config[sym] || @config[sym]
101
54
  end
102
55
  end
103
56
 
104
- def add_parameter_unless_exist(name, value)
105
- @context.addParameter(name, value) unless @context.findParameter(name)
57
+ def extensions
58
+ @extensions ||= begin
59
+ extensions = @config[:extensions] || {}
60
+ extensions.merge!(@app_config[:extensions]) if @app_config[:extensions]
61
+ extensions
62
+ end
106
63
  end
107
64
 
108
- def load_extensions?
109
- @app.has_key?(:extensions)
65
+ protected
66
+ def add_parameter_unless_exist(param_name, param_value)
67
+ @params[param_name] = param_value unless web_context_param(param_name)
110
68
  end
111
69
 
112
- def configure_extensions(tomcat)
113
- return unless load_extensions?
70
+ private
71
+ def web_xml
72
+ @web_xml ||= File.read(default_deployment_descriptor).gsub(/\s+/, '') unless default_deployment_descriptor.nil?
73
+ end
114
74
 
115
- Trinidad::Extensions.configure_webapp_extensions(@app[:extensions], tomcat, @context)
116
- end
75
+ def web_context_param(param)
76
+ if web_xml =~ /<context-param><param-name>#{param}<\/param-name><param-value>(.+)<\/param-value>/
77
+ return $1
78
+ end
79
+ end
117
80
  end
118
81
  end
@@ -0,0 +1,91 @@
1
+ module Trinidad
2
+ import org.apache.catalina.LifecycleListener
3
+ import org.apache.catalina.Lifecycle
4
+
5
+ class WebAppLifecycleListener
6
+ include LifecycleListener
7
+
8
+ attr_reader :context
9
+
10
+ def initialize(webapp)
11
+ @webapp = webapp
12
+ end
13
+
14
+ def lifecycleEvent(event)
15
+ if Lifecycle::BEFORE_START_EVENT == event.type
16
+ init_defaults(event.lifecycle)
17
+ end
18
+ end
19
+
20
+ def init_defaults(context)
21
+ @context = context
22
+
23
+ deployment_descriptor = configure_deployment_descriptor
24
+ unless deployment_descriptor
25
+ configure_rack_servlet
26
+ configure_rack_listener
27
+ end
28
+ configure_init_params
29
+ configure_context_loader
30
+ end
31
+
32
+ def configure_deployment_descriptor
33
+ if descriptor = @webapp.default_deployment_descriptor
34
+ @context.setDefaultWebXml(descriptor)
35
+
36
+ context_config = Trinidad::Tomcat::ContextConfig.new
37
+ context_config.setDefaultWebXml(descriptor)
38
+
39
+ @context.addLifecycleListener(context_config)
40
+ end
41
+ descriptor
42
+ end
43
+
44
+ def configure_rack_servlet
45
+ wrapper = @context.create_wrapper
46
+ wrapper.servlet_class = @webapp.servlet[:class]
47
+ wrapper.name = @webapp.servlet[:name]
48
+
49
+ @context.add_child(wrapper)
50
+ @context.add_servlet_mapping('/*', wrapper.name)
51
+ end
52
+
53
+ def configure_rack_listener
54
+ @context.addApplicationListener(@webapp.rack_listener)
55
+ end
56
+
57
+ def configure_init_params
58
+ @webapp.init_params.each do |name, value|
59
+ @context.addParameter(name, value)
60
+ end
61
+ end
62
+
63
+ def configure_context_loader
64
+ class_loader = @webapp.class_loader
65
+
66
+ add_application_jars(class_loader)
67
+ add_application_java_classes(class_loader)
68
+
69
+ loader = Trinidad::Tomcat::WebappLoader.new(class_loader)
70
+ loader.container = @context
71
+ @context.loader = loader
72
+ end
73
+
74
+ def add_application_jars(class_loader)
75
+ return unless @webapp.libs_dir
76
+
77
+ resources_dir = File.join(@webapp.web_app_dir, @webapp.libs_dir, '**', '*.jar')
78
+
79
+ Dir[resources_dir].each do |resource|
80
+ class_loader.addURL(java.io.File.new(resource).to_url)
81
+ end
82
+ end
83
+
84
+ def add_application_java_classes(class_loader)
85
+ return unless @webapp.classes_dir
86
+
87
+ resources_dir = File.join(@webapp.web_app_dir, @webapp.classes_dir)
88
+ class_loader.addURL(java.io.File.new(resources_dir).to_url)
89
+ end
90
+ end
91
+ end
data/lib/trinidad.rb CHANGED
@@ -11,10 +11,12 @@ require 'trinidad/extensions'
11
11
  require 'trinidad/command_line_parser'
12
12
  require 'trinidad/jars'
13
13
  require 'trinidad/server'
14
+ require 'trinidad/web_app_lifecycle_listener'
14
15
  require 'trinidad/web_app'
15
16
  require 'trinidad/rails_web_app'
16
17
  require 'trinidad/rackup_web_app'
17
18
 
19
+
18
20
  module Trinidad
19
21
  VERSION = File.read(File.expand_path('../../VERSION', __FILE__))
20
22
  TOMCAT_VERSION = '6.0.26'
@@ -2,7 +2,7 @@ module Trinidad
2
2
  module Extensions
3
3
  class FooWebAppExtension < WebAppExtension
4
4
  def configure(tomcat, app_context)
5
- @options
5
+ app_context.doc_base = 'foo_app_extension' if app_context
6
6
  end
7
7
  end
8
8
 
@@ -37,4 +37,22 @@ describe Trinidad::Extensions do
37
37
  extended = Trinidad::Extensions.configure_server_extensions(extensions, tomcat)
38
38
  extended.should_not equal(tomcat)
39
39
  end
40
+
41
+ it "ignores extensions that don't exist for that scope" do
42
+ extensions = {:override_tomcat => {}}
43
+ tomcat = Trinidad::Tomcat::Tomcat.new
44
+
45
+ lambda {
46
+ Trinidad::Extensions.configure_webapp_extensions(extensions, tomcat, nil)
47
+ }.should_not raise_error
48
+ end
49
+
50
+ it "raises an error when the extension doesn't exist" do
51
+ extensions = {:foo_bar => {}}
52
+ tomcat = Trinidad::Tomcat::Tomcat.new
53
+
54
+ lambda {
55
+ Trinidad::Extensions.configure_webapp_extensions(extensions, tomcat, nil)
56
+ }.should raise_error
57
+ end
40
58
  end
@@ -17,8 +17,71 @@ EOF
17
17
  EOF
18
18
  end
19
19
 
20
+ def create_rails_web_xml
21
+ @rails_web_xml ||= config_file 'config/web.xml', <<-EOF
22
+ <?xml version="1.0" encoding="UTF-8"?>
23
+ <web-app>
24
+ <servlet>
25
+ <servlet-name>RackServlet</servlet-name>
26
+ <servlet-class>org.jruby.rack.RackServlet</servlet-class>
27
+ </servlet>
28
+
29
+ <servlet-mapping>
30
+ <servlet-name>RackServlet</servlet-name>
31
+ <url-pattern>/*</url-pattern>
32
+ </servlet-mapping>
33
+
34
+ <listener>
35
+ <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
36
+ </listener>
37
+
38
+ </web-app>
39
+ EOF
40
+ end
41
+
42
+ def create_rackup_web_xml
43
+ @rackup_web_xml ||= config_file 'config/web.xml', <<-EOF
44
+ <?xml version="1.0" encoding="UTF-8"?>
45
+ <web-app>
46
+ <context-param>
47
+ <param-name>jruby.min.runtimes</param-name>
48
+ <param-value>1<param-value>
49
+ </context-param>
50
+
51
+ <context-param>
52
+ <param-name>jruby.max.runtimes</param-name>
53
+ <param-value>1</param-value>
54
+ </context-param>
55
+
56
+ <servlet>
57
+ <servlet-name>RackServlet</servlet-name>
58
+ <servlet-class>org.jruby.rack.RackServlet</servlet-class>
59
+ </servlet>
60
+
61
+ <servlet-mapping>
62
+ <servlet-name>RackServlet</servlet-name>
63
+ <url-pattern>/*</url-pattern>
64
+ </servlet-mapping>
65
+
66
+ <listener>
67
+ <listener-class>org.jruby.rack.RackServletContextListener</listener-class>
68
+ </listener>
69
+
70
+ </web-app>
71
+ EOF
72
+ end
73
+
74
+ def create_rackup_file
75
+ @rackup ||= config_file 'config/config.ru', <<-EOF
76
+ require 'rubygems'
77
+ require 'sinatra'
78
+
79
+ run App
80
+ EOF
81
+ end
82
+
20
83
  private
21
- def config_file(path, options)
22
- File.open(path, 'w') {|io| io.write(options) }
84
+ def config_file(path, content)
85
+ File.open(path, 'w') {|io| io.write(content) }
23
86
  end
24
87
  end
@@ -12,47 +12,49 @@ describe Trinidad::Server do
12
12
 
13
13
  it "enables catalina naming" do
14
14
  Trinidad::Server.new
15
- JSystem.getProperty(JContext.URL_PKG_PREFIXES).should include("org.apache.naming")
16
- JSystem.getProperty(JContext.INITIAL_CONTEXT_FACTORY).should == "org.apache.naming.java.javaURLContextFactory"
17
- JSystem.getProperty("catalina.useNaming").should == "true"
15
+ JSystem.get_property(JContext.URL_PKG_PREFIXES).should include("org.apache.naming")
16
+ JSystem.get_property(JContext.INITIAL_CONTEXT_FACTORY).should == "org.apache.naming.java.javaURLContextFactory"
17
+ JSystem.get_property("catalina.useNaming").should == "true"
18
18
  end
19
19
 
20
- it "should have ssl disabled when config param is nil" do
20
+ it "disables ssl when config param is nil" do
21
21
  server = Trinidad::Server.new
22
22
  server.ssl_enabled?.should be_false
23
23
  end
24
24
 
25
- it "should have ajp disabled when config param is nil" do
25
+ it "disables ajp when config param is nil" do
26
26
  server = Trinidad::Server.new
27
27
  server.ajp_enabled?.should be_false
28
28
  end
29
29
 
30
- it "should have ssl enabled when config param is a number" do
30
+ it "enables ssl when config param is a number" do
31
31
  server = Trinidad::Server.new({:ssl => {:port => 8443},
32
32
  :web_app_dir => MOCK_WEB_APP_DIR})
33
33
 
34
34
  server.ssl_enabled?.should be_true
35
35
  end
36
36
 
37
- it "should have ajp enabled when config param is a number" do
37
+ it "enables ajp when config param is a number" do
38
38
  server = Trinidad::Server.new({:ajp => {:port => 8009}})
39
39
 
40
40
  server.ajp_enabled?.should be_true
41
41
  end
42
42
 
43
- it "should have a connector with https scheme" do
43
+ it "includes a connector with https scheme when ssl is enabled" do
44
44
  server = Trinidad::Server.new({:ssl => {:port => 8443},
45
45
  :web_app_dir => MOCK_WEB_APP_DIR})
46
46
 
47
- server.tomcat.service.findConnectors().should have(1).connectors
48
- server.tomcat.service.findConnectors()[0].scheme.should == 'https'
47
+ connectors = server.tomcat.service.find_connectors
48
+ connectors.should have(1).connector
49
+ connectors[0].scheme.should == 'https'
49
50
  end
50
51
 
51
- it "should have an ajp connector enabled" do
52
+ it "includes a connector with protocol AJP when ajp is enabled" do
52
53
  server = Trinidad::Server.new({:ajp => {:port => 8009}})
53
54
 
54
- server.tomcat.service.findConnectors().should have(1).connectors
55
- server.tomcat.service.findConnectors()[0].protocol.should == 'AJP/1.3'
55
+ connectors = server.tomcat.service.find_connectors
56
+ connectors.should have(1).connector
57
+ connectors[0].protocol.should == 'AJP/1.3'
56
58
  end
57
59
 
58
60
  it "loads one application for each option present into :web_apps" do
@@ -71,43 +73,86 @@ describe Trinidad::Server do
71
73
  }
72
74
  })
73
75
 
74
- context_loaded = server.tomcat.host.findChildren()
76
+ context_loaded = server.tomcat.host.find_children
75
77
  context_loaded.should have(3).web_apps
76
78
 
77
79
  expected = ['/mock1', '/mock2', '/']
78
80
  context_loaded.each do |context|
79
- expected.delete(context.getPath()).should == context.getPath()
81
+ expected.delete(context.path).should == context.path
80
82
  end
81
83
  end
82
84
 
83
85
  it "loads the default application from the current directory if :web_apps is not present" do
84
86
  server = Trinidad::Server.new({:web_app_dir => MOCK_WEB_APP_DIR})
85
87
 
86
- default_context_should_be_loaded(server.tomcat.host.findChildren())
88
+ default_context_should_be_loaded(server.tomcat.host.find_children)
87
89
  end
88
90
 
89
- it "loads the default application from the current directory using the rackup file if :web_apps is not present" do
91
+ it "removes default servlets from the application" do
92
+ server = Trinidad::Server.new({:web_app_dir => MOCK_WEB_APP_DIR})
93
+ app = server.tomcat.host.find_child('/')
94
+
95
+ app.find_child('default').should be_nil
96
+ app.find_child('jsp').should be_nil
97
+
98
+ app.find_servlet_mapping('*.jsp').should be_nil
99
+ app.find_servlet_mapping('*.jspx').should be_nil
100
+
101
+ app.process_tlds.should be_false
102
+ end
103
+
104
+ it "uses the default HttpConnector when http is not configured" do
105
+ server = Trinidad::Server.new({:web_app_dir => MOCK_WEB_APP_DIR})
106
+ server.http_configured?.should be_false
107
+
108
+ server.tomcat.connector.protocol_handler_class_name.should == 'org.apache.coyote.http11.Http11Protocol'
109
+ end
110
+
111
+ it "uses the NioConnector when the http configuration sets nio to true" do
90
112
  server = Trinidad::Server.new({
91
113
  :web_app_dir => MOCK_WEB_APP_DIR,
92
- :rackup => 'config.ru'
114
+ :http => {:nio => true}
93
115
  })
116
+ server.http_configured?.should be_true
94
117
 
95
- context = default_context_should_be_loaded(server.tomcat.host.findChildren())
96
- context.findParameter('rackup').gsub(/\s+/, ' ').should == "require 'rubygems' require 'sinatra'"
118
+ server.tomcat.connector.protocol_handler_class_name.should == 'org.apache.coyote.http11.Http11NioProtocol'
97
119
  end
98
120
 
99
- it "removes default servlets from the application" do
121
+ it "configures NioConnector with http option values" do
122
+ server = Trinidad::Server.new({
123
+ :web_app_dir => MOCK_WEB_APP_DIR,
124
+ :http => {
125
+ :nio => true,
126
+ 'maxKeepAliveRequests' => 4,
127
+ 'socket.bufferPool' => 1000
128
+ }
129
+ })
130
+ connector = server.tomcat.connector
131
+ connector.get_property('maxKeepAliveRequests').should == 4
132
+ connector.get_property('socket.bufferPool').should == '1000'
133
+ end
134
+
135
+ it "adds the WebAppLifecycleListener to each webapp" do
100
136
  server = Trinidad::Server.new({:web_app_dir => MOCK_WEB_APP_DIR})
101
- app = server.tomcat.host.find_child('/')
102
-
103
- app.find_child('default').should be_nil
104
- app.find_child('jsp').should be_nil
137
+ app_context = server.tomcat.host.find_child('/')
138
+
139
+ app_context.find_lifecycle_listeners.map {|l| l.class.name }.should include('Trinidad::WebAppLifecycleListener')
140
+ end
141
+
142
+ it "loads application extensions from the root of the configuration" do
143
+ server = Trinidad::Server.new({
144
+ :web_app_dir => MOCK_WEB_APP_DIR,
145
+ :extensions => { :foo => {} }
146
+ })
147
+
148
+ app_context = server.tomcat.host.find_child('/')
149
+ app_context.doc_base.should == 'foo_app_extension'
105
150
  end
106
151
 
107
152
  def default_context_should_be_loaded(children)
108
153
  children.should have(1).web_apps
109
- children[0].getDocBase().should == MOCK_WEB_APP_DIR
110
- children[0].getPath().should == '/'
154
+ children[0].doc_base.should == MOCK_WEB_APP_DIR
155
+ children[0].path.should == '/'
111
156
  children[0]
112
157
  end
113
158
  end
@@ -0,0 +1,179 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+ require File.dirname(__FILE__) + '/fakeapp'
3
+
4
+ include FakeApp
5
+
6
+ # adding accessor for tests
7
+ class Trinidad::WebAppLifecycleListener
8
+ attr_accessor :context
9
+ end
10
+
11
+ import org.apache.catalina.Lifecycle
12
+
13
+ describe Trinidad::WebAppLifecycleListener do
14
+ before do
15
+ @mock = mock
16
+ @mock.stubs(:type).returns(Lifecycle::BEFORE_START_EVENT)
17
+ @mock.stubs(:lifecycle).returns(Trinidad::Tomcat::StandardContext.new)
18
+
19
+ @tomcat = Trinidad::Tomcat::Tomcat.new
20
+ @tomcat.host.app_base = Dir.pwd
21
+ end
22
+
23
+ it "ignores the event when it's not BEFORE_START_EVENT" do
24
+ listener = Trinidad::WebAppLifecycleListener.new(nil)
25
+ @mock.stubs(:type).returns(Lifecycle::BEFORE_STOP_EVENT)
26
+ lambda {
27
+ listener.lifecycleEvent(@mock)
28
+ }.should_not raise_error
29
+ end
30
+
31
+ it "tries to initialize the context when the event is BEFORE_START_EVENT" do
32
+ listener = Trinidad::WebAppLifecycleListener.new(nil)
33
+ lambda {
34
+ listener.lifecycleEvent(@mock)
35
+ }.should raise_error
36
+ end
37
+
38
+ it "doesn't load a default web xml when the deployment descriptor is not provided" do
39
+ listener = Trinidad::WebAppLifecycleListener.new(Trinidad::RailsWebApp.new({}, {}))
40
+ listener.configure_deployment_descriptor.should be_nil
41
+ end
42
+
43
+ it "loads a default web xml when the deployment descriptor is provided" do
44
+ FakeFS do
45
+ create_rails_web_xml
46
+
47
+ listener = Trinidad::WebAppLifecycleListener.new(Trinidad::RailsWebApp.new({}, {
48
+ :web_app_dir => Dir.pwd,
49
+ :default_web_xml => 'config/web.xml'
50
+ }))
51
+ listener.context = Trinidad::Tomcat::StandardContext.new
52
+
53
+ expected_xml = File.join(Dir.pwd, 'config/web.xml')
54
+ listener.configure_deployment_descriptor.should == expected_xml
55
+ listener.context.default_web_xml.should == expected_xml
56
+
57
+ listener.context.find_lifecycle_listeners.
58
+ map {|l| l.class.name }.should include('Java::OrgApacheCatalinaStartup::ContextConfig')
59
+ end
60
+ end
61
+
62
+ it "adds the rack servlet and the mapping for /*" do
63
+ listener = Trinidad::WebAppLifecycleListener.new(Trinidad::RailsWebApp.new({}, {}))
64
+ listener.context = Trinidad::Tomcat::StandardContext.new
65
+
66
+ listener.configure_rack_servlet
67
+
68
+ servlet = listener.context.find_child('RackServlet')
69
+ servlet.should_not be_nil
70
+ servlet.servlet_class.should == 'org.jruby.rack.RackServlet'
71
+
72
+ listener.context.find_servlet_mapping('/*').should == 'RackServlet'
73
+ end
74
+
75
+ it "configures the rack context listener from the web app" do
76
+ listener = Trinidad::WebAppLifecycleListener.new(Trinidad::RackupWebApp.new({}, {}))
77
+ listener.context = Trinidad::Tomcat::StandardContext.new
78
+ listener.configure_rack_listener
79
+
80
+ listener.context.find_application_listeners.should include('org.jruby.rack.RackServletContextListener')
81
+ end
82
+
83
+ it "adds context parameters from the web app" do
84
+ listener = Trinidad::WebAppLifecycleListener.new(Trinidad::RailsWebApp.new({}, {
85
+ :jruby_min_runtimes => 1
86
+ }))
87
+ listener.context = Trinidad::Tomcat::StandardContext.new
88
+ listener.configure_init_params
89
+
90
+ listener.context.find_parameter('jruby.min.runtimes').should == '1'
91
+ end
92
+
93
+ it "ignores parameters already present in the deployment descriptor" do
94
+ listener = Trinidad::WebAppLifecycleListener.new(Trinidad::RailsWebApp.new({}, {
95
+ :jruby_max_runtimes => 1,
96
+ :web_app_dir => MOCK_WEB_APP_DIR,
97
+ :default_web_xml => 'config/web.xml'
98
+ }))
99
+ listener.init_defaults(@tomcat.add_webapp('/', Dir.pwd))
100
+
101
+ listener.context.find_parameter('jruby.max.runtimes').should be_nil
102
+ listener.context.start
103
+ listener.context.find_parameter('jruby.max.runtimes').should == '8'
104
+ end
105
+
106
+ it "doesn't load classes into a jar when the libs directory is not present" do
107
+ web_app = Trinidad::RailsWebApp.new({}, {})
108
+
109
+ listener = Trinidad::WebAppLifecycleListener.new(web_app)
110
+ listener.add_application_jars(web_app.class_loader)
111
+
112
+ lambda {
113
+ web_app.class_loader.find_class('org.ho.yaml.Yaml')
114
+ }.should raise_error
115
+ end
116
+
117
+ it "loads classes into a jar when the libs directory is provided" do
118
+ web_app = Trinidad::RailsWebApp.new({}, {
119
+ :web_app_dir => MOCK_WEB_APP_DIR,
120
+ :libs_dir => 'lib'
121
+ })
122
+
123
+ listener = Trinidad::WebAppLifecycleListener.new(web_app)
124
+ listener.add_application_jars(web_app.class_loader)
125
+
126
+ lambda {
127
+ web_app.class_loader.find_class('org.ho.yaml.Yaml').should_not be_nil
128
+ }.should_not raise_error
129
+ end
130
+
131
+ it "doesn't load java classes when the classes directory is not present" do
132
+ web_app = Trinidad::RailsWebApp.new({}, {})
133
+
134
+ listener = Trinidad::WebAppLifecycleListener.new(web_app)
135
+ listener.add_application_java_classes(web_app.class_loader)
136
+
137
+ lambda {
138
+ web_app.class_loader.find_class('HelloTomcat')
139
+ }.should raise_error
140
+ end
141
+
142
+ it "loads java classes when the classes directory is provided" do
143
+ web_app = Trinidad::RailsWebApp.new({}, {
144
+ :web_app_dir => MOCK_WEB_APP_DIR,
145
+ :classes_dir => 'classes'
146
+ })
147
+
148
+ listener = Trinidad::WebAppLifecycleListener.new(web_app)
149
+ listener.add_application_java_classes(web_app.class_loader)
150
+
151
+ lambda {
152
+ web_app.class_loader.find_class('HelloTomcat').should_not be_nil
153
+ }.should_not raise_error
154
+ end
155
+
156
+ it "creates a WebappLoader with the JRuby class loader" do
157
+ web_app = Trinidad::RailsWebApp.new({}, {})
158
+
159
+ listener = Trinidad::WebAppLifecycleListener.new(web_app)
160
+ listener.context = Trinidad::Tomcat::StandardContext.new
161
+ listener.configure_context_loader
162
+
163
+ loader = listener.context.loader
164
+
165
+ loader.should be_instance_of(Java::OrgApacheCatalinaLoader::WebappLoader)
166
+ end
167
+
168
+ it "loads the default application from the current directory using the rackup file if :web_apps is not present" do
169
+ web_app = Trinidad::RackupWebApp.new({
170
+ :web_app_dir => MOCK_WEB_APP_DIR,
171
+ :rackup => 'config.ru'
172
+ }, {})
173
+ listener = Trinidad::WebAppLifecycleListener.new(web_app)
174
+ listener.context = Trinidad::Tomcat::StandardContext.new
175
+ listener.configure_init_params
176
+
177
+ listener.context.find_parameter('rackup').should == "require 'rubygems'\nrequire 'sinatra'"
178
+ end
179
+ end
@@ -1,144 +1,133 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
+ require File.dirname(__FILE__) + '/fakeapp'
2
3
 
3
- describe Trinidad::WebApp do
4
- before do
5
- @tomcat = Trinidad::Tomcat::Tomcat.new
6
- @tomcat.host.app_base = Dir.pwd
7
- @tomcat_web_app = @tomcat.addWebapp('/', File.dirname(__FILE__) + '/../../')
8
-
9
- @app = {
10
- :web_app_dir => MOCK_WEB_APP_DIR,
11
- :context_path => '/'
12
- }
13
- @config = {
14
- :libs_dir => 'lib',
15
- :classes_dir => 'classes',
16
- :default_web_xml => 'config/web.xml',
17
- :jruby_min_runtimes => 2,
18
- :jruby_max_runtimes => 6,
19
- :web_apps => {
20
- :default => @app
21
- }
22
- }
23
- @web_app = Trinidad::RailsWebApp.new(@tomcat_web_app, @config, @app)
24
- end
4
+ include FakeApp
25
5
 
6
+ describe Trinidad::WebApp do
26
7
  it "creates a RailsWebApp if rackup option is not present" do
27
- app = Trinidad::WebApp.create(@tomcat_web_app, @config, @app)
8
+ app = Trinidad::WebApp.create({}, {})
28
9
  app.should be_an_instance_of(Trinidad::RailsWebApp)
29
10
  end
30
11
 
31
12
  it "creates a RackupWebApp if rackup option is present" do
32
- rackup_app = {:rackup => 'config.ru'}
33
- @config.deep_merge({:web_apps => {:default => rackup_app}})
34
- app = Trinidad::WebApp.create(@tomcat_web_app, @config, rackup_app)
13
+ app = Trinidad::WebApp.create({}, {:rackup => 'config.ru'})
35
14
  app.should be_an_instance_of(Trinidad::RackupWebApp)
36
15
  end
37
16
 
38
- it "should load custom jars" do
39
- class_loader = org.jruby.util.JRubyClassLoader.new(JRuby.runtime.jruby_class_loader)
40
- @web_app.add_application_libs(class_loader)
17
+ it "ignores rack_servlet when a deployment descriptor already provides it" do
18
+ FakeFS do
19
+ create_rails_web_xml
41
20
 
42
- resource = class_loader.find_class('org.ho.yaml.Yaml')
43
- resource.should_not be_nil
21
+ app = Trinidad::WebApp.create({}, {
22
+ :web_app_dir => Dir.pwd,
23
+ :default_web_xml => 'config/web.xml'
24
+ })
25
+ app.servlet.should be_nil
26
+ end
44
27
  end
45
28
 
46
- it "should load custom classes" do
47
- class_loader = org.jruby.util.JRubyClassLoader.new(JRuby.runtime.jruby_class_loader)
48
- @web_app.add_application_classes(class_loader)
29
+ it "ignores rack_listener when a deployment descriptor already provides it" do
30
+ FakeFS do
31
+ create_rails_web_xml
49
32
 
50
- resource = class_loader.find_class('HelloTomcat')
51
- resource.should_not be_nil
33
+ app = Trinidad::WebApp.create({}, {
34
+ :web_app_dir => Dir.pwd,
35
+ :default_web_xml => 'config/web.xml'
36
+ })
37
+ app.rack_listener.should be_nil
38
+ end
52
39
  end
53
40
 
54
- it "should start application context without errors" do
55
- start_context
41
+ it "uses rack_servlet as the default servlet when a deployment descriptor is not provided" do
42
+ app = Trinidad::WebApp.create({}, {})
43
+ app.servlet.should_not be_nil
44
+ app.servlet[:name].should == 'RackServlet'
45
+ app.servlet[:class].should == 'org.jruby.rack.RackServlet'
56
46
  end
57
47
 
58
- it "should add a filter from the default web.xml" do
59
- start_context_with_web_xml
60
- @web_app.context.findFilterDefs().should have(1).filters
48
+ it "uses rack_listener as the default listener when a deployment descriptor is not provided" do
49
+ app = Trinidad::WebApp.create({}, {})
50
+ app.rack_listener.should == 'org.jruby.rack.rails.RailsServletContextListener'
61
51
  end
62
52
 
63
- it "shouldn't duplicate init params" do
64
- start_context_with_web_xml
65
- lambda { @web_app.add_init_params }.should_not raise_error
53
+ it "loads the context parameters from the configuration when a deployment descriptor is not provided" do
54
+ app = Trinidad::WebApp.create({}, {
55
+ :jruby_min_runtimes => 1,
56
+ :jruby_max_runtimes => 1,
57
+ :public => 'foo',
58
+ :environment => :production
59
+ })
60
+ parameters = app.init_params
61
+ parameters['jruby.min.runtimes'].should == '1'
62
+ parameters['jruby.initial.runtimes'].should == '1'
63
+ parameters['jruby.max.runtimes'].should == '1'
64
+ parameters['public.root'].should == '/foo'
65
+ parameters['rails.env'].should == 'production'
66
+ parameters['rails.root'].should == '/'
66
67
  end
67
68
 
68
- it "loads init params from configuration root" do
69
- @web_app.add_init_params
69
+ it "adds the rackup script as a context parameter when it's provided" do
70
+ FakeFS do
71
+ create_rackup_file
72
+ app = Trinidad::WebApp.create({}, {
73
+ :web_app_dir => Dir.pwd,
74
+ :rackup => 'config/config.ru'
75
+ })
70
76
 
71
- @web_app.context.findParameter('jruby.min.runtimes').should == '2'
72
- @web_app.context.findParameter('jruby.max.runtimes').should == '6'
77
+ parameters = app.init_params
78
+ parameters['rackup'].should =~ /run App/
79
+ end
73
80
  end
74
81
 
75
- it 'loads init params from application node' do
76
- @app[:jruby_min_runtimes] = 4
77
- @app[:jruby_max_runtimes] = 8
78
- @config[:web_apps][:default] = @app
82
+ it "ignores parameters from configuration when the deployment descriptor already contains them" do
83
+ FakeFS do
84
+ create_rackup_web_xml
79
85
 
80
- web_app = Trinidad::WebApp.create(@tomcat_web_app, @config, @app)
81
- web_app.add_init_params
82
-
83
- web_app.context.findParameter('jruby.min.runtimes').should == '4'
84
- web_app.context.findParameter('jruby.max.runtimes').should == '8'
85
- end
86
+ app = Trinidad::WebApp.create({}, {
87
+ :web_app_dir => Dir.pwd,
88
+ :default_web_xml => 'config/web.xml',
89
+ :jruby_min_runtimes => 2,
90
+ :jruby_max_runtimes => 5
91
+ })
92
+ parameters = app.init_params
86
93
 
87
- it "configures rack handler" do
88
- @web_app.configure_rack
89
- @web_app.context.findChild('RackServlet').should_not be_nil
94
+ parameters['jruby.min.runtimes'].should be_nil
95
+ parameters['jruby.max.runtimes'].should be_nil
96
+ end
90
97
  end
91
98
 
92
- it "configures rack listener" do
93
- @web_app.add_rack_context_listener
94
- @web_app.context.findApplicationListeners().should have(1).listeners
95
- end
96
-
97
- it "has rack handler already configured when web.xml includes it" do
98
- @web_app.load_default_web_xml
99
- @web_app.rack_configured?().should be_true
100
-
101
- @web_app.configure_rack
102
- @web_app.context.findChild('RackServlet').should be_nil
103
- end
104
-
105
- it "has rack listener already configured when web.xml includes it" do
106
- @web_app.load_default_web_xml
107
- @web_app.rack_listener_configured?().should be_true
108
-
109
- @web_app.add_rack_context_listener
110
- @web_app.context.findApplicationListeners().should have(0).listeners
111
- end
112
-
113
- it "loads the provided web.xml for rails applications" do
114
- @config[:default_web_xml] = 'config/foo.xml'
115
- app = Trinidad::WebApp.create(@tomcat_web_app, @config, @app)
116
-
117
- app.load_default_web_xml
118
- app.context.default_web_xml.should =~ /rails_web.xml$/
119
- end
120
-
121
- it "loads the provided web.xml for rack applications" do
122
- @config[:default_web_xml] = 'config/foo.xml'
123
- @app[:rackup] = 'config.ru'
124
-
125
- app = Trinidad::WebApp.create(@tomcat_web_app, @config, @app)
126
- app.load_default_web_xml
127
- app.context.default_web_xml.should =~ /rackup_web.xml$/
99
+ it "ignores the deployment descriptor when it doesn't exist" do
100
+ app = Trinidad::WebApp.create({}, {
101
+ :web_app_dir => Dir.pwd,
102
+ :default_web_xml => 'config/web.xml'
103
+ })
104
+ app.default_deployment_descriptor.should be_nil
128
105
  end
129
106
 
130
- def start_context_with_web_xml
131
- @web_app.load_default_web_xml
132
- start_context
107
+ it "doesn't load any web.xml when the deployment descriptor doesn't exist" do
108
+ app = Trinidad::WebApp.create({}, {
109
+ :web_app_dir => Dir.pwd,
110
+ :default_web_xml => 'config/web.xml'
111
+ })
112
+ app.rack_servlet_configured?.should be_false
113
+ app.rack_listener_configured?.should be_false
133
114
  end
134
115
 
135
- def start_context
136
- load_tomcat_libs
137
- lambda { @web_app.context.start }.should_not raise_error
116
+ it "uses `public` as default public root directory" do
117
+ app = Trinidad::WebApp.create({}, {})
118
+ app.public_root.should == 'public'
119
+ end
120
+
121
+ it "uses extensions from the global configuration" do
122
+ config = { :extensions => {:hotdeploy => {}} }
123
+ app = Trinidad::WebApp.create(config, {})
124
+ app.extensions.should include(:hotdeploy)
138
125
  end
139
126
 
140
- def load_tomcat_libs
141
- @web_app.config[:libs_dir] = File.join(File.dirname(__FILE__), '..', '..', 'tomcat-libs')
142
- @web_app.add_context_loader
127
+ it "overrides global extensions with application extensions" do
128
+ config = { :extensions => {:hotdeploy => {}} }
129
+ app_config = { :extensions => {:hotdeploy => {:delay => 30000}} }
130
+ app = Trinidad::WebApp.create(config, app_config)
131
+ app.extensions[:hotdeploy].should include(:delay)
143
132
  end
144
133
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 0
9
- version: 0.9.0
8
+ - 1
9
+ version: 0.9.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - David Calavera
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-28 00:00:00 +02:00
17
+ date: 2010-05-09 00:00:00 +02:00
18
18
  default_executable: trinidad
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -111,12 +111,11 @@ files:
111
111
  - lib/trinidad/command_line_parser.rb
112
112
  - lib/trinidad/core_ext.rb
113
113
  - lib/trinidad/extensions.rb
114
- - lib/trinidad/rackup_web.xml
115
114
  - lib/trinidad/rackup_web_app.rb
116
- - lib/trinidad/rails_web.xml
117
115
  - lib/trinidad/rails_web_app.rb
118
116
  - lib/trinidad/server.rb
119
117
  - lib/trinidad/web_app.rb
118
+ - lib/trinidad/web_app_lifecycle_listener.rb
120
119
  has_rdoc: true
121
120
  homepage: http://calavera.github.com/trinidad
122
121
  licenses: []
@@ -155,4 +154,5 @@ test_files:
155
154
  - spec/trinidad/extensions_spec.rb
156
155
  - spec/trinidad/fakeapp.rb
157
156
  - spec/trinidad/server_spec.rb
157
+ - spec/trinidad/web_app_lifecycle_listener_spec.rb
158
158
  - spec/trinidad/web_app_spec.rb
@@ -1,17 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <web-app>
3
- <servlet>
4
- <servlet-name>RackServlet</servlet-name>
5
- <servlet-class>org.jruby.rack.RackServlet</servlet-class>
6
- </servlet>
7
-
8
- <servlet-mapping>
9
- <servlet-name>RackServlet</servlet-name>
10
- <url-pattern>/*</url-pattern>
11
- </servlet-mapping>
12
-
13
- <listener>
14
- <listener-class>org.jruby.rack.RackServletContextListener</listener-class>
15
- </listener>
16
-
17
- </web-app>
@@ -1,17 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <web-app>
3
- <servlet>
4
- <servlet-name>RackServlet</servlet-name>
5
- <servlet-class>org.jruby.rack.RackServlet</servlet-class>
6
- </servlet>
7
-
8
- <servlet-mapping>
9
- <servlet-name>RackServlet</servlet-name>
10
- <url-pattern>/*</url-pattern>
11
- </servlet-mapping>
12
-
13
- <listener>
14
- <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
15
- </listener>
16
-
17
- </web-app>