I want to use multiple external resources in my test class, but I have a problem with ordering of external resources.
Here is code snippet :
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();
...
}
The problem is it tries to start pig before hadoop started, therefore I could not connect local hadoop single node cluster.
Is there any way to order rules of junit?
thanks
You can use RuleChain.
@Rule
public TestRule chain= RuleChain.outerRule(new HadoopSingleNodeCluster())
.around(new PigExternalResource());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With