我想在我的测试类中使用多个外部资源,但是我对外部资源的排序有问题.
这是代码片段:
public class TestPigExternalResource { // hadoop external resource,this should start first @Rule public HadoopSingleNodeCluster cluster = new HadoopSingleNodeCluster(); // pig external resourcem,this should wait until hadoop external resource starts @Rule public PigExternalResource pigExternalResource = new PigExternalResource(); ... }
问题是它尝试在hadoop启动之前启动猪,因此我无法连接本地hadoop单节点集群.
有没有办法订购junit规则?
谢谢
解决方法
你可以使用
RuleChain.
@Rule public TestRule chain= RuleChain.outerRule(new HadoopSingleNodeCluster()) .around(new PigExternalResource());