CAMEL-7554 - camel-metrics * Compliance with Checkstyle rules.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4ea79b19 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4ea79b19 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4ea79b19 Branch: refs/heads/master Commit: 4ea79b197bf3413f72195814ac704aaf7e628702 Parents: 5068b9c Author: Lauri Kimmel <lauri.kim...@gmx.com> Authored: Thu Jul 3 22:31:11 2014 +1000 Committer: Lauri Kimmel <lauri.kim...@gmx.com> Committed: Thu Jul 3 22:31:11 2014 +1000 ---------------------------------------------------------------------- .../camel/metrics/AbstractMetricsEndpoint.java | 18 ++++++- .../camel/metrics/AbstractMetricsProducer.java | 29 ++++++++--- .../apache/camel/metrics/MetricsComponent.java | 53 ++++++++++++-------- .../org/apache/camel/metrics/MetricsType.java | 24 +++++++-- .../camel/metrics/counter/CounterEndpoint.java | 18 ++++++- .../camel/metrics/counter/CounterProducer.java | 30 ++++++++--- .../metrics/histogram/HistogramEndpoint.java | 20 +++++++- .../metrics/histogram/HistogramProducer.java | 26 +++++++--- .../camel/metrics/meter/MeterEndpoint.java | 18 ++++++- .../camel/metrics/meter/MeterProducer.java | 27 +++++++--- .../camel/metrics/timer/TimerEndpoint.java | 19 ++++++- .../camel/metrics/timer/TimerProducer.java | 38 ++++++++------ .../metrics/AbstractMetricsEndpointTest.java | 31 ++++++++---- .../metrics/AbstractMetricsProducerTest.java | 34 +++++++++---- .../metrics/MetricComponentSpringTest.java | 26 +++++++--- .../metrics/MetricsComponentRouteTest.java | 24 +++++++-- .../camel/metrics/MetricsComponentTest.java | 35 +++++++++---- .../apache/camel/metrics/MetricsTypeTest.java | 22 ++++++-- .../metrics/counter/CounterEndpointTest.java | 30 ++++++++--- .../metrics/counter/CounterProducerTest.java | 34 +++++++++---- .../camel/metrics/counter/CounterRouteTest.java | 38 +++++++++----- .../histogram/HistogramEndpointTest.java | 28 ++++++++--- .../histogram/HistogramProducerTest.java | 32 ++++++++---- .../metrics/histogram/HistogramRouteTest.java | 34 +++++++++---- .../camel/metrics/meter/MeterEndpointTest.java | 30 ++++++++--- .../camel/metrics/meter/MeterProducerTest.java | 34 +++++++++---- .../camel/metrics/meter/MeterRouteTest.java | 34 +++++++++---- .../camel/metrics/timer/TimerEndpointTest.java | 30 ++++++++--- .../camel/metrics/timer/TimerProducerTest.java | 36 +++++++++---- .../camel/metrics/timer/TimerRouteTest.java | 34 +++++++++---- 30 files changed, 653 insertions(+), 233 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/AbstractMetricsEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/AbstractMetricsEndpoint.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/AbstractMetricsEndpoint.java index d8c8af7..f437846 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/AbstractMetricsEndpoint.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/AbstractMetricsEndpoint.java @@ -1,11 +1,27 @@ +/** + * 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.metrics; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Consumer; import org.apache.camel.Processor; import org.apache.camel.RuntimeCamelException; import org.apache.camel.impl.DefaultEndpoint; -import com.codahale.metrics.MetricRegistry; public abstract class AbstractMetricsEndpoint extends DefaultEndpoint { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/AbstractMetricsProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/AbstractMetricsProducer.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/AbstractMetricsProducer.java index 8bf99d0..cd11447 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/AbstractMetricsProducer.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/AbstractMetricsProducer.java @@ -1,16 +1,31 @@ +/** + * 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.metrics; -import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; -import static org.apache.camel.metrics.MetricsComponent.HEADER_PERFIX; - +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.impl.DefaultProducer; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; +import static org.apache.camel.metrics.MetricsComponent.HEADER_PERFIX; -import com.codahale.metrics.MetricRegistry; public abstract class AbstractMetricsProducer<T extends AbstractMetricsEndpoint> extends DefaultProducer { @@ -31,9 +46,9 @@ public abstract class AbstractMetricsProducer<T extends AbstractMetricsEndpoint> MetricRegistry registry = endpoint.getRegistry(); try { doProcess(exchange, endpoint, registry, finalMetricsName); - } - catch (Exception e) { - LOG.warn("Failed to produce metrics for {} in {} - {}", new Object[] { finalMetricsName, getClass().getSimpleName(), e.getMessage() }); + } catch (Exception e) { + LOG.warn("Failed to produce metrics for {} in {} - {}", new Object[] { + finalMetricsName, getClass().getSimpleName(), e.getMessage() }); } clearMetricsHeaders(in); } http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/MetricsComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/MetricsComponent.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/MetricsComponent.java index 596b08b..b73626a 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/MetricsComponent.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/MetricsComponent.java @@ -1,8 +1,25 @@ +/** + * 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.metrics; import java.util.Map; import java.util.concurrent.TimeUnit; - +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.Slf4jReporter; import org.apache.camel.Endpoint; import org.apache.camel.RuntimeCamelException; import org.apache.camel.impl.DefaultComponent; @@ -15,9 +32,6 @@ import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.Slf4jReporter; - /** * Represents the component that manages {@link MetricsEndpoint}. */ @@ -60,20 +74,20 @@ public class MetricsComponent extends DefaultComponent { Endpoint createNewEndpoint(MetricRegistry registry, MetricsType type, String metricsName) { Endpoint endpoint; switch (type) { - case COUNTER: - endpoint = new CounterEndpoint(registry, metricsName); - break; - case METER: - endpoint = new MeterEndpoint(registry, metricsName); - break; - case HISTOGRAM: - endpoint = new HistogramEndpoint(registry, metricsName); - break; - case TIMER: - endpoint = new TimerEndpoint(registry, metricsName); - break; - default: - throw new RuntimeCamelException("Metrics type \"" + type.toString() + "\" not supported"); + case COUNTER: + endpoint = new CounterEndpoint(registry, metricsName); + break; + case METER: + endpoint = new MeterEndpoint(registry, metricsName); + break; + case HISTOGRAM: + endpoint = new HistogramEndpoint(registry, metricsName); + break; + case TIMER: + endpoint = new TimerEndpoint(registry, metricsName); + break; + default: + throw new RuntimeCamelException("Metrics type \"" + type.toString() + "\" not supported"); } return endpoint; } @@ -83,8 +97,7 @@ public class MetricsComponent extends DefaultComponent { MetricsType type; if (name == null) { type = DEFAULT_METRICS_TYPE; - } - else { + } else { type = MetricsType.getByName(name); } if (type == null) { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/MetricsType.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/MetricsType.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/MetricsType.java index f602647..760c794 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/MetricsType.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/MetricsType.java @@ -1,3 +1,19 @@ +/** + * 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.metrics; import java.util.EnumSet; @@ -10,15 +26,15 @@ public enum MetricsType { COUNTER("counter"), HISTOGRAM("histogram"), METER("meter"), - TIMER("timer"), ; + TIMER("timer"); - private static final Map<String, MetricsType> map = new HashMap<String, MetricsType>(); + private static final Map<String, MetricsType> MAP = new HashMap<String, MetricsType>(); private final String name; static { for (MetricsType type : EnumSet.allOf(MetricsType.class)) { - map.put(type.name, type); + MAP.put(type.name, type); } } @@ -32,6 +48,6 @@ public enum MetricsType { } public static MetricsType getByName(String name) { - return map.get(name); + return MAP.get(name); } } http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/counter/CounterEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/counter/CounterEndpoint.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/counter/CounterEndpoint.java index 508e485..406c21d 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/counter/CounterEndpoint.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/counter/CounterEndpoint.java @@ -1,11 +1,27 @@ +/** + * 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.metrics.counter; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Producer; import org.apache.camel.metrics.AbstractMetricsEndpoint; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; -import com.codahale.metrics.MetricRegistry; @UriEndpoint(scheme = "metrics") public class CounterEndpoint extends AbstractMetricsEndpoint { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/counter/CounterProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/counter/CounterProducer.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/counter/CounterProducer.java index 2d9431c..bdabba3 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/counter/CounterProducer.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/counter/CounterProducer.java @@ -1,14 +1,30 @@ +/** + * 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.metrics.counter; -import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_DECREMENT; -import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_INCREMENT; +import com.codahale.metrics.Counter; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.metrics.AbstractMetricsProducer; +import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_DECREMENT; +import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_INCREMENT; -import com.codahale.metrics.Counter; -import com.codahale.metrics.MetricRegistry; public class CounterProducer extends AbstractMetricsProducer<CounterEndpoint> { @@ -26,11 +42,9 @@ public class CounterProducer extends AbstractMetricsProducer<CounterEndpoint> { Long finalDecrement = getLongHeader(in, HEADER_COUNTER_DECREMENT, decrement); if (finalIncrement != null) { counter.inc(finalIncrement); - } - else if (finalDecrement != null) { + } else if (finalDecrement != null) { counter.dec(finalDecrement); - } - else { + } else { counter.inc(); } } http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/histogram/HistogramEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/histogram/HistogramEndpoint.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/histogram/HistogramEndpoint.java index c6e7157..fad53c0 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/histogram/HistogramEndpoint.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/histogram/HistogramEndpoint.java @@ -1,16 +1,32 @@ +/** + * 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.metrics.histogram; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Producer; import org.apache.camel.metrics.AbstractMetricsEndpoint; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; -import com.codahale.metrics.MetricRegistry; @UriEndpoint(scheme = "metrics") public class HistogramEndpoint extends AbstractMetricsEndpoint { - public static String ENDPOINT_URI = "metrics:histogram"; + public static final String ENDPOINT_URI = "metrics:histogram"; @UriParam private Long value; http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/histogram/HistogramProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/histogram/HistogramProducer.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/histogram/HistogramProducer.java index 46c586d..b29505a 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/histogram/HistogramProducer.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/histogram/HistogramProducer.java @@ -1,15 +1,30 @@ +/** + * 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.metrics.histogram; -import static org.apache.camel.metrics.MetricsComponent.HEADER_HISTOGRAM_VALUE; +import com.codahale.metrics.Histogram; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.metrics.AbstractMetricsProducer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import com.codahale.metrics.Histogram; -import com.codahale.metrics.MetricRegistry; +import static org.apache.camel.metrics.MetricsComponent.HEADER_HISTOGRAM_VALUE; public class HistogramProducer extends AbstractMetricsProducer<HistogramEndpoint> { @@ -27,8 +42,7 @@ public class HistogramProducer extends AbstractMetricsProducer<HistogramEndpoint Long finalValue = getLongHeader(in, HEADER_HISTOGRAM_VALUE, value); if (finalValue != null) { histogram.update(finalValue); - } - else { + } else { LOG.warn("Cannot update histogram \"{}\" with null value", metricsName); } } http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/meter/MeterEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/meter/MeterEndpoint.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/meter/MeterEndpoint.java index 82c7187..84c6316 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/meter/MeterEndpoint.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/meter/MeterEndpoint.java @@ -1,11 +1,27 @@ +/** + * 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.metrics.meter; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Producer; import org.apache.camel.metrics.AbstractMetricsEndpoint; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; -import com.codahale.metrics.MetricRegistry; @UriEndpoint(scheme = "metrics") public class MeterEndpoint extends AbstractMetricsEndpoint { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/meter/MeterProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/meter/MeterProducer.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/meter/MeterProducer.java index 7622112..686b198 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/meter/MeterProducer.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/meter/MeterProducer.java @@ -1,13 +1,27 @@ +/** + * 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.metrics.meter; -import static org.apache.camel.metrics.MetricsComponent.HEADER_METER_MARK; - +import com.codahale.metrics.Meter; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.metrics.AbstractMetricsProducer; - -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricRegistry; +import static org.apache.camel.metrics.MetricsComponent.HEADER_METER_MARK; public class MeterProducer extends AbstractMetricsProducer<MeterEndpoint> { @@ -23,8 +37,7 @@ public class MeterProducer extends AbstractMetricsProducer<MeterEndpoint> { Long finalMark = getLongHeader(in, HEADER_METER_MARK, mark); if (finalMark == null) { meter.mark(); - } - else { + } else { meter.mark(finalMark); } } http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/timer/TimerEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/timer/TimerEndpoint.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/timer/TimerEndpoint.java index 7b534c4..10bc25f 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/timer/TimerEndpoint.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/timer/TimerEndpoint.java @@ -1,12 +1,27 @@ +/** + * 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.metrics.timer; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Producer; import org.apache.camel.metrics.AbstractMetricsEndpoint; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; -import com.codahale.metrics.MetricRegistry; - @UriEndpoint(scheme = "metrics") public class TimerEndpoint extends AbstractMetricsEndpoint { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/main/java/org/apache/camel/metrics/timer/TimerProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/main/java/org/apache/camel/metrics/timer/TimerProducer.java b/components/camel-metrics/src/main/java/org/apache/camel/metrics/timer/TimerProducer.java index 9586bbd..d12726e 100644 --- a/components/camel-metrics/src/main/java/org/apache/camel/metrics/timer/TimerProducer.java +++ b/components/camel-metrics/src/main/java/org/apache/camel/metrics/timer/TimerProducer.java @@ -1,17 +1,31 @@ +/** + * 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.metrics.timer; -import static org.apache.camel.metrics.MetricsComponent.HEADER_TIMER_ACTION; -import static org.apache.camel.metrics.timer.TimerEndpoint.ENDPOINT_URI; - +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.Timer; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.metrics.AbstractMetricsProducer; import org.apache.camel.metrics.timer.TimerEndpoint.TimerAction; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.Timer; +import static org.apache.camel.metrics.MetricsComponent.HEADER_TIMER_ACTION; +import static org.apache.camel.metrics.timer.TimerEndpoint.ENDPOINT_URI; public class TimerProducer extends AbstractMetricsProducer<TimerEndpoint> { @@ -28,11 +42,9 @@ public class TimerProducer extends AbstractMetricsProducer<TimerEndpoint> { TimerAction finalAction = in.getHeader(HEADER_TIMER_ACTION, action, TimerAction.class); if (finalAction == TimerAction.start) { handleStart(exchange, registry, metricsName); - } - else if (finalAction == TimerAction.stop) { + } else if (finalAction == TimerAction.stop) { handleStop(exchange, registry, metricsName); - } - else { + } else { LOG.warn("No action provided for timer \"{}\"", metricsName); } } @@ -44,8 +56,7 @@ public class TimerProducer extends AbstractMetricsProducer<TimerEndpoint> { Timer timer = registry.timer(metricsName); context = timer.time(); exchange.setProperty(propertyName, context); - } - else { + } else { LOG.warn("Timer \"{}\" already running", metricsName); } } @@ -56,8 +67,7 @@ public class TimerProducer extends AbstractMetricsProducer<TimerEndpoint> { if (context != null) { context.stop(); exchange.removeProperty(propertyName); - } - else { + } else { LOG.warn("Timer \"{}\" not found", metricsName); } } http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/AbstractMetricsEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/AbstractMetricsEndpointTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/AbstractMetricsEndpointTest.java index 1a7543e..a4e1218 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/AbstractMetricsEndpointTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/AbstractMetricsEndpointTest.java @@ -1,9 +1,22 @@ +/** + * 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.metrics; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Mockito.when; - +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.Processor; @@ -17,18 +30,14 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.MetricRegistry; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class AbstractMetricsEndpointTest { private static final String METRICS_NAME = "metrics.name"; - private static final String HEADER = "header"; - private static final String STRING_VALUE = "string-value"; - private static final String DEFAULT_STRING_VALUE = "default-value"; - private static final Long LONG_VALUE = System.currentTimeMillis(); - private static final Long DEFAULT_LONG_VALUE = -10101L; @Mock private MetricRegistry registry; http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/AbstractMetricsProducerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/AbstractMetricsProducerTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/AbstractMetricsProducerTest.java index 3435247..b740634 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/AbstractMetricsProducerTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/AbstractMetricsProducerTest.java @@ -1,13 +1,22 @@ +/** + * 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.metrics; -import static org.apache.camel.metrics.AbstractMetricsProducer.HEADER_PATTERN; -import static org.apache.camel.metrics.MetricsComponent.HEADER_HISTOGRAM_VALUE; -import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.impl.DefaultMessage; @@ -18,8 +27,13 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.MetricRegistry; +import static org.apache.camel.metrics.AbstractMetricsProducer.HEADER_PATTERN; +import static org.apache.camel.metrics.MetricsComponent.HEADER_HISTOGRAM_VALUE; +import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class AbstractMetricsProducerTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricComponentSpringTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricComponentSpringTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricComponentSpringTest.java index a6590c5..417cab6 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricComponentSpringTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricComponentSpringTest.java @@ -1,8 +1,23 @@ +/** + * 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.metrics; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - +import com.codahale.metrics.Counter; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; @@ -19,9 +34,8 @@ import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; - -import com.codahale.metrics.Counter; -import com.codahale.metrics.MetricRegistry; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(CamelSpringJUnit4ClassRunner.class) @ContextConfiguration( http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsComponentRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsComponentRouteTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsComponentRouteTest.java index 4ef44f3..09270c1 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsComponentRouteTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsComponentRouteTest.java @@ -1,19 +1,33 @@ +/** + * 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.metrics; -import static org.apache.camel.metrics.MetricsComponent.HEADER_HISTOGRAM_VALUE; -import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; -import static org.apache.camel.metrics.MetricsComponent.HEADER_PERFIX; - import java.util.Date; import java.util.HashMap; import java.util.Map; - import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; +import static org.apache.camel.metrics.MetricsComponent.HEADER_HISTOGRAM_VALUE; +import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; +import static org.apache.camel.metrics.MetricsComponent.HEADER_PERFIX; public class MetricsComponentRouteTest extends CamelTestSupport { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsComponentTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsComponentTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsComponentTest.java index 74d91c2..8fd02ce 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsComponentTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsComponentTest.java @@ -1,17 +1,25 @@ +/** + * 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.metrics; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - import java.util.EnumSet; import java.util.HashMap; import java.util.Map; - +import com.codahale.metrics.MetricRegistry; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.RuntimeCamelException; @@ -27,8 +35,13 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.MetricRegistry; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.notNullValue; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class MetricsComponentTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsTypeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsTypeTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsTypeTest.java index 2d0d28d..9a3129a 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsTypeTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/MetricsTypeTest.java @@ -1,11 +1,25 @@ +/** + * 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.metrics; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - import java.util.EnumSet; - import org.junit.Test; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; public class MetricsTypeTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterEndpointTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterEndpointTest.java index 8f713a2..0d5c015 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterEndpointTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterEndpointTest.java @@ -1,11 +1,22 @@ +/** + * 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.metrics.counter; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; - +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Producer; import org.junit.After; import org.junit.Before; @@ -15,8 +26,11 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.MetricRegistry; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.nullValue; @RunWith(MockitoJUnitRunner.class) public class CounterEndpointTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterProducerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterProducerTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterProducerTest.java index 6351814..e33429d 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterProducerTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterProducerTest.java @@ -1,12 +1,23 @@ +/** + * 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.metrics.counter; -import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_DECREMENT; -import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_INCREMENT; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - +import com.codahale.metrics.Counter; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.junit.Before; @@ -16,9 +27,12 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.Counter; -import com.codahale.metrics.MetricRegistry; +import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_DECREMENT; +import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_INCREMENT; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class CounterProducerTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterRouteTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterRouteTest.java index 844401e..246f11e 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterRouteTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/counter/CounterRouteTest.java @@ -1,17 +1,26 @@ +/** + * 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.metrics.counter; -import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_DECREMENT; -import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_INCREMENT; -import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; -import static org.apache.camel.metrics.MetricsComponent.METRIC_REGISTRY_NAME; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - import java.util.HashMap; import java.util.Map; +import com.codahale.metrics.Counter; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; @@ -30,9 +39,14 @@ import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; - -import com.codahale.metrics.Counter; -import com.codahale.metrics.MetricRegistry; +import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_DECREMENT; +import static org.apache.camel.metrics.MetricsComponent.HEADER_COUNTER_INCREMENT; +import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; +import static org.apache.camel.metrics.MetricsComponent.METRIC_REGISTRY_NAME; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(CamelSpringJUnit4ClassRunner.class) @ContextConfiguration( http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramEndpointTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramEndpointTest.java index 3ba9ea1..688337b 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramEndpointTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramEndpointTest.java @@ -1,10 +1,22 @@ +/** + * 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.metrics.histogram; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; - +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Producer; import org.junit.After; import org.junit.Before; @@ -14,8 +26,10 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.MetricRegistry; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.nullValue; @RunWith(MockitoJUnitRunner.class) public class HistogramEndpointTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramProducerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramProducerTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramProducerTest.java index 8fe1e06..4513027 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramProducerTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramProducerTest.java @@ -1,11 +1,23 @@ +/** + * 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.metrics.histogram; -import static org.apache.camel.metrics.MetricsComponent.HEADER_HISTOGRAM_VALUE; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - +import com.codahale.metrics.Histogram; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.junit.Before; @@ -15,9 +27,11 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.Histogram; -import com.codahale.metrics.MetricRegistry; +import static org.apache.camel.metrics.MetricsComponent.HEADER_HISTOGRAM_VALUE; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class HistogramProducerTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramRouteTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramRouteTest.java index cc01a1d..a06cd22 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramRouteTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/histogram/HistogramRouteTest.java @@ -1,12 +1,23 @@ +/** + * 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.metrics.histogram; -import static org.apache.camel.metrics.MetricsComponent.HEADER_HISTOGRAM_VALUE; -import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; -import static org.apache.camel.metrics.MetricsComponent.METRIC_REGISTRY_NAME; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - +import com.codahale.metrics.Histogram; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; @@ -25,9 +36,12 @@ import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; - -import com.codahale.metrics.Histogram; -import com.codahale.metrics.MetricRegistry; +import static org.apache.camel.metrics.MetricsComponent.HEADER_HISTOGRAM_VALUE; +import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; +import static org.apache.camel.metrics.MetricsComponent.METRIC_REGISTRY_NAME; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(CamelSpringJUnit4ClassRunner.class) @ContextConfiguration( http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterEndpointTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterEndpointTest.java index 3779da9..73935fa 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterEndpointTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterEndpointTest.java @@ -1,11 +1,22 @@ +/** + * 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.metrics.meter; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; - +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Producer; import org.junit.After; import org.junit.Before; @@ -15,8 +26,11 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.MetricRegistry; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.nullValue; @RunWith(MockitoJUnitRunner.class) public class MeterEndpointTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterProducerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterProducerTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterProducerTest.java index 66dcce2..7c9c47b 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterProducerTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterProducerTest.java @@ -1,12 +1,23 @@ +/** + * 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.metrics.meter; -import static org.apache.camel.metrics.MetricsComponent.HEADER_METER_MARK; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.notNullValue; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - +import com.codahale.metrics.Meter; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.junit.Before; @@ -16,9 +27,12 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricRegistry; +import static org.apache.camel.metrics.MetricsComponent.HEADER_METER_MARK; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.notNullValue; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class MeterProducerTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterRouteTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterRouteTest.java index 6bd5b59..a8de5ea 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterRouteTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/meter/MeterRouteTest.java @@ -1,12 +1,23 @@ +/** + * 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.metrics.meter; -import static org.apache.camel.metrics.MetricsComponent.HEADER_METER_MARK; -import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; -import static org.apache.camel.metrics.MetricsComponent.METRIC_REGISTRY_NAME; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - +import com.codahale.metrics.Meter; +import com.codahale.metrics.MetricRegistry; import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; @@ -25,9 +36,12 @@ import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; - -import com.codahale.metrics.Meter; -import com.codahale.metrics.MetricRegistry; +import static org.apache.camel.metrics.MetricsComponent.HEADER_METER_MARK; +import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; +import static org.apache.camel.metrics.MetricsComponent.METRIC_REGISTRY_NAME; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(CamelSpringJUnit4ClassRunner.class) @ContextConfiguration( http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerEndpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerEndpointTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerEndpointTest.java index cb3232f..82c9213 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerEndpointTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerEndpointTest.java @@ -1,11 +1,22 @@ +/** + * 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.metrics.timer; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; - +import com.codahale.metrics.MetricRegistry; import org.apache.camel.Producer; import org.apache.camel.metrics.timer.TimerEndpoint.TimerAction; import org.junit.After; @@ -16,8 +27,11 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.MetricRegistry; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.nullValue; @RunWith(MockitoJUnitRunner.class) public class TimerEndpointTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerProducerTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerProducerTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerProducerTest.java index ff7c1f6..3a2c364 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerProducerTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerProducerTest.java @@ -1,13 +1,23 @@ +/** + * 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.metrics.timer; -import static org.apache.camel.metrics.MetricsComponent.HEADER_TIMER_ACTION; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.nullValue; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.Timer; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.metrics.timer.TimerEndpoint.TimerAction; @@ -18,9 +28,13 @@ import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; - -import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.Timer; +import static org.apache.camel.metrics.MetricsComponent.HEADER_TIMER_ACTION; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.nullValue; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) public class TimerProducerTest { http://git-wip-us.apache.org/repos/asf/camel/blob/4ea79b19/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerRouteTest.java ---------------------------------------------------------------------- diff --git a/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerRouteTest.java b/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerRouteTest.java index 1a6581c..4dab66a 100644 --- a/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerRouteTest.java +++ b/components/camel-metrics/src/test/java/org/apache/camel/metrics/timer/TimerRouteTest.java @@ -1,12 +1,23 @@ +/** + * 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.metrics.timer; -import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; -import static org.apache.camel.metrics.MetricsComponent.HEADER_TIMER_ACTION; -import static org.apache.camel.metrics.MetricsComponent.METRIC_REGISTRY_NAME; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.when; - +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.Timer; import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; @@ -26,9 +37,12 @@ import org.mockito.Mockito; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; - -import com.codahale.metrics.MetricRegistry; -import com.codahale.metrics.Timer; +import static org.apache.camel.metrics.MetricsComponent.HEADER_METRIC_NAME; +import static org.apache.camel.metrics.MetricsComponent.HEADER_TIMER_ACTION; +import static org.apache.camel.metrics.MetricsComponent.METRIC_REGISTRY_NAME; +import static org.mockito.Mockito.reset; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; @RunWith(CamelSpringJUnit4ClassRunner.class) @ContextConfiguration(