Skip to content

Commit 016bf5d

Browse files
luigidemasidavsclaus
authored andcommitted
[CAMEL-22848] camel-file: checksumFileAlgorithm option is ignored due to missing mapping in GenericFileEndpoint (#20798)
1 parent 47c169e commit 016bf5d

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,9 @@ protected Map<String, Object> getParamsAsMap() {
17451745
if (readLockIdempotentReleaseExecutorService != null) {
17461746
params.put("readLockIdempotentReleaseExecutorService", readLockIdempotentReleaseExecutorService);
17471747
}
1748+
if (checksumFileAlgorithm != null) {
1749+
params.put("checksumFileAlgorithm", checksumFileAlgorithm);
1750+
}
17481751
return params;
17491752
}
17501753

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.camel.component.file;
18+
19+
import java.util.Map;
20+
21+
import org.apache.camel.Component;
22+
import org.apache.camel.ContextTestSupport;
23+
import org.junit.jupiter.api.Test;
24+
25+
import static org.junit.jupiter.api.Assertions.assertEquals;
26+
27+
public class FileEndpointParamsTest extends ContextTestSupport {
28+
29+
@Test
30+
public void testChecksumFileAlgorithmParams() throws Exception {
31+
MyFileEndpoint myEndpoint = new MyFileEndpoint("file:target/foo", context.getComponent("file"));
32+
myEndpoint.setChecksumFileAlgorithm("MD5");
33+
34+
Map<String, Object> params = myEndpoint.getParams();
35+
assertEquals("MD5", params.get("checksumFileAlgorithm"), "checksumFileAlgorithm should be in params map");
36+
}
37+
38+
private static class MyFileEndpoint extends FileEndpoint {
39+
public MyFileEndpoint(String uri, Component component) {
40+
super(uri, component);
41+
}
42+
43+
public Map<String, Object> getParams() {
44+
return getParamsAsMap();
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)