Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.CamelTestSupport;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.Test;

public class HibernateValidationProviderResolverTest extends CamelTestSupport {
Expand Down Expand Up @@ -58,7 +59,7 @@ void shouldResolveHibernateValidationProviderResolver() throws InterruptedExcept
CarWithAnnotations carWithNullFields = new CarWithAnnotations(null, null);

// When
sendBody("direct:test", carWithNullFields);
TestSupport.sendBody(template, "direct:test", carWithNullFields);

// Then
MockEndpoint.assertIsSatisfied(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.test.junit6.CamelTestSupport;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.slf4j.Logger;
Expand Down Expand Up @@ -91,7 +92,7 @@ void testECDSASHA1() throws Exception {
assumeFalse(!canRun, "Test preconditions failed: canRun=" + canRun);

setupMock();
sendBody("direct:ecdsa-sha1", payload);
TestSupport.sendBody(template, "direct:ecdsa-sha1", payload);
MockEndpoint.assertIsSatisfied(context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.support.jsse.KeyStoreParameters;
import org.apache.camel.test.junit6.CamelTestSupport;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;

Expand Down Expand Up @@ -195,7 +196,7 @@ public void configure() {
@Test
void testBasicSignatureRoute() throws Exception {
setupMock();
sendBody("direct:keypair", payload);
TestSupport.sendBody(template, "direct:keypair", payload);
MockEndpoint.assertIsSatisfied(context);

MockEndpoint mock = getMockEndpoint("mock:result");
Expand All @@ -207,64 +208,64 @@ void testBasicSignatureRoute() throws Exception {
@Test
void testSetAlgorithmInRouteDefinition() throws Exception {
setupMock();
sendBody("direct:algorithm", payload);
TestSupport.sendBody(template, "direct:algorithm", payload);
MockEndpoint.assertIsSatisfied(context);
}

@Test
void testRSASHA1() throws Exception {
setupMock();
sendBody("direct:rsa-sha1", payload);
TestSupport.sendBody(template, "direct:rsa-sha1", payload);
MockEndpoint.assertIsSatisfied(context);
}

@Test
void testRSASHA256() throws Exception {
setupMock();
sendBody("direct:rsa-sha256", payload);
TestSupport.sendBody(template, "direct:rsa-sha256", payload);
MockEndpoint.assertIsSatisfied(context);
}

@Test
void testSetBufferInRouteDefinition() throws Exception {
setupMock();
sendBody("direct:buffersize", payload);
TestSupport.sendBody(template, "direct:buffersize", payload);
MockEndpoint.assertIsSatisfied(context);
}

@Test
void testSetRandomInRouteDefinition() throws Exception {
setupMock();
sendBody("direct:random", payload);
TestSupport.sendBody(template, "direct:random", payload);
MockEndpoint.assertIsSatisfied(context);
}

@DisabledIfSystemProperty(named = "java.vendor", matches = ".*ibm.*")
@Test
void testSetProviderInRouteDefinition() throws Exception {
setupMock();
sendBody("direct:provider", payload);
TestSupport.sendBody(template, "direct:provider", payload);
MockEndpoint.assertIsSatisfied(context);
}

@Test
void testSetCertificateInRouteDefinition() throws Exception {
setupMock();
sendBody("direct:certificate", payload);
TestSupport.sendBody(template, "direct:certificate", payload);
MockEndpoint.assertIsSatisfied(context);
}

@Test
void testSetKeystoreInRouteDefinition() throws Exception {
setupMock();
sendBody("direct:keystore", payload);
TestSupport.sendBody(template, "direct:keystore", payload);
MockEndpoint.assertIsSatisfied(context);
}

@Test
void testSetKeystoreParametersInRouteDefinition() throws Exception {
setupMock();
sendBody("direct:keystoreParameters", payload);
TestSupport.sendBody(template, "direct:keystoreParameters", payload);
MockEndpoint.assertIsSatisfied(context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.google.drive.internal.DriveFilesApiMethod;
import org.apache.camel.component.google.drive.internal.GoogleDriveApiCollection;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIf;
Expand Down Expand Up @@ -79,7 +80,7 @@ public void testDelete() {
String fileId = testFile.getId();

// using String message body for single parameter "fileId"
sendBody("direct://DELETE", fileId);
TestSupport.sendBody(template, "direct://DELETE", fileId);

try {
// the file should be gone now
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.CamelTestSupport;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.Test;

/**
Expand All @@ -41,7 +42,7 @@ public void testSendMatchingMessage() throws Exception {
cells.put("foo", "bar");
grid.add(cells);

sendBody("direct:start", grid);
TestSupport.sendBody(template, "direct:start", grid);

MockEndpoint.assertIsSatisfied(context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.TestSupport;
import org.influxdb.dto.Point;
import org.influxdb.dto.Query;
import org.influxdb.dto.QueryResult;
Expand Down Expand Up @@ -76,7 +77,7 @@ public void testWithExistingDB() throws InterruptedException {

Mockito.when(mockedDbConnection.query(Mockito.any(Query.class))).thenReturn(queryResult);

sendBody("direct:test", createPoint());
TestSupport.sendBody(template, "direct:test", createPoint());

//if db exist, there will be only 1 call to show databases.
Mockito.verify(mockedDbConnection, Mockito.times(2)).query(Mockito.any(Query.class));
Expand All @@ -94,7 +95,7 @@ public void testWithNonExistingDB() throws InterruptedException {
QueryResult queryResult = new QueryResult();
queryResult.setResults(Collections.singletonList(new QueryResult.Result()));

sendBody("direct:test", createPoint());
TestSupport.sendBody(template, "direct:test", createPoint());

//if db does not exist, there will be 2 queries (show databases and create database)
Mockito.verify(mockedDbConnection, Mockito.times(2)).query(Mockito.any(Query.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.TestSupport;
import org.influxdb.dto.BatchPoints;
import org.influxdb.dto.Point;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -62,7 +63,7 @@ public void writeBatchPoints() throws InterruptedException {
successEndpoint.expectedMessageCount(1);

BatchPoints batchPoints = createBatchPoints();
sendBody("direct:test", batchPoints);
TestSupport.sendBody(template, "direct:test", batchPoints);

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -53,7 +54,7 @@ public void writePointFromMapAndStaticDbName() throws InterruptedException {

successEndpoint.expectedMessageCount(1);

sendBody("direct:test", "test");
TestSupport.sendBody(template, "direct:test", "test");

successEndpoint.assertIsSatisfied();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -71,7 +72,7 @@ public void writePointFromMapAndStaticDbName() throws InterruptedException {
successEndpoint.expectedMessageCount(1);

Map<String, Object> pointMap = createMapPoint();
sendBody("direct:test", pointMap);
TestSupport.sendBody(template, "direct:test", pointMap);

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -61,7 +62,7 @@ public void writePointFromMapAndStaticDbName() throws InterruptedException {
successEndpoint.expectedMessageCount(1);

Map<String, Object> pointMap = createMapPoint();
sendBody("direct:test", pointMap);
TestSupport.sendBody(template, "direct:test", pointMap);

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand All @@ -76,7 +77,7 @@ public void writePointFromMapAndDynamicDbName() throws InterruptedException {

Map<String, Object> pointMap = createMapPoint();
Map<String, Object> header = createHeader();
sendBody("direct:test", pointMap, header);
TestSupport.sendBody(template, "direct:test", pointMap, header);

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand All @@ -91,7 +92,7 @@ public void missingMeassurementNameFails() throws InterruptedException {

Map<String, Object> pointMap = new HashMap<>();
pointMap.remove(InfluxDbConstants.MEASUREMENT_NAME);
sendBody("direct:test", pointMap);
TestSupport.sendBody(template, "direct:test", pointMap);

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -49,7 +50,7 @@ public void ping() throws InterruptedException {

successEndpoint.expectedMessageCount(1);

sendBody("direct:test", "test");
TestSupport.sendBody(template, "direct:test", "test");

successEndpoint.assertIsSatisfied();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.camel.component.influxdb2.data.Record;
import org.apache.camel.component.influxdb2.data.Records;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -79,7 +80,7 @@ public void configure() {

Point point = Point.measurement("temperature");

sendBody("direct:test", point);
TestSupport.sendBody(template, "direct:test", point);

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand All @@ -102,7 +103,7 @@ public void configure() {
});

Map<String, Object> pointMap = createMapPoint();
sendBody("direct:test", pointMap);
TestSupport.sendBody(template, "direct:test", pointMap);

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand All @@ -125,7 +126,7 @@ public void configure() {
}
});

sendBody("direct:test", record);
TestSupport.sendBody(template, "direct:test", record);

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand All @@ -152,7 +153,7 @@ public void configure() {

Measurement measurement = Measurement.fromObject(temperature);

sendBody("direct:test", measurement);
TestSupport.sendBody(template, "direct:test", measurement);

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand All @@ -177,7 +178,7 @@ public void configure() {
}
};

sendBody("direct:test", Points.create(points));
TestSupport.sendBody(template, "direct:test", Points.create(points));

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand All @@ -197,7 +198,7 @@ public void configure() {
}
});

sendBody("direct:test", Records.create("temperature,location=north value=60.0"));
TestSupport.sendBody(template, "direct:test", Records.create("temperature,location=north value=60.0"));

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand All @@ -224,7 +225,7 @@ public void configure() {
Measurement measurement = Measurement.fromObject(temperature);

Measurements.create(measurement);
sendBody("direct:test", Records.create("temperature,location=north value=60.0"));
TestSupport.sendBody(template, "direct:test", Records.create("temperature,location=north value=60.0"));

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand All @@ -247,7 +248,7 @@ public void configure() {

Map<String, Object> pointMap = createMapPoint();
pointMap.remove(InfluxDb2Constants.MEASUREMENT);
sendBody("direct:test", pointMap);
TestSupport.sendBody(template, "direct:test", pointMap);

errorEndpoint.assertIsSatisfied();
successEndpoint.assertIsSatisfied();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit6.CamelTestSupport;
import org.apache.camel.test.junit6.TestSupport;
import org.junit.jupiter.api.Test;

public class JaxbErrorLogTest extends CamelTestSupport {
Expand All @@ -35,7 +36,7 @@ public void testErrorHandling() throws Exception {

// FailingBean will cause message at index 2 to throw exception
for (int i = 0; i < 5; i++) {
sendBody("seda:test", new CannotMarshal(i));
TestSupport.sendBody(template, "seda:test", new CannotMarshal(i));
}

MockEndpoint.assertIsSatisfied(context);
Expand Down
Loading