-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting to test and debug the component.
- Loading branch information
1 parent
81a62af
commit 435dd0a
Showing
6 changed files
with
152 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<!-- | ||
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. | ||
--> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.apache.camel</groupId> | ||
|
@@ -10,6 +25,11 @@ | |
|
||
<name>Camel PgEvent Component</name> | ||
<url>http://www.zanclus.com/</url> | ||
<inceptionYear>2014</inceptionYear> | ||
<organization> | ||
<name>Apache Software Foundation</name> | ||
<url>http://www.apache.org/</url> | ||
</organization> | ||
<description> | ||
A Camel component capable of sending/receiving notifications | ||
in PostgreSQL version 8.3 and higher via the use of the pgjdbc-ng | ||
|
@@ -73,8 +93,8 @@ | |
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.5.1</version> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
</configuration> | ||
</plugin> | ||
|
||
|
@@ -104,4 +124,24 @@ | |
</plugins> | ||
</build> | ||
|
||
<scm> | ||
<url>https://github.com/InfoSec812/pgevent.git</url> | ||
<connection>scm:git:[email protected]:InfoSec812/pgevent.git</connection> | ||
<developerConnection>scm:git:[email protected]:InfoSec812/pgevent.git</developerConnection> | ||
</scm> | ||
|
||
<developers> | ||
<developer> | ||
<id>dphillips</id> | ||
<name>Deven Phillips</name> | ||
</developer> | ||
</developers> | ||
<licenses> | ||
<license> | ||
<name>Apache License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
<comments>A business-friendly OSS license</comments> | ||
</license> | ||
</licenses> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
src/test/java/org/apache/camel/pgevent/IntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Copyright 2014 Apache Software Foundation. | ||
* | ||
* Licensed 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 javax.sql.DataSource; | ||
import org.apache.camel.CamelContext; | ||
import org.apache.camel.builder.RouteBuilder; | ||
import org.apache.camel.component.log.LogComponent; | ||
import org.apache.camel.component.timer.TimerComponent; | ||
import org.apache.camel.impl.DefaultCamelContext; | ||
import org.apache.camel.impl.SimpleRegistry; | ||
import org.apache.camel.main.Main; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
/** | ||
* | ||
* @author dphillips | ||
*/ | ||
public class IntegrationTest { | ||
|
||
private Main main; | ||
|
||
private PGDataSource ds; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
ds = new PGDataSource(); | ||
ds.setHost(System.getProperty("pgjdbc.test.server", "localhost")); | ||
ds.setPort(Integer.parseInt(System.getProperty("pgjdbc.test.port", "5432"))); | ||
ds.setDatabase(System.getProperty("pgjdbc.test.db", "event_tests")); | ||
ds.setUser(System.getProperty("pgjdbc.test.user", "dphillips")); | ||
|
||
main = new Main(); | ||
main.bind("pgevent", new PgEventComponent(PgEventEndpoint.class)); | ||
main.bind("log", new LogComponent()); | ||
main.bind("timer", new TimerComponent()); | ||
main.enableHangupSupport(); | ||
main.bind("test", ds); | ||
main.addRouteBuilder(buildConsumer()); | ||
main.addRouteBuilder(buildProducer()); | ||
} | ||
|
||
RouteBuilder buildConsumer() { | ||
RouteBuilder builder = new RouteBuilder() { | ||
|
||
@Override | ||
public void configure() throws Exception { | ||
from("pgevent://127.0.0.1:5432/event_tests/testchannel?user=dphillips") | ||
.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") | ||
.to("pgevent://127.0.0.1:5432/event_tests/testchannel?user=dphillips"); | ||
} | ||
}; | ||
|
||
return builder; | ||
} | ||
|
||
@Test | ||
public void waitHere() throws Exception { | ||
main.run(); | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
src/test/java/org/apache/camel/pgevent/PgEventComponentTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters