Skip to content

Commit

Permalink
Align TestSystemPerformance with the master branch
Browse files Browse the repository at this point in the history
Main changes are the reporting (e.g. file naming plus the scheme
for naming the configurations), and the new memberOf computation.
  • Loading branch information
mederly committed Sep 30, 2021
1 parent e7211bb commit 6c206fb
Show file tree
Hide file tree
Showing 9 changed files with 170 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@
import java.io.IOException;
import java.io.PrintWriter;

import static com.evolveum.midpoint.testing.story.sysperf.TestSystemPerformance.START;
import static com.evolveum.midpoint.testing.story.sysperf.TestSystemPerformance.TARGET_DIR;
import static com.evolveum.midpoint.testing.story.sysperf.TestSystemPerformance.*;

class DetailsOutputFile {

private static final File FILE = new File(TARGET_DIR, START + "-details.txt");
private final PrintWriter writer;

DetailsOutputFile() throws IOException {
writer = new PrintWriter(new FileWriter(FILE));
writer = new PrintWriter(new FileWriter(getFile()));
}

private File getFile() {
return new File(TARGET_DIR, START + "-" + OTHER_PARAMETERS.label + "-details.txt");
}

void logTaskFinish(String testName, TaskType taskAfter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ private String createDefaultLabel() {
getSourceMappingsLabel() + "-" +
TARGETS_CONFIGURATION.getNumberOfResources() + "t-" +
getTargetMappingsLabel() + "-" +
getAssignmentsLabel()
getAssignmentsLabel() + "-" +
getUsersLabel()
;
}

Expand Down Expand Up @@ -58,6 +59,25 @@ private String getAssignmentsLabel() {
}
}

private String getUsersLabel() {
int users = SOURCES_CONFIGURATION.getNumberOfAccounts();

int number;
String suffix;

if (users >= 1_000_000 && users % 1_000_000 == 0) {
number = users / 1_000_000;
suffix = "M";
} else if (users >= 1_000 && users % 1_000 == 0) {
number = users / 1_000;
suffix = "k";
} else {
number = users;
suffix = "";
}
return number + suffix + "u";
}

static OtherParameters setup() {
return new OtherParameters();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
package com.evolveum.midpoint.testing.story.sysperf;

import com.evolveum.midpoint.task.api.Task;
import static com.evolveum.midpoint.testing.story.sysperf.TestSystemPerformance.*;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

import static com.evolveum.midpoint.testing.story.sysperf.TestSystemPerformance.TARGET_DIR;
import static com.evolveum.midpoint.testing.story.sysperf.TestSystemPerformance.START;
import com.evolveum.midpoint.task.api.Task;

class ProgressOutputFile {

static final File FILE = new File(TARGET_DIR, START + "-progress.csv");
private final PrintWriter writer;

ProgressOutputFile() throws IOException {
writer = new PrintWriter(new FileWriter(FILE));
writer = new PrintWriter(new FileWriter(getFile()));
writer.println("test;time;progress");
}

private File getFile() {
return new File(TARGET_DIR, START + "-" + OTHER_PARAMETERS.label + "-progress.csv");
}

void recordProgress(String label, Task task) {
long start = task.getLastRunStartTimestamp();
Long lastFinish = task.getLastRunFinishTimestamp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class RolesConfiguration {
private static final String PROP_INDUCEMENTS_COUNT = PROP_INDUCEMENTS + ".count";
private static final String PROP_INDUCEMENTS_MIN = PROP_INDUCEMENTS + ".min";
private static final String PROP_INDUCEMENTS_MAX = PROP_INDUCEMENTS + ".max";
private static final String PROP_MEMBER_OF_COMPUTATION = PROP + ".memberOfComputation";

private static final File BUSINESS_ROLE_TEMPLATE_FILE = new File(TEST_DIR, "role-business.vm.xml");
private static final File TECHNICAL_ROLE_TEMPLATE_FILE = new File(TEST_DIR, "role-technical.vm.xml");
Expand All @@ -49,6 +50,8 @@ class RolesConfiguration {
private final int numberOfInducementsMin;
private final int numberOfInducementsMax;

private final boolean memberOfComputation;

private final List<TestResource<RoleType>> generatedBusinessRoles;
private final List<TestResource<RoleType>> generatedTechnicalRoles;

Expand All @@ -69,6 +72,7 @@ private RolesConfiguration() {
numberOfInducementsMin = Integer.parseInt(System.getProperty(PROP_INDUCEMENTS_MIN, "1"));
numberOfInducementsMax = Integer.parseInt(System.getProperty(PROP_INDUCEMENTS_MAX, String.valueOf(numberOfInducementsMin)));
}
memberOfComputation = Boolean.parseBoolean(System.getProperty(PROP_MEMBER_OF_COMPUTATION, "false"));

generatedTechnicalRoles = generateTechnicalRoles();
generatedBusinessRoles = generateBusinessRoles();
Expand Down Expand Up @@ -106,6 +110,10 @@ List<TestResource<RoleType>> getGeneratedTechnicalRoles() {
return generatedTechnicalRoles;
}

boolean isMemberOfComputation() {
return memberOfComputation;
}

@Override
public String toString() {
return "RolesConfiguration{" +
Expand All @@ -115,6 +123,7 @@ public String toString() {
", numberOfAssignmentsMax=" + numberOfAssignmentsMax +
", numberOfInducementsMin=" + numberOfInducementsMin +
", numberOfInducementsMax=" + numberOfInducementsMax +
", memberOfComputation=" + memberOfComputation +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@

class SummaryOutputFile {

private static final File FILE = new File(TARGET_DIR, START + "-summary.txt");
private final PrintWriter writer;

SummaryOutputFile() throws IOException {
writer = new PrintWriter(new FileWriter(FILE));
writer = new PrintWriter(new FileWriter(getFile()));
}

private File getFile() {
return new File(TARGET_DIR, START + "-" + OTHER_PARAMETERS.label + "-summary.txt");
}

void logStart() {
writer.println("Started: " + new Date(START) + " (" + START + ")");
writer.println("Label: " + OTHER_PARAMETERS.label);
writer.println();
writer.printf("Schema: %s\n", SCHEMA_CONFIGURATION);
writer.printf("Sources: %s\n", SOURCES_CONFIGURATION);
writer.printf("Targets: %s\n", TARGETS_CONFIGURATION);
writer.printf("Roles: %s\n", ROLES_CONFIGURATION);
writer.printf("Import: %s\n", IMPORTS_CONFIGURATION);
writer.printf("Reconciliation: %s\n", RECONCILIATIONS_CONFIGURATION);
writer.printf("Recomputation: %s\n", RECOMPUTATION_CONFIGURATION);
writer.printf("Progress file: %s\n\n", ProgressOutputFile.FILE);
writer.printf("Recomputation: %s\n\n", RECOMPUTATION_CONFIGURATION);
writer.flush();
}

Expand All @@ -36,4 +40,13 @@ void logTaskFinish(String desc, long executionTime, double timePerAccount) {
writer.printf("Time per account: %,.1f ms\n\n", timePerAccount);
writer.flush();
}

void logFinish() {
long end = System.currentTimeMillis();
writer.printf("Finished at: %s\n", new Date(end));
long millis = end - START;
writer.printf("Took: %,.1f seconds = %.1f minutes\n", millis / 1000.0, millis / 60000.0);
writer.printf("Accounts: %,d\n", SOURCES_CONFIGURATION.getNumberOfAccounts());
writer.flush();
}
}

0 comments on commit 6c206fb

Please sign in to comment.