You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2018/01/18 10:25:14 UTC

[camel] branch master updated: CAMEL-11907: Improve test coverage for pgevent component

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 183b0fa  CAMEL-11907: Improve test coverage for pgevent component
183b0fa is described below

commit 183b0fae3ce9cd441675e8f2100562a1a3b6aef8
Author: James Netherton <ja...@gmail.com>
AuthorDate: Thu Jan 18 09:58:39 2018 +0000

    CAMEL-11907: Improve test coverage for pgevent component
---
 components/camel-pgevent/pom.xml                   |   7 +-
 .../org/apache/camel/pgevent/IntegrationTest.java  |  92 -------------
 .../apache/camel/pgevent/PgEventConsumerTest.java  | 102 +++++++++++++++
 .../apache/camel/pgevent/PgEventProducerTest.java  | 142 +++++++++++++++++++++
 .../AbstractPgEventIntegrationTest.java            |  34 +++++
 .../integration/PgEventPubSubIntegrationTest.java  |  60 +++++++++
 ...gEventWithDefinedDatasourceIntegrationTest.java |  83 ++++++++++++
 .../src/test/resources/test-options.properties     |  37 ++++++
 8 files changed, 464 insertions(+), 93 deletions(-)

diff --git a/components/camel-pgevent/pom.xml b/components/camel-pgevent/pom.xml
index fd0fc0d..25f6583 100644
--- a/components/camel-pgevent/pom.xml
+++ b/components/camel-pgevent/pom.xml
@@ -54,8 +54,13 @@
       <artifactId>camel-test</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <scope>test</scope>
+    </dependency>
 
-    <!-- logging -->   
+    <!-- logging -->
     <dependency>
       <groupId>org.apache.logging.log4j</groupId>
       <artifactId>log4j-api</artifactId>
diff --git a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/IntegrationTest.java b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/IntegrationTest.java
deleted file mode 100644
index 7f525ba..0000000
--- a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/IntegrationTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * 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.pgevent;
-
-import com.impossibl.postgres.jdbc.PGDataSource;
-import org.apache.camel.Exchange;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.main.Main;
-import org.junit.Before;
-import org.junit.Test;
-
-public class IntegrationTest {
-
-    private String host;
-    private String port;
-    private String database;
-    private String user;
-    private String password;
-
-    private Main main;
-
-    private PGDataSource ds;
-
-    @Before
-    public void setUp() throws Exception {
-        this.host = System.getProperty("pgjdbc.test.server", "localhost");
-        this.port = System.getProperty("pgjdbc.test.port", "5432");
-        this.database = System.getProperty("pgjdbc.test.db", "event_tests");
-        this.user = System.getProperty("pgjdbc.test.user", "dphillips");
-        this.password = System.getProperty("pgjdbc.test.password");
-
-        ds = new PGDataSource();
-        ds.setHost(this.host);
-        ds.setPort(Integer.parseInt(this.port));
-        ds.setDatabase(this.database);
-        ds.setUser(this.user);
-        if (this.password != null) {
-            ds.setPassword(this.password);
-        }
-
-        main = new Main();
-        main.bind("test", ds);
-        main.addRouteBuilder(buildConsumer());
-        main.addRouteBuilder(buildProducer());
-    }
-
-    RouteBuilder buildConsumer() {
-        RouteBuilder builder = new RouteBuilder() {
-
-            @Override
-            public void configure() throws Exception {
-                fromF("pgevent://%s:%s/%s/testchannel?user=%s&pass=%s", host, port, database, user, password)
-                    .to("log:org.apache.camel.pgevent.PgEventConsumer?level=DEBUG");
-            }
-        };
-
-        return builder;
-    }
-
-    RouteBuilder buildProducer() {
-        RouteBuilder builder = new RouteBuilder() {
-
-            @Override
-            public void configure() throws Exception {
-                from("timer://test?fixedRate=true&period=5000")
-                    .setBody(header(Exchange.TIMER_FIRED_TIME))
-                    .toF("pgevent://%s:%s/%s/testchannel?user=%s&pass=%s", host, port, database, user, password);
-            }
-        };
-
-        return builder;
-    }
-
-    @Test
-    public void waitHere() throws Exception {
-        main.run();
-    }
-}
diff --git a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/PgEventConsumerTest.java b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/PgEventConsumerTest.java
new file mode 100644
index 0000000..f8e8912
--- /dev/null
+++ b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/PgEventConsumerTest.java
@@ -0,0 +1,102 @@
+/**
+ * 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.pgevent;
+
+import java.sql.PreparedStatement;
+
+import com.impossibl.postgres.api.jdbc.PGConnection;
+import com.impossibl.postgres.jdbc.PGDataSource;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.Processor;
+import org.apache.camel.component.pgevent.PgEventConsumer;
+import org.apache.camel.component.pgevent.PgEventEndpoint;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class PgEventConsumerTest {
+
+    @Test
+    public void testPgEventConsumerStart() throws Exception {
+        PGDataSource dataSource = mock(PGDataSource.class);
+        PGConnection connection = mock(PGConnection.class);
+        PreparedStatement statement = mock(PreparedStatement.class);
+        PgEventEndpoint endpoint = mock(PgEventEndpoint.class);
+        Processor processor = mock(Processor.class);
+
+        when(endpoint.getDatasource()).thenReturn(dataSource);
+        when(endpoint.initJdbc()).thenReturn(connection);
+        when(connection.prepareStatement("LISTEN camel")).thenReturn(statement);
+        when(endpoint.getChannel()).thenReturn("camel");
+
+        PgEventConsumer consumer = new PgEventConsumer(endpoint, processor);
+        consumer.start();
+
+        verify(connection).addNotificationListener("camel", "camel", consumer);
+        assertTrue(consumer.isStarted());
+    }
+
+    @Test
+    public void testPgEventConsumerStop() throws Exception {
+        PGDataSource dataSource = mock(PGDataSource.class);
+        PGConnection connection = mock(PGConnection.class);
+        PreparedStatement statement = mock(PreparedStatement.class);
+        PgEventEndpoint endpoint = mock(PgEventEndpoint.class);
+        Processor processor = mock(Processor.class);
+
+        when(endpoint.getDatasource()).thenReturn(dataSource);
+        when(endpoint.initJdbc()).thenReturn(connection);
+        when(connection.prepareStatement("LISTEN camel")).thenReturn(statement);
+        when(endpoint.getChannel()).thenReturn("camel");
+        when(connection.prepareStatement("UNLISTEN camel")).thenReturn(statement);
+
+        PgEventConsumer consumer = new PgEventConsumer(endpoint, processor);
+        consumer.start();
+        consumer.stop();
+
+        verify(connection).removeNotificationListener("camel");
+        verify(connection).close();
+        assertTrue(consumer.isStopped());
+    }
+
+    @Test
+    public void testPgEventNotification() throws Exception {
+        PgEventEndpoint endpoint = mock(PgEventEndpoint.class);
+        Processor processor = mock(Processor.class);
+        Exchange exchange = mock(Exchange.class);
+        Message message = mock(Message.class);
+
+        when(endpoint.createExchange()).thenReturn(exchange);
+        when(exchange.getIn()).thenReturn(message);
+
+        PgEventConsumer consumer = new PgEventConsumer(endpoint, processor);
+        consumer.notification(1, "camel", "some event");
+
+        verify(message).setHeader("channel", "camel");
+        verify(message).setBody("some event");
+        verify(processor).process(exchange);
+    }
+
+}
diff --git a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/PgEventProducerTest.java b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/PgEventProducerTest.java
new file mode 100644
index 0000000..a2904bb
--- /dev/null
+++ b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/PgEventProducerTest.java
@@ -0,0 +1,142 @@
+/**
+ * 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.pgevent;
+
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+import com.impossibl.postgres.api.jdbc.PGConnection;
+import com.impossibl.postgres.jdbc.PGDataSource;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.component.pgevent.InvalidStateException;
+import org.apache.camel.component.pgevent.PgEventEndpoint;
+import org.apache.camel.component.pgevent.PgEventProducer;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class PgEventProducerTest {
+
+    private PgEventEndpoint endpoint = mock(PgEventEndpoint.class);
+    private PGDataSource dataSource = mock(PGDataSource.class);
+    private PGConnection connection = mock(PGConnection.class);
+    private PreparedStatement statement = mock(PreparedStatement.class);
+    private Exchange exchange = mock(Exchange.class);
+    private Message message = mock(Message.class);
+
+    @Test
+    public void testPgEventProducerStart() throws Exception {
+        when(endpoint.getDatasource()).thenReturn(dataSource);
+        when(endpoint.initJdbc()).thenReturn(connection);
+
+        PgEventProducer producer = new PgEventProducer(endpoint);
+        producer.start();
+
+        assertTrue(producer.isStarted());
+    }
+
+    @Test
+    public void testPgEventProducerStop() throws Exception {
+        when(endpoint.getDatasource()).thenReturn(dataSource);
+        when(endpoint.initJdbc()).thenReturn(connection);
+
+        PgEventProducer producer = new PgEventProducer(endpoint);
+        producer.start();
+        producer.stop();
+
+        verify(connection).close();
+        assertTrue(producer.isStopped());
+    }
+
+    @Test(expected = InvalidStateException.class)
+    public void testPgEventProducerProcessDbThrowsInvalidStateException() throws Exception {
+        when(endpoint.getDatasource()).thenReturn(dataSource);
+        when(endpoint.initJdbc()).thenReturn(connection);
+        when(connection.isClosed()).thenThrow(new SQLException("DB problem occurred"));
+
+        PgEventProducer producer = new PgEventProducer(endpoint);
+        producer.start();
+        producer.process(exchange);
+    }
+
+    @Test
+    public void testPgEventProducerProcessDbConnectionClosed() throws Exception {
+        PGConnection connectionNew = mock(PGConnection.class);
+
+        when(endpoint.getDatasource()).thenReturn(dataSource);
+        when(endpoint.initJdbc()).thenReturn(connection, connectionNew);
+        when(connection.isClosed()).thenReturn(true);
+        when(exchange.getIn()).thenReturn(message);
+        when(message.getBody(String.class)).thenReturn("pgevent");
+        when(endpoint.getChannel()).thenReturn("camel");
+        when(connectionNew.prepareStatement("NOTIFY camel, 'pgevent'")).thenReturn(statement);
+
+        PgEventProducer producer = new PgEventProducer(endpoint);
+        producer.start();
+        producer.process(exchange);
+
+        verify(statement).execute();
+    }
+
+    @Test
+    public void testPgEventProducerProcessServerMinimumVersionMatched() throws Exception {
+        CallableStatement statement = mock(CallableStatement.class);
+
+        when(endpoint.getDatasource()).thenReturn(dataSource);
+        when(connection.isClosed()).thenReturn(false);
+        when(endpoint.initJdbc()).thenReturn(connection);
+        when(exchange.getIn()).thenReturn(message);
+        when(message.getBody(String.class)).thenReturn("pgevent");
+        when(endpoint.getChannel()).thenReturn("camel");
+        when(connection.isServerMinimumVersion(9, 0)).thenReturn(true);
+        when(connection.prepareCall(Mockito.anyString())).thenReturn(statement);
+
+        PgEventProducer producer = new PgEventProducer(endpoint);
+        producer.start();
+        producer.process(exchange);
+
+        verify(statement).execute();
+    }
+
+    @Test
+    public void testPgEventProducerProcessServerMinimumVersionNotMatched() throws Exception {
+        when(endpoint.getDatasource()).thenReturn(dataSource);
+        when(connection.isClosed()).thenReturn(false);
+        when(endpoint.initJdbc()).thenReturn(connection);
+        when(exchange.getIn()).thenReturn(message);
+        when(message.getBody(String.class)).thenReturn("pgevent");
+        when(endpoint.getChannel()).thenReturn("camel");
+        when(connection.isServerMinimumVersion(9, 0)).thenReturn(false);
+        when(connection.prepareStatement("NOTIFY camel, 'pgevent'")).thenReturn(statement);
+
+        PgEventProducer producer = new PgEventProducer(endpoint);
+        producer.start();
+        producer.process(exchange);
+
+        verify(statement).execute();
+    }
+}
diff --git a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/AbstractPgEventIntegrationTest.java b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/AbstractPgEventIntegrationTest.java
new file mode 100644
index 0000000..9319da8
--- /dev/null
+++ b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/AbstractPgEventIntegrationTest.java
@@ -0,0 +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.pgevent.integration;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.properties.PropertiesComponent;
+import org.apache.camel.test.junit4.CamelTestSupport;
+
+public class AbstractPgEventIntegrationTest extends CamelTestSupport {
+
+    protected static final String TEST_MESSAGE_BODY = "Test Camel PGEvent";
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext camelContext = super.createCamelContext();
+        PropertiesComponent component = new PropertiesComponent("classpath:/test-options.properties");
+        camelContext.addComponent("properties", component);
+        return camelContext;
+    }
+}
diff --git a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventPubSubIntegrationTest.java b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventPubSubIntegrationTest.java
new file mode 100644
index 0000000..deac01b
--- /dev/null
+++ b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventPubSubIntegrationTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.pgevent.integration;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
+
+public class PgEventPubSubIntegrationTest extends AbstractPgEventIntegrationTest {
+
+    @EndpointInject(uri = "pgevent://{{host}}:{{port}}/{{database}}/testchannel?user={{userName}}&pass={{password}}")
+    private Endpoint subscribeEndpoint;
+
+    @EndpointInject(uri = "pgevent://{{host}}:{{port}}/{{database}}/testchannel?user={{userName}}&pass={{password}}")
+    private Endpoint notifyEndpoint;
+
+    @EndpointInject(uri = "timer://test?repeatCount=1&period=1")
+    private Endpoint timerEndpoint;
+
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint mockEndpoint;
+
+    @Test
+    public void testPgEventPublishSubscribe() throws Exception {
+        mockEndpoint.expectedBodiesReceived(TEST_MESSAGE_BODY);
+        mockEndpoint.assertIsSatisfied(5000);
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(timerEndpoint)
+                    .setBody(constant(TEST_MESSAGE_BODY))
+                    .to(notifyEndpoint);
+
+                from(subscribeEndpoint)
+                    .to(mockEndpoint);
+            }
+        };
+    }
+}
diff --git a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventWithDefinedDatasourceIntegrationTest.java b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventWithDefinedDatasourceIntegrationTest.java
new file mode 100644
index 0000000..e63884f
--- /dev/null
+++ b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventWithDefinedDatasourceIntegrationTest.java
@@ -0,0 +1,83 @@
+/**
+ * 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.pgevent.integration;
+
+import java.util.Properties;
+
+import com.impossibl.postgres.jdbc.PGDataSource;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+import org.junit.Test;
+
+public class PgEventWithDefinedDatasourceIntegrationTest extends AbstractPgEventIntegrationTest {
+
+    @EndpointInject(uri = "pgevent:///{{database}}/testchannel?datasource=#pgDataSource")
+    private Endpoint subscribeEndpoint;
+
+    @EndpointInject(uri = "pgevent:///{{database}}/testchannel?datasource=#pgDataSource")
+    private Endpoint notifyEndpoint;
+
+    @EndpointInject(uri = "timer://test?repeatCount=1&period=1")
+    private Endpoint timerEndpoint;
+
+    @EndpointInject(uri = "mock:result")
+    private MockEndpoint mockEndpoint;
+
+    @Override
+    protected JndiRegistry createRegistry() throws Exception {
+        Properties properties = new Properties();
+        properties.load(getClass().getResourceAsStream("/test-options.properties"));
+
+        PGDataSource dataSource = new PGDataSource();
+        dataSource.setHost(properties.getProperty("host"));
+        dataSource.setPort(Integer.parseInt(properties.getProperty("port")));
+        dataSource.setDatabase(properties.getProperty("database"));
+        dataSource.setUser(properties.getProperty("userName"));
+        dataSource.setPassword(properties.getProperty("password"));
+
+        JndiRegistry registry = super.createRegistry();
+        registry.bind("pgDataSource", dataSource);
+
+        return registry;
+    }
+
+    @Test
+    public void testPgEventPublishSubscribeWithDefinedDatasource() throws Exception {
+        mockEndpoint.expectedBodiesReceived(TEST_MESSAGE_BODY);
+        mockEndpoint.assertIsSatisfied(5000);
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from(timerEndpoint)
+                    .setBody(constant(TEST_MESSAGE_BODY))
+                    .to(notifyEndpoint);
+
+                from(subscribeEndpoint)
+                    .to(mockEndpoint);
+            }
+        };
+    }
+}
diff --git a/components/camel-pgevent/src/test/resources/test-options.properties b/components/camel-pgevent/src/test/resources/test-options.properties
new file mode 100644
index 0000000..08ff2c4
--- /dev/null
+++ b/components/camel-pgevent/src/test/resources/test-options.properties
@@ -0,0 +1,37 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# Change the following properties to work with your PostgreSQL instance.
+
+# The default values work with the PostgreSQL docker image https://hub.docker.com/_/postgres/.
+
+# docker run -ti --rm -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 postgres
+
+# The host where PostgreSQL is running
+host=localhost
+
+# The port that PostgreSQL is bound to
+port=5432
+
+# The user name used for connecting to PostgreSQL
+userName=postgres
+
+# The password used for connecting to PostgreSQL
+password=mysecretpassword
+
+# The name of the database to use during integration testing
+database=postgres

-- 
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <co...@camel.apache.org>'].