forked from jruby/jruby
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: VERSION core/pom.xml core/src/main/java/org/jruby/RubyString.java core/src/main/java/org/jruby/RubyStruct.java core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java docs/man/pom.xml docs/pom.xml ext/pom.xml ext/readline/pom.xml ext/ripper/pom.xml lib/pom.rb lib/pom.xml maven/jruby-complete/pom.xml maven/jruby-complete/src/it/integrity/verify.bsh maven/jruby-dist/pom.xml maven/jruby-dist/src/it/integrity/verify.bsh maven/jruby-jars/pom.xml maven/jruby-jars/src/it/integrity/verify.bsh maven/jruby-noasm/pom.xml maven/jruby-noasm/src/it/integrity/verify.bsh maven/jruby-rake-plugin/pom.xml maven/jruby-stdlib/pom.xml maven/jruby/pom.rb maven/jruby/pom.xml maven/jruby/src/it/integrity/verify.bsh maven/jruby/src/it/runnable/pom.xml maven/pom.xml pom.xml rakelib/test.rake spec/regression/GH-2524_bigdecimal_loss_of_precision_with_different_excution_order_spec.rb test/externals/ruby1.9/excludes/OpenSSL/TestASN1.rb test/externals/ruby1.9/excludes/OpenSSL/TestCipher.rb test/externals/ruby1.9/excludes/OpenSSL/TestDigest.rb test/externals/ruby1.9/excludes/OpenSSL/TestX509Name.rb test/externals/ruby1.9/excludes/OpenSSL/TestX509Request.rb test/externals/ruby1.9/openssl/test_asn1.rb test/pom.xml test/test_adding_pem_to_x509store.rb
- Loading branch information
Showing
33 changed files
with
1,054 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
core/src/test/java/org/jruby/embed/IsolatedScriptingContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.jruby.embed; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.fail; | ||
|
||
import java.net.URL; | ||
import java.net.URLClassLoader; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
public class IsolatedScriptingContainerTest { | ||
|
||
static ClassLoader cl; | ||
|
||
@BeforeClass | ||
public static void setupClassLoader() { | ||
cl = Thread.currentThread().getContextClassLoader(); | ||
// make sure we have classloader which does not find jruby | ||
ClassLoader c = new URLClassLoader( new URL[] {}, null ); | ||
try { | ||
c.loadClass( "org.jruby.embed.ScriptingContainer" ); | ||
fail( "this classloader shall not find jruby" ); | ||
} | ||
catch( ClassNotFoundException expected){} | ||
// set it as context classloader | ||
Thread.currentThread().setContextClassLoader( c ); | ||
} | ||
|
||
@AfterClass | ||
public static void restClassLoader() { | ||
Thread.currentThread().setContextClassLoader( cl ); | ||
} | ||
|
||
@Test | ||
public void testIsolatedScriptingContainer() throws Exception { | ||
// we do have an instance of "jruby" loaded via some other classloader | ||
//System.setProperty("jruby.debug.loadService", "true"); | ||
ScriptingContainer instance = new IsolatedScriptingContainer(); | ||
String result = instance.runScriptlet( "$LOAD_PATH" ).toString(); | ||
assertNotNull(result); | ||
|
||
assertEquals(instance.runScriptlet("JRuby.runtime.jruby_class_loader.parent" ), cl ); | ||
assertEquals(ScriptingContainer.class.getClassLoader(), cl); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# dummy to run IsolatedScriptingContainerTest | ||
module Gem | ||
class Specification | ||
def self.reset | ||
end | ||
def self.add_dir *args | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
. | ||
config.ru | ||
gems | ||
specifications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 jetty for the tests | ||
plugin( 'org.eclipse.jetty:jetty-maven-plugin', '9.1.3.v20140225', | ||
:path => '/', | ||
:webAppSourceDirectory => '${public.dir}', | ||
:stopPort => 9999, | ||
:stopKey => 'foo' ) do | ||
execute_goal( 'start', :id => 'start jetty', :phase => 'pre-integration-test', :daemon => true ) | ||
execute_goal( 'stop', :id => 'stop jetty', :phase => 'post-integration-test' ) | ||
end | ||
|
||
# download files during the tests | ||
result = nil | ||
execute 'download', :phase => 'integration-test' do | ||
require 'open-uri' | ||
result = open( 'http://localhost:8080' ).string | ||
puts result | ||
end | ||
|
||
# verify the downloads | ||
execute 'check download', :phase => :verify do | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'openssl' | ||
|
||
class HelloWorld < String | ||
def initialize | ||
super "hello world: #{OpenSSL::Random.random_bytes( 16 ).inspect}" | ||
end | ||
end |
Oops, something went wrong.