Repository: camel
Updated Branches:
  refs/heads/master 6978bc785 -> f140b2e88


Fixed test after java 8 dsl changes in getHeader causing it to think 2nd 
parameter is supplier and not a default value


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f140b2e8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f140b2e8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f140b2e8

Branch: refs/heads/master
Commit: f140b2e88d8840ceee401341a667de96c60e1c26
Parents: 6978bc7
Author: Claus Ibsen <davscl...@apache.org>
Authored: Sat Feb 18 10:21:07 2017 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sat Feb 18 10:21:07 2017 +0100

----------------------------------------------------------------------
 .../component/metrics/CounterProducerTest.java  | 31 ++++++--------------
 .../metrics/HistogramProducerTest.java          | 15 ++--------
 .../component/metrics/MeterProducerTest.java    | 16 ++--------
 .../component/metrics/TimerProducerTest.java    |  7 +++--
 4 files changed, 18 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f140b2e8/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/CounterProducerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/CounterProducerTest.java
 
b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/CounterProducerTest.java
index e59ca32..7a35062 100644
--- 
a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/CounterProducerTest.java
+++ 
b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/CounterProducerTest.java
@@ -77,6 +77,7 @@ public class CounterProducerTest {
 
     @Test
     public void testProcessWithIncrementOnly() throws Exception {
+        Object action = null;
         when(endpoint.getIncrement()).thenReturn(INCREMENT);
         when(endpoint.getDecrement()).thenReturn(null);
         when(in.getHeader(HEADER_COUNTER_INCREMENT, INCREMENT, 
Long.class)).thenReturn(INCREMENT);
@@ -87,13 +88,14 @@ public class CounterProducerTest {
         inOrder.verify(endpoint, times(1)).getIncrement();
         inOrder.verify(endpoint, times(1)).getDecrement();
         inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_INCREMENT, 
INCREMENT, Long.class);
-        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_DECREMENT, null, 
Long.class);
+        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_DECREMENT, 
action, Long.class);
         inOrder.verify(counter, times(1)).inc(INCREMENT);
         inOrder.verifyNoMoreInteractions();
     }
 
     @Test
     public void testProcessWithDecrementOnly() throws Exception {
+        Object action = null;
         when(endpoint.getIncrement()).thenReturn(null);
         when(endpoint.getDecrement()).thenReturn(DECREMENT);
         when(in.getHeader(HEADER_COUNTER_INCREMENT, null, 
Long.class)).thenReturn(null);
@@ -103,7 +105,7 @@ public class CounterProducerTest {
         inOrder.verify(registry, times(1)).counter(METRICS_NAME);
         inOrder.verify(endpoint, times(1)).getIncrement();
         inOrder.verify(endpoint, times(1)).getDecrement();
-        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_INCREMENT, null, 
Long.class);
+        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_INCREMENT, 
action, Long.class);
         inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_DECREMENT, 
DECREMENT, Long.class);
         inOrder.verify(counter, times(1)).dec(DECREMENT);
         inOrder.verifyNoMoreInteractions();
@@ -128,6 +130,7 @@ public class CounterProducerTest {
 
     @Test
     public void testProcessWithOutIncrementAndDecrement() throws Exception {
+        Object action = null;
         when(endpoint.getIncrement()).thenReturn(null);
         when(endpoint.getDecrement()).thenReturn(null);
         when(in.getHeader(HEADER_COUNTER_INCREMENT, null, 
Long.class)).thenReturn(null);
@@ -137,30 +140,13 @@ public class CounterProducerTest {
         inOrder.verify(registry, times(1)).counter(METRICS_NAME);
         inOrder.verify(endpoint, times(1)).getIncrement();
         inOrder.verify(endpoint, times(1)).getDecrement();
-        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_INCREMENT, null, 
Long.class);
-        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_DECREMENT, null, 
Long.class);
+        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_INCREMENT, 
action, Long.class);
+        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_DECREMENT, 
action, Long.class);
         inOrder.verify(counter, times(1)).inc();
         inOrder.verifyNoMoreInteractions();
     }
 
     @Test
-    public void testProcessWithHeaderValuesOnly() throws Exception {
-        when(endpoint.getIncrement()).thenReturn(null);
-        when(endpoint.getDecrement()).thenReturn(null);
-        when(in.getHeader(HEADER_COUNTER_INCREMENT, null, 
Long.class)).thenReturn(INCREMENT + 1);
-        when(in.getHeader(HEADER_COUNTER_DECREMENT, null, 
Long.class)).thenReturn(DECREMENT - 1);
-        producer.doProcess(exchange, endpoint, registry, METRICS_NAME);
-        inOrder.verify(exchange, times(1)).getIn();
-        inOrder.verify(registry, times(1)).counter(METRICS_NAME);
-        inOrder.verify(endpoint, times(1)).getIncrement();
-        inOrder.verify(endpoint, times(1)).getDecrement();
-        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_INCREMENT, null, 
Long.class);
-        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_DECREMENT, null, 
Long.class);
-        inOrder.verify(counter, times(1)).inc(INCREMENT + 1);
-        inOrder.verifyNoMoreInteractions();
-    }
-
-    @Test
     public void testProcessOverridingIncrement() throws Exception {
         when(endpoint.getIncrement()).thenReturn(INCREMENT);
         when(endpoint.getDecrement()).thenReturn(DECREMENT);
@@ -179,6 +165,7 @@ public class CounterProducerTest {
 
     @Test
     public void testProcessOverridingDecrement() throws Exception {
+        Object action = null;
         when(endpoint.getIncrement()).thenReturn(null);
         when(endpoint.getDecrement()).thenReturn(DECREMENT);
         when(in.getHeader(HEADER_COUNTER_INCREMENT, null, 
Long.class)).thenReturn(null);
@@ -188,7 +175,7 @@ public class CounterProducerTest {
         inOrder.verify(registry, times(1)).counter(METRICS_NAME);
         inOrder.verify(endpoint, times(1)).getIncrement();
         inOrder.verify(endpoint, times(1)).getDecrement();
-        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_INCREMENT, null, 
Long.class);
+        inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_INCREMENT, 
action, Long.class);
         inOrder.verify(in, times(1)).getHeader(HEADER_COUNTER_DECREMENT, 
DECREMENT, Long.class);
         inOrder.verify(counter, times(1)).dec(DECREMENT - 1);
         inOrder.verifyNoMoreInteractions();

http://git-wip-us.apache.org/repos/asf/camel/blob/f140b2e8/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/HistogramProducerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/HistogramProducerTest.java
 
b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/HistogramProducerTest.java
index 99ed77f..9e5d6c3 100644
--- 
a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/HistogramProducerTest.java
+++ 
b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/HistogramProducerTest.java
@@ -88,13 +88,14 @@ public class HistogramProducerTest {
 
     @Test
     public void testProcessValueNotSet() throws Exception {
+        Object action = null;
         when(endpoint.getValue()).thenReturn(null);
         when(in.getHeader(HEADER_HISTOGRAM_VALUE, null, 
Long.class)).thenReturn(null);
         producer.doProcess(exchange, endpoint, registry, METRICS_NAME);
         inOrder.verify(exchange, times(1)).getIn();
         inOrder.verify(registry, times(1)).histogram(METRICS_NAME);
         inOrder.verify(endpoint, times(1)).getValue();
-        inOrder.verify(in, times(1)).getHeader(HEADER_HISTOGRAM_VALUE, null, 
Long.class);
+        inOrder.verify(in, times(1)).getHeader(HEADER_HISTOGRAM_VALUE, action, 
Long.class);
         inOrder.verifyNoMoreInteractions();
     }
 
@@ -111,16 +112,4 @@ public class HistogramProducerTest {
         inOrder.verifyNoMoreInteractions();
     }
 
-    @Test
-    public void testProcessOverrideUriValueNotSet() throws Exception {
-        when(endpoint.getValue()).thenReturn(null);
-        when(in.getHeader(HEADER_HISTOGRAM_VALUE, null, 
Long.class)).thenReturn(VALUE + 2);
-        producer.doProcess(exchange, endpoint, registry, METRICS_NAME);
-        inOrder.verify(exchange, times(1)).getIn();
-        inOrder.verify(registry, times(1)).histogram(METRICS_NAME);
-        inOrder.verify(endpoint, times(1)).getValue();
-        inOrder.verify(in, times(1)).getHeader(HEADER_HISTOGRAM_VALUE, null, 
Long.class);
-        inOrder.verify(histogram, times(1)).update(VALUE + 2);
-        inOrder.verifyNoMoreInteractions();
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/f140b2e8/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MeterProducerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MeterProducerTest.java
 
b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MeterProducerTest.java
index 02f5c61..79416f4 100644
--- 
a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MeterProducerTest.java
+++ 
b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MeterProducerTest.java
@@ -104,25 +104,15 @@ public class MeterProducerTest {
 
     @Test
     public void testProcessMarkNotSet() throws Exception {
+        Object action = null;
         when(endpoint.getMark()).thenReturn(null);
         when(in.getHeader(HEADER_METER_MARK, null, 
Long.class)).thenReturn(null);
         producer.doProcess(exchange, endpoint, registry, METRICS_NAME);
         inOrder.verify(registry, times(1)).meter(METRICS_NAME);
         inOrder.verify(endpoint, times(1)).getMark();
-        inOrder.verify(in, times(1)).getHeader(HEADER_METER_MARK, null, 
Long.class);
+        inOrder.verify(in, times(1)).getHeader(HEADER_METER_MARK, action, 
Long.class);
         inOrder.verify(meter, times(1)).mark();
         inOrder.verifyNoMoreInteractions();
     }
 
-    @Test
-    public void testProcessMarkNotSetOverrideByHeaderValue() throws Exception {
-        when(endpoint.getMark()).thenReturn(null);
-        when(in.getHeader(HEADER_METER_MARK, null, 
Long.class)).thenReturn(MARK);
-        producer.doProcess(exchange, endpoint, registry, METRICS_NAME);
-        inOrder.verify(registry, times(1)).meter(METRICS_NAME);
-        inOrder.verify(endpoint, times(1)).getMark();
-        inOrder.verify(in, times(1)).getHeader(HEADER_METER_MARK, null, 
Long.class);
-        inOrder.verify(meter, times(1)).mark(MARK);
-        inOrder.verifyNoMoreInteractions();
-    }
-}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/f140b2e8/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/TimerProducerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/TimerProducerTest.java
 
b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/TimerProducerTest.java
index fd66b16..0baf5778 100644
--- 
a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/TimerProducerTest.java
+++ 
b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/TimerProducerTest.java
@@ -150,18 +150,19 @@ public class TimerProducerTest {
         producer.doProcess(exchange, endpoint, registry, METRICS_NAME);
         inOrder.verify(exchange, times(1)).getIn();
         inOrder.verify(endpoint, times(1)).getAction();
-        inOrder.verify(in, times(1)).getHeader(HEADER_TIMER_ACTION, null, 
MetricsTimerAction.class);
+        inOrder.verify(in, times(1)).getHeader(HEADER_TIMER_ACTION, (Object) 
null, MetricsTimerAction.class);
         inOrder.verifyNoMoreInteractions();
     }
 
     @Test
     public void testProcessNoActionOverride() throws Exception {
+        Object action = null;
         when(endpoint.getAction()).thenReturn(null);
-        when(in.getHeader(HEADER_TIMER_ACTION, null, 
MetricsTimerAction.class)).thenReturn(MetricsTimerAction.start);
+        when(in.getHeader(HEADER_TIMER_ACTION, action, 
MetricsTimerAction.class)).thenReturn(MetricsTimerAction.start);
         producer.doProcess(exchange, endpoint, registry, METRICS_NAME);
         inOrder.verify(exchange, times(1)).getIn();
         inOrder.verify(endpoint, times(1)).getAction();
-        inOrder.verify(in, times(1)).getHeader(HEADER_TIMER_ACTION, null, 
MetricsTimerAction.class);
+        inOrder.verify(in, times(1)).getHeader(HEADER_TIMER_ACTION, action, 
MetricsTimerAction.class);
         inOrder.verify(exchange, times(1)).getProperty(PROPERTY_NAME, 
Timer.Context.class);
         inOrder.verify(registry, times(1)).timer(METRICS_NAME);
         inOrder.verify(timer, times(1)).time();

Reply via email to