You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2021/03/18 11:52:58 UTC
[camel] branch master updated: Fix core tests using a shared
directory
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 8652820 Fix core tests using a shared directory
8652820 is described below
commit 8652820398a8e6d5c64720ffdf48cfe1504f7c0c
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Mar 18 07:45:43 2021 +0100
Fix core tests using a shared directory
---
.../file/FileProduceAppendCharsEmptyMessageTest.java | 12 ++----------
.../file/FileProduceAppendCharsSingleMessageTest.java | 12 ++----------
.../processor/MultiCastStreamCachingInSubRouteTest.java | 2 +-
3 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendCharsEmptyMessageTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendCharsEmptyMessageTest.java
index 4605f93..25435cb 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendCharsEmptyMessageTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendCharsEmptyMessageTest.java
@@ -20,7 +20,6 @@ import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
@@ -32,7 +31,7 @@ public class FileProduceAppendCharsEmptyMessageTest extends ContextTestSupport {
public void testAppendChars() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
- mock.expectedFileExists("target/data/test-file-append/hello.txt", "@@@");
+ mock.expectedFileExists(testFile("hello.txt"), "@@@");
template.sendBody("direct:start", "");
@@ -40,18 +39,11 @@ public class FileProduceAppendCharsEmptyMessageTest extends ContextTestSupport {
}
@Override
- @BeforeEach
- public void setUp() throws Exception {
- deleteDirectory("target/data/test-file-append");
- super.setUp();
- }
-
- @Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:start").setHeader(Exchange.FILE_NAME, constant("hello.txt"))
- .to("file://target/data/test-file-append?fileExist=Append&appendChars=@@@", "mock:result");
+ .to(fileUri("?fileExist=Append&appendChars=@@@"), "mock:result");
}
};
}
diff --git a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendCharsSingleMessageTest.java b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendCharsSingleMessageTest.java
index fbd1206..d72756d 100644
--- a/core/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendCharsSingleMessageTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/component/file/FileProduceAppendCharsSingleMessageTest.java
@@ -20,7 +20,6 @@ import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
@@ -32,7 +31,7 @@ public class FileProduceAppendCharsSingleMessageTest extends ContextTestSupport
public void testAppendChars() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
- mock.expectedFileExists("target/data/test-file-append/hello.txt", "Hello@@@");
+ mock.expectedFileExists(testFile("hello.txt"), "Hello@@@");
template.sendBody("direct:start", "Hello");
@@ -40,18 +39,11 @@ public class FileProduceAppendCharsSingleMessageTest extends ContextTestSupport
}
@Override
- @BeforeEach
- public void setUp() throws Exception {
- deleteDirectory("target/data/test-file-append");
- super.setUp();
- }
-
- @Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:start").setHeader(Exchange.FILE_NAME, constant("hello.txt"))
- .to("file://target/data/test-file-append?fileExist=Append&appendChars=@@@", "mock:result");
+ .to(fileUri("?fileExist=Append&appendChars=@@@"), "mock:result");
}
};
}
diff --git a/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastStreamCachingInSubRouteTest.java b/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastStreamCachingInSubRouteTest.java
index 27f05e7..46e980e 100644
--- a/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastStreamCachingInSubRouteTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/processor/MultiCastStreamCachingInSubRouteTest.java
@@ -38,7 +38,7 @@ public class MultiCastStreamCachingInSubRouteTest extends ContextTestSupport {
public void configure() throws Exception {
context.setStreamCaching(true);
context.getStreamCachingStrategy().setEnabled(true);
- context.getStreamCachingStrategy().setSpoolDirectory("target/camel/cache");
+ context.getStreamCachingStrategy().setSpoolDirectory(testDirectory().toString());
context.getStreamCachingStrategy().setSpoolThreshold(1L);
from("direct:start").multicast(new InternalAggregationStrategy()).to("direct:a", "direct:b").end()