Java 11 migrate remaining e (#1112)

* Moves eip-aggregator to Java 11

* Moves eip-message-channel to Java 11

* Moves eip-publish-subscribe to Java 11

* Moves eip-splitter to Java 11

* Moves eip-wire-tap to Java 11

* Moves event-aggregator to Java 11

* Moves event-asynchronous to Java 11

* Moves event-driven-architecture to Java 11

* Moves event-queue to Java 11

* Moves event-sourcing to Java 11

* Moves execute-around to Java 11

* Moves extension-objects to Java 11
This commit is contained in:
Anurag Agarwal
2019-12-09 22:33:30 +05:30
committed by Ilkka Seppälä
parent b09b100614
commit fb2c026822
64 changed files with 306 additions and 390 deletions

View File

@@ -32,7 +32,6 @@ public class AppTest {
@Test
public void testMain() throws Exception {
String[] args = {};
App.main(args);
App.main(new String[]{});
}
}

View File

@@ -23,6 +23,8 @@
package com.iluwatar.eip.aggregator.routes;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.camel.EndpointInject;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.component.mock.MockEndpoint;
@@ -35,13 +37,11 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Test class for <i>AggregatorRoute</i>.
* <p>
* In order for it to work we have to mock endpoints we want to read/write to. To mock those we need to substitute
* original endpoint names to mocks.
* In order for it to work we have to mock endpoints we want to read/write to. To mock those we need
* to substitute original endpoint names to mocks.
* </p>
*/
@ExtendWith(SpringExtension.class)
@@ -59,6 +59,7 @@ public class AggregatorRouteTest {
/**
* Test if endpoint receives three separate messages.
*
* @throws Exception in case of en exception during the test
*/
@Test
@@ -76,10 +77,10 @@ public class AggregatorRouteTest {
endpoint.expectedMessageCount(2);
endpoint.assertIsSatisfied();
String body = (String) endpoint.getReceivedExchanges().get(0).getIn().getBody();
var body = (String) endpoint.getReceivedExchanges().get(0).getIn().getBody();
assertEquals(3, body.split(";").length);
String body2 = (String) endpoint.getReceivedExchanges().get(1).getIn().getBody();
var body2 = (String) endpoint.getReceivedExchanges().get(1).getIn().getBody();
assertEquals(2, body2.split(";").length);
}
}

View File

@@ -23,13 +23,12 @@
package com.iluwatar.eip.aggregator.routes;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultExchange;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Tests MessageAggregationStrategy
*/
@@ -37,27 +36,27 @@ public class MessageAggregationStrategyTest {
@Test
public void testAggregate() {
MessageAggregationStrategy mas = new MessageAggregationStrategy();
Exchange oldExchange = new DefaultExchange((CamelContext) null);
var mas = new MessageAggregationStrategy();
var oldExchange = new DefaultExchange((CamelContext) null);
oldExchange.getIn().setBody("TEST1");
Exchange newExchange = new DefaultExchange((CamelContext) null);
var newExchange = new DefaultExchange((CamelContext) null);
newExchange.getIn().setBody("TEST2");
Exchange output = mas.aggregate(oldExchange, newExchange);
String outputBody = (String) output.getIn().getBody();
var output = mas.aggregate(oldExchange, newExchange);
var outputBody = (String) output.getIn().getBody();
assertEquals("TEST1;TEST2", outputBody);
}
@Test
public void testAggregateOldNull() {
MessageAggregationStrategy mas = new MessageAggregationStrategy();
var mas = new MessageAggregationStrategy();
Exchange newExchange = new DefaultExchange((CamelContext) null);
var newExchange = new DefaultExchange((CamelContext) null);
newExchange.getIn().setBody("TEST2");
Exchange output = mas.aggregate(null, newExchange);
String outputBody = (String) output.getIn().getBody();
var output = mas.aggregate(null, newExchange);
var outputBody = (String) output.getIn().getBody();
assertEquals(newExchange, output);
assertEquals("TEST2", outputBody);