Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file: Add some extra logs to attempt catching info about flakiness #3584 #3787

Merged
merged 1 commit into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,27 @@ public void startRoute(String routeId) throws Exception {
@Path("/getFromMock/{mockId}")
@GET
public String getFromMock(@PathParam("mockId") String mockId) {
System.out.println("CAMEL-QUARKUS-3584 => FileResource.getFromMock(" + mockId + ").thread.id => "
+ Thread.currentThread().getId());
MockEndpoint mockEndpoint = context.getEndpoint("mock:" + mockId, MockEndpoint.class);
System.out.println("CAMEL-QUARKUS-3584 => FileResource.getFromMock(" + mockId + ").mockEndpoint => 0x"
+ System.identityHashCode(mockEndpoint));

String result = mockEndpoint.getExchanges().stream().map(e -> e.getIn().getBody(String.class))
.collect(Collectors.joining(SEPARATOR));

System.out.println("CAMEL-QUARKUS-3584 => FileResource.getFromMock(" + mockId + ") returns => " + result);

return result;
}

@Path("/resetMock/{mockId}")
@GET
public void resetMock(@PathParam("mockId") String mockId) {
System.out.println("CAMEL-QUARKUS-3584 => FileResource.resetMock().thread.id => " + Thread.currentThread().getId());
MockEndpoint mockEndpoint = context.getEndpoint("mock:" + mockId, MockEndpoint.class);
System.out.println(
"CAMEL-QUARKUS-3584 => FileResource.resetMock.mockEndpoint => 0x" + System.identityHashCode(mockEndpoint));
mockEndpoint.reset();
}

Expand All @@ -121,6 +130,7 @@ public void resetMock(@PathParam("mockId") String mockId) {
public Response createFile(@PathParam("folder") String folder, byte[] content, @QueryParam("charset") String charset,
@QueryParam("fileName") String fileName)
throws Exception {
System.out.println("CAMEL-QUARKUS-3584 => FileResource.createFile().thread.id => " + Thread.currentThread().getId());
StringBuilder url = new StringBuilder("file:target/" + folder + "?initialDelay=10");
if (charset != null && !charset.equals("")) {
url.append("&charset=").append(charset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ public void configure() {
.to("mock:charsetIsoRead");

from("file://target/idempotent?idempotent=true&move=done/${file:name}&initialDelay=0&delay=10")
.log("CAMEL-QUARKUS-3584 => from(\"file://target/idempotent?idempotent=true&move=done/${file:name}&initialDelay=0&delay=10\")... consumed message ${body}")
.convertBodyTo(String.class).to("mock:idempotent");

bindToRegistry("myFilter", new MyFileFilter<>());
from(("file://target/filter?initialDelay=0&delay=10&filter=#myFilter"))
.log("CAMEL-QUARKUS-3584 => from(\"file://target/filter?initialDelay=0&delay=10&filter=#myFilter\")... consumed message ${body}")
.convertBodyTo(String.class).to("mock:filter");

from(("file://target/sortBy?initialDelay=0&delay=10&sortBy=reverse:file:name"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public void batch() throws InterruptedException, UnsupportedEncodingException {

@Test
public void idempotent() throws IOException {
System.out.println("CAMEL-QUARKUS-3584 => FileTest.idempotent().thread.id => " + Thread.currentThread().getId());
// Create a new file
String fileName01 = createFile(FILE_CONTENT_01, "/file/create/idempotent");

Expand Down Expand Up @@ -149,6 +150,7 @@ public void idempotent() throws IOException {

@Test
public void filter() throws IOException {
System.out.println("CAMEL-QUARKUS-3584 => FileTest.filter().thread.id => " + Thread.currentThread().getId());
String fileName = createFile(FILE_CONTENT_01, "/file/create/filter", null, "skip_" + UUID.randomUUID().toString());
createFile(FILE_CONTENT_02, "/file/create/filter");

Expand All @@ -164,6 +166,7 @@ public void filter() throws IOException {

@Test
public void sortBy() throws IOException, InterruptedException {
System.out.println("CAMEL-QUARKUS-3584 => FileTest.sortBy().thread.id => " + Thread.currentThread().getId());
createFile(FILE_CONTENT_03, "/file/create/" + SORT_BY, null, "c_" + UUID.randomUUID().toString());
createFile(FILE_CONTENT_01, "/file/create/" + SORT_BY, null, "a_" + UUID.randomUUID().toString());
createFile(FILE_CONTENT_02, "/file/create/" + SORT_BY, null, "b_" + UUID.randomUUID().toString());
Expand Down