Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.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
在SoapUI Groovy脚本中使用FileNameFinder类_Groovy_Ant_Soapui_Ready Api - Fatal编程技术网

在SoapUI Groovy脚本中使用FileNameFinder类

在SoapUI Groovy脚本中使用FileNameFinder类,groovy,ant,soapui,ready-api,Groovy,Ant,Soapui,Ready Api,我试图模拟一个服务,其请求输入参数可以是Name或UniqueIdentifier。对于这两种输入类型,返回的响应是相同的 因此,我想将文件命名为\uu.xml,并从目录中读取模拟响应 当在mock上收到请求时,我想用输入参数搜索文件(它将是目录中文件名的子字符串)并发送响应 为此,我尝试使用FileNameFinder类 java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException 我还尝试过在C:\ProgramFil

我试图模拟一个服务,其请求输入参数可以是Name或UniqueIdentifier。对于这两种输入类型,返回的响应是相同的

因此,我想将文件命名为
\uu.xml
,并从目录中读取模拟响应

当在mock上收到请求时,我想用输入参数搜索文件(它将是目录中文件名的子字符串)并发送响应

为此,我尝试使用FileNameFinder类

java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException

我还尝试过在
C:\ProgramFiles\SmartBear\ReadyAPI-1.8.5\lib
下使用ant.jar。但是,我得到了同样的错误

如果您能帮助解决这个问题,我们将不胜感激

谢谢

ReadyAPI中的分派脚本

def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context);
def holder = groovyUtils.getXmlHolder("externalBnSearch#Request");
import groovy.util.FileNameFinder;

String name = holder.getNodeValue( "//tn.type:name" )
log.info('Request - name: ' + name);

String UNI = holder.getNodeValue( "//tn.type:UNI" )
log.info('Request - number: ' +UNI);

def file = new FileNameFinder().getFileNames("C:/resposne/", '"+name+"*/*.xml')
log.info(txtFiles)

def mockname = "LookUpResponse"

if (file.exists())  
{
context.content = file.getText()
return (mockname);
}

您的
ant.jar是什么版本的ant。为什么蚂蚁会卷入其中?2.你能出示样品吗?3.所有响应是否都在同一目录中?4.是否有以相同名称开头的文件如果请求只有名称,那么您想做什么?最后,上面的脚本发生了什么?有错误吗?对延迟的响应表示歉意。ant.jar版本是1.6.5@Rao 1),在internet上读到FileNameFinder是一个ant支持的类,提到的解决方案之一是尝试将ant.jar添加到readyapi库中。2) 附上一份样品申请。3) 是,所有响应都在同一目录中。4.所有文件都有唯一的名称5。使用FileNameFinder函数,我得到了错误java.lang.NoClassDefFoundError:org/apache/tools/ant/BuildException@newtogroovy
ant.jar
FileNameFinder
没有真正的关联。这个类在groovy
gdk
中。实际上,“java.lang.NoClassDefFoundError:org/apache/tools/ant/BuildException”问题与
FileNameFinder
无关,可能与脚本执行的编排有关。您的
ant.jar
是什么版本的ant。为什么蚂蚁会卷入其中?2.你能出示样品吗?3.所有响应是否都在同一目录中?4.是否有以相同名称开头的文件如果请求只有名称,那么您想做什么?最后,上面的脚本发生了什么?有错误吗?对延迟的响应表示歉意。ant.jar版本是1.6.5@Rao 1),在internet上读到FileNameFinder是一个ant支持的类,提到的解决方案之一是尝试将ant.jar添加到readyapi库中。2) 附上一份样品申请。3) 是,所有响应都在同一目录中。4.所有文件都有唯一的名称5。使用FileNameFinder函数,我得到了错误java.lang.NoClassDefFoundError:org/apache/tools/ant/BuildException@newtogroovy
ant.jar
FileNameFinder
没有真正的关联。这个类在groovy
gdk
中。实际上,“java.lang.NoClassDefFoundError:org/apache/tools/ant/BuildException”问题与
FileNameFinder
无关,可能与脚本执行的编排有关。