Skip to content

Commit

Permalink
Polish code
Browse files Browse the repository at this point in the history
  • Loading branch information
astefanutti committed Jan 13, 2016
1 parent 8be3afc commit bc43efb
Show file tree
Hide file tree
Showing 38 changed files with 162 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.camel.cdi.se.bean;


import org.apache.camel.cdi.Uri;
import org.apache.camel.Endpoint;
import org.apache.camel.builder.RouteBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.camel.cdi.se.bean;


import org.apache.camel.cdi.se.pojo.TypeConverterOutput;
import org.apache.camel.builder.RouteBuilder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.camel.cdi.se.bean;


import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.util.ObjectHelper;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
/*
* *
* * Licensed to the Apache Software Foundation (ASF) under one or more
* * contributor license agreements. See the NOTICE file distributed with
* * this work for additional information regarding copyright ownership.
* * The ASF licenses this file to You under the Apache License, Version 2.0
* * (the "License"); you may not use this file except in compliance with
* * the License. You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.cdi.se.bean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@
*/
package org.apache.camel.cdi.se.bean;


import org.apache.camel.builder.RouteBuilder;

public class PropertyEndpointRoute extends RouteBuilder {

@Override
public void configure() {
from("direct:{{from}}")
.routeId("route")
.setHeader("header").simple("properties:header.message")
.to("{{to}}");
.routeId("route")
.setHeader("header").simple("properties:header.message")
.to("{{to}}");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.camel.cdi.se.pojo;


public class TypeConverterInput {

private String property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.camel.cdi.se.pojo;


public class TypeConverterOutput {

private String property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ public static Archive<?> deployment() {

@Test
public void camelStartedEvent(@Uri("mock:started") MockEndpoint started) {
assertThat("Event fired is incorrect!", started.getExchanges(), contains(hasProperty("in", hasProperty("body", instanceOf(CamelContextStartedEvent.class)))));
assertThat("Event fired is incorrect!", started.getExchanges(),
contains(
hasProperty("in",
hasProperty("body", instanceOf(CamelContextStartedEvent.class)))));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ private void onCamelContextStoppedEvent(@Observes CamelContextStoppedEvent event
@Test
@InSequence(1)
public void startedCamelContext(List<Class> events) throws Exception {
assertThat("Events fired are incorrect", events, Matchers.<Class>contains(CamelContextStartingEvent.class, CamelContextStartedEvent.class));
assertThat("Events fired are incorrect", events,
Matchers.<Class>contains(
CamelContextStartingEvent.class,
CamelContextStartedEvent.class));
}

@Test
Expand All @@ -115,14 +118,34 @@ public void sendMessageToInbound(List<Class> events) throws InterruptedException

assertIsSatisfied(2L, TimeUnit.SECONDS, outbound);

assertThat("Events fired are incorrect", events, Matchers.<Class>contains(CamelContextStartingEvent.class, CamelContextStartedEvent.class, ExchangeSendingEvent.class, ExchangeCreatedEvent.class, ExchangeSendingEvent.class, ExchangeSentEvent.class, ExchangeCompletedEvent.class, ExchangeSentEvent.class));
assertThat("Events fired are incorrect", events,
Matchers.<Class>contains(
CamelContextStartingEvent.class,
CamelContextStartedEvent.class,
ExchangeSendingEvent.class,
ExchangeCreatedEvent.class,
ExchangeSendingEvent.class,
ExchangeSentEvent.class,
ExchangeCompletedEvent.class,
ExchangeSentEvent.class));
}

@Test
@InSequence(3)
public void stopCamelContext(CamelContext context, List<Class> events) throws Exception {
context.stop();

assertThat("Events fired are incorrect", events, Matchers.<Class>contains(CamelContextStartingEvent.class, CamelContextStartedEvent.class, ExchangeSendingEvent.class, ExchangeCreatedEvent.class, ExchangeSendingEvent.class, ExchangeSentEvent.class, ExchangeCompletedEvent.class, ExchangeSentEvent.class, CamelContextStoppingEvent.class, CamelContextStoppedEvent.class));
assertThat("Events fired are incorrect", events,
Matchers.<Class>contains(
CamelContextStartingEvent.class,
CamelContextStartedEvent.class,
ExchangeSendingEvent.class,
ExchangeCreatedEvent.class,
ExchangeSendingEvent.class,
ExchangeSentEvent.class,
ExchangeCompletedEvent.class,
ExchangeSentEvent.class,
CamelContextStoppingEvent.class,
CamelContextStoppedEvent.class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public static Archive<?> deployment() {
// Camel CDI
.addPackage(CdiCamelExtension.class.getPackage())
// Test classes
.addClasses(DefaultCamelContextBean.class,
.addClasses(
DefaultCamelContextBean.class,
FirstNamedCamelContextBean.class,
FirstNamedCamelContextRoute.class,
SecondNamedCamelContextBean.class,
Expand Down Expand Up @@ -77,7 +78,8 @@ public void configure() {

@Test
@InSequence(2)
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound, @Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound,
@Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
outbound.expectedMessageCount(1);
outbound.expectedBodiesReceived("first-test");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.camel.component.mock.MockEndpoint;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
Expand Down Expand Up @@ -59,7 +58,6 @@ public static Archive<?> deployment() {
private MockEndpoint outbound;

@Test
@InSequence(2)
public void sendMessageToInbound() throws InterruptedException {
outbound.expectedMessageCount(1);
outbound.expectedBodiesReceived("test");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ public static Archive<?> deployment() {
private ProducerTemplate produceBarQualifier;

@Inject
Event<Object> objectEvent;
private Event<Object> objectEvent;

@Inject
Event<EventPayload<String>> stringPayloadEvent;
private Event<EventPayload<String>> stringPayloadEvent;

@Inject
Event<EventPayload<Integer>> integerPayloadEvent;
private Event<EventPayload<Integer>> integerPayloadEvent;

@Inject
private EventObserver observer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ private static PropertiesComponent configuration() {
}

@Test
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound, @Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
public void sendMessageToInbound(@Uri("direct:inbound") ProducerTemplate inbound,
@Uri("mock:outbound") MockEndpoint outbound) throws InterruptedException {
outbound.expectedMessageCount(1);

TypeConverterInput input = new TypeConverterInput();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public void verifyCamelContext() {
public void sendMessageToInbound() throws InterruptedException {
defaultOutbound.expectedMessageCount(1);
defaultOutbound.expectedBodiesReceived("test");
defaultOutbound.expectedHeaderReceived("foo","bar");
defaultOutbound.expectedHeaderReceived("foo", "bar");

defaultInbound.sendBodyAndHeader("test","foo","bar");
defaultInbound.sendBodyAndHeader("test", "foo", "bar");

assertIsSatisfied(2L, TimeUnit.SECONDS, defaultOutbound);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public static Archive<?> deployment() {
// Camel CDI
.addPackage(CdiCamelExtension.class.getPackage())
// Test classes
.addClasses(DefaultCamelContextBean.class,
.addClasses(
DefaultCamelContextBean.class,
UriEndpointRoute.class,
FirstCamelContextRoute.class)
// Bean archive deployment descriptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public static Archive<?> deployment() {
// Camel CDI
.addPackage(CdiCamelExtension.class.getPackage())
// Test classes
.addClasses(DefaultCamelContextBean.class,
.addClasses(
DefaultCamelContextBean.class,
UriEndpointRoute.class,
FirstCamelContextBean.class,
FirstCamelContextRoute.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public static Archive<?> deployment() {
// Camel CDI
.addPackage(CdiCamelExtension.class.getPackage())
// Test classes
.addClasses(DefaultCamelContextBean.class,
.addClasses(
DefaultCamelContextBean.class,
EndpointInjectRoute.class,
FirstCamelContextBean.class,
FirstCamelContextEndpointInjectRoute.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public static Archive<?> deployment() {
// Camel CDI
.addPackage(CdiCamelExtension.class.getPackage())
// Test classes
.addClasses(FirstCamelContextBean.class,
.addClasses(
FirstCamelContextBean.class,
FirstCamelContextEventConsumingRoute.class,
FirstCamelContextEventProducingRoute.class,
SecondCamelContextBean.class,
Expand Down Expand Up @@ -92,7 +93,7 @@ public static Archive<?> deployment() {
private ProducerTemplate secondProduceString;

@Inject
Event<Object> objectEvent;
private Event<Object> objectEvent;

@Inject
private EventObserver observer;
Expand Down
Loading

0 comments on commit bc43efb

Please sign in to comment.