trinidad_jars 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +26 -0
- data/README.rdoc +48 -0
- data/bin/trinidad +9 -0
- data/lib/trinidad/jars.rb +31 -0
- data/spec/fixtures/foo.rb +15 -0
- data/spec/fixtures/trinidad_foo_extension.rb +1 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/trinidad/command_line_parser_spec.rb +85 -0
- data/spec/trinidad/extensions_spec.rb +19 -0
- data/spec/trinidad/server_spec.rb +105 -0
- data/spec/trinidad/web_app_spec.rb +112 -0
- data/trinidad-libs/jetty-util-6.1.14.jar +0 -0
- data/trinidad-libs/jruby-rack-0.9.7-SNAPSHOT.jar +0 -0
- data/trinidad-libs/jsp-2.1.jar +0 -0
- data/trinidad-libs/jsp-api-2.1.jar +0 -0
- data/trinidad-libs/servlet-api-2.5-6.1.14.jar +0 -0
- data/trinidad-libs/tomcat-core.jar +0 -0
- metadata +77 -0
data/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
== Trinidad
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2009 David Calavera
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
== Additional Bundled Software
|
|
25
|
+
|
|
26
|
+
Apache Tomcat is licensed according to the terms of Apache License, Version 2.0 (current). See http://www.apache.org/licenses/LICENSE-2.0 for details.
|
data/README.rdoc
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
= trinidad
|
|
2
|
+
|
|
3
|
+
Trinidad allows you to run a rails or rackup applications within an embedded Apache Tomcat container.
|
|
4
|
+
|
|
5
|
+
This project was initially called "Tomcat-rails" but due to legal issues with the ASF and the Tomcat trademark it has been renamed.
|
|
6
|
+
|
|
7
|
+
== INSTALL:
|
|
8
|
+
|
|
9
|
+
jgem install trinidad
|
|
10
|
+
jgem install calavera-trinidad -s http://gems.github.com
|
|
11
|
+
|
|
12
|
+
== USAGE:
|
|
13
|
+
|
|
14
|
+
cd myrailsapp
|
|
15
|
+
jruby -S trinidad
|
|
16
|
+
|
|
17
|
+
== CONFIGURATION:
|
|
18
|
+
|
|
19
|
+
Trinidad allows you to configure some parameters when the server is started from the command line, the following is a list of the currently supported options:
|
|
20
|
+
|
|
21
|
+
* -p, --port PORT => port to bind to.
|
|
22
|
+
* -e, --env ENVIRONMENT => rails environment.
|
|
23
|
+
* -c, --context CONTEXT => application context path.
|
|
24
|
+
* --lib, --jars LIBS_DIR => directory containing jars.
|
|
25
|
+
* --classes CLASSES_DIR => directory containing classes.
|
|
26
|
+
* --rackup [RACKUP_FILE] => run a provided rackup file instead of a rails application, by default it's config.ru.
|
|
27
|
+
* --public PUBLIC_DIR => specify the public directory for your application, by default it's 'public'.
|
|
28
|
+
|
|
29
|
+
The server can also be configured from a yaml file. If a file is not especified, the server tries to load the file <em>config/tomcat.yml</em>. Within this file you can add other options like jruby.min.runtimes(:jruby_min_runtimes) or jruby.max.runtimes(:jruby_max_runtimes).
|
|
30
|
+
|
|
31
|
+
jruby -S trinidad -f
|
|
32
|
+
jruby -S trinidad --config my_custom_configuration.yml
|
|
33
|
+
|
|
34
|
+
You can also specify a default web.xml to config your web application. By default the server tries to load the file <em>config/web.xml</em> but you can modify this path adding the option <em>default_web_xml</em> within your configuration file.
|
|
35
|
+
|
|
36
|
+
Other advanced options can be found in the wiki: http://wiki.github.com/calavera/trinidad/advanced-configuration
|
|
37
|
+
|
|
38
|
+
== EXTENSIONS:
|
|
39
|
+
|
|
40
|
+
From the version 0.8.0 Trinidad allows to extend the server with more Tomcat features, here there is a list with the current available extensions:
|
|
41
|
+
|
|
42
|
+
* Database connection pooling: http://github.com/calavera/trinidad-dbpool
|
|
43
|
+
|
|
44
|
+
You can find further information on how to write your onw extension in the wiki: http://wiki.github.com/calavera/trinidad/extensions
|
|
45
|
+
|
|
46
|
+
== Copyright
|
|
47
|
+
|
|
48
|
+
Copyright (c) 2010 David Calavera<calavera@apache.org>. See LICENSE for details.
|
data/bin/trinidad
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
TRINIDAD_LIBS = File.dirname(__FILE__) + "/../../trinidad-libs" unless defined?(TRINIDAD_LIBS)
|
|
2
|
+
$:.unshift(TRINIDAD_LIBS) unless
|
|
3
|
+
$:.include?(TRINIDAD_LIBS) || $:.include?(File.expand_path(TRINIDAD_LIBS))
|
|
4
|
+
|
|
5
|
+
module Trinidad
|
|
6
|
+
require 'servlet-api-2.5-6.1.14'
|
|
7
|
+
require 'jsp-api-2.1'
|
|
8
|
+
require 'jsp-2.1'
|
|
9
|
+
require 'tomcat-core'
|
|
10
|
+
require 'jetty-util-6.1.14'
|
|
11
|
+
|
|
12
|
+
require 'jruby-rack-0.9.7-SNAPSHOT'
|
|
13
|
+
|
|
14
|
+
module Tomcat
|
|
15
|
+
include_package 'org.apache.catalina'
|
|
16
|
+
include_package 'org.apache.catalina.startup'
|
|
17
|
+
include_package 'org.apache.catalina.core'
|
|
18
|
+
include_package 'org.apache.catalina.deploy'
|
|
19
|
+
include_package 'org.apache.catalina.loader'
|
|
20
|
+
|
|
21
|
+
include_package 'org.apache.naming.resources'
|
|
22
|
+
|
|
23
|
+
import 'org.apache.catalina.connector.Connector'
|
|
24
|
+
import 'sun.security.tools.KeyTool'
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
module Rack
|
|
28
|
+
include_package 'org.jruby.rack'
|
|
29
|
+
include_package 'org.jruby.rack.rails'
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Trinidad
|
|
2
|
+
module Extensions
|
|
3
|
+
class FooWebAppExtension < WebAppExtension
|
|
4
|
+
def configure(tomcat, app_context)
|
|
5
|
+
@options
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class FooServerExtension < ServerExtension
|
|
10
|
+
def configure(tomcat)
|
|
11
|
+
@options
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/foo'
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'spec'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
gem 'rspec'
|
|
6
|
+
require 'spec'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
|
10
|
+
$:.unshift(File.dirname(__FILE__) + '/../trinidad-libs')
|
|
11
|
+
$:.unshift(File.dirname(__FILE__) + '/fixtures')
|
|
12
|
+
|
|
13
|
+
require 'java'
|
|
14
|
+
require 'trinidad'
|
|
15
|
+
require 'mocha'
|
|
16
|
+
|
|
17
|
+
Spec::Runner.configure do |config|
|
|
18
|
+
config.mock_with :mocha
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
MOCK_WEB_APP_DIR = File.join(File.dirname(__FILE__), 'web_app_mock')
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Trinidad::CommandLineParser do
|
|
4
|
+
it "should override classes option" do
|
|
5
|
+
ARGV = "--classes my_classes".split
|
|
6
|
+
|
|
7
|
+
options = Trinidad::CommandLineParser.parse
|
|
8
|
+
options[:classes_dir].should == 'my_classes'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "should override libs option with lib option" do
|
|
12
|
+
ARGV = "--lib my_libs".split
|
|
13
|
+
|
|
14
|
+
options = Trinidad::CommandLineParser.parse
|
|
15
|
+
options[:libs_dir].should == 'my_libs'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "should override libs option with jar option" do
|
|
19
|
+
ARGV = "--jars my_jars".split
|
|
20
|
+
|
|
21
|
+
options = Trinidad::CommandLineParser.parse
|
|
22
|
+
options[:libs_dir].should == 'my_jars'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should override the config file when it's especified" do
|
|
26
|
+
ARGV = "-f #{File.join(MOCK_WEB_APP_DIR, 'tomcat.yml')}".split
|
|
27
|
+
|
|
28
|
+
options = Trinidad::CommandLineParser.parse
|
|
29
|
+
options[:environment].should == 'production'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "should add default ssl port to options" do
|
|
33
|
+
ARGV = '--ssl'.split
|
|
34
|
+
|
|
35
|
+
options = Trinidad::CommandLineParser.parse
|
|
36
|
+
options[:ssl].should == {:port => 8443}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "should add custom ssl port to options" do
|
|
40
|
+
ARGV = '--ssl 8843'.split
|
|
41
|
+
|
|
42
|
+
options = Trinidad::CommandLineParser.parse
|
|
43
|
+
options[:ssl].should == {:port => 8843}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "should add ajp connection with default port to options" do
|
|
47
|
+
ARGV = '--ajp'.split
|
|
48
|
+
|
|
49
|
+
options = Trinidad::CommandLineParser.parse
|
|
50
|
+
options[:ajp].should == {:port => 8009}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it "should add ajp connection with coustom port to options" do
|
|
54
|
+
ARGV = '--ajp 8099'.split
|
|
55
|
+
|
|
56
|
+
options = Trinidad::CommandLineParser.parse
|
|
57
|
+
options[:ajp].should == {:port => 8099}
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "should merge ajp options from the config file" do
|
|
61
|
+
ARGV = "--ajp 8099 -f #{File.join(MOCK_WEB_APP_DIR, 'tomcat.yml')}".split
|
|
62
|
+
|
|
63
|
+
options = Trinidad::CommandLineParser.parse
|
|
64
|
+
options[:ajp][:port].should == 8099
|
|
65
|
+
options[:ajp][:secure].should == true
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "uses default rackup file to configure the server" do
|
|
69
|
+
ARGV = "--rackup".split
|
|
70
|
+
options = Trinidad::CommandLineParser.parse
|
|
71
|
+
options[:rackup].should == 'config.ru'
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "uses a custom rackup file if it's provided" do
|
|
75
|
+
ARGV = "--rackup custom_config.ru".split
|
|
76
|
+
options = Trinidad::CommandLineParser.parse
|
|
77
|
+
options[:rackup].should == 'custom_config.ru'
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "uses a custom public directory" do
|
|
81
|
+
ARGV = "--public web".split
|
|
82
|
+
options = Trinidad::CommandLineParser.parse
|
|
83
|
+
options[:public].should == 'web'
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
require 'optparse'
|
|
3
|
+
|
|
4
|
+
describe Trinidad::Extensions do
|
|
5
|
+
|
|
6
|
+
before(:each) do
|
|
7
|
+
@extensions = {:foo => {:bar => :bazz}}
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "configures the server with new stuff" do
|
|
11
|
+
lambda {Trinidad::Extensions.configure_server_extensions(@extensions, nil)}.should_not raise_error
|
|
12
|
+
lambda {Trinidad::Extensions.const_get(:FooServerExtension)}.should_not raise_error
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "configures the webapp with new stuff" do
|
|
16
|
+
lambda {Trinidad::Extensions.configure_webapp_extensions(@extensions, nil, nil)}.should_not raise_error
|
|
17
|
+
lambda {Trinidad::Extensions.const_get(:FooWebAppExtension)}.should_not raise_error
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
|
|
3
|
+
JSystem = java.lang.System
|
|
4
|
+
JContext = javax.naming.Context
|
|
5
|
+
|
|
6
|
+
describe Trinidad::Server do
|
|
7
|
+
|
|
8
|
+
it "always uses symbols as configuration keys" do
|
|
9
|
+
server = Trinidad::Server.new({'port' => 4000})
|
|
10
|
+
server.config[:port].should == 4000
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "enables catalina naming" do
|
|
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"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "should have ssl disabled when config param is nil" do
|
|
21
|
+
server = Trinidad::Server.new
|
|
22
|
+
server.ssl_enabled?.should == false
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should have ajp disabled when config param is nil" do
|
|
26
|
+
server = Trinidad::Server.new
|
|
27
|
+
server.ajp_enabled?.should == false
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should have ssl enabled when config param is a number" do
|
|
31
|
+
server = Trinidad::Server.new({:ssl => {:port => 8443},
|
|
32
|
+
:web_app_dir => MOCK_WEB_APP_DIR})
|
|
33
|
+
|
|
34
|
+
server.ssl_enabled?.should == true
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it "should have ajp enabled when config param is a number" do
|
|
38
|
+
server = Trinidad::Server.new({:ajp => {:port => 8009}})
|
|
39
|
+
|
|
40
|
+
server.ajp_enabled?.should == true
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "should have a connector with https scheme" do
|
|
44
|
+
server = Trinidad::Server.new({:ssl => {:port => 8443},
|
|
45
|
+
:web_app_dir => MOCK_WEB_APP_DIR})
|
|
46
|
+
|
|
47
|
+
server.tomcat.service.findConnectors().should have(1).connectors
|
|
48
|
+
server.tomcat.service.findConnectors()[0].scheme.should == 'https'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "should have an ajp connector enabled" do
|
|
52
|
+
server = Trinidad::Server.new({:ajp => {:port => 8009}})
|
|
53
|
+
|
|
54
|
+
server.tomcat.service.findConnectors().should have(1).connectors
|
|
55
|
+
server.tomcat.service.findConnectors()[0].protocol.should == 'AJP/1.3'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "loads one application for each option present into :web_apps" do
|
|
59
|
+
server = Trinidad::Server.new({
|
|
60
|
+
:web_apps => {
|
|
61
|
+
:mock1 => {
|
|
62
|
+
:context_path => '/mock1',
|
|
63
|
+
:web_app_dir => MOCK_WEB_APP_DIR
|
|
64
|
+
},
|
|
65
|
+
:mock2 => {
|
|
66
|
+
:web_app_dir => MOCK_WEB_APP_DIR
|
|
67
|
+
},
|
|
68
|
+
:default => {
|
|
69
|
+
:web_app_dir => MOCK_WEB_APP_DIR
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
context_loaded = server.tomcat.host.findChildren()
|
|
75
|
+
context_loaded.should have(3).web_apps
|
|
76
|
+
|
|
77
|
+
expected = ['/mock1', '/mock2', '/']
|
|
78
|
+
context_loaded.each do |context|
|
|
79
|
+
expected.delete(context.getPath()).should == context.getPath()
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "loads the default application from the current directory if :web_apps is not present" do
|
|
84
|
+
server = Trinidad::Server.new({:web_app_dir => MOCK_WEB_APP_DIR})
|
|
85
|
+
|
|
86
|
+
default_context_should_be_loaded(server.tomcat.host.findChildren())
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it "loads the default application from the current directory using the rackup file if :web_apps is not present" do
|
|
90
|
+
server = Trinidad::Server.new({
|
|
91
|
+
:web_app_dir => MOCK_WEB_APP_DIR,
|
|
92
|
+
:rackup => 'config.ru'
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
context = default_context_should_be_loaded(server.tomcat.host.findChildren())
|
|
96
|
+
context.findParameter('rackup').gsub(/\s+/, ' ').should == "require 'rubygems' require 'sinatra'"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def default_context_should_be_loaded(children)
|
|
100
|
+
children.should have(1).web_apps
|
|
101
|
+
children[0].getDocBase().should == MOCK_WEB_APP_DIR
|
|
102
|
+
children[0].getPath().should == '/'
|
|
103
|
+
children[0]
|
|
104
|
+
end
|
|
105
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Trinidad::WebApp do
|
|
4
|
+
before do
|
|
5
|
+
@tomcat = Trinidad::Tomcat::Tomcat.new
|
|
6
|
+
@tomcat_web_app = @tomcat.addWebapp('/', File.dirname(__FILE__) + '/../../')
|
|
7
|
+
@app = {
|
|
8
|
+
:web_app_dir => MOCK_WEB_APP_DIR,
|
|
9
|
+
:context_path => '/'
|
|
10
|
+
}
|
|
11
|
+
@config = {
|
|
12
|
+
:libs_dir => 'lib',
|
|
13
|
+
:classes_dir => 'classes',
|
|
14
|
+
:default_web_xml => 'config/web.xml',
|
|
15
|
+
:jruby_min_runtimes => 2,
|
|
16
|
+
:jruby_max_runtimes => 6,
|
|
17
|
+
:web_apps => {
|
|
18
|
+
:default => @app
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
@web_app = Trinidad::RailsWebApp.new(@tomcat_web_app, @config, @app)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "creates a RailsWebApp if rackup option is not present" do
|
|
25
|
+
Trinidad::WebApp.create(@tomcat_web_app, @config, @app).is_a?(Trinidad::RailsWebApp).should be_true
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "creates a RackupWebApp if rackup option is present" do
|
|
29
|
+
rackup_app = {:rackup => 'config.ru'}
|
|
30
|
+
@config.deep_merge({:web_apps => {:default => rackup_app}})
|
|
31
|
+
Trinidad::WebApp.create(@tomcat_web_app, @config, rackup_app).is_a?(Trinidad::RackupWebApp).should be_true
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should load custom jars" do
|
|
35
|
+
class_loader = org.jruby.util.JRubyClassLoader.new(JRuby.runtime.jruby_class_loader)
|
|
36
|
+
@web_app.add_application_libs(class_loader)
|
|
37
|
+
|
|
38
|
+
resource = class_loader.find_class('org.ho.yaml.Yaml')
|
|
39
|
+
resource.should_not == nil
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it "should load custom classes" do
|
|
43
|
+
class_loader = org.jruby.util.JRubyClassLoader.new(JRuby.runtime.jruby_class_loader)
|
|
44
|
+
@web_app.add_application_classes(class_loader)
|
|
45
|
+
|
|
46
|
+
resource = class_loader.find_class('HelloTomcat')
|
|
47
|
+
resource.should_not == nil
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "should start application context without errors" do
|
|
51
|
+
start_context
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it "should add a filter from the default web.xml" do
|
|
55
|
+
start_context_with_web_xml
|
|
56
|
+
@web_app.context.findFilterDefs().should have(1).filters
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it "shouldn't duplicate init params" do
|
|
60
|
+
start_context_with_web_xml
|
|
61
|
+
lambda { @web_app.add_init_params }.should_not raise_error
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "should load init params" do
|
|
65
|
+
@web_app.add_init_params
|
|
66
|
+
|
|
67
|
+
@web_app.context.findParameter('jruby.min.runtimes').should == '2'
|
|
68
|
+
@web_app.context.findParameter('jruby.max.runtimes').should == '6'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "should configure rack filter" do
|
|
72
|
+
@web_app.add_rack_filter
|
|
73
|
+
@web_app.context.findFilterDefs().should have(1).filters
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "should configure rack listener" do
|
|
77
|
+
@web_app.add_rack_context_listener
|
|
78
|
+
@web_app.context.findApplicationListeners().should have(1).listeners
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it "should have rack filter already configured" do
|
|
82
|
+
@web_app.load_default_web_xml
|
|
83
|
+
@web_app.rack_filter_configured?().should == true
|
|
84
|
+
|
|
85
|
+
@web_app.add_rack_filter
|
|
86
|
+
@web_app.context.findFilterDefs().should have(0).filters
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it "should have rack listener already configured" do
|
|
90
|
+
@web_app.load_default_web_xml
|
|
91
|
+
@web_app.rack_listener_configured?().should == true
|
|
92
|
+
|
|
93
|
+
@web_app.add_rack_context_listener
|
|
94
|
+
@web_app.context.findApplicationListeners().should have(0).listeners
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def start_context_with_web_xml
|
|
98
|
+
@web_app.load_default_web_xml
|
|
99
|
+
start_context
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def start_context
|
|
103
|
+
load_tomcat_libs
|
|
104
|
+
lambda { @web_app.context.start }.should_not raise_error
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def load_tomcat_libs
|
|
108
|
+
@web_app.config[:libs_dir] = File.join(File.dirname(__FILE__), '..', '..', 'tomcat-libs')
|
|
109
|
+
@web_app.add_context_loader
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
end
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
metadata
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: trinidad_jars
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
prerelease: false
|
|
5
|
+
segments:
|
|
6
|
+
- 0
|
|
7
|
+
- 1
|
|
8
|
+
- 0
|
|
9
|
+
version: 0.1.0
|
|
10
|
+
platform: ruby
|
|
11
|
+
authors:
|
|
12
|
+
- David Calavera
|
|
13
|
+
autorequire:
|
|
14
|
+
bindir: bin
|
|
15
|
+
cert_chain: []
|
|
16
|
+
|
|
17
|
+
date: 2010-04-04 00:00:00 +02:00
|
|
18
|
+
default_executable: trinidad
|
|
19
|
+
dependencies: []
|
|
20
|
+
|
|
21
|
+
description:
|
|
22
|
+
email: calavera@apache.org
|
|
23
|
+
executables:
|
|
24
|
+
- trinidad
|
|
25
|
+
extensions: []
|
|
26
|
+
|
|
27
|
+
extra_rdoc_files:
|
|
28
|
+
- LICENSE
|
|
29
|
+
- README.rdoc
|
|
30
|
+
files:
|
|
31
|
+
- lib/trinidad/jars.rb
|
|
32
|
+
- trinidad-libs/jetty-util-6.1.14.jar
|
|
33
|
+
- trinidad-libs/jruby-rack-0.9.7-SNAPSHOT.jar
|
|
34
|
+
- trinidad-libs/jsp-2.1.jar
|
|
35
|
+
- trinidad-libs/jsp-api-2.1.jar
|
|
36
|
+
- trinidad-libs/servlet-api-2.5-6.1.14.jar
|
|
37
|
+
- trinidad-libs/tomcat-core.jar
|
|
38
|
+
- LICENSE
|
|
39
|
+
- README.rdoc
|
|
40
|
+
has_rdoc: true
|
|
41
|
+
homepage: http://calavera.github.com/trinidad
|
|
42
|
+
licenses: []
|
|
43
|
+
|
|
44
|
+
post_install_message:
|
|
45
|
+
rdoc_options:
|
|
46
|
+
- --charset=UTF-8
|
|
47
|
+
require_paths:
|
|
48
|
+
- lib
|
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
segments:
|
|
54
|
+
- 0
|
|
55
|
+
version: "0"
|
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
segments:
|
|
61
|
+
- 0
|
|
62
|
+
version: "0"
|
|
63
|
+
requirements: []
|
|
64
|
+
|
|
65
|
+
rubyforge_project: trinidad_jars
|
|
66
|
+
rubygems_version: 1.3.6
|
|
67
|
+
signing_key:
|
|
68
|
+
specification_version: 3
|
|
69
|
+
summary: Common jars for Trinidad
|
|
70
|
+
test_files:
|
|
71
|
+
- spec/fixtures/foo.rb
|
|
72
|
+
- spec/fixtures/trinidad_foo_extension.rb
|
|
73
|
+
- spec/spec_helper.rb
|
|
74
|
+
- spec/trinidad/command_line_parser_spec.rb
|
|
75
|
+
- spec/trinidad/extensions_spec.rb
|
|
76
|
+
- spec/trinidad/server_spec.rb
|
|
77
|
+
- spec/trinidad/web_app_spec.rb
|