Revert "Fixed style and documentation issues. The documentation is not yet 
complete."

This reverts commit cec7b30f3395529dae6dc5b5d46ff0e64cb1d209.


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

Branch: refs/heads/master
Commit: 25dbd0d8ce0ba5d57cb2fc350c8a0b125b7f0b72
Parents: e898247
Author: Andrea Cosentino <anco...@gmail.com>
Authored: Fri Nov 25 12:50:21 2016 +0100
Committer: Andrea Cosentino <anco...@gmail.com>
Committed: Fri Nov 25 12:50:21 2016 +0100

----------------------------------------------------------------------
 .../src/main/docs/firebase-component.adoc       | 204 -------------------
 .../component/firebase/FirebaseComponent.java   |  20 +-
 .../component/firebase/FirebaseConfig.java      |  26 +--
 .../component/firebase/FirebaseConsumer.java    |  16 --
 .../component/firebase/FirebaseEndpoint.java    |  43 +---
 .../component/firebase/FirebaseProducer.java    |  16 --
 .../firebase/data/FirebaseMessage.java          |  28 +--
 .../component/firebase/data/Operation.java      |  16 --
 .../exception/DatabaseErrorException.java       |  16 --
 .../firebase/exception/FirebaseException.java   |  47 +++--
 .../firebase/FirebaseConsumerDeleteTest.java    |  51 ++---
 .../firebase/FirebaseConsumerTest.java          |  45 ++--
 .../firebase/FirebaseProducerTest.java          |  42 ++--
 .../provider/ConfigurationProvider.java         |  25 +--
 .../firebase/provider/SampleInputProvider.java  |  18 +-
 15 files changed, 96 insertions(+), 517 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/main/docs/firebase-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-firebase/src/main/docs/firebase-component.adoc 
b/components/camel-firebase/src/main/docs/firebase-component.adoc
deleted file mode 100644
index e3ca1bb..0000000
--- a/components/camel-firebase/src/main/docs/firebase-component.adoc
+++ /dev/null
@@ -1,204 +0,0 @@
-[[Firebase-FirebaseComponent]]
-Firebase Component
-~~~~~~~~~~~~~~~~~
-
-*Available as of Camel 2.18.x*
-
-The *firebase* component enables you to save, modify data in Google Firebase 
database
-and consume to all child of a specific reference.
-
-This component supports producer and event based consumer endpoints.
-
-The Firebase consumer is an event based consumer and can be used to listen
-and respond to five types of Firebase events: add, change, remove, move and 
cancel 
-
-Maven users will need to add the following dependency to
-their `pom.xml` for this component:
-
-[source,xml]
-------------------------------------------------------------
-<dependency>
-    <groupId>org.apache.camel</groupId>
-    <artifactId>camel-firebase</artifactId>
-    <version>x.x.x</version>
-    <!-- use the same version as your Camel core version -->
-</dependency>
-------------------------------------------------------------
-
-[[Ehcache-URIformat]]
-URI format
-^^^^^^^^^^
-
-[source,java]
------------------------------
-firebase://databaseUrl[?options]
------------------------------
-
-You can append query options to the URI in the following
-format, `?option=value&option=#beanRef&...`
-
-Do not forget to URL encode the parameters
-
-[[Firebase-Options]]
-Options
-^^^^^^^
-
-
-// component options: START
-The Firebase component has no options.
-// component options: END
-
-
-
-// endpoint options: START
-The Firebase component supports 9 endpoint options which are listed below:
-
-{% raw %}
-[width="100%",cols="2,1,1m,1m,5",options="header"]
-|=======================================================================
-| Name | Group | Default | Java Type | Description
-| databaseUrl | common |  | String | *Required* The Firebase database URL. 
Always uses https
-| async | common | async | boolean | If true the save or update request (set 
value in Firebase terms) is fired and the reply will be ignored else the 
routing thread will wait and the reply will be saved in the exchange message
-| keyName | common | firebaseKey | String | The Camel exchange header name in 
which the Firebase key is specified. Only needed in case you are saving or 
updating data
-| rootReference | common |  | String | *Required* The path in the database 
tree where the key value pairs are to be stored
-| serviceAccountFile | common |  | String | *Required* The path to the JSON 
file which provided the keys used to connect to Firebase. This file is 
typically generated when you create the database
-| bridgeErrorHandler | consumer | false | boolean | Allows for bridging the 
consumer to the Camel routing Error Handler which mean any exceptions occurred 
while the consumer is trying to pickup incoming messages or the likes will now 
be processed as a message and handled by the routing Error Handler. By default 
the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions that will be logged at WARN/ERROR level and ignored.
-| exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the 
consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler 
is enabled then this options is not in use. By default the consumer will deal 
with exceptions that will be logged at WARN/ERROR level and ignored.
-| exchangePattern | consumer (advanced) |  | ExchangePattern | Sets the 
exchange pattern when the consumer creates an exchange.
-| synchronous | advanced | false | boolean | Sets whether synchronous 
processing should be strictly used or Camel is allowed to use asynchronous 
processing (if supported).
-|=======================================================================
-{% endraw %}
-// endpoint options: END
-
-
-[[Ehcache-MessageHeadersCamel]]
-Message Headers Camel 
-++++++++++++++++++++++
-
- 
-[width="100%",cols="10%,10%,80%",options="header",]
-|=======================================================================
-|Header |Type |Description
-
-|CamelEhcacheAction |`String` |The operation to be perfomed on the cache, 
valid options are:
-
-* CLEAR
-* PUT
-* PUT_ALL
-* PUT_IF_ABSENT
-* GET
-* GET_ALL
-* REMOVE
-* REMOVE_ALL
-* REPLACE
-
-|CamelEhcacheActionHasResult |Boolean |Set to true if the action has a result
-
-|CamelEhcacheActionSucceeded |`Boolean` |Set to true if the actionsuccedded
-
-|CamelEhcacheKey |Object |The cache key used for an action
-
-|CamelEhcacheKeys |Set<Object> |A list of keys, used in
-
-* PUT_ALL
-* GET_ALL
-* REMOVE_ALL
-
-|CamelEhcacheValue |Object |The value to put in the cache or the result of an 
operation
-
-|CamelEhcacheOldValue |Object |The old value associated to a key for actions 
like PUT_IF_ABSENT or the
-Object used for comparison for actions like REPLACE
-
-|CamelEhcacheEventType |EventType |The type of event received
-|=======================================================================
-
-[[Ehcache-Ehcachebasedidempotentrepositoryexample:]]
-Ehcache based idempotent repository example:
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-[source,java]
-------------------------------------------------------------------------------------------------
-CacheManager manager = CacheManagerBuilder.newCacheManager(new 
XmlConfiguration("ehcache.xml"));
-EhcacheIdempotentRepository repo = new EhcacheIdempotentRepository(manager, 
"idempotent-cache");
- 
-from("direct:in")
-    .idempotentConsumer(header("messageId"), idempotentRepo)
-    .to("mock:out");
-------------------------------------------------------------------------------------------------
-
- 
-
-[[Ehcache-Ehcachebasedaggregationrepositoryexample:]]
-Ehcache based aggregation repository example:
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-[source,java]
----------------------------------------------------------------------------------------------------------------------------------
-public class EhcacheAggregationRepositoryRoutesTest extends CamelTestSupport {
-    private static final String ENDPOINT_MOCK = "mock:result";
-    private static final String ENDPOINT_DIRECT = "direct:one";
-    private static final int[] VALUES = generateRandomArrayOfInt(10, 0, 30);
-    private static final int SUM = IntStream.of(VALUES).reduce(0, (a, b) -> a 
+ b);
-    private static final String CORRELATOR = "CORRELATOR";
-
-    @EndpointInject(uri = ENDPOINT_MOCK)
-    private MockEndpoint mock;
-
-    @Produce(uri = ENDPOINT_DIRECT)
-    private ProducerTemplate producer;
-
-    @Test
-    public void checkAggregationFromOneRoute() throws Exception {
-        mock.expectedMessageCount(VALUES.length);
-        mock.expectedBodiesReceived(SUM);
-
-        IntStream.of(VALUES).forEach(
-            i -> producer.sendBodyAndHeader(i, CORRELATOR, CORRELATOR)
-        );
-
-        mock.assertIsSatisfied();
-    }
-
-    private Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
-        if (oldExchange == null) {
-            return newExchange;
-        } else {
-            Integer n = newExchange.getIn().getBody(Integer.class);
-            Integer o = oldExchange.getIn().getBody(Integer.class);
-            Integer v = (o == null ? 0 : o) + (n == null ? 0 : n);
-
-            oldExchange.getIn().setBody(v, Integer.class);
-
-            return oldExchange;
-        }
-    }
-
-    @Override
-    protected RoutesBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from(ENDPOINT_DIRECT)
-                    .routeId("AggregatingRouteOne")
-                    .aggregate(header(CORRELATOR))
-                    .aggregationRepository(createAggregateRepository())
-                    
.aggregationStrategy(EhcacheAggregationRepositoryRoutesTest.this::aggregate)
-                    .completionSize(VALUES.length)
-                        
.to("log:org.apache.camel.component.ehcache.processor.aggregate.level=INFO&showAll=true&mulltiline=true")
-                        .to(ENDPOINT_MOCK);
-            }
-        };
-    }
-
-    protected EhcacheAggregationRepository createAggregateRepository() throws 
Exception {
-        CacheManager cacheManager = CacheManagerBuilder.newCacheManager(new 
XmlConfiguration("ehcache.xml"));
-        cacheManager.init();
-
-        EhcacheAggregationRepository repository = new 
EhcacheAggregationRepository();
-        repository.setCacheManager(cacheManager);
-        repository.setCacheName("aggregate");
-
-        return repository;
-    }
-}
----------------------------------------------------------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseComponent.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseComponent.java
 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseComponent.java
index 8b80a2a..18e6d64 100644
--- 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseComponent.java
+++ 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseComponent.java
@@ -1,27 +1,11 @@
-/**
- * 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.component.firebase;
 
-import java.util.Map;
-
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.UriEndpointComponent;
 
+import java.util.Map;
+
 /**
  * Represents the component that manages {@link FirebaseEndpoint}.
  */

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConfig.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConfig.java
 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConfig.java
index 7f6641e..a46caf8 100644
--- 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConfig.java
+++ 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConfig.java
@@ -1,34 +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.
- */
 package org.apache.camel.component.firebase;
 
+import com.google.firebase.FirebaseApp;
+import com.google.firebase.FirebaseOptions;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.UUID;
 
-import com.google.firebase.FirebaseApp;
-import com.google.firebase.FirebaseOptions;
-
 /**
  * Contains the elements needed to connect to Firebase
  */
-public final class FirebaseConfig {
+public class FirebaseConfig {
 
     private final String databaseUrl;
 
@@ -51,7 +35,7 @@ public final class FirebaseConfig {
     }
 
     public void init() throws IOException {
-        try (InputStream in = 
Files.newInputStream(Paths.get(serviceAccountFile))) {
+        try(InputStream in = 
Files.newInputStream(Paths.get(serviceAccountFile))) {
             FirebaseOptions options = new FirebaseOptions.Builder()
                     .setServiceAccount(in)
                     .setDatabaseUrl(this.databaseUrl)

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConsumer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConsumer.java
 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConsumer.java
index bbcb2b6..1dee1a4 100644
--- 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConsumer.java
+++ 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseConsumer.java
@@ -1,19 +1,3 @@
-/**
- * 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.component.firebase;
 
 import com.google.firebase.database.ChildEventListener;

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseEndpoint.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseEndpoint.java
 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseEndpoint.java
index a6b035b..0be796a 100644
--- 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseEndpoint.java
+++ 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseEndpoint.java
@@ -1,19 +1,3 @@
-/**
- * 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.component.firebase;
 
 import com.google.firebase.FirebaseApp;
@@ -24,37 +8,27 @@ import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
-import org.apache.camel.spi.UriPath;
 
 /**
  * Represents a Firebase endpoint.
  */
-@UriEndpoint(scheme = "firebase", title = "Firebase", syntax = 
"firebase:name", consumerClass = FirebaseConsumer.class, label = "Firebase")
+@UriEndpoint(scheme = "firebase", title = "Firebase", syntax="firebase:name", 
consumerClass = FirebaseConsumer.class, label = "Firebase")
 public class FirebaseEndpoint extends DefaultEndpoint {
 
     private final FirebaseConfig firebaseConfig;
 
-    @UriPath(description = "The Firebase database URL. Always uses https")
-    @Metadata(required = "true")
-    private String databaseUrl;
-
-    @UriParam(description = "The path in the database tree where the key value 
pairs are to be stored")
+    @UriParam
     @Metadata(required = "true")
     private String rootReference;
 
-    @UriParam(description = "The path to the JSON file which provided the keys 
used to connect to Firebase. #"
-            + "This file is typically generated when you create the database")
+    @UriParam
     @Metadata(required = "true")
     private String serviceAccountFile;
 
-    @UriParam(defaultValue = "firebaseKey", description = "The Camel exchange 
header name in which "
-            + "the Firebase key is specified. Only needed in case you are 
saving or updating data")
-    @Metadata(required = "false")
+    @UriParam(defaultValue = "firebaseKey") @Metadata(required = "false")
     private String keyName = "firebaseKey";
 
-    @UriParam(defaultValue = "async", description = "If true, the save or 
update request (set value in Firebase terms) "
-            + "is fired and the reply will be ignored, else the routing thread 
will wait and the reply will be saved in the exchange message")
-    @Metadata(required = "false")
+    @UriParam(defaultValue = "async") @Metadata(required = "false")
     private boolean async;
 
     public FirebaseEndpoint(String uri, FirebaseComponent firebaseComponent, 
FirebaseConfig firebaseConfig) {
@@ -62,10 +36,9 @@ public class FirebaseEndpoint extends DefaultEndpoint {
         this.firebaseConfig = firebaseConfig;
         this.setRootReference(firebaseConfig.getRootReference());
         this.setServiceAccountFile(firebaseConfig.getServiceAccountFile());
-        this.databaseUrl = firebaseConfig.getDatabaseUrl();
         final String keyName = firebaseConfig.getKeyName();
         this.setAsync(firebaseConfig.isAsync());
-        if (keyName != null) {
+        if(keyName != null) {
             this.setKeyName(keyName);
         }
     }
@@ -121,8 +94,4 @@ public class FirebaseEndpoint extends DefaultEndpoint {
     public FirebaseApp getFirebaseApp() {
         return firebaseConfig.getFirebaseApp();
     }
-
-    public String getDatabaseUrl() {
-        return databaseUrl;
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseProducer.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseProducer.java
 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseProducer.java
index ef8f8a6..bc09550 100644
--- 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseProducer.java
+++ 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/FirebaseProducer.java
@@ -1,19 +1,3 @@
-/**
- * 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.component.firebase;
 
 import com.google.firebase.database.DatabaseError;

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/data/FirebaseMessage.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/data/FirebaseMessage.java
 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/data/FirebaseMessage.java
index 4999102..afd02ae 100644
--- 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/data/FirebaseMessage.java
+++ 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/data/FirebaseMessage.java
@@ -1,19 +1,3 @@
-/**
- * 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.component.firebase.data;
 
 import com.google.firebase.database.DataSnapshot;
@@ -22,7 +6,7 @@ import com.google.firebase.database.DatabaseError;
 /**
  * Contains a message sent by Firebase.
  */
-public final class FirebaseMessage {
+public class FirebaseMessage {
 
     private final Operation operation;
 
@@ -57,11 +41,11 @@ public final class FirebaseMessage {
 
     @Override
     public String toString() {
-        return "FirebaseMessage{"
-                + "operation=" + operation
-                + ", dataSnapshot=" + dataSnapshot
-                + ", previousChildName='" + previousChildName + '\''
-                + ", databaseError=" + databaseError + '}';
+        return "FirebaseMessage{" + "operation=" + operation +
+                ", dataSnapshot=" + dataSnapshot +
+                ", previousChildName='" + previousChildName + '\'' +
+                ", databaseError=" + databaseError +
+                '}';
     }
 
     public static class Builder {

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/data/Operation.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/data/Operation.java
 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/data/Operation.java
index 609a209..5410c61 100644
--- 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/data/Operation.java
+++ 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/data/Operation.java
@@ -1,19 +1,3 @@
-/**
- * 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.component.firebase.data;
 
 /**

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/exception/DatabaseErrorException.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/exception/DatabaseErrorException.java
 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/exception/DatabaseErrorException.java
index a7939e2..4c2d23e 100644
--- 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/exception/DatabaseErrorException.java
+++ 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/exception/DatabaseErrorException.java
@@ -1,19 +1,3 @@
-/**
- * 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.component.firebase.exception;
 
 import com.google.firebase.database.DatabaseError;

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/exception/FirebaseException.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/exception/FirebaseException.java
 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/exception/FirebaseException.java
index a39b871..190f386 100644
--- 
a/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/exception/FirebaseException.java
+++ 
b/components/camel-firebase/src/main/java/org/apache/camel/component/firebase/exception/FirebaseException.java
@@ -1,26 +1,34 @@
-/**
- * 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.component.firebase.exception;
 
+import com.google.firebase.database.DatabaseError;
+
 /**
  * Used to mark an exception occurred in the Firebase Camel processor.
  */
 public class FirebaseException extends RuntimeException {
 
+    private DatabaseError databaseError;
+
+    /**
+     * Constructs a new runtime exception with {@code null} as its
+     * detail message.  The cause is not initialized, and may subsequently be
+     * initialized by a call to {@link #initCause}.
+     */
+    public FirebaseException() {
+    }
+
+    /**
+     * Constructs a new runtime exception with the specified detail message.
+     * The cause is not initialized, and may subsequently be initialized by a
+     * call to {@link #initCause}.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public FirebaseException(String message) {
+        super(message);
+    }
+
     /**
      * Constructs a new runtime exception with the specified detail message and
      * cause.  <p>Note that the detail message associated with
@@ -39,4 +47,11 @@ public class FirebaseException extends RuntimeException {
         super(message, cause);
     }
 
+    public void setDatabaseError(DatabaseError databaseError) {
+        this.databaseError = databaseError;
+    }
+
+    public DatabaseError getDatabaseError() {
+        return databaseError;
+    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseConsumerDeleteTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseConsumerDeleteTest.java
 
b/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseConsumerDeleteTest.java
index f3600e9..460a7e7 100644
--- 
a/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseConsumerDeleteTest.java
+++ 
b/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseConsumerDeleteTest.java
@@ -1,27 +1,5 @@
-/**
- * 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.component.firebase;
 
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
-
-import static junit.framework.TestCase.fail;
-
 import com.google.firebase.database.DatabaseReference;
 import com.google.firebase.database.FirebaseDatabase;
 import org.apache.camel.CamelContext;
@@ -33,8 +11,12 @@ import 
org.apache.camel.component.firebase.provider.SampleInputProvider;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.junit.Test;
 
-import static org.assertj.core.api.Assertions.assertThat;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
 
+import static junit.framework.TestCase.fail;
+import static org.assertj.core.api.Assertions.assertThat;
 
 /**
  * Starts a route which listens to the remove event in Firebase. It then 
writes and deletes an entry in Firebase and
@@ -47,13 +29,15 @@ public class FirebaseConsumerDeleteTest {
     private final Condition wake = reentrantLock.newCondition();
 
     @Test
-    public void whenDeleteDeleteMessageShouldBeIntercepted() throws Exception {
+    public void whenDelete_DeleteMessageShouldBeIntercepted() throws Exception 
{
         CamelContext context = new DefaultCamelContext();
-        boolean[] deleteMessageReceived = {false};
+        boolean[] deleteMessageReceived = { false };
         FirebaseConfig firebaseConfig = 
ConfigurationProvider.createDemoConfig();
-        createAndDeleteContent(firebaseConfig, false);
         setupRoute(context, deleteMessageReceived);
-
+        context.addStartupListener((context1, alreadyStarted) -> {
+            TimeUnit.SECONDS.sleep(5);
+            createAndDeleteContent(firebaseConfig);
+        });
         context.start();
         try {
             reentrantLock.lock();
@@ -65,19 +49,16 @@ public class FirebaseConsumerDeleteTest {
         context.stop();
     }
 
-    private void createAndDeleteContent(FirebaseConfig firebaseConfig, boolean 
delete) {
+    private void createAndDeleteContent(FirebaseConfig firebaseConfig) {
         final DatabaseReference rootReference = 
FirebaseDatabase.getInstance(firebaseConfig.getFirebaseApp())
                 
.getReference(ConfigurationProvider.createRootReference()).child(SampleInputProvider.createDeleteKey());
         rootReference
                 .setValue("AETHELWULF 839-856", (databaseError, 
databaseReference) -> {
-                    if (delete) {
-                        databaseReference.removeValue();
-                    }
+                    databaseReference.removeValue();
                 });
     }
 
     private void setupRoute(CamelContext context, final boolean[] 
deleteMessageReceived) throws Exception {
-        boolean deleteFired[] = {false};
         context.addRoutes(new RouteBuilder() {
             public void configure() {
                 try {
@@ -94,12 +75,6 @@ public class FirebaseConsumerDeleteTest {
                                     } finally {
                                         reentrantLock.unlock();
                                     }
-                                } else {
-                                    if (!deleteFired[0]) {
-                                        deleteFired[0] = true;
-                                        FirebaseConfig firebaseConfig = 
ConfigurationProvider.createDemoConfig();
-                                        createAndDeleteContent(firebaseConfig, 
true);
-                                    }
                                 }
                             });
 

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseConsumerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseConsumerTest.java
 
b/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseConsumerTest.java
index 8395a98..2c6cbc4 100644
--- 
a/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseConsumerTest.java
+++ 
b/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseConsumerTest.java
@@ -1,28 +1,5 @@
-/**
- * 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.component.firebase;
 
-
-import java.io.IOException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
-
 import com.google.firebase.database.FirebaseDatabase;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.firebase.provider.ConfigurationProvider;
@@ -30,17 +7,19 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
+import java.io.IOException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+
 /**
  * Writes a dummy message and then checks, if the consumer receives at least 
one message.
  */
 public class FirebaseConsumerTest extends CamelTestSupport {
 
-    private final ReentrantLock lock = new ReentrantLock();
-
-    private final Condition wake = lock.newCondition();
-
     @Test
-    public void whenFirebaseListenerShouldReceiveMessages() throws Exception {
+    public void whenFirebaseListener_ShouldReceiveMessages() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
         mock.expectedMinimumMessageCount(1);
         assertMockEndpointsSatisfied();
@@ -68,6 +47,10 @@ public class FirebaseConsumerTest extends CamelTestSupport {
         };
     }
 
+    private final ReentrantLock lock = new ReentrantLock();
+
+    private final Condition wake = lock.newCondition();
+
     private void insertDummyData(String databaseUrl, String 
originalRootReference, String serviceAccountFile) throws IOException, 
InterruptedException {
         FirebaseConfig config = new FirebaseConfig.Builder(databaseUrl, 
originalRootReference, URLDecoder.decode(serviceAccountFile, "UTF-8"))
                 .build();
@@ -78,14 +61,16 @@ public class FirebaseConsumerTest extends CamelTestSupport {
                     try {
                         lock.lock();
                         wake.signal();
-                    } finally {
+                    }
+                    finally {
                         lock.unlock();
                     }
                 });
         try {
             lock.lock();
             wake.await();
-        } finally {
+        }
+        finally {
             lock.unlock();
         }
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseProducerTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseProducerTest.java
 
b/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseProducerTest.java
index f0f2cc3..549bfef 100644
--- 
a/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseProducerTest.java
+++ 
b/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/FirebaseProducerTest.java
@@ -1,27 +1,5 @@
-/**
- * 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.component.firebase;
 
-import java.net.URLEncoder;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.ReentrantLock;
-
 import com.google.firebase.database.DatabaseReference;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Message;
@@ -33,6 +11,12 @@ import org.apache.camel.impl.DefaultCamelContext;
 import org.junit.Before;
 import org.junit.Test;
 
+import java.net.URLEncoder;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+
 import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
 
 /**
@@ -52,12 +36,12 @@ public class FirebaseProducerTest {
     }
 
     @Test
-    public void whenFirebaseSetShouldReceiveMessagesSync() throws Exception {
+    public void whenFirebaseSet_ShouldReceiveMessagesSync() throws Exception {
         startRoute(false, DatabaseReference.class);
     }
 
     @Test
-    public void whenFirebaseSetShouldReceiveMessagesAsync() throws Exception {
+    public void whenFirebaseSet_ShouldReceiveMessagesAsync() throws Exception {
         startRoute(true, String.class);
     }
 
@@ -83,20 +67,22 @@ public class FirebaseProducerTest {
                         .to("log:whenFirebaseSet?level=WARN")
                         .process(exchange1 -> {
                             
assertThat(exchange1.getIn().getBody().getClass()).isEqualTo(expectedBodyClass);
-                            try {
+                            try{
                                 reentrantLock.lock();
                                 wake.signal();
-                            } finally {
+                            }
+                            finally {
                                 reentrantLock.unlock();
                             }
                         });
             }
         });
         context.start();
-        try {
+        try{
             reentrantLock.lock();
             wake.await();
-        } finally {
+        }
+        finally {
             reentrantLock.unlock();
         }
         context.stop();

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/provider/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/provider/ConfigurationProvider.java
 
b/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/provider/ConfigurationProvider.java
index 6b6a51f..d33d881 100644
--- 
a/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/provider/ConfigurationProvider.java
+++ 
b/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/provider/ConfigurationProvider.java
@@ -1,21 +1,7 @@
-/**
- * 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.component.firebase.provider;
 
+import org.apache.camel.component.firebase.FirebaseConfig;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -24,17 +10,12 @@ import java.net.URL;
 import java.net.URLDecoder;
 import java.net.URLEncoder;
 
-import org.apache.camel.component.firebase.FirebaseConfig;
-
 import static org.junit.Assert.assertNotNull;
 
 /**
  * Provides the path of the configuration used to access Firebase.
  */
-public final class ConfigurationProvider {
-
-    private ConfigurationProvider() {
-    }
+public class ConfigurationProvider {
 
     public static String createFirebaseConfigLink() throws URISyntaxException, 
UnsupportedEncodingException {
         URL url = 
Thread.currentThread().getContextClassLoader().getResource("firebase-admin-connection.json");

http://git-wip-us.apache.org/repos/asf/camel/blob/25dbd0d8/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/provider/SampleInputProvider.java
----------------------------------------------------------------------
diff --git 
a/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/provider/SampleInputProvider.java
 
b/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/provider/SampleInputProvider.java
index 38477ef..4b0d4f7 100644
--- 
a/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/provider/SampleInputProvider.java
+++ 
b/components/camel-firebase/src/test/java/org/apache/camel/component/firebase/provider/SampleInputProvider.java
@@ -1,19 +1,3 @@
-/**
- * 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.component.firebase.provider;
 
 import java.io.IOException;
@@ -36,7 +20,7 @@ public class SampleInputProvider {
 
     public SampleInputProvider() throws IOException {
         targetFolder = Paths.get("src/data");
-        if (!Files.exists(targetFolder)) {
+        if(!Files.exists(targetFolder)) {
             Files.createDirectories(targetFolder);
         }
     }

Reply via email to