-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Slawomir Chodnicki
committed
Feb 21, 2011
1 parent
c3c675b
commit 3827bcb
Showing
7 changed files
with
100 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ bin | |
dist | ||
testdist | ||
testclasses | ||
package | ||
.DS_Store |
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
41 changes: 41 additions & 0 deletions
41
test/org/typeexit/kettle/plugin/steps/ruby/TestFactory.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,41 @@ | ||
package org.typeexit.kettle.plugin.steps.ruby; | ||
|
||
import org.jruby.embed.ScriptingContainer; | ||
import org.typeexit.kettle.plugin.steps.ruby.RubyStepMeta.RubyVersion; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class TestFactory extends TestCase{ | ||
|
||
public void testFactory(){ | ||
|
||
ScriptingContainer c = RubyStepFactory.createScriptingContainer(false, RubyVersion.RUBY_1_8); | ||
c.runScriptlet("puts \"Ruby version: #{RUBY_VERSION}\""); | ||
|
||
} | ||
|
||
public void testJDBCDrivers(){ | ||
// this is a regression test for JDBC drivers disappearing from the JVM, since jruby will | ||
// remove them by default. | ||
// The factory is supposed to create a container that does not do that | ||
|
||
// this script will raise an exception if the org.h2.Driver got unregistered | ||
// see http://jira.codehaus.org/browse/JRUBY-5528 | ||
String testScript = "require 'java'" + "\n" + | ||
"Java::org.h2.Driver" + "\n" + | ||
"url = 'jdbc:h2:mem:MyDatabase'" + "\n" + | ||
"conn = java.sql.DriverManager.get_connection(url, 'H2', '')" + "\n" + | ||
"conn.close"; | ||
|
||
// if the script can be executed repeatedly, all is fine. It raises an exception | ||
// if the driver got unregistered at some point. | ||
for (int i=1;i<=5;i++){ | ||
ScriptingContainer c = RubyStepFactory.createScriptingContainer(false, RubyVersion.RUBY_1_8); | ||
c.runScriptlet(testScript); | ||
c.terminate(); | ||
System.out.println("Testing JDBC Driver persistence: iteration "+i); | ||
} | ||
|
||
} | ||
|
||
} |
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,10 @@ | ||
package org.typeexit.kettle.plugin.steps.ruby; | ||
|
||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Suite; | ||
|
||
@RunWith(Suite.class) | ||
@Suite.SuiteClasses({ TestFactory.class, TestSamples.class }) | ||
public class TestSuite { | ||
|
||
} |