Skip to content

Commit 18a9c6b

Browse files
committed
use records for internals
1 parent 585b4cf commit 18a9c6b

9 files changed

Lines changed: 131 additions & 143 deletions

File tree

allure-cucumber7-jvm/src/main/java/io/qameta/allure/cucumber7jvm/testsourcemodel/TestSourcesModel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ private AstNode createAstNode(final Object node, final AstNode astNode) {
165165
return new AstNode(node, astNode);
166166
}
167167

168+
/**
169+
* A node of the parsed Gherkin document tree, linked to its parent for upward traversal.
170+
*/
168171
private static class AstNode {
169172
private final Object node;
170173
private final AstNode parent;

allure-grpc/src/main/java/io/qameta/allure/grpc/AllureGrpc.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,10 @@ private static void copyAsciiResponseMetadata(
443443
}
444444
}
445445

446+
/**
447+
* Per-call mutable state of a reported gRPC call: the Allure step identity, the call metadata, and the
448+
* client/server messages accumulated while the call is in flight.
449+
*/
446450
private static final class StepContext<T, R> {
447451
private final AllureExternalKey stepKey;
448452
private final MethodDescriptor<T, R> methodDescriptor;

allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java

Lines changed: 100 additions & 123 deletions
Large diffs are not rendered by default.

allure-java-commons/src/main/java/io/qameta/allure/FileSystemResultsWriter.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ private static String getErrorMessage(final String entityName) {
132132
return "Could not write Allure " + entityName;
133133
}
134134

135+
/**
136+
* Writer callback over the open file channel of a result file being written atomically.
137+
*/
135138
private interface ChannelConsumer {
136139

137140
void accept(FileChannel channel) throws IOException;

allure-java-commons/src/main/java/io/qameta/allure/http/HttpExchangeProcessor.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,18 @@ private static int utf8Length(final int codePoint) {
266266
return 4;
267267
}
268268

269+
/**
270+
* The kind of name-value pair being processed, selecting the matching redaction and formatting rules.
271+
*/
269272
private enum NameValueKind {
270273
HEADER,
271274
QUERY,
272275
FORM
273276
}
274277

278+
/**
279+
* A possibly truncated body value: the retained text, the original size, and whether truncation happened.
280+
*/
275281
private record TruncatedValue(String value, Long size, boolean truncated) {
276282
}
277283
}

allure-junit-platform/src/main/java/io/qameta/allure/junitplatform/AllureJunitPlatform.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,9 @@ private String getOrCreateTest(final TestIdentifier testIdentifier) {
905905
return tests.get().getOrCreate(testIdentifier);
906906
}
907907

908+
/**
909+
* Thread-safe registry of the Allure uuids assigned to JUnit Platform test identifiers within one launch.
910+
*/
908911
private static final class Uuids {
909912

910913
private final Map<TestIdentifier, String> storage = new ConcurrentHashMap<>();

allure-playwright/src/main/java/io/qameta/allure/playwright/AllurePlaywrightRegistry.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ static void clear() {
111111
STATE.remove();
112112
}
113113

114+
/**
115+
* Per-test mutable registry state: the pages, contexts, and trace sessions observed for the current test, and
116+
* the artifact bookkeeping flags used when the test finishes.
117+
*/
114118
private static final class State {
115119
private final Set<Page> pages = identitySet();
116120
private final Set<BrowserContext> contexts = identitySet();

allure-selenium-bidi/src/main/java/io/qameta/allure/seleniumbidi/SeleniumBiDiSessionFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ private WebDriver toBiDiDriver(final WebDriver driver) {
6464
return augmented instanceof HasBiDi ? augmented : null;
6565
}
6666

67+
/**
68+
* Recording session over Selenium BiDi inspectors; closing it closes every registered inspector.
69+
*/
6770
private static final class SeleniumRecordingSession implements RecordingSession {
6871

6972
private final List<AutoCloseable> inspectors;

allure-testng/src/main/java/io/qameta/allure/testng/AllureTestNg.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ public void onTestSuccess(final ITestResult testResult) {
447447
return;
448448
}
449449

450-
final AllureExternalKey testCaseKey = testKey(currentTest.get().getUuid());
450+
final AllureExternalKey testCaseKey = testKey(currentTest.get().uuid());
451451
getLifecycle().updateTest(testCaseKey, setStatus(Status.PASSED));
452452
getLifecycle().stopTest(testCaseKey);
453453
getLifecycle().writeTest(testCaseKey);
@@ -490,10 +490,10 @@ public void onTestSkipped(final ITestResult result) {
490490
*/
491491
private String ensureTestStarted(final ITestResult result) {
492492
final CurrentTest running = currentTest.get();
493-
if (Objects.isNull(running) || running.getSource() != result) {
493+
if (Objects.isNull(running) || running.source() != result) {
494494
onTestStart(result);
495495
}
496-
return currentTest.get().getUuid();
496+
return currentTest.get().uuid();
497497
}
498498

499499
@Override
@@ -570,7 +570,7 @@ private void ifMethodFixtureStarted(final ITestNGMethod testMethod) {
570570
// linked by its known uuid
571571
final CurrentTest running = currentTest.get();
572572
if (nonNull(running)) {
573-
getLifecycle().addChildToScope(scopeKey, running.getUuid());
573+
getLifecycle().addChildToScope(scopeKey, running.uuid());
574574
}
575575
currentAfterMethodScope.set(scopeKey);
576576
}
@@ -966,22 +966,7 @@ private static boolean isClassAvailableOnClasspath(final String clazz) {
966966
* The test currently running on a thread: the testng result it belongs to (its invocation identity) and the allure
967967
* uuid assigned to it.
968968
*/
969-
private static final class CurrentTest {
970-
private final ITestResult source;
971-
private final String uuid;
972-
973-
private CurrentTest(final ITestResult source, final String uuid) {
974-
this.source = source;
975-
this.uuid = uuid;
976-
}
977-
978-
private ITestResult getSource() {
979-
return source;
980-
}
981-
982-
private String getUuid() {
983-
return uuid;
984-
}
969+
private record CurrentTest(ITestResult source, String uuid) {
985970
}
986971

987972
}

0 commit comments

Comments
 (0)