Skip to content

Commit 51a077d

Browse files
Fix issue with Octoperf engine due change of api
1 parent 4d3cca1 commit 51a077d

File tree

4 files changed

+64
-51
lines changed

4 files changed

+64
-51
lines changed

jmeter-java-dsl-octoperf/src/main/java/us/abstracta/jmeter/javadsl/octoperf/OctoPerfEngine.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
import us.abstracta.jmeter.javadsl.octoperf.api.Scenario;
3232
import us.abstracta.jmeter.javadsl.octoperf.api.TableEntry;
3333
import us.abstracta.jmeter.javadsl.octoperf.api.User;
34-
import us.abstracta.jmeter.javadsl.octoperf.api.UserLoad;
35-
import us.abstracta.jmeter.javadsl.octoperf.api.UserLoad.UserLoadRampUp;
34+
import us.abstracta.jmeter.javadsl.octoperf.api.UserProfile;
35+
import us.abstracta.jmeter.javadsl.octoperf.api.UserProfile.UserLoadRampUp;
3636
import us.abstracta.jmeter.javadsl.octoperf.api.VirtualUser;
3737
import us.abstracta.jmeter.javadsl.octoperf.api.Workspace;
3838

@@ -264,8 +264,8 @@ private Scenario buildScenario(User user, Project project, List<VirtualUser> vus
264264
HashTree tree) throws IOException {
265265
Provider provider = apiClient.findProviderByWorkspace(project.getWorkspace());
266266
String defaultRegion = provider.getRegions().keySet().iterator().next();
267-
List<UserLoad> userLoads = vus.stream()
268-
.map(vu -> new UserLoad(vu.getId(), provider.getId(), defaultRegion,
267+
List<UserProfile> userLoads = vus.stream()
268+
.map(vu -> new UserProfile(vu.getId(), provider.getId(), defaultRegion,
269269
buildUserLoadConfig(tree)))
270270
.collect(Collectors.toList());
271271
Scenario ret = apiClient.createScenario(

jmeter-java-dsl-octoperf/src/main/java/us/abstracta/jmeter/javadsl/octoperf/api/Scenario.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ public class Scenario {
1616
private final String projectId;
1717
private final String name;
1818
private final String description = "";
19-
private final List<UserLoad> userLoads;
19+
private final List<UserProfile> userProfiles;
2020
private final String mode = "STANDARD";
2121
private final Instant created = Instant.now();
2222
private final Instant lastModified = Instant.now();
2323
private final Set<String> tags;
24-
private final BackendListenerSettings backendListeners = new BackendListenerSettings();
2524
private Project project;
2625

2726
@JsonCreator
@@ -30,18 +29,18 @@ public Scenario(@JsonProperty("id") String id, @JsonProperty("tags") Set<String>
3029
this.userId = null;
3130
this.projectId = null;
3231
this.name = null;
33-
this.userLoads = null;
32+
this.userProfiles = null;
3433
this.tags = tags;
3534
}
3635

37-
public Scenario(User user, Project project, String name, List<UserLoad> userLoads,
36+
public Scenario(User user, Project project, String name, List<UserProfile> userProfiles,
3837
Set<String> tags) {
3938
this.id = "";
4039
this.userId = user.getId();
4140
this.project = project;
4241
this.projectId = project.getId();
4342
this.name = name;
44-
this.userLoads = userLoads;
43+
this.userProfiles = userProfiles;
4544
this.tags = tags;
4645
}
4746

@@ -67,15 +66,4 @@ public String getUrl() {
6766
return project.getBaseUrl() + "/runtime/scenario/" + id;
6867
}
6968

70-
public static class BackendListenerSettings {
71-
72-
private final int queueSize = 5000;
73-
private final List<BackendListener> listeners = Collections.emptyList();
74-
75-
}
76-
77-
public static class BackendListener {
78-
79-
}
80-
8169
}

jmeter-java-dsl-octoperf/src/main/java/us/abstracta/jmeter/javadsl/octoperf/api/UserLoad.java renamed to jmeter-java-dsl-octoperf/src/main/java/us/abstracta/jmeter/javadsl/octoperf/api/UserProfile.java

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,37 @@
66
import com.fasterxml.jackson.annotation.JsonSubTypes;
77
import com.fasterxml.jackson.annotation.JsonTypeInfo;
88
import com.fasterxml.jackson.annotation.JsonTypeName;
9+
910
import java.util.Collections;
1011
import java.util.List;
1112
import java.util.Map;
1213
import org.apache.jmeter.threads.ThreadGroup;
1314
import us.abstracta.jmeter.javadsl.core.threadgroups.BaseThreadGroup.SampleErrorAction;
1415

15-
public class UserLoad {
16+
public class UserProfile {
1617

1718
// we don't need getters since Jackson gets the values from fields
1819
private final String name = "";
1920
private final String virtualUserId;
2021
private final String providerId;
21-
private final String region;
22-
private final UserLoadStrategy strategy;
23-
private final BandwidthSettings bandwidth = new BandwidthSettings();
24-
private final BrowserSettings browser = new BrowserSettings();
25-
private final DnsSettings dns = new DnsSettings();
26-
private final ThinkTimeSettings thinktime = new ThinkTimeSettings();
22+
private final String location;
23+
private final UserLoadStrategy load;
2724
private final MemorySettings memory = new MemorySettings();
28-
private final JtlSettings jtl = new JtlSettings();
29-
private final PropertiesSettings properties = new PropertiesSettings();
30-
private final SetUpTearDownSettings setUp = null;
31-
private final SetUpTearDownSettings tearDown = null;
25+
private final Engine engine = new Engine();
3226

33-
public UserLoad() {
27+
public UserProfile() {
3428
virtualUserId = null;
3529
providerId = null;
36-
region = null;
37-
strategy = null;
30+
location = null;
31+
load = null;
3832
}
3933

40-
public UserLoad(String virtualUserId, String providerId, String region,
34+
public UserProfile(String virtualUserId, String providerId, String location,
4135
UserLoadStrategy strategy) {
4236
this.virtualUserId = virtualUserId;
4337
this.providerId = providerId;
44-
this.region = region;
45-
this.strategy = strategy;
38+
this.location = location;
39+
this.load = strategy;
4640
}
4741

4842
@JsonTypeInfo(use = NAME, include = PROPERTY)
@@ -53,25 +47,24 @@ public abstract static class UserLoadStrategy {
5347

5448
}
5549

56-
@JsonTypeName("UserLoadRampup")
50+
@JsonTypeName("UserProfileLoadRampUp")
5751
public static class UserLoadRampUp extends UserLoadStrategy {
5852

59-
private final int userload;
60-
private final long rampup;
61-
private final long peak;
62-
private final long delay = 0;
63-
private final SampleErrorAction onSampleError = SampleErrorAction.CONTINUE;
53+
private final int plateauVus;
54+
private final long rampUpMs;
55+
private final long plateauMs;
56+
private final long delayMs = 0;
6457

6558
public UserLoadRampUp() {
66-
userload = 0;
67-
rampup = 0;
68-
peak = 0;
59+
plateauVus = 0;
60+
rampUpMs = 0;
61+
plateauMs = 0;
6962
}
7063

7164
public UserLoadRampUp(int userLoad, long rampUpMillis, long peakMillis) {
72-
this.userload = userLoad;
73-
this.rampup = rampUpMillis;
74-
this.peak = peakMillis;
65+
this.plateauVus = userLoad;
66+
this.rampUpMs = rampUpMillis;
67+
this.plateauMs = peakMillis;
7568
}
7669

7770
public static UserLoadRampUp fromThreadGroup(ThreadGroup threadGroup) {
@@ -85,6 +78,38 @@ public static UserLoadRampUp fromThreadGroup(ThreadGroup threadGroup) {
8578

8679
}
8780

81+
@JsonTypeInfo(use = NAME, include = PROPERTY)
82+
@JsonTypeName("JmeterUserProfileEngine")
83+
public static class Engine {
84+
85+
private final EngineSettings settings = new EngineSettings();
86+
private final BrowserSettings browser = new BrowserSettings();
87+
private final BandwidthSettings bandwidth = new BandwidthSettings();
88+
private final DnsSettings dns = new DnsSettings();
89+
private final JtlSettings jtl = new JtlSettings();
90+
private final PropertiesSettings properties = new PropertiesSettings();
91+
92+
}
93+
94+
public static class EngineSettings {
95+
96+
private final ExternalLiveReportingSettings externalLiveReporting = new ExternalLiveReportingSettings();
97+
private final SampleErrorAction errorHandling = SampleErrorAction.CONTINUE;
98+
private final ThinkTimeSettings thinkTime = new ThinkTimeSettings();
99+
private final SetUpTearDownSettings setUp = null;
100+
private final SetUpTearDownSettings tearDown = null;
101+
102+
}
103+
104+
@JsonTypeInfo(use = NAME, include = PROPERTY)
105+
@JsonTypeName("JmeterExternalLiveReportingSettings")
106+
public static class ExternalLiveReportingSettings {
107+
108+
private final List<String> listeners = Collections.emptyList();
109+
private final int queueSize = 5000;
110+
111+
}
112+
88113
public static class SetUpTearDownSettings {
89114

90115
}
@@ -102,6 +127,8 @@ public static class BrowserSettings {
102127
private final String userAgent = "";
103128
private final CacheManager cache = new CacheManager();
104129
private final CookiesManager cookies = new CookiesManager();
130+
private final Boolean downloadResources = null;
131+
private final Boolean keepAlive = null;
105132

106133
}
107134

jmeter-java-dsl-octoperf/src/test/java/us/abstracta/jmeter/javadsl/octoperf/OctoPerfEngineTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import static us.abstracta.jmeter.javadsl.JmeterDsl.threadGroup;
77

88
import java.time.Duration;
9-
import java.util.HashMap;
10-
import java.util.Map;
119
import org.junit.jupiter.api.Test;
1210
import us.abstracta.jmeter.javadsl.core.TestPlanStats;
1311

0 commit comments

Comments
 (0)