我想在我的测试类中使用多个外部资源,但是我对外部资源的排序有问题。Junit外部资源@规则
下面是代码片段:
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规则吗?
感谢
“HadoopSingleNodeCluster”类是否公开?因为我使用'org.apache.hadoop.mapred.ClusterMapReduceTestCase',但它并不那么稳定。 –
@nefo_x ** HadoopSingleNodeCluster **是我自己的类,在hadoop发行版中不可用。 –
是基于一些现有的代码库吗?我尝试使用集群映射减少测试用例,但它启动外部JVM,并且在某些情况下调试有点困难。 –