Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mule 从Munit调用Dataweave函数时出现问题_Mule - Fatal编程技术网

Mule 从Munit调用Dataweave函数时出现问题

Mule 从Munit调用Dataweave函数时出现问题,mule,Mule,您是如何从Munit调用Dataweave函数的?我只是在mule单元测试用例中调用Dataweave所在的子流 例如: 欢迎来到StackOverflow。由于问题的格式,完全不清楚你在问什么。你应该学习如何格式化你的问题。编辑时,编辑区域正下方有一个“如何编辑”框。请参考那里的提示。。。 %output application/java %function splitEachRow(row) row splitBy p('field.delimiter') %function convert

您是如何从Munit调用Dataweave函数的?

我只是在mule单元测试用例中调用Dataweave所在的子流 例如:


欢迎来到StackOverflow。由于问题的格式,完全不清楚你在问什么。你应该学习如何格式化你的问题。编辑时,编辑区域正下方有一个“如何编辑”框。请参考那里的提示。。。
%output application/java
%function splitEachRow(row) row splitBy p('field.delimiter')
%function convertStringToLocateDateTime(date,format)  ( date as :localdatetime {format: format})
%var record =  splitEachRow(payload) 
%var actionDateTime=record[0]
---
{
    dateTimefn: convertStringToLocateDateTime(actionDateTime ,p('action.date.time.format')),
    dateTime: actionDateTime as :localdatetime {format: p('action.date.time.format')},
    Action_Type__c:record[1]
}


while calling a function created within Dataweave script  getting below exception.It happens when I run it as  Munit test, when I deploy it in Server it works fine.

ERROR 2017-01-30 14:30:03,924 [main] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : -1 (java.lang.ArrayIndexOutOfBoundsException). Message payload is of type: String
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. -1 (java.lang.ArrayIndexOutOfBoundsException)
  com.mulesoft.weave.engine.ExecutionContext$InternalExecutionContext:69 (null)
2. -1 (java.lang.ArrayIndexOutOfBoundsException). Message payload is of type: String (org.mule.api.MessagingException)
  org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.ArrayIndexOutOfBoundsException: -1
    at com.mulesoft.weave.engine.ExecutionContext$InternalExecutionContext.getVariable(ExecutionContext.scala:69)
    at com.mulesoft.weave.engine.ast.variables.VariableReferenceNode.value(VariableReferenceNode.scala:24)
    at com.mulesoft.weave.model.values.wrappers.DelegateValue$class.valueType(DelegateValue.scala:12)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

ERROR - The test vba-prod-data-integration-test-suiteTest finished with an Error.
-1 (java.lang.ArrayIndexOutOfBoundsException). Message payload is of type: String
org.mule.api.MessagingException: -1 (java.lang.ArrayIndexOutOfBoundsException). Message payload is of type: String
    at vba-prod-data-integration-test-suiteTest.dw:transform-message{doc:name=Transform Message}(vba-prod-data-integration-test-suite.xml:16)
    at vba-prod-data-integration-test-suiteTest.mule:set-payload{doc:name=Set Payload, value=01/12/2017 11:03:07 AM|"Atlanta VAMC records uploaded"|0|3176342462|"Rating"|"020NEW"|0|"0609122664"|"020"|"020"|"3020486138"|||4|349|2||1||1|0.931|Ready to Work|3492328660|1|1762475691|"176247569117-JAN-1231763424622"|"A244840216033" }(vba-prod-data-integration-test-suite.xml:15)
    at appleFlow.munit:test{initialState=started, description=MUnit Test, ignore=false, abstract=false, id=MunitTestFlow$$EnhancerByMUNIT$$904837f0{vba-prod-data-integration-test-suiteTest}}(vba-prod-data-integration-test-suite.xml:13)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
    at com.mulesoft.weave.engine.ExecutionContext$InternalExecutionContext.getVariable(ExecutionContext.scala:69)
    at com.mulesoft.weave.engine.ast.variables.VariableReferenceNode.value(VariableReferenceNode.scala:24)
    at com.mulesoft.weave.model.values.wrappers.DelegateValue$class.valueType(DelegateValue.scala:12)
<munit:test name="endpoints-test-suiteTest" description="MUnit Test">
        <flow-ref name="call-my-dataweave" doc:name="Flow Reference"/>
        </munit:test>