Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3474eea51f45^
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b05091c12693
Choose a head ref
  • 6 commits
  • 5 files changed
  • 1 contributor

Commits on Jul 30, 2015

  1. Copy the full SHA
    3474eea View commit details
  2. Copy the full SHA
    4f88af6 View commit details
  3. Copy the full SHA
    5fb03c7 View commit details
  4. Copy the full SHA
    5bbee5a View commit details
  5. Copy the full SHA
    94e54f3 View commit details
  6. Copy the full SHA
    b05091c View commit details
7 changes: 6 additions & 1 deletion maven/jruby-complete/src/it/integrity/verify.bsh
Original file line number Diff line number Diff line change
@@ -33,7 +33,12 @@ if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jar-dependencies,jruby-openssl";
expected = "jar-dependencies";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jruby-openssl";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
Original file line number Diff line number Diff line change
@@ -26,8 +26,8 @@
***** END LICENSE BLOCK *****/
package org.jruby.embed.osgi.test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import static org.ops4j.pax.exam.CoreOptions.bundle;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.options;
@@ -36,12 +36,9 @@

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;

import javax.inject.Inject;

import org.jruby.embed.LocalContextScope;
import org.jruby.embed.LocalVariableBehavior;
import org.jruby.embed.ScriptingContainer;
import org.jruby.embed.osgi.OSGiIsolatedScriptingContainer;
import org.junit.Test;
import org.junit.Ignore;
@@ -64,11 +61,13 @@ public class JRubyOsgiEmbedTest {

@Configuration
public Option[] config() {
return options(junitBundles(),
systemProperty("org.ops4j.pax.url.mvn.localRepository").value(System.getProperty( "maven.repo.local" )),
mavenBundle("org.jruby", "jruby-complete", System.getProperty("project.version")),
mavenBundle("org.jruby.osgi", "gems-bundle", "1.0"),
mavenBundle("org.jruby.osgi", "scripts-bundle", "1.0"));
return options(
junitBundles(),
systemProperty("org.ops4j.pax.url.mvn.localRepository").value(System.getProperty( "maven.repo.local" )),
mavenBundle("org.jruby", "jruby-complete", System.getProperty("project.version")),
mavenBundle("org.jruby.osgi", "gems-bundle", "1.0"),
mavenBundle("org.jruby.osgi", "scripts-bundle", "1.0")
);
}

@Test
@@ -80,27 +79,27 @@ public void testJRubyCreate() throws Exception {
//System.setProperty( "jruby.debug.loadService", "true" );
//System.setProperty( "jruby.native.enabled", "true" );

OSGiIsolatedScriptingContainer jruby = new OSGiIsolatedScriptingContainer();
OSGiIsolatedScriptingContainer jruby = new OSGiIsolatedScriptingContainer();
jruby.addBundleToLoadPath( "org.jruby.osgi.scripts-bundle" );
jruby.addBundleToGemPath( FrameworkUtil.getBundle( Gems.class ) );

// run a script from LOAD_PATH
String hello = (String) jruby.runScriptlet( "require 'hello'; Hello.say" );
assertEquals( hello, "world" );
assertEquals( "world", hello );

System.err.println();
System.err.println();

String gemPath = (String) jruby.runScriptlet( "Gem::Specification.dirs.inspect" );
gemPath = gemPath.replaceAll( "bundle[^:]*://[^/]*", "bundle:/" );
assertEquals( gemPath, "[\"uri:bundle://specifications\"]" );
assertEquals( "[\"uri:bundle://specifications\"]", gemPath );

// ensure we can load rake from the default gems
boolean loaded = (Boolean) jruby.runScriptlet( "require 'rake'" );
assertEquals(true, loaded);

String list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.inspect" );
assertEquals(list, "[\"rake\"]");
assertEquals( "[\"rake\"]", list );

// ensure we have native working
loaded = (Boolean) jruby.runScriptlet( "JRuby.runtime.posix.is_native" );
@@ -111,14 +110,37 @@ public void testJRubyCreate() throws Exception {
assertEquals(true, loaded);

jruby.runScriptlet( "require 'jar-dependencies'" );
list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.inspect" );
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\"]");

assertGemListEquals(jruby, "jar-dependencies", "jruby-openssl", "rake");

// ensure we can load can load embedded gems
loaded = (Boolean) jruby.runScriptlet( "require 'virtus'" );
assertEquals(true, loaded);

list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.inspect" );
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\", \"thread_safe\", \"descendants_tracker\", \"equalizer\", \"coercible\", \"ice_nine\", \"axiom-types\", \"virtus\"]");
assertGemListEquals(jruby, "axiom-types", "coercible", "descendants_tracker", "equalizer", "ice_nine", "jar-dependencies", "jruby-openssl", "rake", "thread_safe", "virtus");
}

private static void assertGemListEquals(final OSGiIsolatedScriptingContainer jruby, final String... expected) {
String list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.sort.join(', ')" );

Arrays.sort(expected);

if ( gemJOpenSSLPreRelease(jruby) ) {
ArrayList<String> tmp = new ArrayList<String>(Arrays.asList(expected));
tmp.remove("jruby-openssl"); // pre-release gem not reported in loaded_keys

for ( String name : tmp.toArray(new String[0]) ) {
assertThat(list, containsString(name));
}
}
else {
assertEquals( Arrays.toString(expected), '[' + list + ']' );
}
}

private static boolean gemJOpenSSLPreRelease(final OSGiIsolatedScriptingContainer jruby) {
String josslVersion = (String) jruby.runScriptlet( "require 'jopenssl/version'; Jopenssl::Version::VERSION" );
return josslVersion.matches(".*?[a-zA-Z]");
}

}
9 changes: 7 additions & 2 deletions maven/jruby-dist/src/it/integrity/verify.bsh
Original file line number Diff line number Diff line change
@@ -33,7 +33,12 @@ if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jar-dependencies,jruby-openssl";
expected = "jar-dependencies";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jruby-openssl";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
@@ -42,4 +47,4 @@ expected = "there is NO org.objectweb.asm.ClassWriter on the classpath";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
}
7 changes: 6 additions & 1 deletion maven/jruby-jars/src/it/integrity/verify.bsh
Original file line number Diff line number Diff line change
@@ -33,7 +33,12 @@ if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jar-dependencies,jruby-openssl";
expected = "jar-dependencies";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "jruby-openssl";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
Original file line number Diff line number Diff line change
@@ -26,18 +26,16 @@
***** END LICENSE BLOCK *****/
package org.jruby.embed.osgi.test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import static org.ops4j.pax.exam.CoreOptions.bundle;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.options;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;

import org.jruby.embed.LocalContextScope;
import org.jruby.embed.LocalVariableBehavior;
import org.jruby.embed.ScriptingContainer;
import org.jruby.embed.osgi.OSGiIsolatedScriptingContainer;
import org.junit.Test;
import org.junit.Ignore;
@@ -66,12 +64,12 @@ public void testJRubyCreate() throws InterruptedException {
System.err.println();
System.err.println();

// System.setProperty( "jruby.debug.loadService", "true" );
OSGiIsolatedScriptingContainer jruby = new OSGiIsolatedScriptingContainer();
// System.setProperty( "jruby.debug.loadService", "true" );
OSGiIsolatedScriptingContainer jruby = new OSGiIsolatedScriptingContainer();

// run a script from LOAD_PATH
String hello = (String) jruby.runScriptlet( "require 'hello'; Hello.say" );
assertEquals( hello, "world" );
assertEquals( "world", hello );

System.err.println();
System.err.println();
@@ -81,7 +79,7 @@ public void testJRubyCreate() throws InterruptedException {
assertEquals(true, loaded);

String list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.inspect" );
assertEquals(list, "[\"rake\"]");
assertEquals( "[\"rake\"]", list );

// ensure we have native working
loaded = (Boolean) jruby.runScriptlet( "JRuby.runtime.posix.is_native" );
@@ -95,17 +93,40 @@ public void testJRubyCreate() throws InterruptedException {

gemPath = gemPath.replaceAll( "bundle[^:]*://[^/]*", "bundle:/" );
// TODO fix the URLResource to produce uri:classloader:// urls only
assertEquals( gemPath, "[\"uri:classloader:/specifications\", \"uri:classloader://specifications\"]" );
assertEquals( "[\"uri:classloader:/specifications\", \"uri:classloader://specifications\"]", gemPath );

jruby.runScriptlet( "require 'jar-dependencies'" );
list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.inspect" );
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\"]");

assertGemListEquals(jruby, "jar-dependencies", "jruby-openssl", "rake");

// ensure we can load can load embedded gems
loaded = (Boolean) jruby.runScriptlet( "require 'virtus'" );
assertEquals(true, loaded);

list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.inspect" );
assertEquals(list, "[\"rake\", \"jruby-openssl\", \"jar-dependencies\", \"thread_safe\", \"descendants_tracker\", \"equalizer\", \"coercible\", \"ice_nine\", \"axiom-types\", \"virtus\"]");
assertGemListEquals(jruby, "axiom-types", "coercible", "descendants_tracker", "equalizer", "ice_nine", "jar-dependencies", "jruby-openssl", "rake", "thread_safe", "virtus");
}

private static void assertGemListEquals(final OSGiIsolatedScriptingContainer jruby, final String... expected) {
String list = (String) jruby.runScriptlet( "Gem.loaded_specs.keys.sort.join(', ')" );

Arrays.sort(expected);

if ( gemJOpenSSLPreRelease(jruby) ) {
ArrayList<String> tmp = new ArrayList<String>(Arrays.asList(expected));
tmp.remove("jruby-openssl"); // pre-release gem not reported in loaded_keys

for ( String name : tmp.toArray(new String[0]) ) {
assertThat(list, containsString(name));
}
}
else {
assertEquals( Arrays.toString(expected), '[' + list + ']' );
}
}

private static boolean gemJOpenSSLPreRelease(final OSGiIsolatedScriptingContainer jruby) {
String josslVersion = (String) jruby.runScriptlet( "require 'jopenssl/version'; Jopenssl::Version::VERSION" );
return josslVersion.matches(".*?[a-zA-Z]");
}

}