-
Notifications
You must be signed in to change notification settings - Fork 188
/
PopulationVariant.java
52 lines (42 loc) · 1.33 KB
/
PopulationVariant.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright (C) 2010-2021 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.testing.story.sysperf;
enum PopulationVariant {
P10("10", 10),
P100("100", 100),
P1K("1k", 1000),
P10K("10k", 10000),
P100K("100k", 100_000),
P1M("1m", 1_000_000);
private static final String PROP_POPULATION = "population";
private final String name;
private final int accounts;
PopulationVariant(String name, int accounts) {
this.name = name;
this.accounts = accounts;
}
public String getName() {
return name;
}
public int getAccounts() {
return accounts;
}
public static PopulationVariant setup() {
String configuredName = System.getProperty(PROP_POPULATION, P10.name);
PopulationVariant variant = fromName(configuredName);
System.out.println("Population variant: " + variant);
return variant;
}
private static PopulationVariant fromName(String name) {
for (PopulationVariant value : values()) {
if (value.name.equals(name)) {
return value;
}
}
throw new IllegalArgumentException("Unknown population variant: " + name);
}
}