final int outerLoopCount = 4;
controller.setLoops(outerLoopCount);
// OnlyOnce samples
OnceOnlyController sub_1 = new OnceOnlyController();
sub_1.setName("outer OnlyOnce");
sub_1.addTestElement(new TestSampler("one"));
sub_1.addTestElement(new TestSampler("two"));
controller.addTestElement(sub_1);
controller.addIterationListener(sub_1);
// Outer sample
controller.addTestElement(new TestSampler("three"));
// Inner loop
LoopController sub_2 = new LoopController();
final int innerLoopCount = 5;
sub_2.setLoops(innerLoopCount);
sub_2.addTestElement(new TestSampler("four"));
// OnlyOnce inside inner loop
OnceOnlyController sub_3 = new OnceOnlyController();
sub_3.setName("In loop OnlyOnce");
sub_3.addTestElement(new TestSampler("five"));
sub_3.addTestElement(new TestSampler("six"));
sub_2.addTestElement(sub_3);
sub_2.addIterationListener(sub_3);
// InterleaveController in inner loop
InterleaveControl sub_4 = new InterleaveControl();
sub_4.setStyle(InterleaveControl.USE_SUB_CONTROLLERS);
// OnlyOnce inside InterleaveController
OnceOnlyController sub_5 = new OnceOnlyController();
sub_5.addTestElement(new TestSampler("seven"));
sub_5.addTestElement(new TestSampler("eight"));
sub_5.setName("Inside InterleaveController OnlyOnce");
sub_4.addTestElement(sub_5);
sub_4.addIterationListener(sub_5);
// Samples inside InterleaveController
sub_4.addTestElement(new TestSampler("nine"));
sub_4.addTestElement(new TestSampler("ten"));
sub_2.addTestElement(sub_4);
// Sample in inner loop
sub_2.addTestElement(new TestSampler("eleven"));
controller.addTestElement(sub_2);
// Compute the expected sample names
String[] onlyOnceOrder = new String[] { "one", "two" };
String[] order = new String[] { "three", "four", "five", "six", "seven", "eight", "eleven",