Skip to content

Commit

Permalink
do not run jetty test with jdk6. add same test for tomcat
Browse files Browse the repository at this point in the history
  • Loading branch information
mkristian committed Jan 14, 2015
1 parent ce87497 commit 753dd28
Show file tree
Hide file tree
Showing 10 changed files with 277 additions and 1 deletion.
2 changes: 1 addition & 1 deletion maven/jruby/pom.rb
Expand Up @@ -65,7 +65,7 @@
activation do
jdk '1.6'
end
plugin :invoker, :pomExcludes => ['extended/pom.xml', 'jetty/pom.xml','j2ee_jetty/pom.xml','j2ee_wildfly/pom.xml', '${its.j2ee}', '${its.osgi}']
plugin :invoker, :pomExcludes => ['extended/pom.xml', 'jetty/pom.xml','j2ee_jetty_rack/pom.xml','j2ee_jetty/pom.xml','j2ee_wildfly/pom.xml', '${its.j2ee}', '${its.osgi}']
end

profile :id => :wlp do
Expand Down
1 change: 1 addition & 0 deletions maven/jruby/pom.xml
Expand Up @@ -141,6 +141,7 @@
<pomExcludes>
<pomExclude>extended/pom.xml</pomExclude>
<pomExclude>jetty/pom.xml</pomExclude>
<pomExclude>j2ee_jetty_rack/pom.xml</pomExclude>
<pomExclude>j2ee_jetty/pom.xml</pomExclude>
<pomExclude>j2ee_wildfly/pom.xml</pomExclude>
<pomExclude>${its.j2ee}</pomExclude>
Expand Down
1 change: 1 addition & 0 deletions maven/jruby/src/it/j2ee_tomcat_rack/.gitignore
@@ -0,0 +1 @@
pkg
4 changes: 4 additions & 0 deletions maven/jruby/src/it/j2ee_tomcat_rack/.jrubydir
@@ -0,0 +1,4 @@
.
config.ru
gems
specifications
80 changes: 80 additions & 0 deletions maven/jruby/src/it/j2ee_tomcat_rack/Mavenfile
@@ -0,0 +1,80 @@
#-*- mode: ruby -*-

# it is war-file
packaging 'war'

# get jruby dependencies
properties( 'jruby.version' => '@project.version@',
'jruby.plugins.version' => '1.0.7',
'project.build.sourceEncoding' => 'utf-8',
'public.dir' => '${basedir}/public' )

pom( 'org.jruby:jruby', '${jruby.version}' )

jar( 'org.jruby.rack:jruby-rack', '1.1.18',
:exclusions => [ 'org.jruby:jruby-complete' ] )


# ruby-maven will dump an equivalent pom.xml
properties[ 'tesla.dump.pom' ] = 'pom.xml'

# a gem to be used
gem 'flickraw', '0.9.7'

repository( :url => 'http://rubygems-proxy.torquebox.org/releases',
:id => 'rubygems-releases' )

jruby_plugin :gem, :includeRubygemsInResources => true, :includeLibDirectoryInResources => true do
execute_goal :initialize
end

# not really needed but for completeness:
# pack the war with that ruby-like directory layout
plugin( :war, '2.2',
:warSourceDirectory => '${public.dir}' )

resource :directory => '${basedir}', :includes => [ 'config.ru', '.jrubydir' ]

# start tomcat for the tests
plugin( 'org.codehaus.mojo:tomcat-maven-plugin', '1.1',
:fork => true, :path => '/',
:warSourceDirectory => '${public.dir}' ) do
execute_goals( 'run',
:id => 'run-tomcat',
:phase => 'pre-integration-test' )
end

# download files during the tests
execute 'download', :phase => 'integration-test' do
require 'open-uri'
result = open( 'http://localhost:8080' ).string
File.open( 'result', 'w' ) { |f| f.puts result }
puts result
end

# verify the downloads
execute 'check download', :phase => :verify do
result = File.read( 'result' )
expected = 'hello world:'
unless result.match( /^#{expected}/ )
raise "missed expected string in download: #{expected}"
end
expected = 'self: uri:classloader://config.ru'
unless result.match( /#{expected}/ )
raise "missed expected string in download: #{expected}"
end
expected = 'PWD: uri:classloader://'
unless result.match( /#{expected}/ )
raise "missed expected string in download: #{expected}"
end
expected = 'Gem.path: ."uri:classloader://",'
unless result.match( /#{expected}/ )
raise "missed expected string in download: #{expected}"
end
# TODO get rid off this over normalization
expected = 'uri:classloader:/gems/flickraw-0.9.7'
unless result.match( /#{expected}/ )
raise "missed expected string in download: #{expected}"
end
end
# vim: syntax=Ruby
19 changes: 19 additions & 0 deletions maven/jruby/src/it/j2ee_tomcat_rack/config.ru
@@ -0,0 +1,19 @@
#-*- mode: ruby -*-

use Rack::ShowExceptions

require 'hello_world'

run lambda { |env|
require 'flickraw'
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
[ "self: #{__FILE__}\n", "PWD: #{Dir.pwd}\n", "Gem.path: #{Gem.path.inspect}\n", Gem.loaded_specs['flickraw'].gem_dir + "\n", HelloWorld.new + "\n" ]
]
}

# vim: syntax=Ruby
7 changes: 7 additions & 0 deletions maven/jruby/src/it/j2ee_tomcat_rack/lib/hello_world.rb
@@ -0,0 +1,7 @@
require 'openssl'

class HelloWorld < String
def initialize
super "hello world: #{OpenSSL::Random.random_bytes( 16 ).inspect}"
end
end
140 changes: 140 additions & 0 deletions maven/jruby/src/it/j2ee_tomcat_rack/pom.xml
@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>no_group_id_given</groupId>
<artifactId>j2ee_tomcat_rack</artifactId>
<version>0.0.0</version>
<packaging>war</packaging>
<name>j2ee_tomcat_rack</name>
<properties>
<jruby.version>@project.version@</jruby.version>
<jruby.plugins.version>1.0.7</jruby.plugins.version>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
<public.dir>${basedir}/public</public.dir>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<tesla.version>0.1.1</tesla.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby</artifactId>
<version>${jruby.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jruby.rack</groupId>
<artifactId>jruby-rack</artifactId>
<version>1.1.18</version>
<exclusions>
<exclusion>
<artifactId>jruby-complete</artifactId>
<groupId>org.jruby</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>flickraw</artifactId>
<version>0.9.7</version>
<type>gem</type>
</dependency>
</dependencies>
<repositories>
<repository>
<id>rubygems-releases</id>
<url>http://rubygems-proxy.torquebox.org/releases</url>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>${basedir}</directory>
<includes>
<include>config.ru</include>
<include>.jrubydir</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>de.saumya.mojo</groupId>
<artifactId>gem-maven-plugin</artifactId>
<version>${jruby.plugins.version}</version>
<executions>
<execution>
<goals>
<goal>initialize</goal>
</goals>
</execution>
</executions>
<configuration>
<includeRubygemsInResources>true</includeRubygemsInResources>
<includeLibDirectoryInResources>true</includeLibDirectoryInResources>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<warSourceDirectory>${public.dir}</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>run-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<fork>true</fork>
<path>/</path>
<warSourceDirectory>${public.dir}</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>io.tesla.polyglot</groupId>
<artifactId>tesla-polyglot-maven-plugin</artifactId>
<version>${tesla.version}</version>
<executions>
<execution>
<id>download</id>
<phase>integration-test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<taskId>download</taskId>
<nativePom>Mavenfile</nativePom>
</configuration>
</execution>
<execution>
<id>check download</id>
<phase>verify</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<taskId>check download</taskId>
<nativePom>Mavenfile</nativePom>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.tesla.polyglot</groupId>
<artifactId>tesla-polyglot-ruby</artifactId>
<version>${tesla.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
2 changes: 2 additions & 0 deletions maven/jruby/src/it/j2ee_tomcat_rack/public/WEB-INF/.gitignore
@@ -0,0 +1,2 @@
classes
config.ru
22 changes: 22 additions & 0 deletions maven/jruby/src/it/j2ee_tomcat_rack/public/WEB-INF/web.xml
@@ -0,0 +1,22 @@
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>jruby.rack.layout_class</param-name>
<param-value>JRuby::Rack::ClassPathLayout</param-value>
</context-param>

<filter>
<filter-name>RackFilter</filter-name>
<filter-class>org.jruby.rack.RackFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RackFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
<listener-class>org.jruby.rack.RackServletContextListener</listener-class>
</listener>
</web-app>

0 comments on commit 753dd28

Please sign in to comment.