Skip to content

Commit fe344e5

Browse files
committed
Remove usage of deprecated method
useOverridePropertiesWithPropertiesComponent in Tests it was deprecated in Camel 4.7.0 https://github.com/apache/camel/blob/0a8fc9314ccd6571e8a5686f38d381e728ab1375/components/camel-test/camel-test-junit5/src/main/java/org/apache/camel/test/junit5/AbstractTestSupport.java#L339-L342 Signed-off-by: Aurélien Pupier <apupier@redhat.com>
1 parent 5127bbb commit fe344e5

11 files changed

Lines changed: 67 additions & 44 deletions

File tree

aws/main-endpointdsl-kafka-aws2-s3-restarting-policy/src/test/java/org/apache/camel/example/KafkaAwsS3Test.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
3030
import org.apache.camel.test.infra.kafka.services.KafkaService;
3131
import org.apache.camel.test.infra.kafka.services.KafkaServiceFactory;
32+
import org.apache.camel.test.junit5.CamelContextConfiguration;
3233
import org.apache.camel.test.main.junit5.CamelMainTestSupport;
3334
import org.junit.jupiter.api.Test;
3435
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -55,10 +56,10 @@ protected CamelContext createCamelContext() throws Exception {
5556
}
5657

5758
@Override
58-
protected Properties useOverridePropertiesWithPropertiesComponent() {
59-
return asProperties(
60-
"kafkaBrokers", KAFKA_SERVICE.getBootstrapServers()
61-
);
59+
public void configureContext(CamelContextConfiguration camelContextConfiguration) {
60+
super.configureContext(camelContextConfiguration);
61+
Properties overridenProperties = asProperties("kafkaBrokers", KAFKA_SERVICE.getBootstrapServers());
62+
camelContextConfiguration.withUseOverridePropertiesWithPropertiesComponent(overridenProperties);
6263
}
6364

6465
@Test

aws/main-endpointdsl-kafka-aws2-s3/src/test/java/org/apache/camel/example/KafkaAwsS3Test.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.camel.test.infra.aws2.services.AWSServiceFactory;
3030
import org.apache.camel.test.infra.kafka.services.KafkaService;
3131
import org.apache.camel.test.infra.kafka.services.KafkaServiceFactory;
32+
import org.apache.camel.test.junit5.CamelContextConfiguration;
3233
import org.apache.camel.test.main.junit5.CamelMainTestSupport;
3334
import org.junit.jupiter.api.Test;
3435
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -55,10 +56,10 @@ protected CamelContext createCamelContext() throws Exception {
5556
}
5657

5758
@Override
58-
protected Properties useOverridePropertiesWithPropertiesComponent() {
59-
return asProperties(
60-
"kafkaBrokers", KAFKA_SERVICE.getBootstrapServers()
61-
);
59+
public void configureContext(CamelContextConfiguration camelContextConfiguration) {
60+
super.configureContext(camelContextConfiguration);
61+
Properties overridenProperties = asProperties("kafkaBrokers", KAFKA_SERVICE.getBootstrapServers());
62+
camelContextConfiguration.withUseOverridePropertiesWithPropertiesComponent(overridenProperties);
6263
}
6364

6465
@Test

couchbase-log/src/test/java/org/apache/camel/example/CouchbaseTest.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.apache.camel.main.MainConfigurationProperties;
3535
import org.apache.camel.test.infra.couchbase.services.CouchbaseService;
3636
import org.apache.camel.test.infra.couchbase.services.CouchbaseServiceFactory;
37+
import org.apache.camel.test.junit5.CamelContextConfiguration;
3738
import org.apache.camel.test.main.junit5.CamelMainTestSupport;
3839
import org.junit.jupiter.api.AfterAll;
3940
import org.junit.jupiter.api.BeforeAll;
@@ -80,14 +81,15 @@ static void destroy() {
8081
}
8182

8283
@Override
83-
protected Properties useOverridePropertiesWithPropertiesComponent() {
84-
return asProperties(
85-
"couchbase.host", SERVICE.getHostname(),
86-
"couchbase.port", Integer.toString(SERVICE.getPort()),
87-
"couchbase.username", SERVICE.getUsername(),
88-
"couchbase.password", SERVICE.getPassword(),
89-
"couchbase.bucket", BUCKET
90-
);
84+
public void configureContext(CamelContextConfiguration camelContextConfiguration) {
85+
super.configureContext(camelContextConfiguration);
86+
Properties overridenProperties = asProperties(
87+
"couchbase.host", SERVICE.getHostname(),
88+
"couchbase.port", Integer.toString(SERVICE.getPort()),
89+
"couchbase.username", SERVICE.getUsername(),
90+
"couchbase.password", SERVICE.getPassword(),
91+
"couchbase.bucket", BUCKET);
92+
camelContextConfiguration.withUseOverridePropertiesWithPropertiesComponent(overridenProperties);
9193
}
9294

9395
@Test

csimple-joor/src/test/java/org/apache/camel/example/CSimpleJOORTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import org.apache.camel.builder.NotifyBuilder;
2020
import org.apache.camel.main.MainConfigurationProperties;
21+
import org.apache.camel.test.junit5.CamelContextConfiguration;
2122
import org.apache.camel.test.main.junit5.CamelMainTestSupport;
2223
import org.junit.jupiter.api.Test;
2324

@@ -32,10 +33,11 @@
3233
*/
3334
class CSimpleJOORTest extends CamelMainTestSupport {
3435

35-
3636
@Override
37-
protected Properties useOverridePropertiesWithPropertiesComponent() {
38-
return asProperties("myPeriod", Integer.toString(500));
37+
public void configureContext(CamelContextConfiguration camelContextConfiguration) {
38+
super.configureContext(camelContextConfiguration);
39+
Properties overridenProperties = asProperties("myPeriod", Integer.toString(500));
40+
camelContextConfiguration.withUseOverridePropertiesWithPropertiesComponent(overridenProperties);
3941
}
4042

4143
@Test

csimple/src/test/java/org/apache/camel/example/CSimpleTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import org.apache.camel.builder.NotifyBuilder;
2020
import org.apache.camel.main.MainConfigurationProperties;
21+
import org.apache.camel.test.junit5.CamelContextConfiguration;
2122
import org.apache.camel.test.main.junit5.CamelMainTestSupport;
2223
import org.junit.jupiter.api.Test;
2324

@@ -33,8 +34,10 @@
3334
class CSimpleTest extends CamelMainTestSupport {
3435

3536
@Override
36-
protected Properties useOverridePropertiesWithPropertiesComponent() {
37-
return asProperties("myPeriod", Integer.toString(500));
37+
public void configureContext(CamelContextConfiguration camelContextConfiguration) {
38+
super.configureContext(camelContextConfiguration);
39+
Properties overridenProperties = asProperties("myPeriod", Integer.toString(500));
40+
camelContextConfiguration.withUseOverridePropertiesWithPropertiesComponent(overridenProperties);
3841
}
3942

4043
@Test

debezium/src/test/java/org/apache/camel/example/debezium/DebeziumTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.apache.camel.test.infra.cassandra.services.CassandraServiceFactory;
3636
import org.apache.camel.test.infra.postgres.services.PostgresLocalContainerService;
3737
import org.apache.camel.test.infra.postgres.services.PostgresService;
38+
import org.apache.camel.test.junit5.CamelContextConfiguration;
3839
import org.apache.camel.test.main.junit5.CamelMainTestSupport;
3940
import org.junit.jupiter.api.BeforeEach;
4041
import org.junit.jupiter.api.Test;
@@ -106,15 +107,14 @@ protected CamelContext createCamelContext() throws Exception {
106107
}
107108

108109
@Override
109-
protected Properties useOverridePropertiesWithPropertiesComponent() {
110-
// Override the host and port of the broker
111-
return asProperties(
112-
"debezium.postgres.databaseHostName", POSTGRES_SERVICE.host(),
113-
"debezium.postgres.databasePort", Integer.toString(POSTGRES_SERVICE.port()),
114-
"debezium.postgres.databaseUser", SOURCE_DB_USERNAME,
115-
"debezium.postgres.databasePassword", SOURCE_DB_PASSWORD,
116-
"cassandra.node", String.format("%s:%d", CASSANDRA_SERVICE.getCassandraHost(), CASSANDRA_SERVICE.getCQL3Port())
117-
);
110+
public void configureContext(CamelContextConfiguration camelContextConfiguration) {
111+
super.configureContext(camelContextConfiguration);
112+
Properties overridenProperties = asProperties("debezium.postgres.databaseHostName", POSTGRES_SERVICE.host(),
113+
"debezium.postgres.databasePort", Integer.toString(POSTGRES_SERVICE.port()),
114+
"debezium.postgres.databaseUser", SOURCE_DB_USERNAME,
115+
"debezium.postgres.databasePassword", SOURCE_DB_PASSWORD,
116+
"cassandra.node", String.format("%s:%d", CASSANDRA_SERVICE.getCassandraHost(), CASSANDRA_SERVICE.getCQL3Port()));
117+
camelContextConfiguration.withUseOverridePropertiesWithPropertiesComponent(overridenProperties);
118118
}
119119

120120
@Test

ftp/src/test/java/org/apache/camel/example/ftp/FtpTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import org.apache.camel.builder.NotifyBuilder;
2626
import org.apache.camel.main.MainConfigurationProperties;
27+
import org.apache.camel.test.junit5.CamelContextConfiguration;
2728
import org.apache.camel.test.main.junit5.CamelMainTestSupport;
2829
import org.apache.ftpserver.FtpServer;
2930
import org.apache.ftpserver.FtpServerFactory;
@@ -87,12 +88,13 @@ static void destroy() {
8788
}
8889

8990
@Override
90-
protected Properties useOverridePropertiesWithPropertiesComponent() {
91-
return asProperties(
92-
"ftp.port", Integer.toString(PORT),
93-
"ftp.username", "admin",
94-
"ftp.password", "admin"
95-
);
91+
public void configureContext(CamelContextConfiguration camelContextConfiguration) {
92+
super.configureContext(camelContextConfiguration);
93+
Properties overridenProperties = asProperties(
94+
"ftp.port", Integer.toString(PORT),
95+
"ftp.username", "admin",
96+
"ftp.password", "admin");
97+
camelContextConfiguration.withUseOverridePropertiesWithPropertiesComponent(overridenProperties);
9698
}
9799

98100
@Test

main-endpointdsl/src/test/java/org/apache/camel/example/MainEndpointDSLTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.apache.camel.builder.NotifyBuilder;
2323
import org.apache.camel.main.MainConfigurationProperties;
24+
import org.apache.camel.test.junit5.CamelContextConfiguration;
2425
import org.apache.camel.test.main.junit5.CamelMainTestSupport;
2526
import org.junit.jupiter.api.Test;
2627

@@ -33,8 +34,10 @@
3334
class MainEndpointDSLTest extends CamelMainTestSupport {
3435

3536
@Override
36-
protected Properties useOverridePropertiesWithPropertiesComponent() {
37-
return asProperties("myPeriod", Integer.toString(500));
37+
public void configureContext(CamelContextConfiguration camelContextConfiguration) {
38+
super.configureContext(camelContextConfiguration);
39+
Properties overridenProperties = asProperties("myPeriod", Integer.toString(500));
40+
camelContextConfiguration.withUseOverridePropertiesWithPropertiesComponent(overridenProperties);
3841
}
3942

4043
@Test

main-health/src/test/java/org/apache/camel/example/MainHealthTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.apache.camel.builder.NotifyBuilder;
2323
import org.apache.camel.main.MainConfigurationProperties;
24+
import org.apache.camel.test.junit5.CamelContextConfiguration;
2425
import org.apache.camel.test.main.junit5.CamelMainTestSupport;
2526
import org.junit.jupiter.api.Test;
2627

@@ -33,8 +34,10 @@
3334
class MainHealthTest extends CamelMainTestSupport {
3435

3536
@Override
36-
protected Properties useOverridePropertiesWithPropertiesComponent() {
37-
return asProperties("myPeriod", Integer.toString(500));
37+
public void configureContext(CamelContextConfiguration camelContextConfiguration) {
38+
super.configureContext(camelContextConfiguration);
39+
Properties overridenProperties = asProperties("myPeriod", Integer.toString(500));
40+
camelContextConfiguration.withUseOverridePropertiesWithPropertiesComponent(overridenProperties);
3841
}
3942

4043
@Override

main-joor/src/test/java/org/apache/camel/example/MainJOORTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.apache.camel.builder.NotifyBuilder;
2323
import org.apache.camel.main.MainConfigurationProperties;
24+
import org.apache.camel.test.junit5.CamelContextConfiguration;
2425
import org.apache.camel.test.main.junit5.CamelMainTestSupport;
2526
import org.junit.jupiter.api.Test;
2627

@@ -33,8 +34,10 @@
3334
class MainJOORTest extends CamelMainTestSupport {
3435

3536
@Override
36-
protected Properties useOverridePropertiesWithPropertiesComponent() {
37-
return asProperties("myPeriod", Integer.toString(500));
37+
public void configureContext(CamelContextConfiguration camelContextConfiguration) {
38+
super.configureContext(camelContextConfiguration);
39+
Properties overridenProperties = asProperties("myPeriod", Integer.toString(500));
40+
camelContextConfiguration.withUseOverridePropertiesWithPropertiesComponent(overridenProperties);
3841
}
3942

4043
@Test

0 commit comments

Comments
 (0)