DICE-UNC / jargon

Jargon core libraries
Other
28 stars 31 forks source link

Read length set to zero on execute rule with condition #110

Closed michael-conway closed 9 years ago

michael-conway commented 9 years ago

in RuleProcessingAOImplTest, failure in


@Test
    public void testRuleContainsConditionWithEqualsInAttrib() throws Exception {

        // put a collection out to do a checksum on
        String testFileName = "testRuleChecksum1.txt";
        String absPath = scratchFileUtils
                .createAndReturnAbsoluteScratchPath(IRODS_TEST_SUBDIR_PATH);
        FileGenerator.generateFileOfFixedLengthGivenName(absPath, testFileName,
                100);

        String targetIrodsCollection = testingPropertiesHelper
                .buildIRODSCollectionAbsolutePathFromTestProperties(
                        testingProperties, IRODS_TEST_SUBDIR_PATH);

        IRODSAccount irodsAccount = testingPropertiesHelper
                .buildIRODSAccountFromTestProperties(testingProperties);
        IRODSAccessObjectFactory accessObjectFactory = irodsFileSystem
                .getIRODSAccessObjectFactory();

        StringBuilder fileNameAndPath = new StringBuilder();
        fileNameAndPath.append(absPath);

        fileNameAndPath.append(testFileName);

        IRODSFile targetCollectionFile = accessObjectFactory
                .getIRODSFileFactory(irodsAccount).instanceIRODSFile(
                        targetIrodsCollection);
        targetCollectionFile.mkdirs();
        File sourceFile = new File(fileNameAndPath.toString());

        DataTransferOperations dto = accessObjectFactory
                .getDataTransferOperations(irodsAccount);
        dto.putOperation(sourceFile, targetCollectionFile, null, null);

        StringBuilder ruleBuilder = new StringBuilder();
        ruleBuilder
                .append("myTestRule||acGetIcatResults(*Action,*Condition,*B)##forEachExec(*B,msiGetValByKey(*B,RESC_LOC,*R)##remoteExec(*R,null,msiDataObjChksum(*B,*Operation,*C),nop)##msiGetValByKey(*B,DATA_NAME,*D)##msiGetValByKey(*B,COLL_NAME,*E)##writeLine(stdout,CheckSum of *E/*D at *R is *C),nop)|nop##nop\n");
        ruleBuilder.append("*Action=chksumRescLoc%*Condition=COLL_NAME = '");

        ruleBuilder.append(targetIrodsCollection);
        ruleBuilder.append("'%*Operation=ChksumAll\n");
        ruleBuilder.append("*Action%*Condition%*Operation%*C%ruleExecOut");
        String ruleString = ruleBuilder.toString();

        RuleProcessingAO ruleProcessingAO = accessObjectFactory
                .getRuleProcessingAO(irodsAccount);

        IRODSRuleExecResult result = ruleProcessingAO.executeRule(ruleString);

        Assert.assertNotNull("did not get a response", result);

        Assert.assertEquals("did not get results for each output parameter", 6,
                result.getOutputParameterResults().size());

        String conditionValue = (String) result.getOutputParameterResults()
                .get("*Condition").getResultObject();

        String expectedCondition = "COLL_NAME = '" + targetIrodsCollection
                + "'";
        Assert.assertEquals("condition not found", expectedCondition,
                conditionValue);

    }

stack trace


org.irods.jargon.core.exception.JargonException: java.io.IOException: read length is set to zero
    at org.irods.jargon.core.connection.AbstractIRODSMidLevelProtocol.readHeader(AbstractIRODSMidLevelProtocol.java:1015)
    at org.irods.jargon.core.connection.AbstractIRODSMidLevelProtocol.readMessage(AbstractIRODSMidLevelProtocol.java:646)
    at org.irods.jargon.core.connection.AbstractIRODSMidLevelProtocol.readMessage(AbstractIRODSMidLevelProtocol.java:629)
    at org.irods.jargon.core.connection.IRODSMidLevelProtocol.irodsFunction(IRODSMidLevelProtocol.java:231)
    at org.irods.jargon.core.connection.AbstractIRODSMidLevelProtocol.irodsFunction(AbstractIRODSMidLevelProtocol.java:174)
    at org.irods.jargon.core.connection.AbstractIRODSMidLevelProtocol.irodsFunction(AbstractIRODSMidLevelProtocol.java:571)
    at org.irods.jargon.core.pub.RuleProcessingAOImpl.executeRule(RuleProcessingAOImpl.java:225)
    at org.irods.jargon.core.pub.RuleProcessingAOImplTest.testRuleContainsConditionWithEqualsInAttrib(RuleProcessingAOImplTest.java:502)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:24)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:24)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.io.IOException: read length is set to zero
    at org.irods.jargon.core.connection.AbstractConnection.read(AbstractConnection.java:554)
    at org.irods.jargon.core.connection.AbstractIRODSMidLevelProtocol.readHeader(AbstractIRODSMidLevelProtocol.java:1011)
    ... 49 more
michael-conway commented 9 years ago

api number seems OK, this may be a rule engine issue...rule is:

1270 [main] DEBUG org.irods.jargon.core.connection.IRODSMidLevelProtocol  - calling irods function with byte array
1271 [main] DEBUG org.irods.jargon.core.connection.IRODSMidLevelProtocol  - calling irods function with:<ExecMyRuleInp_PI><myRule>myTestRule||acGetIcatResults(*Action,*Condition,*B)##forEachExec(*B,msiGetValByKey(*B,RESC_LOC,*R)##remoteExec(*R,null,msiDataObjChksum(*B,*Operation,*C),nop)##msiGetValByKey(*B,DATA_NAME,*D)##msiGetValByKey(*B,COLL_NAME,*E)##writeLine(stdout,CheckSum of *E/*D at *R is *C),nop)|nop##nop
</myRule>
<RHostAddr_PI><hostAddr></hostAddr>
<rodsZone></rodsZone>
<port>0</port>
<dummyInt>0</dummyInt>
</RHostAddr_PI>
<KeyValPair_PI><ssLen>0</ssLen>
</KeyValPair_PI>
<outParamDesc>*Action%*Condition%*Operation%*C%ruleExecOut</outParamDesc>
<MsParamArray_PI><paramLen>3</paramLen>
<oprType>0</oprType>
<MsParam_PI><label>*Action</label>
<type>STR_PI</type>
<STR_PI><myStr>chksumRescLoc</myStr>
</STR_PI>
</MsParam_PI>
<MsParam_PI><label>*Condition</label>
<type>STR_PI</type>
<STR_PI><myStr>COLL_NAME = '/tempZone/home/test1/jargon-scratch/RuleProcessingAOImplTest'</myStr>
</STR_PI>
</MsParam_PI>
<MsParam_PI><label>*Operation</label>
<type>STR_PI</type>
<STR_PI><myStr>ChksumAll</myStr>
</STR_PI>
</MsParam_PI>
</MsParamArray_PI>
</ExecMyRuleInp_PI>
michael-conway commented 9 years ago

iRODS issue resolved