Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed missed test and cleanup javadocs
Browse files Browse the repository at this point in the history
mkristian committed Oct 7, 2014

Verified

This commit was signed with the committer’s verified signature. The key has expired.
nomadium Miguel Landaeta
1 parent 53f542a commit 03efb7b
Showing 3 changed files with 8 additions and 1,685 deletions.
17 changes: 4 additions & 13 deletions core/src/main/java/org/jruby/embed/IsolatedScriptingContainer.java
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@

import java.net.URL;

import org.jruby.util.cli.Options;

/**
* the IsolatedScriptingContainer detects the whether it is used with
* a Thread.currentThread.contextClassLoader (J2EE) or with the classloader
@@ -17,23 +15,16 @@
*
* in the OSGi case there are helper methods to add ClassLoaders to the LOAD_PATH or GEM_PATH
*
* a typical setup for the ContextClassLoader case looks likes this:
* a typical setup for the ContextClassLoader case and OSGi case looks likes this:
* <li>LOAD_PATH == [ "uri:classloader:/META-INF/jruby.home/lib/ruby/1.9/site_ruby",
* "uri:classloader:/META-INF/jruby.home/lib/ruby/shared",
* "uri:classloader:/META-INF/jruby.home/lib/ruby/1.9",
* "uri:classloader:" ]</li>
* <li>Gem::Specification.dirs == [ "uri:classloader:", "uri:classloader:/META-INF/jruby.home/lib/ruby/gems/shared" ]
* <li>Gem::Specification.dirs == [ "uri:classloader:/specifications", "uri:classloader:/META-INF/jruby.home/lib/ruby/gems/shared/specifications" ]
* here very resource is loaded via <code>Thread.currentTHread.getContextClassLoader().getResourceAsStream(...)</code>
*
* a typical setup for OSGi case (one bundle with everything):
* <li>LOAD_PATH == [ "uri:bundle://16.0:1/META-INF/jruby.home/lib/ruby/1.9/site_ruby",
* "uri:bundle://16.0:1/META-INF/jruby.home/lib/ruby/shared",
* "uri:bundle://16.0:1/META-INF/jruby.home/lib/ruby/1.9",
* "uri:bundle://16.0:1" ]</li>
* <li>Gem::Specification.dirs == [ "uri:bundle://16.0:1", "uri:bundle://16.0:1/META-INF/jruby.home/lib/ruby/gems/shared" ]
* other OSGi frameworks use other uris like bundleresource:/16.fwk1661197821. here very resource is loaded via
* <code>new URL( uri )openStream()</code>, i.e. <code>new URL(classloader.getResource().toString()).openStream()</code> has to work for
* those classloaders. felix and equinox OSGi framework do work.
* <code>new URL( uri ).openStream()</code>, i.e. <code>new URL(classloader.getResource().toString()).openStream()</code> has to work for
* those classloaders. felix, knoplerfish and equinox OSGi framework do work.
*
* NOTE: <code>Gem.path</code> is base for determine the <code>Gem::Specification.dirs</code> and <code>Gem::Specification.dirs</code> is
* used to find gemspec files of the installed gems.
8 changes: 4 additions & 4 deletions core/src/test/java/org/jruby/util/URLResourceTest.java
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ public class URLResourceTest extends TestCase {
public void testDirectory(){
String uri = Thread.currentThread().getContextClassLoader().getResource( "somedir" ).toExternalForm();
// hmm not sure why the url from the classloader does not work :(
FileResource resource = URLResource.create( "uri:" + uri.replace( "file://", "file:/" ));
FileResource resource = URLResource.create( null, "uri:" + uri.replace( "file://", "file:/" ));

assertNotNull(resource );
assertFalse(resource.isFile());
@@ -22,7 +22,7 @@ public void testDirectory(){
public void testNoneDirectory(){
String uri = Thread.currentThread().getContextClassLoader().getResource( "somedir/dir_without_listing" ).toExternalForm();
// TODO once the URLResource does keep the protocol part of the uri as is we can remove this replace
FileResource resource = URLResource.create( "uri:" + uri.replace( "file:/", "file:///" ));
FileResource resource = URLResource.create( null, "uri:" + uri.replace( "file:/", "file:///" ));

assertNotNull(resource );
// you can open streams on file-system directories
@@ -35,7 +35,7 @@ public void testNoneDirectory(){
public void testFile(){
String uri = Thread.currentThread().getContextClassLoader().getResource( "somedir/.jrubydir" ).toExternalForm();
// TODO once the URLResource does keep the protocol part of the uri as is we can remove this replace
FileResource resource = URLResource.create( "uri:" + uri.replace( "file:/", "file:///" ));
FileResource resource = URLResource.create( null, "uri:" + uri.replace( "file:/", "file:///" ));

assertNotNull(resource );
// you can open streams on file-system directories
@@ -48,7 +48,7 @@ public void testFile(){
public void testNonExistingFile(){
String uri = Thread.currentThread().getContextClassLoader().getResource( "somedir" ).toExternalForm();
// TODO once the URLResource does keep the protocol part of the uri as is we can remove this replace
FileResource resource = URLResource.create( "uri:" + uri.replace( "file:/", "file:///" ) + "/not_there");
FileResource resource = URLResource.create( null, "uri:" + uri.replace( "file:/", "file:///" ) + "/not_there");

assertNotNull(resource );
assertFalse(resource.isFile());
1,668 changes: 0 additions & 1,668 deletions maven/jruby-dist/p.xml

This file was deleted.

0 comments on commit 03efb7b

Please sign in to comment.