You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2018/05/24 14:53:43 UTC
[incubator-plc4x] branch master updated (3afbc02 -> f50b046)
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git.
from 3afbc02 added initial consumer(subscription support) for apache camel
new 0c84555 ignore optional parameters
new f50b046 added a manual test for apache camel
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
integrations/apache-camel/pom.xml | 6 ++
.../java/org/apache/plc4x/camel/ManualTest.java | 87 ++++++++++++++++++++++
.../org/apache/plc4x/java/ads/AdsPlcDriver.java | 2 +-
3 files changed, 94 insertions(+), 1 deletion(-)
create mode 100644 integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ManualTest.java
--
To stop receiving notification emails like this one, please contact
sruehl@apache.org.
[incubator-plc4x] 01/02: ignore optional parameters
Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit 0c845552a009b4d54abe51b0b9a288e1c15be318
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu May 24 16:53:21 2018 +0200
ignore optional parameters
---
.../ads/src/main/java/org/apache/plc4x/java/ads/AdsPlcDriver.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/AdsPlcDriver.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/AdsPlcDriver.java
index 28af628..2e6b3bf 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/AdsPlcDriver.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/AdsPlcDriver.java
@@ -47,7 +47,7 @@ public class AdsPlcDriver implements PlcDriver {
+ ")?");
public static final Pattern INET_ADDRESS_PATTERN = Pattern.compile("tcp://(?<host>[\\w.]+)(:(?<port>\\d*))?");
public static final Pattern SERIAL_PATTERN = Pattern.compile("serial://(?<serialDefinition>.*)");
- public static final Pattern ADS_URI_PATTERN = Pattern.compile("^ads:(" + INET_ADDRESS_PATTERN + "|" + SERIAL_PATTERN + ")/" + ADS_ADDRESS_PATTERN);
+ public static final Pattern ADS_URI_PATTERN = Pattern.compile("^ads:(" + INET_ADDRESS_PATTERN + "|" + SERIAL_PATTERN + ")/" + ADS_ADDRESS_PATTERN + "(\\?.*)?");
private AdsConnectionFactory adsConnectionFactory;
--
To stop receiving notification emails like this one, please contact
sruehl@apache.org.
[incubator-plc4x] 02/02: added a manual test for apache camel
Posted by sr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit f50b046a10993ccb828bf1edc7173f4d3e6cae6c
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu May 24 16:53:39 2018 +0200
added a manual test for apache camel
---
integrations/apache-camel/pom.xml | 6 ++
.../java/org/apache/plc4x/camel/ManualTest.java | 87 ++++++++++++++++++++++
2 files changed, 93 insertions(+)
diff --git a/integrations/apache-camel/pom.xml b/integrations/apache-camel/pom.xml
index 4702340..792b059 100644
--- a/integrations/apache-camel/pom.xml
+++ b/integrations/apache-camel/pom.xml
@@ -87,6 +87,12 @@
<version>${camel.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.plc4x</groupId>
+ <artifactId>plc4j-protocol-ads</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<dependencyManagement>
diff --git a/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ManualTest.java b/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ManualTest.java
new file mode 100644
index 0000000..1ded42a
--- /dev/null
+++ b/integrations/apache-camel/src/test/java/org/apache/plc4x/camel/ManualTest.java
@@ -0,0 +1,87 @@
+/*
+ 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.plc4x.camel;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.main.Main;
+import org.apache.camel.main.MainListenerSupport;
+import org.apache.camel.main.MainSupport;
+
+import java.util.Date;
+
+public class ManualTest {
+
+ private Main main;
+
+ public static void main(String[] args) throws Exception {
+ ManualTest example = new ManualTest();
+ example.boot();
+ }
+
+ public void boot() throws Exception {
+ // create a Main instance
+ main = new Main();
+ // bind MyBean into the registry
+ main.bind("foo", new MyBean());
+ // add routes
+ main.addRouteBuilder(new MyRouteBuilder());
+ // add event listener
+ main.addMainListener(new Events());
+ // set the properties from a file
+ main.setPropertyPlaceholderLocations("example.properties");
+ // run until you terminate the JVM
+ System.out.println("Starting Camel. Use ctrl + c to terminate the JVM.\n");
+ main.run();
+ }
+
+ private static class MyRouteBuilder extends RouteBuilder {
+ @Override
+ public void configure() {
+ from("plc4x:ads:tcp://10.10.64.40/10.10.64.40.1.1:851/10.10.56.23.1.1:30000?dataType=java.lang.Integer&address=Allgemein_S2.Station")
+ .process(new Processor() {
+ public void process(Exchange exchange) {
+ System.out.println("Invoked timer at " + new Date());
+ }
+ })
+ .bean("foo")
+ .log("Received ${body}");
+ }
+ }
+
+ public static class MyBean {
+ public void callMe() {
+ System.out.println("MyBean.callMe method has been called");
+ }
+ }
+
+ public static class Events extends MainListenerSupport {
+
+ @Override
+ public void afterStart(MainSupport main) {
+ System.out.println("MainExample with Camel is now started!");
+ }
+
+ @Override
+ public void beforeStop(MainSupport main) {
+ System.out.println("MainExample with Camel is now being stopped!");
+ }
+ }
+}
--
To stop receiving notification emails like this one, please contact
sruehl@apache.org.