-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
61 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/com/casinthecloud/simpleperf/test/RandomTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.casinthecloud.simpleperf.test; | ||
|
||
import lombok.val; | ||
|
||
import java.net.http.HttpClient; | ||
import java.util.concurrent.atomic.AtomicLong; | ||
|
||
/** | ||
* Randomly run test. | ||
* | ||
* @author Jerome LELEU | ||
* @since 1.0.0 | ||
*/ | ||
public class RandomTest extends BaseTest { | ||
|
||
private BaseTest[] tests; | ||
|
||
public RandomTest(final BaseTest... tests) { | ||
this.tests = tests; | ||
} | ||
|
||
@Override | ||
public void run() throws Exception { | ||
val r = random(tests.length); | ||
|
||
tests[r].run(); | ||
} | ||
|
||
public void setClient(final HttpClient client) { | ||
for (val test : tests) { | ||
test.setClient(client); | ||
} | ||
} | ||
|
||
public void setTime(final AtomicLong time) { | ||
for (val test : tests) { | ||
test.setTime(time); | ||
} | ||
} | ||
} |