Skip to content

Commit

Permalink
Keep consistent for E2ETestCasesLoader on jaeger and zipkin module (a…
Browse files Browse the repository at this point in the history
…pache#32190)

* Rename E2ETestEnvironment

* Keep consistent for E2ETestCasesLoader on jaeger and zipkin module
  • Loading branch information
terrymanu authored Jul 19, 2024
1 parent 570e493 commit e5da78d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static E2ETestCasesLoader getInstance() {
}

/**
* Load E2E test cases.
* Load test cases.
*
* @param adapter adapter
* @return test cases
Expand Down Expand Up @@ -103,8 +103,8 @@ public FileVisitResult visitFile(final Path file, final BasicFileAttributes basi
return result;
}

private E2ETestCases unmarshal(final String integrateCasesFile) throws IOException, JAXBException {
try (FileReader reader = new FileReader(integrateCasesFile)) {
private E2ETestCases unmarshal(final String e2eCasesFile) throws IOException, JAXBException {
try (FileReader reader = new FileReader(e2eCasesFile)) {
return (E2ETestCases) JAXBContext.newInstance(E2ETestCases.class).createUnmarshaller().unmarshal(reader);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
/**
* Span test case.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
public final class SpanTestCase {

@XmlAttribute(name = "service-name")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private static class TestCaseArgumentsProvider implements ArgumentsProvider {

@Override
public Stream<? extends Arguments> provideArguments(final ExtensionContext extensionContext) {
return E2ETestCasesLoader.getInstance().loadE2ETestCases(E2ETestEnvironment.getInstance().getAdapter()).stream().map(Arguments::of);
return E2ETestCasesLoader.getInstance().loadTestCases(E2ETestEnvironment.getInstance().getAdapter()).stream().map(Arguments::of);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public final class E2ETestCasesLoader {

private static final E2ETestCasesLoader INSTANCE = new E2ETestCasesLoader();

private Collection<SpanTestCase> e2eTestCases;
private Collection<SpanTestCase> testCases;

/**
* Get singleton instance.
Expand All @@ -62,25 +62,25 @@ public static E2ETestCasesLoader getInstance() {
}

/**
* Load E2E test cases.
* Load test cases.
*
* @param adapter adapter
* @return E2E test cases
* @return test cases
*/
@SneakyThrows({IOException.class, URISyntaxException.class, JAXBException.class})
public Collection<SpanTestCase> loadE2ETestCases(final String adapter) {
if (null != e2eTestCases) {
return e2eTestCases;
public Collection<SpanTestCase> loadTestCases(final String adapter) {
if (null != testCases) {
return testCases;
}
e2eTestCases = new LinkedList<>();
testCases = new LinkedList<>();
URL url = Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource(String.format("cases/%s", adapter)));
for (File each : getFiles(url)) {
e2eTestCases.addAll(loadE2ETestCases(each));
testCases.addAll(loadTestCases(each));
}
return e2eTestCases;
return testCases;
}

private Collection<SpanTestCase> loadE2ETestCases(final File file) throws IOException, JAXBException {
private Collection<SpanTestCase> loadTestCases(final File file) throws IOException, JAXBException {
Collection<SpanTestCase> result = new LinkedList<>();
for (SpanTestCase each : unmarshal(file.getPath()).getTestCases()) {
result.addAll(each.getTagCases().stream().map(optional -> createSpanTestCase(each.getServiceName(), each.getSpanName(), optional)).collect(Collectors.toList()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
/**
* Span test case.
*/
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
public final class SpanTestCase {

@XmlAttribute(name = "service-name")
Expand Down

0 comments on commit e5da78d

Please sign in to comment.