Skip to content

Commit

Permalink
added regular tests for jruby main maven artifact
Browse files Browse the repository at this point in the history
some tests are not working and get omitted - #2215
and one test got a little workaround for #2216

Sponsored by Lookout Inc.
  • Loading branch information
mkristian committed Nov 19, 2014
1 parent 0544b46 commit eda5521
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 1 deletion.
3 changes: 3 additions & 0 deletions maven/jruby/src/it/extended/invoker.properties
@@ -0,0 +1,3 @@
invoker.goals = install
invoker.mavenOpts = -client

5 changes: 5 additions & 0 deletions maven/jruby/src/it/extended/pom.rb
@@ -0,0 +1,5 @@
# jruby scripting container
pom 'org.jruby:jruby', '@project.version@'

# unit tests
jar 'junit:junit', '4.8.2', :scope => :test
40 changes: 40 additions & 0 deletions maven/jruby/src/it/extended/pom.xml
@@ -0,0 +1,40 @@
<?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>app</artifactId>
<version>0.0.0</version>
<name>app</name>
<dependencies>
<dependency>
<groupId>de.saumya.mojo</groupId>
<artifactId>maven-tools</artifactId>
<version>0.34.2</version>
</dependency>
<dependency>
<groupId>org.rubygems</groupId>
<artifactId>zip</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby</artifactId>
<version>@project.version@</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/ruby</directory>
</resource>
</resources>
</build>
</project>
@@ -0,0 +1,26 @@
package org.example;

import static org.junit.Assert.assertTrue;

import java.util.Arrays;

import org.jruby.embed.ScriptingContainer;

import org.junit.Test;

public class SimpleTest {

@Test
public void test() throws Exception {
ScriptingContainer container = new ScriptingContainer();
container.getProvider().getRubyInstanceConfig().setJRubyHome("uri:classloader://META-INF/jruby.home");
container.getProvider().getRubyInstanceConfig().setLoadPaths(Arrays.asList("../../../",
"../../../test/externals/ruby1.9",
"../../../test/externals/ruby1.9/ruby"));

String output = (String) container.runScriptlet("Dir.pwd");

assertEquals( output, "hello world" );
}

}
5 changes: 4 additions & 1 deletion test/test_higher_javasupport.rb
Expand Up @@ -709,7 +709,10 @@ def test_top_level_package_load_doesnt_set_error

# JRUBY-2169
def test_java_class_resource_methods
$CLASSPATH << 'test/org/jruby/javasupport/test/'
path = 'test/org/jruby/javasupport/test/'
# workaround for https://github.com/jruby/jruby/issues/2216
path = File.expand_path(path) if ENV_JAVA['user.dir'] != Dir.pwd
$CLASSPATH << path
file = 'test_java_class_resource_methods.properties'

jc = JRuby.runtime.jruby_class_loader
Expand Down

0 comments on commit eda5521

Please sign in to comment.