|
| 1 | +package io.lettuce.test.config; |
| 2 | + |
| 3 | +import org.springframework.beans.factory.annotation.Value; |
| 4 | +import org.springframework.stereotype.Component; |
| 5 | + |
| 6 | +/** |
| 7 | + * Configuration properties for test run identification. Contains shared properties like runId and instanceId that can be used |
| 8 | + * across multiple beans. This class is configured via TestRunPropertiesConfiguration to maintain backward compatibility with |
| 9 | + * existing property names (runId, instanceId, appName). |
| 10 | + */ |
| 11 | +@Component |
| 12 | +public class TestRunProperties { |
| 13 | + /** |
| 14 | + * Unique identifier for the test run. Defaults to workload type + random alphanumeric string. |
| 15 | + */ |
| 16 | + @Value("${runId:${runner.test.workload.type}-#{T(org.apache.commons.lang3.RandomStringUtils).randomAlphanumeric(8)}}") |
| 17 | + private String runId; |
| 18 | + |
| 19 | + /** |
| 20 | + * Unique identifier for the application instance. Defaults to application name + random alphanumeric string. |
| 21 | + */ |
| 22 | + @Value("${instanceId:${spring.application.name}-#{T(org.apache.commons.lang3.RandomStringUtils).randomAlphanumeric(8)}}") |
| 23 | + private String instanceId; |
| 24 | + |
| 25 | + /** |
| 26 | + * Application name for identification purposes. Defaults to "lettuce-test-app". |
| 27 | + */ |
| 28 | + @Value("${appName:lettuce-test-app}") |
| 29 | + private String appName; |
| 30 | + |
| 31 | + public String getRunId() { |
| 32 | + return runId; |
| 33 | + } |
| 34 | + |
| 35 | + public void setRunId(String runId) { |
| 36 | + this.runId = runId; |
| 37 | + } |
| 38 | + |
| 39 | + public String getInstanceId() { |
| 40 | + return instanceId; |
| 41 | + } |
| 42 | + |
| 43 | + public void setInstanceId(String instanceId) { |
| 44 | + this.instanceId = instanceId; |
| 45 | + } |
| 46 | + |
| 47 | + public String getAppName() { |
| 48 | + return appName; |
| 49 | + } |
| 50 | + |
| 51 | + public void setAppName(String appName) { |
| 52 | + this.appName = appName; |
| 53 | + } |
| 54 | + |
| 55 | + @Override |
| 56 | + public String toString() { |
| 57 | + return "TestRunProperties{" + "runId='" + runId + '\'' + ", instanceId='" + instanceId + '\'' + ", appName='" + appName |
| 58 | + + '\'' + '}'; |
| 59 | + } |
| 60 | + |
| 61 | +} |
0 commit comments