首页 \ 问答 \ Citrus XPath验证找不到元素(Citrus XPath Validation Cannot Find Element)

Citrus XPath验证找不到元素(Citrus XPath Validation Cannot Find Element)

我有一个ValidationFault元素的XML负载。 我的部分验证是确认ValidationFault元素只在XML有效负载中出现一次。 使用以下Citrus Java DSL:

runner.receive(action -> action.endpoint(endpointName)
      .validate("number://ValidationFault", 1));

我没有得到1的预期值,而是0:

com.consol.citrus.exceptions.TestCaseFailedException: Validation failed: Values not equal for element '//ValidationFault', expected '1' but was '0'

我已经手动确认响应负载确实包含有问题的元素。 我还使用外部工具验证了XPath,并发现XPath应该是正确的。 我也尝试了命名空间, //soapenv:ValidationFault//:ValidationFault ,但我收到了相同的异常。

编辑:

这是接收到的XML有效负载(删除了一些数据):

<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
             xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
     <env:Header/>
     <SOAP-ENV:Body
              xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
              xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <soapenv:Fault>
         <faultcode>soapenv:Client</faultcode>
         <faultstring>ValidationFault</faultstring>
         <faultactor>GetSalutation</faultactor>
         <detail>
             <ValidationFault
                 fault:retryable="false"
                 xmlns="http://domain/fault/2.0/"
                 xmlns:fault="domain/fault/2.0/">
             <ErrorCode>flt-00001</ErrorCode>
             <DescriptionText>A Schema Validation Failed</DescriptionText>
              <Details>
                  <Text></Text>
              </Details
              <TransactionControlIdentificationID>
                  TBD
              </TransactionControlIdentificationID>
              <ZuluDateTime><ZuluDateTime>
          </ValidationFault>
      </detail>
  </soapenv:Fault>
  </SOAP-ENV:Body>
</soapenv:Envelope>

I have an XML payload with the element ValidationFault. Part of my validation is to confirm the ValidationFault element occurs only once in the XML payload. Using the following Citrus Java DSL:

runner.receive(action -> action.endpoint(endpointName)
      .validate("number://ValidationFault", 1));

I do not get back the expected value of 1, instead 0:

com.consol.citrus.exceptions.TestCaseFailedException: Validation failed: Values not equal for element '//ValidationFault', expected '1' but was '0'

I have manually confirmed that the response payload does contain the element in question. I also validated the XPath with an external tool and found that the XPath should be correct. I have tried with the namespaces as well, //soapenv:ValidationFault and //:ValidationFault, but I receive the same exception.

Edit:

This is the XML payload that is received (with some data removed):

<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
             xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
     <env:Header/>
     <SOAP-ENV:Body
              xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
              xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
              xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <soapenv:Fault>
         <faultcode>soapenv:Client</faultcode>
         <faultstring>ValidationFault</faultstring>
         <faultactor>GetSalutation</faultactor>
         <detail>
             <ValidationFault
                 fault:retryable="false"
                 xmlns="http://domain/fault/2.0/"
                 xmlns:fault="domain/fault/2.0/">
             <ErrorCode>flt-00001</ErrorCode>
             <DescriptionText>A Schema Validation Failed</DescriptionText>
              <Details>
                  <Text></Text>
              </Details
              <TransactionControlIdentificationID>
                  TBD
              </TransactionControlIdentificationID>
              <ZuluDateTime><ZuluDateTime>
          </ValidationFault>
      </detail>
  </soapenv:Fault>
  </SOAP-ENV:Body>
</soapenv:Envelope>

原文:https://stackoverflow.com/questions/50804863
更新时间:2024-04-01 21:04

最满意答案

它们都在一个节点上,因为默认情况下,Hadoop默认会首先写入本地节点。 我猜你正在使用该节点的Hadoop客户端。 由于您有一个复制,它只会在该节点上。

由于你只是玩游戏,你可能想强制传播数据。 为此,您可以使用hadoop rebalancer运行重新 hadoop rebalancer 。 几分钟后控制它就可以了。


They are all on one node because by default Hadoop will write to the local node first by default. I'm going to guess you were using the Hadoop client from that node. Since you have a replication of one, it's only going to be on that node.

Since you are just playing around, you might want to force spreading the data out. To do this, you can run the rebalancer with hadoop rebalancer. Just control-C it after a few minutes.

相关问答

更多
  • 最后,我通过为我的系统提供更大的驱动器空间解决了这个问题。 我正在使用VirtualBox,所以我不得不重新安装整个操作系统和hadoop。 使用新设置,它现在可以正常工作。 所以主要猜测是问题与可用空间量有关。 即使对于单节点设置,240MB也是不够的。 Finally I have solved this problem by providing my system with a bigger drive space. I am using VirtualBox, so I had to reinsta ...
  • 不是将文件复制到master中,而是将文件加载到s3中并从那里读取 有关从S3读取文件的信息,请参阅http://databricks.gitbooks.io/databricks-spark-reference-applications/content/logs_analyzer/chapter2/s3.html 。 您需要提供AWS访问密钥ID和密钥。 设置环境变量AWS_ACCESS_KEY_ID和AWS_SECRET_ACCESS_KEY,或者以编程方式设置它,如, sc.hadoopConfigu ...
  • 是的,您可以找到存储在HDFS中不同数据节点上的块的位置。 这是命令: hdfs fsck /user/hduser/file.txt -files -blocks -locations 这将为您提供与为文件创建的各个块相关的所有信息:“/ user / hduser / file.txt”。 输出通常如下所示: [hduser@node001 ~]$ hdfs fsck /user/hduser/file.txt -files -blocks -locations Connecting to namen ...
  • 它们都在一个节点上,因为默认情况下,Hadoop默认会首先写入本地节点。 我猜你正在使用该节点的Hadoop客户端。 由于您有一个复制,它只会在该节点上。 由于你只是玩游戏,你可能想强制传播数据。 为此,您可以使用hadoop rebalancer运行重新 hadoop rebalancer 。 几分钟后控制它就可以了。 They are all on one node because by default Hadoop will write to the local node first by defau ...
  • 在启动后namenode脱离安全模式之前,Job正在启动。 在namenode离开safemode后启动作业将解决此问题。 Job is being kicked off before namenode is out of safemode after startup. Starting job after namenode leaves safemode will fix the issue.
  • 退后一步:给定的Mapper如何知道要使用哪个本地文件系统路径名(20个中的5个与其他路径名不同)? 他们会做反复试验吗? 通常,您尝试避免在本地环境/本地文件系统设置方面在不同映射器之间存在差异。 如果您需要查找特定文件,那么可能需要包含一个预处理步骤,该步骤将文件从各个映射器计算机上载到hdfs目录 - 可能包括新路径中的本地主机名。 也许你可以提一下这个有点非标准设置的动力。 基于OP澄清的更新 。 在mapper中添加代码 (a) checks if the file exists (on Loca ...
  • Maven 2 DEB插件可用于从任何可打包为JAR的项目生成Debian软件包。 Debian软件包可用于大多数基于Debian的Linux Disributions,包括Ubuntu和Knoppix。 http://www.mojohaus.org/deb-maven-plugin/using-deb.html ... org.codehaus.mojo deb-maven-plugin
  • 根据Hadoop:权威指南 Hadoop的默认策略是将第一个副本放在与客户端相同的节点上(对于在群集外部运行的客户端,随机选择一个节点,尽管系统尝试不选择太满或太忙的节点)。 第二个副本放置在与第一个(机架外)不同的机架上,随机选择。 第三个副本与第二个副本放在同一个机架上,但是在随机选择的不同节点上。 进一步的副本放置在群集上的随机节点上,尽管系统试图避免在同一个机架上放置太多副本。 这种逻辑是有意义的,因为它减少了不同节点之间的网络聊天。 我认为这取决于客户端是否与Hadoop节点相同。 如果客户端是H ...
  • 我找到了解决方案。 为了增加文件mapred-site.xml中减少器的数量,我添加了 A 5 在我向集群添加其他节点之后,hadoop增加了映射器,而配置中没有任何其他更改。 现在所有数据节点都以最大功能运行。 I found the solution. To increase number of reducers in the file mapred-site.xml I added ...
  • 问题是你的X.jar可能不在每个节点上......对吗? 因此,您需要在作业运行时随处运送它。 您可以将X.jar添加到-file参数,如下所示: hadoop jar /path/to/hadoop-streaming.jar -input /inDir -ouput /outDir -file jarscript.sh -file /path/to/jar/X.jar -mapper jarscript.sh 当您运行作业时,它jarscript ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)