Class DefaultFuzzer
java.lang.Object
org.btrplace.safeplace.testing.fuzzer.DefaultFuzzer
- All Implemented Interfaces:
Supplier<TestCase>
,ConfigurableFuzzer
,Fuzzer
public class DefaultFuzzer extends Object implements ConfigurableFuzzer
Default implementation of a fuzzer.
- Author:
- Fabien Hermenier
-
Constructor Summary
Constructors Constructor Description DefaultFuzzer(Tester t, Constraint toTest, List<Constraint> pre)
Make a new fuzzer. -
Method Summary
Modifier and Type Method Description ConfigurableFuzzer
dstOffNodes(double ratio)
Set the ratio of nodes OFFLINE at the END of the reconfigurationConfigurableFuzzer
dstVMs(int ready, int running, int sleeping)
Set the distribution of VM final state.ConfigurableFuzzer
durations(int min, int max)
Set the bounds for the action durationTestCase
get()
long
lastFuzzingDuration()
The duration of the fuzzing stage.int
lastFuzzingIterations()
The number of fuzzing iterations to get a valid test case.long
lastValidationDuration()
The duration of the validation stage.ConfigurableFuzzer
nodes(int nb)
Set the number of nodes inside the plan.ConfigurableFuzzer
restriction(Set<Restriction> domain)
Set the restriction domain for the constraint to fuzz.DefaultFuzzer
save(Writer w)
Write the generated test cases for a later replay.DefaultFuzzer
save(String path)
Write the generated test cases for a later replay.ConfigurableFuzzer
srcOffNodes(double ratio)
Set the ratio of nodes initially OFFLINE.ConfigurableFuzzer
srcVMs(int ready, int running, int sleeping)
Set the distribution of VM initial state.ConfigurableFuzzer
vms(int nb)
Set the number of VMs inside the plan.ConfigurableFuzzer
with(String var, int val)
Set the value for a constraint int argument.ConfigurableFuzzer
with(String var, int[] vals)
Set the domain for a constraint int argument.ConfigurableFuzzer
with(String var, int min, int max)
Set the domain for a constraint int argument.ConfigurableFuzzer
with(String arg, String val)
Set the value for a constraint String argument.ConfigurableFuzzer
with(String arg, String[] vals)
Set the domain for a constraint String argument.ConfigurableFuzzer
with(String arg, Domain d)
Set the domain for a constraint argument.ConfigurableFuzzer
with(FuzzerDecorator f)
Add a decorator.
-
Constructor Details
-
DefaultFuzzer
Make a new fuzzer.- Parameters:
t
- the tester to use to validate the test casetoTest
- the constraint to test inside the test casespre
- the constraint to use to validate the generate test case
-
-
Method Details
-
lastFuzzingDuration
public long lastFuzzingDuration()Description copied from interface:Fuzzer
The duration of the fuzzing stage.- Specified by:
lastFuzzingDuration
in interfaceFuzzer
- Returns:
- a duration in millisecond
-
lastValidationDuration
public long lastValidationDuration()Description copied from interface:Fuzzer
The duration of the validation stage.- Specified by:
lastValidationDuration
in interfaceFuzzer
- Returns:
- a duration in millisecond
-
lastFuzzingIterations
public int lastFuzzingIterations()Description copied from interface:Fuzzer
The number of fuzzing iterations to get a valid test case.- Specified by:
lastFuzzingIterations
in interfaceFuzzer
- Returns:
- an integer
-
get
-
with
Description copied from interface:ConfigurableFuzzer
Set the value for a constraint int argument.- Specified by:
with
in interfaceConfigurableFuzzer
- Parameters:
var
- the argument nameval
- the value- Returns:
this
-
with
Description copied from interface:ConfigurableFuzzer
Set the domain for a constraint int argument. The fuzzer will pick a value among this domain- Specified by:
with
in interfaceConfigurableFuzzer
- Parameters:
var
- the argument namemin
- the lower boundmax
- the upper bound- Returns:
this
-
with
Description copied from interface:ConfigurableFuzzer
Set the domain for a constraint int argument. The fuzzer will pick a value among this domain- Specified by:
with
in interfaceConfigurableFuzzer
- Parameters:
var
- the argument namevals
- the possible values- Returns:
this
-
with
Description copied from interface:ConfigurableFuzzer
Set the value for a constraint String argument.- Specified by:
with
in interfaceConfigurableFuzzer
- Parameters:
arg
- the argument nameval
- the value- Returns:
this
-
with
Description copied from interface:ConfigurableFuzzer
Set the domain for a constraint String argument. The fuzzer will pick a value among this domain- Specified by:
with
in interfaceConfigurableFuzzer
- Parameters:
arg
- the argument namevals
- the possible values- Returns:
this
-
with
Description copied from interface:ConfigurableFuzzer
Set the domain for a constraint argument. The fuzzer will pick a value among this domain- Specified by:
with
in interfaceConfigurableFuzzer
- Parameters:
arg
- the argument named
- the argument domain- Returns:
this
-
restriction
Description copied from interface:ConfigurableFuzzer
Set the restriction domain for the constraint to fuzz. The fuzzer will pick a value among this domain- Specified by:
restriction
in interfaceConfigurableFuzzer
- Parameters:
domain
- the domain- Returns:
this
-
save
Description copied from interface:ConfigurableFuzzer
Write the generated test cases for a later replay. EachTestCase
is serialised to a JSON format. One line per test case.- Specified by:
save
in interfaceConfigurableFuzzer
- Parameters:
w
- the output stream- Returns:
this
- See Also:
to provide the saved test cases
-
save
Description copied from interface:ConfigurableFuzzer
Write the generated test cases for a later replay.- Specified by:
save
in interfaceConfigurableFuzzer
- Parameters:
path
- the output file- Returns:
this
- See Also:
ConfigurableFuzzer.save(Writer)
-
vms
Description copied from interface:ConfigurableFuzzer
Set the number of VMs inside the plan.- Specified by:
vms
in interfaceConfigurableFuzzer
- Parameters:
nb
- a number >= 0- Returns:
this
-
nodes
Description copied from interface:ConfigurableFuzzer
Set the number of nodes inside the plan.- Specified by:
nodes
in interfaceConfigurableFuzzer
- Parameters:
nb
- a number >= 0- Returns:
this
-
with
Description copied from interface:ConfigurableFuzzer
Add a decorator. It will be called once the initial plan generated.- Specified by:
with
in interfaceConfigurableFuzzer
- Parameters:
f
- the decorator to add- Returns:
this
-
srcOffNodes
Description copied from interface:ConfigurableFuzzer
Set the ratio of nodes initially OFFLINE.- Specified by:
srcOffNodes
in interfaceConfigurableFuzzer
- Parameters:
ratio
- a number <= 1.0- Returns:
this
-
dstOffNodes
Description copied from interface:ConfigurableFuzzer
Set the ratio of nodes OFFLINE at the END of the reconfiguration- Specified by:
dstOffNodes
in interfaceConfigurableFuzzer
- Parameters:
ratio
- a number <= 1.0- Returns:
this
-
srcVMs
Description copied from interface:ConfigurableFuzzer
Set the distribution of VM initial state. The individual weight compared to their sum indicates the probability. For example, if the cumulative weight is 100, then each weight denotes a percentage- Specified by:
srcVMs
in interfaceConfigurableFuzzer
- Parameters:
ready
- the weight of VMs initially ready.running
- the weight of VMs initially running.sleeping
- the weight of VMs initially sleeping.- Returns:
this
-
dstVMs
Description copied from interface:ConfigurableFuzzer
Set the distribution of VM final state. The individual weight compared to their sum indicates the probability. For example, if the cumulative weight is 100, then each weight denotes a percentage- Specified by:
dstVMs
in interfaceConfigurableFuzzer
- Parameters:
ready
- the weight of VMs eventually ready.running
- the weight of VMs eventually running.sleeping
- the weight of VMs eventually sleeping.- Returns:
this
-
durations
Description copied from interface:ConfigurableFuzzer
Set the bounds for the action duration- Specified by:
durations
in interfaceConfigurableFuzzer
- Parameters:
min
- the minimum durationmax
- the maximum duration- Returns:
this
-