Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: Run pan from a junit test

  1. #1
    Join Date
    May 2007
    Posts
    22

    Default Run pan from a junit test

    Hi I am planning to implement test junit test cases for my transformations. I'm having trouble where the class paths are not properly getting setup for pan. Has anyone done this before. If so please help me out.

    Thanks,
    Gavin

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    We're setting up a collection of JUnit tests to compare 3.0 speed vs 2.5.
    We'll also be using it to compare results.

    Have a look at the source code in trunk/experimental_test/

    All the best,

    Matt

  3. #3
    Join Date
    May 2007
    Posts
    22

    Default http://kettle.pentaho.org/svn/Kettle/trunk/experimental

    Hi Matt,
    I don't have the following class files,

    import org.pentaho.di.trans.StepLoader;
    import org.pentaho.di.trans.Trans;
    import org.pentaho.di.trans.TransMeta;
    import org.pentaho.di.trans.step.BaseStep;
    import org.pentaho.di.trans.step.RowListener;

    Can I find a jar file for the "http://kettle.pentaho.org/svn/Kettle/trunk/experimental/" branch ?

    Thanks,
    Gavin

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    The code is there, yes. However, we don't put it in kettle.jar just yet as the code is euhhh ... experimental.

  5. #5
    Join Date
    May 2007
    Posts
    22

    Default Run pan from a junit test

    Hi Mat I used the experimental stuff to run a test case. I am getting the following error. I think its because the ExecSQL plug found on the latest ketle code is not present in version Kettle-2.5.0. Please let me know how I can include the ExecSQL plug in to the old version.

    Thanks,
    Gavin

    Code:
    [junit] 2007/06/07 11:13:21:582 LKT [INFO] DefaultFileReplicator - -Using "/tmp/vfs_cache" as temporary files store.
        [junit] Exception in thread "Subscriber and Contract.0 (Thread-6)" java.lang.NullPointerException
        [junit]     at be.ibridge.kettle.trans.step.tableinput.TableInput.closePreviousQuery(TableInput.java:176)
        [junit]     at be.ibridge.kettle.trans.step.tableinput.TableInput.dispose(TableInput.java:217)
        [junit]     at be.ibridge.kettle.trans.step.tableinput.TableInput.run(TableInput.java:303)
        [junit] Exception in thread "Update Key.0 (Thread-7)" java.lang.NullPointerException
        [junit]     at be.ibridge.kettle.trans.step.sql.ExecSQL.dispose(ExecSQL.java:172)
        [junit]     at be.ibridge.kettle.trans.step.sql.ExecSQL.run(ExecSQL.java:247)
        [junit] Exception in thread "Update Last Index Read.0 (Thread-8)" java.lang.NullPointerException
        [junit]     at be.ibridge.kettle.trans.step.sql.ExecSQL.dispose(ExecSQL.java:172)
        [junit]     at be.ibridge.kettle.trans.step.sql.ExecSQL.run(ExecSQL.java:247)
        [junit] Exception in thread "Insert Key.0 (Thread-9)" Exception in thread "Last Index.0 (Thread-5)" java.lang.NullPointerException
        [junit]     at be.ibridge.kettle.trans.step.tableinput.TableInput.closePreviousQuery(TableInput.java:176)
        [junit]     at be.ibridge.kettle.trans.step.tableinput.TableInput.dispose(TableInput.java:217)
        [junit]     at be.ibridge.kettle.trans.step.tableinput.TableInput.run(TableInput.java:303)
        [junit] java.lang.NullPointerException
        [junit]     at be.ibridge.kettle.trans.step.sql.ExecSQL.dispose(ExecSQL.java:172)
        [junit]     at be.ibridge.kettle.trans.step.sql.ExecSQL.run(ExecSQL.java:247)
        [junit] Exception in thread "Check Key Table.0 (Thread-11)" java.lang.NullPointerException
        [junit]     at be.ibridge.kettle.trans.step.sql.ExecSQL.dispose(ExecSQL.java:172)
        [junit]     at be.ibridge.kettle.trans.step.sql.ExecSQL.run(ExecSQL.java:247)
        [junit] Exception in thread "Contract Dimension.0 (Thread-12)" java.lang.NullPointerException
        [junit]     at be.ibridge.kettle.trans.step.dimensionlookup.DimensionLookup.dispose(DimensionLookup.java:718)
        [junit]     at be.ibridge.kettle.trans.step.dimensionlookup.DimensionLookup.run(DimensionLookup.java:758)
        [junit] Exception in thread "Get System Date" java.lang.NullPointerException
        [junit]     at be.ibridge.kettle.trans.step.BaseStep.dispose(BaseStep.java:539)
        [junit]     at be.ibridge.kettle.trans.step.systemdata.SystemData.dispose(SystemData.java:312)
        [junit]     at be.ibridge.kettle.trans.step.systemdata.SystemData.run(SystemData.java:333)
        [junit] Exception in thread "Filter rows.0 (Thread-10)" java.lang.NullPointerException
        [junit]     at be.ibridge.kettle.trans.step.BaseStep.dispose(BaseStep.java:539)
        [junit]     at be.ibridge.kettle.trans.step.filterrows.FilterRows.run(FilterRows.java:145)
        [junit] be.ibridge.kettle.core.exception.KettleXMLException:
        [junit] Error reading transformation from XML file
    
        [junit] Unable to load step info from XML step node
    
        [junit] Unable to load class for step/plugin with id [ExecSQL].Check if the plugin is available in the plugins subdirectory of the Kettle distribution.
        [junit]     at org.pentaho.di.trans.TransMeta.loadXML(TransMeta.java:2967)
        [junit]     at org.pentaho.di.trans.TransMeta.<init>(TransMeta.java:2575)
        [junit]     at org.pentaho.di.trans.TransMeta.<init>(TransMeta.java:2531)
        [junit]     at org.pentaho.di.trans.TransMeta.<init>(TransMeta.java:2519)
        [junit]     at org.pentaho.di.run.TimedTransRunner.runNewEngine(TimedTransRunner.java:141)
        [junit]     at org.pentaho.di.run.TimedTransRunner.runOldAndNew(TimedTransRunner.java:51)
        [junit]     at hsenidmobile.dwh.etl.transformation.ContractTransformationTester.test(ContractTransformationTester.java:105)
        [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        [junit]     at java.lang.reflect.Method.invoke(Method.java:585)
        [junit]     at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
        [junit]     at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
        [junit]     at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
        [junit]     at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
        [junit]     at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
        [junit]     at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
        [junit]     at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
        [junit]     at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
        [junit]     at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
        [junit]     at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
        [junit]     at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:32)
        [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:289)
        [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:523)
        [junit] Caused by: be.ibridge.kettle.core.exception.KettleXMLException:
        [junit] Unable to load step info from XML step node

  6. #6
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    No, you need to load/read to initialize the step and job entry plugins.
    See also the Pan java code. (StepLoader.getInstance() etc.)

  7. #7
    Join Date
    May 2007
    Posts
    22

    Default Run pan from a junit test

    Hi Matt,
    In the downloaded code from the subversion site "trunk/plugins/steps" doesn't have a ExecSQL plug in. Do I have to build it ?

    Thanks,
    Gavin

  8. #8
    Join Date
    May 2007
    Posts
    22

    Default Reply to Thread

    Hi Mat,
    I attached the transformation file and I have given the test code I am using bellow.

    Code:
    StepLoader stepLoader = StepLoader.getInstance(new String[]{"/home/gavin/java/Kettle/plugins"});
                JobEntryLoader jobEntryLoader = JobEntryLoader.getInstance(new String[]{"/home/gavin/java/Kettle/plugins"});
                String transformationLocation = "/home/gavin/projects/beyondm/suntelDWH/trunk/core/etl/transformation/" +
                        "Contract.ktr";
    //            String transformationLocation = "/home/gavin/Gavin/tmp/transOne.ktr";
                TimedTransRunner timedTransRunner = new TimedTransRunner(transformationLocation,
                        LogWriter.LOG_LEVEL_ERROR, 100000);
                timedTransRunner.init();
    //            timedTransRunner.runOldAndNew();
    //            timedTransRunner.runOldEngine(true);
                timedTransRunner.runNewEngine();
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.