You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jf...@apache.org on 2019/10/20 13:52:35 UTC

[plc4x] branch feature/resolve-split-package-osgi updated (95c37c0 -> ecc5def)

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

jfeinauer pushed a change to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git.


 discard 95c37c0  - Configured the test to work with failsafe instead of surefire - Cleaned up the maven config
 discard 317c088  Merge remote-tracking branch 'jfeinauer/feature/resolve-split-package-osgi' into feature/resolve-split-package-osgi
 discard f127594  Fixed review comment, removed unused file.
 discard 482875e  [Karaf] Fixed bug in feature.xml.
 discard 41709bb  [Karaf] Removed "old" module in integartions.
 discard 6f22f31  [Karaf] Removed "old" module in integartions.C
 discard 3b41e54  [Karaf] Improved maven config for IT, added readme.
 discard 296efd2  Merge remote-tracking branch 'jfeinauer/feature/resolve-split-package-osgi' into feature/resolve-split-package-osgi
 discard a14fe10  [OSGi] Refactoring.
 discard 47919d5  [OSGi] Finally, integration test is running.
 discard aeaf07f  [OSGi] Tests not running yet.
 discard 1f55774  [OSGi] Added initial Implementation of a Exam Test.
 discard ac8b7e8  [OSGi] Refactoring.
 discard 21fa91d  [OSGi] Finally, integration test is running.
 discard 21b4b48  [OSGi] Tests not running yet.
    omit 6cfcff1  Merge branch 'feature/resolve-split-package-osgi' of https://github.com/JulianFeinauer/incubator-plc4x into feature/resolve-split-package-osgi
    omit 87d9743  [OSGi] Added initial Implementation of a Exam Test.
 discard 0d73e80  - Added the OSGI Annotation to all remaining drivers - Added a missing OPCUA feature - Added the OPCUA feature to the demo-server
 discard ea5d70c  - Removed the XSL again as it seems that it should also work without.
    omit 8318004  - Added some more documentation on the plugin execution - Split up one execution of two goals into two separate ones - Added a transformation that injects the "<feature>scr</feature>" into the gerated feature.xml
    omit 526e56b  - Excluded the slf4j-api module from all karaf modules
    omit 9aac40d  [OSGi] Added version replacement to feature.xml.
    omit 7aff272  [OSGi] Added feature for S7 Driver.
    omit d2455ee  [OSGi] Fixed Component Annotation.
    omit 11bef85  [OSGi] Fixing changed package names.
    omit a964b60  [OSGi] Fixing changed package names.
    omit 7c6fa73  [OSGi] Fixing changed package names.
    omit 6d422a8  [OSGi] Resolved all split package situations.
     add 01cf62b  - WORD and DWORD data types added to AB-ETH - Short doc for AB-ETH PLC users
     add 8253fbd  Negative 4 byte DWORD added
     add ab973c1  Reverted POM changes
     add 0071c2b  Merge pull request #86 from vemmert/AB-ETH-data-types-and-doc
     add 9cf1925  Migrate README to Github flavored markdown page
     add 5b6e773  Merge pull request #88 from dominikriemer/develop
     new 66d3c86  [OSGi] Resolved all split package situations.
     new e53fb11  [OSGi] Fixing changed package names.
     new 63d8993  [OSGi] Fixing changed package names.
     new 57cda2f  [OSGi] Fixing changed package names.
     new 74ebb95  [OSGi] Fixed Component Annotation.
     new 64010d0  [OSGi] Added feature for S7 Driver.
     new 23165c0  [OSGi] Added version replacement to feature.xml.
     new f958e17  - Excluded the slf4j-api module from all karaf modules
     new 6389e9a  [OSGi] Added initial Implementation of a Exam Test.
     new e41822a  - Added some more documentation on the plugin execution - Split up one execution of two goals into two separate ones - Added a transformation that injects the "<feature>scr</feature>" into the gerated feature.xml
     new ed195bd  [OSGi] Tests not running yet.
     new d070b9c  [OSGi] Finally, integration test is running.
     new b289fb9  [OSGi] Refactoring.
     new 6d4b467  - Removed the XSL again as it seems that it should also work without.
     new 0207eb5  - Added the OSGI Annotation to all remaining drivers - Added a missing OPCUA feature - Added the OPCUA feature to the demo-server
     new 68476f4  [OSGi] Added initial Implementation of a Exam Test.
     new 8ea7ea0  [OSGi] Tests not running yet.
     new b76c41e  [OSGi] Finally, integration test is running.
     new a6edd44  [OSGi] Refactoring.
     new 451f0d5  [Karaf] Improved maven config for IT, added readme.
     new f294e17  [Karaf] Removed "old" module in integartions.C
     new 0fe46ca  [Karaf] Removed "old" module in integartions.
     new 528d041  [Karaf] Fixed bug in feature.xml.
     new d6af5c7  Fixed review comment, removed unused file.
     new ecc5def  - Configured the test to work with failsafe instead of surefire - Cleaned up the maven config

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (95c37c0)
            \
             N -- N -- N   refs/heads/feature/resolve-split-package-osgi (ecc5def)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 25 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:
 README => README.md                                | 191 +++++++++++++++------
 .../apache/plc4x/java/abeth/model/AbEthField.java  |  17 +-
 .../plc4x/java/abeth/model/types/FileType.java     |   4 +-
 .../java/abeth/protocol/Plc4xAbEthProtocol.java    |  25 ++-
 .../protocols/{ethernet-ip => ab-eth}/index.adoc   |  17 +-
 src/site/asciidoc/protocols/index.adoc             |   1 +
 6 files changed, 195 insertions(+), 60 deletions(-)
 rename README => README.md (52%)
 copy src/site/asciidoc/protocols/{ethernet-ip => ab-eth}/index.adoc (50%)


[plc4x] 09/25: [OSGi] Added initial Implementation of a Exam Test.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 6389e9a41d0ce43dbf3228ccd44ae3e3b1ead8fc
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Tue Oct 15 21:35:46 2019 +0200

    [OSGi] Added initial Implementation of a Exam Test.
---
 plc4j/karaf-features/karaf-itest/pom.xml           | 142 +++++++++++++++++++++
 .../java/org/apache/plc4x/karaf/FeatureITest.java  | 131 +++++++++++++++++++
 .../karaf-itest/src/test/resources/exam.properties |   1 +
 plc4j/karaf-features/pom.xml                       |   1 +
 plc4j/karaf-features/s7/pom.xml                    |  99 ++++++++++++++
 .../karaf-features/s7/src/main/feature/feature.xml |   2 +-
 .../java/org/apache/plc4x/karaf/FeatureTest.java   |  91 +++++++++++++
 7 files changed, 466 insertions(+), 1 deletion(-)

diff --git a/plc4j/karaf-features/karaf-itest/pom.xml b/plc4j/karaf-features/karaf-itest/pom.xml
new file mode 100644
index 0000000..9d4e3f5
--- /dev/null
+++ b/plc4j/karaf-features/karaf-itest/pom.xml
@@ -0,0 +1,142 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>karaf-features</artifactId>
+    <groupId>org.apache.plc4x</groupId>
+    <version>0.5.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>karaf-itest</artifactId>
+
+  <properties>
+    <dependency.karaf.version>4.2.1</dependency.karaf.version>
+    <pax.version>4.13.1</pax.version>
+  </properties>
+
+  <dependencies>
+<!--    &lt;!&ndash; S7 Driver for Build &ndash;&gt;-->
+<!--    <dependency>-->
+<!--      <groupId>org.apache.plc4x</groupId>-->
+<!--      <artifactId>driver-s7-feature</artifactId>-->
+<!--      <version>0.5.0-SNAPSHOT</version>-->
+<!--      <scope>test</scope>-->
+<!--    </dependency>-->
+
+    <!-- Pax Exam Test setup -->
+    <dependency>
+      <groupId>org.ops4j.pax.exam.samples</groupId>
+      <artifactId>pax-exam-sample8-ds</artifactId>
+      <version>${pax.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>standard</artifactId>
+      <version>${dependency.karaf.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <!-- Dependencies for pax exam karaf container -->
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-container-karaf</artifactId>
+      <version>${pax.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-junit4</artifactId>
+      <version>${pax.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam</artifactId>
+      <version>${pax.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.url</groupId>
+      <artifactId>pax-url-aether</artifactId>
+      <version>2.6.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-api</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>org.apache.karaf.features.core</artifactId>
+      <version>${dependency.karaf.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.bundle</groupId>
+      <artifactId>org.apache.karaf.bundle.core</artifactId>
+      <version>${dependency.karaf.version}</version>
+      <scope>test</scope>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <!-- Needed if you use versionAsInProject() -->
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>depends-maven-plugin</artifactId>
+        <version>1.4.0</version>
+        <executions>
+          <execution>
+            <id>generate-depends-file</id>
+            <goals>
+              <goal>generate-depends-file</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemPropertyVariables>
+            <pax.exam.karaf.version>${dependency.karaf.version}</pax.exam.karaf.version>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
\ No newline at end of file
diff --git a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
new file mode 100644
index 0000000..1efc1db
--- /dev/null
+++ b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
@@ -0,0 +1,131 @@
+/*
+ * 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.plc4x.karaf;
+
+import org.apache.karaf.bundle.core.BundleService;
+import org.apache.karaf.features.FeaturesService;
+import org.apache.plc4x.java.spi.PlcDriver;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.ConfigurationManager;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.io.File;
+import java.util.Arrays;
+import java.util.Optional;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+
+@RunWith(PaxExam.class)
+public class FeatureITest {
+
+    private static Logger LOG = LoggerFactory.getLogger(FeatureITest.class);
+
+    @Inject
+    private FeaturesService featuresService;
+
+    @Inject
+    private BundleContext bundleContext;
+
+    @Configuration
+    public Option[] config() {
+        MavenArtifactUrlReference karafUrl = maven()
+            .groupId("org.apache.karaf")
+            .artifactId("apache-karaf")
+            .version(karafVersion())
+            .type("zip");
+
+        MavenUrlReference karafStandardRepo = maven()
+            .groupId("org.apache.karaf.features")
+            .artifactId("standard")
+            .version(karafVersion())
+            .classifier("features")
+            .type("xml");
+
+        final MavenArtifactUrlReference plc4xRepo = maven()
+            .groupId("org.apache.plc4x")
+            .artifactId("driver-s7-feature")
+            .version("0.5.0-SNAPSHOT")
+            .classifier("features")
+            .type("xml");
+        return new Option[] {
+            // KarafDistributionOption.debugConfiguration("5005", true),
+            karafDistributionConfiguration()
+                .frameworkUrl(karafUrl)
+                .unpackDirectory(new File("target", "exam"))
+                .useDeployFolder(false),
+            keepRuntimeFolder(),
+            configureConsole().ignoreLocalConsole(),
+            features(karafStandardRepo , "scr"),
+            features(plc4xRepo, "driver-s7-feature"),
+            mavenBundle()
+                .groupId("org.apache.plc4x")
+                .artifactId("plc4j-driver-s7")
+                .version("0.5.0-SNAPSHOT")
+                .start()
+        };
+    }
+
+    public static String karafVersion() {
+        ConfigurationManager cm = new ConfigurationManager();
+        String karafVersion = cm.getProperty("pax.exam.karaf.version", "3.0.0");
+        return karafVersion;
+    }
+
+
+    @Test
+    public void checkFeatureInstalled() throws Exception {
+        assertTrue(
+            featuresService.isInstalled(featuresService.getFeature("driver-s7-feature"))
+        );
+    }
+
+    @Test
+    public void checkBundleStarted() throws Exception {
+        for (Bundle bundle : bundleContext.getBundles()) {
+            System.out.println(bundle.getSymbolicName());
+        }
+
+        // Try to find the bundle
+        final Optional<Bundle> optionalBundle = Arrays.stream(bundleContext.getBundles())
+            .filter(bundle -> "org.apache.plc4x.plc4j-driver-s7".equals(bundle.getSymbolicName()))
+            .findFirst();
+
+        // Ensure that the bundle is resolved
+        assertTrue(optionalBundle.isPresent());
+
+        // Check if the bundle is active
+        assertEquals(Bundle.ACTIVE, optionalBundle.get().getState());
+    }
+
+}
diff --git a/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties b/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties
new file mode 100644
index 0000000..db2c7db
--- /dev/null
+++ b/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties
@@ -0,0 +1 @@
+pax.exam.karaf.version = 4.2.1
\ No newline at end of file
diff --git a/plc4j/karaf-features/pom.xml b/plc4j/karaf-features/pom.xml
index 76ab877..1400fd1 100644
--- a/plc4j/karaf-features/pom.xml
+++ b/plc4j/karaf-features/pom.xml
@@ -33,6 +33,7 @@
 
   <modules>
     <module>s7</module>
+    <module>karaf-itest</module>
   </modules>
 
   <build>
diff --git a/plc4j/karaf-features/s7/pom.xml b/plc4j/karaf-features/s7/pom.xml
index 36043d4..472b868 100644
--- a/plc4j/karaf-features/s7/pom.xml
+++ b/plc4j/karaf-features/s7/pom.xml
@@ -30,6 +30,105 @@
   <artifactId>driver-s7-feature</artifactId>
   <packaging>feature</packaging>
 
+  <dependencies>
+    <dependency>
+      <groupId>org.ops4j.pax.exam.samples</groupId>
+      <artifactId>pax-exam-sample8-ds</artifactId>
+      <version>4.13.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>standard</artifactId>
+      <version>4.2.1</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-container-karaf</artifactId>
+      <version>4.13.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-junit4</artifactId>
+      <version>4.13.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam</artifactId>
+      <version>4.13.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.url</groupId>
+      <artifactId>pax-url-aether</artifactId>
+      <version>1.6.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.11</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <!-- -->
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-api</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <!-- Needed if you use versionAsInProject() -->
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>depends-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <id>generate-depends-file</id>
+            <goals>
+              <goal>generate-depends-file</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemPropertyVariables>
+            <pax.exam.karaf.version>4.2.1</pax.exam.karaf.version>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
   <!-- This would be necessary with the kar goal which works not fine, yet -->
 <!--  <dependencies>-->
 <!--    <dependency>-->
diff --git a/plc4j/karaf-features/s7/src/main/feature/feature.xml b/plc4j/karaf-features/s7/src/main/feature/feature.xml
index 6bf41bb..aebf22a 100644
--- a/plc4j/karaf-features/s7/src/main/feature/feature.xml
+++ b/plc4j/karaf-features/s7/src/main/feature/feature.xml
@@ -24,7 +24,7 @@
     </details>
     <feature prerequisite="true" dependency="false">wrap</feature>
     <feature>scr</feature>
-    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.5.0-SNAPSHOT</bundle>
+<!--    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.5.0-SNAPSHOT</bundle>-->
     <bundle>mvn:org.apache.plc4x/plc4j-api/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-on-tcp/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-tp/0.5.0-SNAPSHOT</bundle>
diff --git a/plc4j/karaf-features/s7/src/test/java/org/apache/plc4x/karaf/FeatureTest.java b/plc4j/karaf-features/s7/src/test/java/org/apache/plc4x/karaf/FeatureTest.java
new file mode 100644
index 0000000..eb74608
--- /dev/null
+++ b/plc4j/karaf-features/s7/src/test/java/org/apache/plc4x/karaf/FeatureTest.java
@@ -0,0 +1,91 @@
+/*
+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.karaf;
+
+import org.apache.plc4x.java.spi.PlcDriver;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+
+import javax.inject.Inject;
+
+import java.io.File;
+
+import static org.junit.Assert.assertNotNull;
+import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
+public class FeatureTest {
+
+    @Inject
+    private PlcDriver plcDriver;
+
+    @Configuration
+    public Option[] config() {
+        MavenArtifactUrlReference karafUrl = maven()
+            .groupId("org.apache.karaf")
+            .artifactId("apache-karaf")
+            .version("3.0.0")
+            .type("tar.gz");
+        MavenUrlReference karafStandardRepo = maven()
+            .groupId("org.apache.karaf.features")
+            .artifactId("standard")
+            .classifier("features")
+            .version("4.2.1")
+            .type("xml")
+            .versionAsInProject();
+        return new Option[] {
+            // KarafDistributionOption.debugConfiguration("5005", true),
+            karafDistributionConfiguration()
+                .frameworkUrl(karafUrl)
+                .unpackDirectory(new File("target/exam"))
+                .useDeployFolder(false),
+            keepRuntimeFolder(),
+            features(karafStandardRepo , "scr"),
+            mavenBundle()
+                .groupId("org.ops4j.pax.exam.samples")
+                .artifactId("pax-exam-sample8-ds")
+                .version("4.2.1")
+                //.versionAsInProject()
+            .start(),
+        };
+    }
+
+    @Test
+    public void getHelloService() {
+        assertNotNull(plcDriver);
+        // assertEquals("Hello Pax!", helloService.getMessage());
+    }
+
+}


[plc4x] 23/25: [Karaf] Fixed bug in feature.xml.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 528d04156ca8dc4d06d23b37a11aaeb910473cb2
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Fri Oct 18 14:01:36 2019 +0200

    [Karaf] Fixed bug in feature.xml.
---
 plc4j/karaf-features/s7/src/main/feature/feature.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4j/karaf-features/s7/src/main/feature/feature.xml b/plc4j/karaf-features/s7/src/main/feature/feature.xml
index b05e95f..e79b498 100644
--- a/plc4j/karaf-features/s7/src/main/feature/feature.xml
+++ b/plc4j/karaf-features/s7/src/main/feature/feature.xml
@@ -24,7 +24,7 @@
     </details>
     <feature prerequisite="true">wrap</feature>
     <feature>scr</feature>
-<!--    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/${project.version}</bundle>-->
+    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/${project.version}</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-api/${project.version}</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-on-tcp/${project.version}</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-tp/${project.version}</bundle>


[plc4x] 20/25: [Karaf] Improved maven config for IT, added readme.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 451f0d5deb21a1f8fe357d5caa754c54d4f3562a
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Fri Oct 18 13:54:12 2019 +0200

    [Karaf] Improved maven config for IT, added readme.
---
 plc4j/karaf-features/README.md                     | 42 ++++++++++++++++++++++
 plc4j/karaf-features/karaf-itest/pom.xml           | 35 ++++++++++++++++++
 .../karaf/{FeatureITest.java => FeatureIT.java}    |  2 +-
 .../karaf-features/s7/src/main/feature/feature.xml | 18 +++++-----
 4 files changed, 87 insertions(+), 10 deletions(-)

diff --git a/plc4j/karaf-features/README.md b/plc4j/karaf-features/README.md
new file mode 100644
index 0000000..818a097
--- /dev/null
+++ b/plc4j/karaf-features/README.md
@@ -0,0 +1,42 @@
+<!--
+
+  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.
+
+-->
+# This module provides Karaf features for plc4x
+
+As all plc4x modules are valid OSGi bundles, this module provides Karaf features for easier 
+deployment to Apache Karaf. 
+
+## Structure
+
+The module `driver-s7-featre` contains a `feature.xml` which defines a feature to load 
+the drivers bundles and all dependent bundles.
+The module `karaf-itest` contains an integration test to ensure that the features load correct in Karaf.
+
+## Testing
+
+In the Module `karaf-itest` are integration tests which verify the generated feature.
+But as they use the feature from the local maven repository the features have to be installed first.
+The Integration tests run in the verify phase, so you can e.g. use the comman
+```$mvn
+mvn clean install verify
+```
+in the `karaf-features` module. This will first install the `driver-s7-feature` feature in the 
+maven repo and then run the Integration test.
+
+The integration tests loads the feature and checks if the feature and the most important bundle 
+can be loaded. 
\ No newline at end of file
diff --git a/plc4j/karaf-features/karaf-itest/pom.xml b/plc4j/karaf-features/karaf-itest/pom.xml
index b42c5b6..00e4988 100644
--- a/plc4j/karaf-features/karaf-itest/pom.xml
+++ b/plc4j/karaf-features/karaf-itest/pom.xml
@@ -35,6 +35,14 @@
   </properties>
 
   <dependencies>
+    <!-- Important, have a dependency on the feature maven module that its built first -->
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>driver-s7-feature</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+    </dependency>
     <!-- Provide the KarafTestSupport -->
     <dependency>
       <groupId>org.apache.karaf.itests</groupId>
@@ -144,6 +152,33 @@
           </systemPropertyVariables>
         </configuration>
       </plugin>
+      <!-- Run in the verify Phase -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>**/*IT.java</exclude>
+          </excludes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <phase>integration-test</phase>
+            <configuration>
+              <excludes>
+                <exclude>none</exclude>
+              </excludes>
+              <includes>
+                <include>**/*IT.java</include>
+              </includes>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureIT.java
similarity index 98%
rename from plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
rename to plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureIT.java
index 33a7722..6d2bc16 100644
--- a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
+++ b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureIT.java
@@ -35,7 +35,7 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerMethod.class)
-public class FeatureITest extends KarafTestSupport {
+public class FeatureIT extends KarafTestSupport {
 
     @Configuration
     public Option[] config() {
diff --git a/plc4j/karaf-features/s7/src/main/feature/feature.xml b/plc4j/karaf-features/s7/src/main/feature/feature.xml
index 6bf41bb..b05e95f 100644
--- a/plc4j/karaf-features/s7/src/main/feature/feature.xml
+++ b/plc4j/karaf-features/s7/src/main/feature/feature.xml
@@ -22,19 +22,19 @@
     <details>PLC4X is an effort to create a universal library for accessing industrial programmable logic controllers
       using a variety of protocols using a uniform API.
     </details>
-    <feature prerequisite="true" dependency="false">wrap</feature>
+    <feature prerequisite="true">wrap</feature>
     <feature>scr</feature>
-    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.5.0-SNAPSHOT</bundle>
-    <bundle>mvn:org.apache.plc4x/plc4j-api/0.5.0-SNAPSHOT</bundle>
-    <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-on-tcp/0.5.0-SNAPSHOT</bundle>
-    <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-tp/0.5.0-SNAPSHOT</bundle>
-    <bundle>mvn:org.apache.plc4x/plc4j-protocol-s7/0.5.0-SNAPSHOT</bundle>
+<!--    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/${project.version}</bundle>-->
+    <bundle>mvn:org.apache.plc4x/plc4j-api/${project.version}</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-on-tcp/${project.version}</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-tp/${project.version}</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-protocol-s7/${project.version}</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-protocol-driver-base/${project.version}</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-utils-driver-base-java/${project.version}</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-protocol-driver-base-tcp/${project.version}</bundle>
     <bundle>mvn:io.netty/netty-codec/4.1.39.Final</bundle>
-    <bundle>mvn:org.apache.plc4x/plc4j-protocol-driver-base/0.5.0-SNAPSHOT</bundle>
-    <bundle>mvn:org.apache.plc4x/plc4j-utils-driver-base-java/0.5.0-SNAPSHOT</bundle>
     <bundle>wrap:mvn:com.github.jinahya/bit-io/1.4.2</bundle>
     <bundle>mvn:commons-codec/commons-codec/1.12</bundle>
-    <bundle>mvn:org.apache.plc4x/plc4j-protocol-driver-base-tcp/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:io.netty/netty-common/4.1.39.Final</bundle>
     <bundle>mvn:io.netty/netty-transport/4.1.39.Final</bundle>
     <bundle>mvn:io.netty/netty-resolver/4.1.39.Final</bundle>


[plc4x] 17/25: [OSGi] Tests not running yet.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 8ea7ea0174270972995d0d0862fe0bb4f9c2a396
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Thu Oct 17 20:31:59 2019 +0200

    [OSGi] Tests not running yet.
---
 plc4j/karaf-features/karaf-itest/pom.xml           | 102 ++++-------
 .../java/org/apache/plc4x/karaf/FeatureITest.java  | 200 +++++++++++----------
 2 files changed, 139 insertions(+), 163 deletions(-)

diff --git a/plc4j/karaf-features/karaf-itest/pom.xml b/plc4j/karaf-features/karaf-itest/pom.xml
index 9d4e3f5..44b2a44 100644
--- a/plc4j/karaf-features/karaf-itest/pom.xml
+++ b/plc4j/karaf-features/karaf-itest/pom.xml
@@ -12,55 +12,49 @@
   <artifactId>karaf-itest</artifactId>
 
   <properties>
-    <dependency.karaf.version>4.2.1</dependency.karaf.version>
+    <karaf.version>4.2.1</karaf.version>
     <pax.version>4.13.1</pax.version>
   </properties>
 
   <dependencies>
-<!--    &lt;!&ndash; S7 Driver for Build &ndash;&gt;-->
-<!--    <dependency>-->
-<!--      <groupId>org.apache.plc4x</groupId>-->
-<!--      <artifactId>driver-s7-feature</artifactId>-->
-<!--      <version>0.5.0-SNAPSHOT</version>-->
-<!--      <scope>test</scope>-->
-<!--    </dependency>-->
-
-    <!-- Pax Exam Test setup -->
+    <!-- Provide the KarafTestSupport -->
     <dependency>
-      <groupId>org.ops4j.pax.exam.samples</groupId>
-      <artifactId>pax-exam-sample8-ds</artifactId>
-      <version>${pax.version}</version>
+      <groupId>org.apache.karaf.itests</groupId>
+      <artifactId>common</artifactId>
+      <version>${karaf.version}</version>
       <scope>test</scope>
     </dependency>
+    <!-- Define the Apache Karaf version to download and use for the test -->
+    <!-- We use a released version here to avoid SNAPSHOT resolution -->
     <dependency>
-      <groupId>org.apache.karaf.features</groupId>
-      <artifactId>standard</artifactId>
-      <version>${dependency.karaf.version}</version>
-      <classifier>features</classifier>
-      <type>xml</type>
+      <groupId>org.apache.karaf</groupId>
+      <artifactId>apache-karaf</artifactId>
+      <version>${karaf.version}</version>
       <scope>test</scope>
+      <type>tar.gz</type>
     </dependency>
 
     <dependency>
       <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>1.7.26</version>
       <scope>test</scope>
     </dependency>
-
+    <!-- Required to use shell commands in the tests -->
     <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>6.0.0</version>
-      <scope>provided</scope>
+      <groupId>org.apache.karaf.shell</groupId>
+      <artifactId>org.apache.karaf.shell.core</artifactId>
+      <version>${karaf.version}</version>
+      <scope>test</scope>
     </dependency>
-
-    <!-- Dependencies for pax exam karaf container -->
+    <!-- Provide the PaxExam Karaf support -->
     <dependency>
       <groupId>org.ops4j.pax.exam</groupId>
       <artifactId>pax-exam-container-karaf</artifactId>
       <version>${pax.version}</version>
       <scope>test</scope>
     </dependency>
+    <!-- Provide the PaxExam JUnit extension -->
     <dependency>
       <groupId>org.ops4j.pax.exam</groupId>
       <artifactId>pax-exam-junit4</artifactId>
@@ -68,57 +62,29 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam</artifactId>
-      <version>${pax.version}</version>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-atinject_1.0_spec</artifactId>
+      <version>1.1</version>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.ops4j.pax.url</groupId>
-      <artifactId>pax-url-aether</artifactId>
-      <version>2.6.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>javax.inject</groupId>
-      <artifactId>javax.inject</artifactId>
-      <version>1</version>
-      <scope>test</scope>
+      <groupId>org.awaitility</groupId>
+      <artifactId>awaitility</artifactId>
+      <version>3.1.6</version>
     </dependency>
-
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
+      <groupId>org.apache.servicemix.bundles</groupId>
+      <artifactId>org.apache.servicemix.bundles.hamcrest</artifactId>
+      <version>1.3_1</version>
+      <scope>runtime</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-api</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.karaf.features</groupId>
-      <artifactId>org.apache.karaf.features.core</artifactId>
-      <version>${dependency.karaf.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.karaf.bundle</groupId>
-      <artifactId>org.apache.karaf.bundle.core</artifactId>
-      <version>${dependency.karaf.version}</version>
-      <scope>test</scope>
-    </dependency>
-
   </dependencies>
 
   <build>
     <plugins>
-      <!-- Needed if you use versionAsInProject() -->
       <plugin>
         <groupId>org.apache.servicemix.tooling</groupId>
         <artifactId>depends-maven-plugin</artifactId>
-        <version>1.4.0</version>
         <executions>
           <execution>
             <id>generate-depends-file</id>
@@ -128,14 +94,6 @@
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <systemPropertyVariables>
-            <pax.exam.karaf.version>${dependency.karaf.version}</pax.exam.karaf.version>
-          </systemPropertyVariables>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 
diff --git a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
index 1efc1db..b7a12a6 100644
--- a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
+++ b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
@@ -13,119 +13,137 @@
  */
 package org.apache.plc4x.karaf;
 
-import org.apache.karaf.bundle.core.BundleService;
+import org.apache.karaf.features.Feature;
 import org.apache.karaf.features.FeaturesService;
-import org.apache.plc4x.java.spi.PlcDriver;
+import org.apache.karaf.itests.KarafTestSupport;
+import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.ConfigurationManager;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.container.internal.JavaVersionUtil;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption;
 import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
-import org.ops4j.pax.exam.options.MavenUrlReference;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.ops4j.pax.exam.options.extra.VMOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
 
-import javax.inject.Inject;
 import java.io.File;
-import java.util.Arrays;
-import java.util.Optional;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.bundle;
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureSecurity;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
 
 @RunWith(PaxExam.class)
-public class FeatureITest {
-
-    private static Logger LOG = LoggerFactory.getLogger(FeatureITest.class);
-
-    @Inject
-    private FeaturesService featuresService;
-
-    @Inject
-    private BundleContext bundleContext;
+@ExamReactorStrategy(PerClass.class)
+public class FeatureITest extends KarafTestSupport {
 
+    @Override
     @Configuration
     public Option[] config() {
-        MavenArtifactUrlReference karafUrl = maven()
-            .groupId("org.apache.karaf")
-            .artifactId("apache-karaf")
-            .version(karafVersion())
-            .type("zip");
-
-        MavenUrlReference karafStandardRepo = maven()
-            .groupId("org.apache.karaf.features")
-            .artifactId("standard")
-            .version(karafVersion())
-            .classifier("features")
-            .type("xml");
-
-        final MavenArtifactUrlReference plc4xRepo = maven()
-            .groupId("org.apache.plc4x")
-            .artifactId("driver-s7-feature")
-            .version("0.5.0-SNAPSHOT")
-            .classifier("features")
-            .type("xml");
-        return new Option[] {
-            // KarafDistributionOption.debugConfiguration("5005", true),
-            karafDistributionConfiguration()
-                .frameworkUrl(karafUrl)
-                .unpackDirectory(new File("target", "exam"))
-                .useDeployFolder(false),
-            keepRuntimeFolder(),
-            configureConsole().ignoreLocalConsole(),
-            features(karafStandardRepo , "scr"),
-            features(plc4xRepo, "driver-s7-feature"),
-            mavenBundle()
-                .groupId("org.apache.plc4x")
-                .artifactId("plc4j-driver-s7")
-                .version("0.5.0-SNAPSHOT")
-                .start()
-        };
-    }
-
-    public static String karafVersion() {
-        ConfigurationManager cm = new ConfigurationManager();
-        String karafVersion = cm.getProperty("pax.exam.karaf.version", "3.0.0");
-        return karafVersion;
-    }
-
+        MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("tar.gz");
+
+        String httpPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_HTTP_PORT), Integer.parseInt(MAX_HTTP_PORT)));
+        String rmiRegistryPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_REG_PORT), Integer.parseInt(MAX_RMI_REG_PORT)));
+        String rmiServerPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_SERVER_PORT), Integer.parseInt(MAX_RMI_SERVER_PORT)));
+        String sshPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_SSH_PORT), Integer.parseInt(MAX_SSH_PORT)));
+        String localRepository = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
+        if (localRepository == null) {
+            localRepository = "";
+        }
 
-    @Test
-    public void checkFeatureInstalled() throws Exception {
-        assertTrue(
-            featuresService.isInstalled(featuresService.getFeature("driver-s7-feature"))
-        );
+        if (JavaVersionUtil.getMajorVersion() >= 9) {
+            return new Option[]{
+                //KarafDistributionOption.debugConfiguration("8889", true),
+                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
+                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
+                configureSecurity().disableKarafMBeanServerBuilder(),
+                // configureConsole().ignoreLocalConsole(),
+                keepRuntimeFolder(),
+                logLevel(LogLevelOption.LogLevel.INFO),
+                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
+                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
+                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
+                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
+                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
+                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
+                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
+                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository),
+                new VMOption("--add-reads=java.xml=java.logging"),
+                new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
+                new VMOption("--patch-module"),
+                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
+                    + System.getProperty("karaf.version") + ".jar"),
+                new VMOption("--patch-module"),
+                new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
+                    + System.getProperty("karaf.version") + ".jar"),
+                new VMOption("--add-opens"),
+                new VMOption("java.base/java.security=ALL-UNNAMED"),
+                new VMOption("--add-opens"),
+                new VMOption("java.base/java.net=ALL-UNNAMED"),
+                new VMOption("--add-opens"),
+                new VMOption("java.base/java.lang=ALL-UNNAMED"),
+                new VMOption("--add-opens"),
+                new VMOption("java.base/java.util=ALL-UNNAMED"),
+                new VMOption("--add-opens"),
+                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
+                new VMOption("--add-opens"),
+                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
+                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
+                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
+                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
+                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
+                new VMOption("-classpath"),
+                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
+            };
+        } else {
+            return new Option[]{
+                //KarafDistributionOption.debugConfiguration("8889", true),
+                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
+                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
+                configureSecurity().disableKarafMBeanServerBuilder(),
+                // configureConsole().ignoreLocalConsole(),
+                keepRuntimeFolder(),
+                logLevel(LogLevelOption.LogLevel.INFO),
+                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
+                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
+                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
+                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
+                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
+                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
+                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
+                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository)
+            };
+        }
     }
 
     @Test
-    public void checkBundleStarted() throws Exception {
-        for (Bundle bundle : bundleContext.getBundles()) {
-            System.out.println(bundle.getSymbolicName());
-        }
-
-        // Try to find the bundle
-        final Optional<Bundle> optionalBundle = Arrays.stream(bundleContext.getBundles())
-            .filter(bundle -> "org.apache.plc4x.plc4j-driver-s7".equals(bundle.getSymbolicName()))
-            .findFirst();
-
-        // Ensure that the bundle is resolved
-        assertTrue(optionalBundle.isPresent());
-
-        // Check if the bundle is active
-        assertEquals(Bundle.ACTIVE, optionalBundle.get().getState());
+    public void installAndAssertFeature() throws Exception {
+        // ...
+        final MavenArtifactUrlReference featureRepo = maven()
+            .groupId("org.apache.plc4x")
+            .artifactId("driver-s7-feature")
+            .versionAsInProject()
+            .classifier("xml")
+            .type("feature");
+
+        System.out.println(featureRepo.getURL());
+
+        // ...
+        addFeaturesRepository(featureRepo.getURL());
+        // ...
+        installAndAssertFeature("driver-s7-feature");
+        // Print Bundles
+        String bundles = executeCommand("bundle:list -t 0");
+        System.out.println(bundles);
+        // Print features
+        String features = executeCommand("feature:list -i");
+        System.out.print(features);
     }
 
-}
+}
\ No newline at end of file


[plc4x] 15/25: - Added the OSGI Annotation to all remaining drivers - Added a missing OPCUA feature - Added the OPCUA feature to the demo-server

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 0207eb50020185bc007e902dc6af848eec268a4a
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Oct 14 09:51:08 2019 +0200

    - Added the OSGI Annotation to all remaining drivers
    - Added a missing OPCUA feature
    - Added the OPCUA feature to the demo-server
---
 plc4j/drivers/ads/pom.xml                          |  9 +++-
 .../org/apache/plc4x/java/ads/AdsPlcDriver.java    |  2 +
 plc4j/drivers/ethernet-ip/pom.xml                  |  7 +++
 .../plc4x/java/ethernetip/EtherNetIpPlcDriver.java |  2 +
 plc4j/drivers/modbus/pom.xml                       |  7 +++
 .../apache/plc4x/java/modbus/ModbusPlcDriver.java  |  2 +
 plc4j/drivers/opcua/pom.xml                        |  6 +++
 .../apache/plc4x/java/opcua/OpcuaPlcDriver.java    |  2 +
 plc4j/drivers/simulated/pom.xml                    |  7 +++
 .../plc4x/java/simulated/SimulatedPlcDriver.java   |  2 +
 .../apache-karaf/karaf-demo-server/pom.xml         |  8 ++++
 .../apache-karaf/karaf-opcua-feature}/pom.xml      | 52 +++++++++++-----------
 plc4j/integrations/apache-karaf/pom.xml            |  2 +-
 13 files changed, 80 insertions(+), 28 deletions(-)

diff --git a/plc4j/drivers/ads/pom.xml b/plc4j/drivers/ads/pom.xml
index 616aa3c..6bf5df5 100644
--- a/plc4j/drivers/ads/pom.xml
+++ b/plc4j/drivers/ads/pom.xml
@@ -97,6 +97,13 @@
       <artifactId>commons-codec</artifactId>
       <scope>test</scope>
     </dependency>
-  </dependencies>
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.cmpn</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+ </dependencies>
 
 </project>
\ No newline at end of file
diff --git a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/AdsPlcDriver.java b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/AdsPlcDriver.java
index 3ec56d9..e6f3c34 100644
--- a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/AdsPlcDriver.java
+++ b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/AdsPlcDriver.java
@@ -26,6 +26,7 @@ import org.apache.plc4x.java.api.PlcConnection;
 import org.apache.plc4x.java.api.authentication.PlcAuthentication;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
 import org.apache.plc4x.java.spi.PlcDriver;
+import org.osgi.service.component.annotations.Component;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -38,6 +39,7 @@ import java.util.regex.Pattern;
  * - TCP
  * - Serial
  */
+@Component(service = PlcDriver.class, immediate = true)
 public class AdsPlcDriver implements PlcDriver {
 
     public static final Pattern ADS_ADDRESS_PATTERN =
diff --git a/plc4j/drivers/ethernet-ip/pom.xml b/plc4j/drivers/ethernet-ip/pom.xml
index ade4259..9633526 100644
--- a/plc4j/drivers/ethernet-ip/pom.xml
+++ b/plc4j/drivers/ethernet-ip/pom.xml
@@ -94,6 +94,13 @@
       <version>${ethernetip-driver.version}</version>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.cmpn</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
   <repositories>
diff --git a/plc4j/drivers/ethernet-ip/src/main/java/org/apache/plc4x/java/ethernetip/EtherNetIpPlcDriver.java b/plc4j/drivers/ethernet-ip/src/main/java/org/apache/plc4x/java/ethernetip/EtherNetIpPlcDriver.java
index 41dfc6b..9a98e08 100644
--- a/plc4j/drivers/ethernet-ip/src/main/java/org/apache/plc4x/java/ethernetip/EtherNetIpPlcDriver.java
+++ b/plc4j/drivers/ethernet-ip/src/main/java/org/apache/plc4x/java/ethernetip/EtherNetIpPlcDriver.java
@@ -23,6 +23,7 @@ import org.apache.plc4x.java.api.authentication.PlcAuthentication;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
 import org.apache.plc4x.java.ethernetip.connection.EtherNetIpTcpPlcConnection;
 import org.apache.plc4x.java.spi.PlcDriver;
+import org.osgi.service.component.annotations.Component;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -36,6 +37,7 @@ import java.util.regex.Pattern;
  * Spec:
  * http://read.pudn.com/downloads166/ebook/763212/EIP-CIP-V2-1.0.pdf
  */
+@Component(service = PlcDriver.class, immediate = true)
 public class EtherNetIpPlcDriver implements PlcDriver {
 
     private static final Pattern ETHERNETIP_URI_PATTERN = Pattern.compile("^eip://(?<host>[\\w.]+)(:(?<port>\\d*))?(?<params>\\?.*)?");
diff --git a/plc4j/drivers/modbus/pom.xml b/plc4j/drivers/modbus/pom.xml
index ab2fce3..f0a9868 100644
--- a/plc4j/drivers/modbus/pom.xml
+++ b/plc4j/drivers/modbus/pom.xml
@@ -89,6 +89,13 @@
       <version>0.5.0-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.cmpn</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
 </project>
\ No newline at end of file
diff --git a/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/ModbusPlcDriver.java b/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/ModbusPlcDriver.java
index 97a9a9f..4801feb 100644
--- a/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/ModbusPlcDriver.java
+++ b/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/ModbusPlcDriver.java
@@ -24,6 +24,7 @@ import org.apache.plc4x.java.api.authentication.PlcAuthentication;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
 import org.apache.plc4x.java.modbus.connection.ModbusConnectionFactory;
 import org.apache.plc4x.java.spi.PlcDriver;
+import org.osgi.service.component.annotations.Component;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -34,6 +35,7 @@ import java.util.regex.Pattern;
  * Implementation of the Modbus protocol, based on:
  * - Modbus Protocol (http://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf)
  */
+@Component(service = PlcDriver.class, immediate = true)
 public class ModbusPlcDriver implements PlcDriver {
 
     public static final Pattern INET_ADDRESS_PATTERN = Pattern.compile("tcp://(?<host>[\\w.]+)(:(?<port>\\d*))?");
diff --git a/plc4j/drivers/opcua/pom.xml b/plc4j/drivers/opcua/pom.xml
index 4522fbe..ffb4e3c 100644
--- a/plc4j/drivers/opcua/pom.xml
+++ b/plc4j/drivers/opcua/pom.xml
@@ -65,6 +65,12 @@
       <artifactId>commons-lang3</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.cmpn</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
 
diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OpcuaPlcDriver.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OpcuaPlcDriver.java
index 7fefae7..3a27aa1 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OpcuaPlcDriver.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/OpcuaPlcDriver.java
@@ -24,6 +24,7 @@ import org.apache.plc4x.java.api.authentication.PlcAuthentication;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
 import org.apache.plc4x.java.opcua.connection.OpcuaConnectionFactory;
 import org.apache.plc4x.java.spi.PlcDriver;
+import org.osgi.service.component.annotations.Component;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -38,6 +39,7 @@ import java.util.regex.Pattern;
  * @author Matthias Milan Stlrljic
  * Created by Matthias Milan Stlrljic on 10.05.2019
  */
+@Component(service = PlcDriver.class, immediate = true)
 public class OpcuaPlcDriver implements PlcDriver {
 
 
diff --git a/plc4j/drivers/simulated/pom.xml b/plc4j/drivers/simulated/pom.xml
index 99c76bd..93d53b0 100644
--- a/plc4j/drivers/simulated/pom.xml
+++ b/plc4j/drivers/simulated/pom.xml
@@ -56,6 +56,13 @@
       <artifactId>equalsverifier</artifactId>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.cmpn</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
 </project>
\ No newline at end of file
diff --git a/plc4j/drivers/simulated/src/main/java/org/apache/plc4x/java/simulated/SimulatedPlcDriver.java b/plc4j/drivers/simulated/src/main/java/org/apache/plc4x/java/simulated/SimulatedPlcDriver.java
index 8bfa145..d1e1ef4 100644
--- a/plc4j/drivers/simulated/src/main/java/org/apache/plc4x/java/simulated/SimulatedPlcDriver.java
+++ b/plc4j/drivers/simulated/src/main/java/org/apache/plc4x/java/simulated/SimulatedPlcDriver.java
@@ -24,6 +24,7 @@ import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
 import org.apache.plc4x.java.simulated.connection.SimulatedPlcConnection;
 import org.apache.plc4x.java.simulated.connection.TestDevice;
 import org.apache.plc4x.java.spi.PlcDriver;
+import org.osgi.service.component.annotations.Component;
 
 /**
  * Test driver holding its state in the client process.
@@ -32,6 +33,7 @@ import org.apache.plc4x.java.spi.PlcDriver;
  * Every device contains a random value generator accessible by address {@code random}.
  * Any value can be stored into test devices, however the state will be gone when connection is closed.
  */
+@Component(service = PlcDriver.class, immediate = true)
 public class SimulatedPlcDriver implements PlcDriver {
 
     @Override
diff --git a/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml b/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
index 078c054..ee18822 100644
--- a/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
@@ -71,6 +71,13 @@
     </dependency>
     <dependency>
       <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-karaf-opcua-feature</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
       <artifactId>plc4j-karaf-s7-feature</artifactId>
       <version>0.5.0-SNAPSHOT</version>
       <classifier>features</classifier>
@@ -109,6 +116,7 @@
             <usedDependency>org.apache.plc4x:plc4j-karaf-ads-feature</usedDependency>
             <usedDependency>org.apache.plc4x:plc4j-karaf-ethernet-ip-feature</usedDependency>
             <usedDependency>org.apache.plc4x:plc4j-karaf-modbus-feature</usedDependency>
+            <usedDependency>org.apache.plc4x:plc4j-karaf-opcua-feature</usedDependency>
             <usedDependency>org.apache.plc4x:plc4j-karaf-s7-feature</usedDependency>
             <usedDependency>org.apache.plc4x:plc4j-karaf-simulated-feature</usedDependency>
           </usedDependencies>
diff --git a/plc4j/drivers/simulated/pom.xml b/plc4j/integrations/apache-karaf/karaf-opcua-feature/pom.xml
similarity index 58%
copy from plc4j/drivers/simulated/pom.xml
copy to plc4j/integrations/apache-karaf/karaf-opcua-feature/pom.xml
index 99c76bd..f2602b4 100644
--- a/plc4j/drivers/simulated/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-opcua-feature/pom.xml
@@ -8,7 +8,7 @@
   "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
+    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
@@ -17,45 +17,45 @@
   specific language governing permissions and limitations
   under the License.
   -->
-<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/xsd/maven-4.0.0.xsd">
 
+<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/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
     <groupId>org.apache.plc4x</groupId>
-    <artifactId>plc4j-drivers</artifactId>
+    <artifactId>plc4j-apache-karaf</artifactId>
     <version>0.5.0-SNAPSHOT</version>
   </parent>
 
-  <artifactId>plc4j-driver-simulated</artifactId>
-  <name>PLC4J: Driver: Simulated</name>
-  <description>Implementation of a PLC4X driver able to speak a simulated device.</description>
+  <artifactId>plc4j-karaf-opcua-feature</artifactId>
+  <packaging>feature</packaging>
+
+  <name>PLC4J: Integrations: Apache Karaf: OPC-UA</name>
 
   <dependencies>
     <dependency>
       <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-api</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-protocol-driver-base</artifactId>
+      <artifactId>plc4j-driver-opcua</artifactId>
       <version>0.5.0-SNAPSHOT</version>
     </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-text</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>nl.jqno.equalsverifier</groupId>
-      <artifactId>equalsverifier</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.karaf.tooling</groupId>
+        <artifactId>karaf-maven-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <configuration>
+          <usedDependencies>
+            <usedDependency>org.apache.plc4x:plc4j-driver-opcua</usedDependency>
+          </usedDependencies>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
 </project>
\ No newline at end of file
diff --git a/plc4j/integrations/apache-karaf/pom.xml b/plc4j/integrations/apache-karaf/pom.xml
index 2d4a292..bdbbe6a 100644
--- a/plc4j/integrations/apache-karaf/pom.xml
+++ b/plc4j/integrations/apache-karaf/pom.xml
@@ -43,9 +43,9 @@
     <module>karaf-ads-feature</module>
     <module>karaf-ethernet-ip-feature</module>
     <module>karaf-modbus-feature</module>
+    <module>karaf-opcua-feature</module>
     <module>karaf-s7-feature</module>
     <module>karaf-simulated-feature</module>
-    <!-- TODO: karaf-demo doesn't compile right now as slf4-api bundle dependency can't be resolved -->
     <module>karaf-demo-server</module>
   </modules>
 


[plc4x] 03/25: [OSGi] Fixing changed package names.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 63d89937faaeff2a9e5c34decb073eebd7f0ebec
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Sun Oct 13 12:24:58 2019 +0200

    [OSGi] Fixing changed package names.
---
 .../org/apache/plc4x/java/abeth/connection/AbEthPlcConnection.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/connection/AbEthPlcConnection.java b/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/connection/AbEthPlcConnection.java
index 594f837..113cae3 100644
--- a/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/connection/AbEthPlcConnection.java
+++ b/sandbox/test-java-ab-eth-driver/src/main/java/org/apache/plc4x/java/abeth/connection/AbEthPlcConnection.java
@@ -29,10 +29,11 @@ import org.apache.plc4x.java.api.messages.PlcReadResponse;
 import org.apache.plc4x.java.api.model.PlcField;
 import org.apache.plc4x.java.base.connection.ChannelFactory;
 import org.apache.plc4x.java.base.connection.NettyPlcConnection;
-import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.apache.plc4x.java.base.events.ConnectEvent;
 import org.apache.plc4x.java.base.events.ConnectedEvent;
 import org.apache.plc4x.java.base.messages.*;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 


[plc4x] 08/25: - Excluded the slf4j-api module from all karaf modules

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit f958e17165479c4049cc514342df73c5ea13bf9d
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Sun Oct 13 18:43:29 2019 +0200

    - Excluded the slf4j-api module from all karaf modules
---
 plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml | 7 -------
 plc4j/integrations/apache-karaf/pom.xml                   | 9 +++++++++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml b/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
index a44b44c..078c054 100644
--- a/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
@@ -83,13 +83,6 @@
       <classifier>features</classifier>
       <type>xml</type>
     </dependency>
-
-    <!-- This is just a way of removing this dependency -->
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/plc4j/integrations/apache-karaf/pom.xml b/plc4j/integrations/apache-karaf/pom.xml
index 093431b..1270a95 100644
--- a/plc4j/integrations/apache-karaf/pom.xml
+++ b/plc4j/integrations/apache-karaf/pom.xml
@@ -49,6 +49,15 @@
     <module>karaf-demo-server</module>
   </modules>
 
+  <dependencies>
+    <!-- This is just a way of removing this dependency -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
   <build>
     <plugins>
       <!-- With OSGI there's a lot of stuff with duplicate classes in different versions -->


[plc4x] 12/25: [OSGi] Finally, integration test is running.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit d070b9cebb4e0aa91ced7fee07d49348e4c73305
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Thu Oct 17 21:57:44 2019 +0200

    [OSGi] Finally, integration test is running.
---
 plc4j/karaf-features/karaf-itest/pom.xml           |  52 ++++-
 .../java/org/apache/plc4x/karaf/FeatureITest.java  | 227 ++++++++++++---------
 .../test/resources/etc/org.ops4j.pax.logging.cfg   |  71 +++++++
 .../src/test/resources/etc/system.properties       |  18 ++
 .../karaf-itest/src/test/resources/exam.properties |   1 -
 plc4j/karaf-features/s7/pom.xml                    |  99 ---------
 .../karaf-features/s7/src/main/feature/feature.xml |   2 +-
 7 files changed, 271 insertions(+), 199 deletions(-)

diff --git a/plc4j/karaf-features/karaf-itest/pom.xml b/plc4j/karaf-features/karaf-itest/pom.xml
index 44b2a44..b42c5b6 100644
--- a/plc4j/karaf-features/karaf-itest/pom.xml
+++ b/plc4j/karaf-features/karaf-itest/pom.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  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.
+
+-->
 <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/xsd/maven-4.0.0.xsd">
@@ -12,7 +30,7 @@
   <artifactId>karaf-itest</artifactId>
 
   <properties>
-    <karaf.version>4.2.1</karaf.version>
+    <karaf.version>4.2.6</karaf.version>
     <pax.version>4.13.1</pax.version>
   </properties>
 
@@ -78,6 +96,12 @@
       <version>1.3_1</version>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-api</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
@@ -85,6 +109,7 @@
       <plugin>
         <groupId>org.apache.servicemix.tooling</groupId>
         <artifactId>depends-maven-plugin</artifactId>
+        <version>1.4.0</version>
         <executions>
           <execution>
             <id>generate-depends-file</id>
@@ -94,6 +119,31 @@
           </execution>
         </executions>
       </plugin>
+      <!-- See https://issues.apache.org/jira/browse/KARAF-6457 -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkCount>1</forkCount>
+          <reuseForks>false</reuseForks>
+          <systemPropertyVariables>
+            <org.ops4j.pax.logging.DefaultServiceLog.level>INFO</org.ops4j.pax.logging.DefaultServiceLog.level>
+            <spring31.version>3.1.4.RELEASE</spring31.version>
+            <spring32.version>3.2.18.RELEASE_1</spring32.version>
+            <spring40.version>4.0.9.RELEASE_1</spring40.version>
+            <spring41.version>4.1.9.RELEASE_1</spring41.version>
+            <spring42.version>4.2.9.RELEASE_1</spring42.version>
+            <spring43.version>4.3.25.RELEASE_1</spring43.version>
+            <spring50.version>5.0.15.RELEASE_1</spring50.version>
+            <spring51.version>5.1.9.RELEASE_1</spring51.version>
+            <spring.security31.version>3.1.4.RELEASE</spring.security31.version>
+            <spring.security42.version>4.2.4.RELEASE_1</spring.security42.version>
+            <spring.security51.version>5.1.5.RELEASE_1</spring.security51.version>
+            <activemq.version>5.15.9</activemq.version>
+            <plc4x.version>${project.version}</plc4x.version>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
index b7a12a6..f38cdc1 100644
--- a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
+++ b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
@@ -13,137 +13,170 @@
  */
 package org.apache.plc4x.karaf;
 
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
 import org.apache.karaf.itests.KarafTestSupport;
-import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.karaf.container.internal.JavaVersionUtil;
+import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
 import org.ops4j.pax.exam.karaf.options.LogLevelOption;
 import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
-import org.ops4j.pax.exam.options.extra.VMOption;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+import org.osgi.framework.Bundle;
 
-import java.io.File;
+import java.util.stream.Stream;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureSecurity;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
 
 @RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
+@ExamReactorStrategy(PerMethod.class)
 public class FeatureITest extends KarafTestSupport {
 
-    @Override
     @Configuration
     public Option[] config() {
-        MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("tar.gz");
-
-        String httpPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_HTTP_PORT), Integer.parseInt(MAX_HTTP_PORT)));
-        String rmiRegistryPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_REG_PORT), Integer.parseInt(MAX_RMI_REG_PORT)));
-        String rmiServerPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_SERVER_PORT), Integer.parseInt(MAX_RMI_SERVER_PORT)));
-        String sshPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_SSH_PORT), Integer.parseInt(MAX_SSH_PORT)));
-        String localRepository = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
-        if (localRepository == null) {
-            localRepository = "";
-        }
-
-        if (JavaVersionUtil.getMajorVersion() >= 9) {
-            return new Option[]{
-                //KarafDistributionOption.debugConfiguration("8889", true),
-                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
-                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
-                configureSecurity().disableKarafMBeanServerBuilder(),
-                // configureConsole().ignoreLocalConsole(),
-                keepRuntimeFolder(),
-                logLevel(LogLevelOption.LogLevel.INFO),
-                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
-                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
-                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
-                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
-                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
-                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
-                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
-                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository),
-                new VMOption("--add-reads=java.xml=java.logging"),
-                new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
-                new VMOption("--patch-module"),
-                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
-                    + System.getProperty("karaf.version") + ".jar"),
-                new VMOption("--patch-module"),
-                new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
-                    + System.getProperty("karaf.version") + ".jar"),
-                new VMOption("--add-opens"),
-                new VMOption("java.base/java.security=ALL-UNNAMED"),
-                new VMOption("--add-opens"),
-                new VMOption("java.base/java.net=ALL-UNNAMED"),
-                new VMOption("--add-opens"),
-                new VMOption("java.base/java.lang=ALL-UNNAMED"),
-                new VMOption("--add-opens"),
-                new VMOption("java.base/java.util=ALL-UNNAMED"),
-                new VMOption("--add-opens"),
-                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
-                new VMOption("--add-opens"),
-                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
-                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
-                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
-                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
-                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
-                new VMOption("-classpath"),
-                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
-            };
-        } else {
-            return new Option[]{
-                //KarafDistributionOption.debugConfiguration("8889", true),
-                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
-                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
-                configureSecurity().disableKarafMBeanServerBuilder(),
-                // configureConsole().ignoreLocalConsole(),
-                keepRuntimeFolder(),
-                logLevel(LogLevelOption.LogLevel.INFO),
-                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
-                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
-                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
-                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
-                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
-                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
-                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
-                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository)
-            };
-        }
+        Option[] options = new Option[]{
+            logLevel(LogLevelOption.LogLevel.DEBUG),
+            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "plc4x.version", System.getProperty("plc4x.version")),
+//            features("scr"),
+//            mavenBundle()
+//                .groupId("org.ops4j.pax.exam.samples")
+//                .artifactId("pax-exam-sample8-ds")
+//                .version("4.13.1")
+//                .start()
+        };
+        return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
+
+//
+//        String httpPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_HTTP_PORT), Integer.parseInt(MAX_HTTP_PORT)));
+//        String rmiRegistryPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_REG_PORT), Integer.parseInt(MAX_RMI_REG_PORT)));
+//        String rmiServerPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_SERVER_PORT), Integer.parseInt(MAX_RMI_SERVER_PORT)));
+//        String sshPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_SSH_PORT), Integer.parseInt(MAX_SSH_PORT)));
+//        String localRepository = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
+//        if (localRepository == null) {
+//            localRepository = "";
+//        }
+//
+//        if (JavaVersionUtil.getMajorVersion() >= 9) {
+//            return new Option[]{
+//                //KarafDistributionOption.debugConfiguration("8889", true),
+//                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
+//                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
+//                configureSecurity().disableKarafMBeanServerBuilder(),
+//                // configureConsole().ignoreLocalConsole(),
+//                keepRuntimeFolder(),
+//                logLevel(LogLevelOption.LogLevel.INFO),
+//                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
+//                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
+//                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
+//                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
+//                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository),
+//                new VMOption("--add-reads=java.xml=java.logging"),
+//                new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
+//                new VMOption("--patch-module"),
+//                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
+//                    + System.getProperty("karaf.version") + ".jar"),
+//                new VMOption("--patch-module"),
+//                new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
+//                    + System.getProperty("karaf.version") + ".jar"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.base/java.security=ALL-UNNAMED"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.base/java.net=ALL-UNNAMED"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.base/java.lang=ALL-UNNAMED"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.base/java.util=ALL-UNNAMED"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
+//                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
+//                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
+//                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
+//                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
+//                new VMOption("-classpath"),
+//                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
+//            };
+//        } else {
+//            return new Option[]{
+//                //KarafDistributionOption.debugConfiguration("8889", true),
+//                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
+//                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
+//                configureSecurity().disableKarafMBeanServerBuilder(),
+//                // configureConsole().ignoreLocalConsole(),
+//                keepRuntimeFolder(),
+//                logLevel(LogLevelOption.LogLevel.INFO),
+//                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
+//                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
+//                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
+//                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
+//                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository)
+//            };
+//        }
     }
 
+    /**
+     * Checks:
+     * - the feature can be installed
+     * - the Driver Bundle is there and active
+     * - the Bundle contains the DS for PlcDriver
+     * - the feature is installed
+     */
     @Test
     public void installAndAssertFeature() throws Exception {
-        // ...
+        // Assemble Maven URL
         final MavenArtifactUrlReference featureRepo = maven()
             .groupId("org.apache.plc4x")
             .artifactId("driver-s7-feature")
-            .versionAsInProject()
-            .classifier("xml")
-            .type("feature");
-
-        System.out.println(featureRepo.getURL());
+            .version(System.getProperty("plc4x.version"))
+            .type("xml")
+            .classifier("features");
+        System.out.println("Installing feature repo " + featureRepo.getURL());
 
-        // ...
+        // Install the feature-repo
         addFeaturesRepository(featureRepo.getURL());
-        // ...
+
+        // Install the feature
         installAndAssertFeature("driver-s7-feature");
-        // Print Bundles
+
+        // Print Bundles and fetch result
         String bundles = executeCommand("bundle:list -t 0");
+
+        // Find that line
+        // 84 │ Active │  80 │ 0.5.0.SNAPSHOT │ PLC4J: Driver: S7
+        assertContains("PLC4J: Driver: S7", bundles);
         System.out.println(bundles);
-        // Print features
+
+        // Find Bundle for more detailed check
+        final Bundle bundle = findBundleByName("org.apache.plc4x.plc4j-driver-s7");
+
+        // Bundle has to be ACTIVE
+        assertNotNull(bundle);
+        assertEquals(Bundle.ACTIVE, bundle.getState());
+
+        // Check declarative service is present
+        String services = executeCommand("services -p " + bundle.getBundleId());
+        System.out.println("Services: " + services);
+        assertContains("component.name = org.apache.plc4x.java.s7.S7PlcDriver", services);
+        assertContains("objectClass = [org.apache.plc4x.java.spi.PlcDriver]", services);
+
+        // Just for Debugging...
         String features = executeCommand("feature:list -i");
         System.out.print(features);
+        assertContains("driver-s7-feature", features);
     }
 
 }
\ No newline at end of file
diff --git a/plc4j/karaf-features/karaf-itest/src/test/resources/etc/org.ops4j.pax.logging.cfg b/plc4j/karaf-features/karaf-itest/src/test/resources/etc/org.ops4j.pax.logging.cfg
new file mode 100644
index 0000000..285e55f
--- /dev/null
+++ b/plc4j/karaf-features/karaf-itest/src/test/resources/etc/org.ops4j.pax.logging.cfg
@@ -0,0 +1,71 @@
+###############################################################################
+#
+#    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.
+#
+################################################################################
+
+# See https://issues.apache.org/jira/browse/KARAF-6456
+
+# Common pattern layout for appenders
+log4j2.pattern = %d{ISO8601} | %-5p | %-16t | %-32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
+
+# Root logger
+log4j2.rootLogger.level = INFO
+# uncomment to use asynchronous loggers, which require mvn:com.lmax/disruptor/3.3.2 library
+#log4j2.rootLogger.type = asyncRoot
+#log4j2.rootLogger.includeLocation = false
+log4j2.rootLogger.appenderRefs = RollingFile, PaxOsgi, Console
+log4j2.rootLogger.appenderRef.RollingFile.ref = RollingFile
+log4j2.rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi
+log4j2.rootLogger.appenderRef.Console.ref = Console
+log4j2.rootLogger.appenderRef.Console.filter.threshold.type = ThresholdFilter
+log4j2.rootLogger.appenderRef.Console.filter.threshold.level = ${karaf.log.console:-OFF}
+
+# Appenders configuration
+log4j2.appenders = console, rolling, osgi
+
+# CONSOLE appender not used by default
+log4j2.appender.console.type = Console
+log4j2.appender.console.name = Console
+log4j2.appender.console.layout.type = PatternLayout
+log4j2.appender.console.layout.pattern = ${log4j2.pattern}
+
+# File appender
+log4j2.appender.rolling.type = RollingRandomAccessFile
+log4j2.appender.rolling.name = RollingFile
+log4j2.appender.rolling.fileName = ${karaf.log}/karaf.log
+log4j2.appender.rolling.filePattern = ${karaf.log}/karaf.log.%i
+# uncomment to not force a disk flush
+#log4j2.appender.rolling.immediateFlush = false
+log4j2.appender.rolling.append = true
+log4j2.appender.rolling.layout.type = PatternLayout
+log4j2.appender.rolling.layout.pattern = ${log4j2.pattern}
+log4j2.appender.rolling.policies.type = Policies
+log4j2.appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
+log4j2.appender.rolling.policies.size.size = 16MB
+
+# OSGi appender
+log4j2.appender.osgi.type = PaxOsgi
+log4j2.appender.osgi.name = PaxOsgi
+log4j2.appender.osgi.filter = *
+
+# help with identification of maven-related problems with pax-url-aether
+#log4j2.logger.aether.name = shaded.org.eclipse.aether
+#log4j2.logger.aether.level = TRACE
+#log4j2.logger.http-headers.name = shaded.org.apache.http.headers
+#log4j2.logger.http-headers.level = DEBUG
+#log4j2.logger.maven.name = org.ops4j.pax.url.mvn
+#log4j2.logger.maven.level = TRACE
\ No newline at end of file
diff --git a/plc4j/karaf-features/karaf-itest/src/test/resources/etc/system.properties b/plc4j/karaf-features/karaf-itest/src/test/resources/etc/system.properties
new file mode 100644
index 0000000..a3caa37
--- /dev/null
+++ b/plc4j/karaf-features/karaf-itest/src/test/resources/etc/system.properties
@@ -0,0 +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.
+#
+################################################################################
\ No newline at end of file
diff --git a/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties b/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties
deleted file mode 100644
index db2c7db..0000000
--- a/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties
+++ /dev/null
@@ -1 +0,0 @@
-pax.exam.karaf.version = 4.2.1
\ No newline at end of file
diff --git a/plc4j/karaf-features/s7/pom.xml b/plc4j/karaf-features/s7/pom.xml
index 472b868..36043d4 100644
--- a/plc4j/karaf-features/s7/pom.xml
+++ b/plc4j/karaf-features/s7/pom.xml
@@ -30,105 +30,6 @@
   <artifactId>driver-s7-feature</artifactId>
   <packaging>feature</packaging>
 
-  <dependencies>
-    <dependency>
-      <groupId>org.ops4j.pax.exam.samples</groupId>
-      <artifactId>pax-exam-sample8-ds</artifactId>
-      <version>4.13.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.karaf.features</groupId>
-      <artifactId>standard</artifactId>
-      <version>4.2.1</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam-container-karaf</artifactId>
-      <version>4.13.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam-junit4</artifactId>
-      <version>4.13.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam</artifactId>
-      <version>4.13.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.url</groupId>
-      <artifactId>pax-url-aether</artifactId>
-      <version>1.6.0</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>javax.inject</groupId>
-      <artifactId>javax.inject</artifactId>
-      <version>1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.11</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>6.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <!-- -->
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-api</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>javax.inject</groupId>
-      <artifactId>javax.inject</artifactId>
-      <version>1</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <!-- Needed if you use versionAsInProject() -->
-      <plugin>
-        <groupId>org.apache.servicemix.tooling</groupId>
-        <artifactId>depends-maven-plugin</artifactId>
-        <version>1.2</version>
-        <executions>
-          <execution>
-            <id>generate-depends-file</id>
-            <goals>
-              <goal>generate-depends-file</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <systemPropertyVariables>
-            <pax.exam.karaf.version>4.2.1</pax.exam.karaf.version>
-          </systemPropertyVariables>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
   <!-- This would be necessary with the kar goal which works not fine, yet -->
 <!--  <dependencies>-->
 <!--    <dependency>-->
diff --git a/plc4j/karaf-features/s7/src/main/feature/feature.xml b/plc4j/karaf-features/s7/src/main/feature/feature.xml
index aebf22a..6bf41bb 100644
--- a/plc4j/karaf-features/s7/src/main/feature/feature.xml
+++ b/plc4j/karaf-features/s7/src/main/feature/feature.xml
@@ -24,7 +24,7 @@
     </details>
     <feature prerequisite="true" dependency="false">wrap</feature>
     <feature>scr</feature>
-<!--    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.5.0-SNAPSHOT</bundle>-->
+    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-api/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-on-tcp/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-tp/0.5.0-SNAPSHOT</bundle>


[plc4x] 04/25: [OSGi] Fixing changed package names.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 57cda2f99c8b5dba65958009249559c0ceffea4a
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Sun Oct 13 12:49:07 2019 +0200

    [OSGi] Fixing changed package names.
---
 plc4j/drivers/s7/pom.xml                                            | 6 ++++++
 .../s7/src/main/java/org/apache/plc4x/java/s7/S7PlcDriver.java      | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/plc4j/drivers/s7/pom.xml b/plc4j/drivers/s7/pom.xml
index 68b496b..02b393c 100644
--- a/plc4j/drivers/s7/pom.xml
+++ b/plc4j/drivers/s7/pom.xml
@@ -118,6 +118,12 @@
       <version>1.12</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>osgi.cmpn</artifactId>
+      <version>7.0.0</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/S7PlcDriver.java b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/S7PlcDriver.java
index eec53f2..36efea1 100644
--- a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/S7PlcDriver.java
+++ b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/S7PlcDriver.java
@@ -23,6 +23,7 @@ import org.apache.plc4x.java.api.authentication.PlcAuthentication;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
 import org.apache.plc4x.java.s7.connection.S7PlcConnection;
 import org.apache.plc4x.java.spi.PlcDriver;
+import org.osgi.service.component.annotations.Component;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -36,6 +37,7 @@ import java.util.regex.Pattern;
  * - ISO on TCP (https://tools.ietf.org/html/rfc1006)
  * - TCP
  */
+@Component
 public class S7PlcDriver implements PlcDriver {
 
     private static final Pattern S7_URI_PATTERN = Pattern.compile("^s7://(?<host>.*)/(?<rack>\\d{1,4})/(?<slot>\\d{1,4})(?<params>\\?.*)?");


[plc4x] 05/25: [OSGi] Fixed Component Annotation.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 74ebb956f638d73c3616e2e783e476743e2f8d77
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Sun Oct 13 12:53:34 2019 +0200

    [OSGi] Fixed Component Annotation.
---
 .../drivers/s7/src/main/java/org/apache/plc4x/java/s7/S7PlcDriver.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/S7PlcDriver.java b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/S7PlcDriver.java
index 36efea1..8612e47 100644
--- a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/S7PlcDriver.java
+++ b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/S7PlcDriver.java
@@ -37,7 +37,7 @@ import java.util.regex.Pattern;
  * - ISO on TCP (https://tools.ietf.org/html/rfc1006)
  * - TCP
  */
-@Component
+@Component(service = PlcDriver.class, immediate = true)
 public class S7PlcDriver implements PlcDriver {
 
     private static final Pattern S7_URI_PATTERN = Pattern.compile("^s7://(?<host>.*)/(?<rack>\\d{1,4})/(?<slot>\\d{1,4})(?<params>\\?.*)?");


[plc4x] 25/25: - Configured the test to work with failsafe instead of surefire - Cleaned up the maven config

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit ecc5def89b051da3e4ffda1e3ea8741c31983925
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Fri Oct 18 15:16:30 2019 +0200

    - Configured the test to work with failsafe instead of surefire
    - Cleaned up the maven config
---
 plc4j/karaf-features/karaf-itest/pom.xml | 60 +++++++++++++++++---------------
 plc4j/karaf-features/pom.xml             | 32 +++++++++++++++--
 plc4j/karaf-features/s7/pom.xml          |  5 ++-
 pom.xml                                  | 13 +++++++
 4 files changed, 78 insertions(+), 32 deletions(-)

diff --git a/plc4j/karaf-features/karaf-itest/pom.xml b/plc4j/karaf-features/karaf-itest/pom.xml
index 00e4988..67a06d4 100644
--- a/plc4j/karaf-features/karaf-itest/pom.xml
+++ b/plc4j/karaf-features/karaf-itest/pom.xml
@@ -29,6 +29,8 @@
 
   <artifactId>karaf-itest</artifactId>
 
+  <name>PLC4J: Karaf-Features: Integration-Tests</name>
+
   <properties>
     <karaf.version>4.2.6</karaf.version>
     <pax.version>4.13.1</pax.version>
@@ -60,6 +62,13 @@
       <type>tar.gz</type>
     </dependency>
 
+    <!-- Add the surefire logger api as failsafe doesn't provide this -->
+    <dependency>
+      <groupId>org.apache.maven.surefire</groupId>
+      <artifactId>surefire-logger-api</artifactId>
+      <version>${surefire.version}</version>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-log4j12</artifactId>
@@ -130,7 +139,7 @@
       <!-- See https://issues.apache.org/jira/browse/KARAF-6457 -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
+        <artifactId>maven-failsafe-plugin</artifactId>
         <configuration>
           <forkCount>1</forkCount>
           <reuseForks>false</reuseForks>
@@ -152,34 +161,29 @@
           </systemPropertyVariables>
         </configuration>
       </plugin>
-      <!-- Run in the verify Phase -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>**/*IT.java</exclude>
-          </excludes>
-        </configuration>
-        <executions>
-          <execution>
-            <id>integration-test</id>
-            <goals>
-              <goal>test</goal>
-            </goals>
-            <phase>integration-test</phase>
-            <configuration>
-              <excludes>
-                <exclude>none</exclude>
-              </excludes>
-              <includes>
-                <include>**/*IT.java</include>
-              </includes>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
     </plugins>
   </build>
 
+  <!-- Karaf currently doesn't work with Java 12 and above -->
+  <!-- See: https://issues.apache.org/jira/projects/KARAF/issues/KARAF-6203 -->
+  <profiles>
+    <profile>
+      <id>java12andAbove</id>
+      <activation>
+        <jdk>(12,]</jdk>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-failsafe-plugin</artifactId>
+            <configuration>
+              <skip>true</skip>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
 </project>
\ No newline at end of file
diff --git a/plc4j/karaf-features/pom.xml b/plc4j/karaf-features/pom.xml
index 1400fd1..1d5d27f 100644
--- a/plc4j/karaf-features/pom.xml
+++ b/plc4j/karaf-features/pom.xml
@@ -20,22 +20,48 @@
 <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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
   <parent>
-    <!-- TODO Currnelty thats the easeist way to avoid importing of slf4j -->
-    <artifactId>plc4x-parent</artifactId>
     <groupId>org.apache.plc4x</groupId>
+    <artifactId>plc4j</artifactId>
     <version>0.5.0-SNAPSHOT</version>
   </parent>
-  <modelVersion>4.0.0</modelVersion>
 
   <artifactId>karaf-features</artifactId>
   <packaging>pom</packaging>
 
+  <name>PLC4J: Karaf-Features</name>
+
   <modules>
     <module>s7</module>
     <module>karaf-itest</module>
   </modules>
 
+  <dependencies>
+    <!-- Forcefully exclude slf4j -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.glassfish.jaxb</groupId>
+        <artifactId>jaxb-runtime</artifactId>
+        <version>2.3.2</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.configadmin</artifactId>
+        <version>1.9.14</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
   <build>
     <resources>
       <resource>
diff --git a/plc4j/karaf-features/s7/pom.xml b/plc4j/karaf-features/s7/pom.xml
index 36043d4..4ef3301 100644
--- a/plc4j/karaf-features/s7/pom.xml
+++ b/plc4j/karaf-features/s7/pom.xml
@@ -20,16 +20,19 @@
 <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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
   <parent>
     <artifactId>karaf-features</artifactId>
     <groupId>org.apache.plc4x</groupId>
     <version>0.5.0-SNAPSHOT</version>
   </parent>
-  <modelVersion>4.0.0</modelVersion>
 
   <artifactId>driver-s7-feature</artifactId>
   <packaging>feature</packaging>
 
+  <name>PLC4J: Karaf-Features: S7</name>
+
   <!-- This would be necessary with the kar goal which works not fine, yet -->
 <!--  <dependencies>-->
 <!--    <dependency>-->
diff --git a/pom.xml b/pom.xml
index 3812323..9c2d9ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -904,6 +904,19 @@
         </configuration>
       </plugin>
 
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>integration-test</goal>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
       <!-- Generate the legally required text files in the jars -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>


[plc4x] 14/25: - Removed the XSL again as it seems that it should also work without.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 6d4b4672ae465a054554d33a83fc022693138ada
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Oct 14 09:37:44 2019 +0200

    - Removed the XSL again as it seems that it should also work without.
---
 .../apache-karaf/karaf-s7-feature/pom.xml          | 29 -------------
 .../karaf-s7-feature/src/main/feature/feature.xslt | 47 ----------------------
 2 files changed, 76 deletions(-)

diff --git a/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
index 059298b..f614f0a 100644
--- a/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
@@ -47,35 +47,6 @@
         <artifactId>karaf-maven-plugin</artifactId>
       </plugin>
       <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>xml-maven-plugin</artifactId>
-        <version>1.0.2</version>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>transform</goal>
-            </goals>
-            <configuration>
-              <transformationSets>
-                <transformationSet>
-                  <dir>${build.directory}/feature</dir>
-                  <outputDir>${build.directory}/feature</outputDir>
-                  <stylesheet>src/main/feature/feature.xslt</stylesheet>
-                </transformationSet>
-              </transformationSets>
-            </configuration>
-          </execution>
-        </executions>
-        <dependencies>
-          <dependency>
-            <groupId>net.sf.saxon</groupId>
-            <artifactId>saxon</artifactId>
-            <version>8.7</version>
-          </dependency>
-        </dependencies>
-      </plugin>
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <configuration>
diff --git a/plc4j/integrations/apache-karaf/karaf-s7-feature/src/main/feature/feature.xslt b/plc4j/integrations/apache-karaf/karaf-s7-feature/src/main/feature/feature.xslt
deleted file mode 100644
index 1c4b621..0000000
--- a/plc4j/integrations/apache-karaf/karaf-s7-feature/src/main/feature/feature.xslt
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
-  -->
-<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"
-                xpath-default-namespace="http://karaf.apache.org/xmlns/features/v1.6.0">
-
-    <xsl:output indent="yes"/>
-
-    <xsl:template match="/features">
-        <features>
-            <xsl:copy-of select="@*"/>
-            <xsl:apply-templates/>
-        </features>
-    </xsl:template>
-
-    <xsl:template match="feature">
-        <feature>
-            <xsl:copy-of select="@*"/>
-            <xsl:copy-of select="details"/>
-            <xsl:copy-of select="feature"/>
-            <feature>scr</feature>
-            <xsl:copy-of select="bundle"/>
-        </feature>
-    </xsl:template>
-
-    <xsl:template match="*">
-        <xsl:copy-of select="."/>
-    </xsl:template>
-
-</xsl:stylesheet>


[plc4x] 11/25: [OSGi] Tests not running yet.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit ed195bd14277589bb3dc511813cd4ee6161b35ad
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Thu Oct 17 20:31:59 2019 +0200

    [OSGi] Tests not running yet.
---
 plc4j/karaf-features/karaf-itest/pom.xml           | 102 ++++-------
 .../java/org/apache/plc4x/karaf/FeatureITest.java  | 200 +++++++++++----------
 2 files changed, 139 insertions(+), 163 deletions(-)

diff --git a/plc4j/karaf-features/karaf-itest/pom.xml b/plc4j/karaf-features/karaf-itest/pom.xml
index 9d4e3f5..44b2a44 100644
--- a/plc4j/karaf-features/karaf-itest/pom.xml
+++ b/plc4j/karaf-features/karaf-itest/pom.xml
@@ -12,55 +12,49 @@
   <artifactId>karaf-itest</artifactId>
 
   <properties>
-    <dependency.karaf.version>4.2.1</dependency.karaf.version>
+    <karaf.version>4.2.1</karaf.version>
     <pax.version>4.13.1</pax.version>
   </properties>
 
   <dependencies>
-<!--    &lt;!&ndash; S7 Driver for Build &ndash;&gt;-->
-<!--    <dependency>-->
-<!--      <groupId>org.apache.plc4x</groupId>-->
-<!--      <artifactId>driver-s7-feature</artifactId>-->
-<!--      <version>0.5.0-SNAPSHOT</version>-->
-<!--      <scope>test</scope>-->
-<!--    </dependency>-->
-
-    <!-- Pax Exam Test setup -->
+    <!-- Provide the KarafTestSupport -->
     <dependency>
-      <groupId>org.ops4j.pax.exam.samples</groupId>
-      <artifactId>pax-exam-sample8-ds</artifactId>
-      <version>${pax.version}</version>
+      <groupId>org.apache.karaf.itests</groupId>
+      <artifactId>common</artifactId>
+      <version>${karaf.version}</version>
       <scope>test</scope>
     </dependency>
+    <!-- Define the Apache Karaf version to download and use for the test -->
+    <!-- We use a released version here to avoid SNAPSHOT resolution -->
     <dependency>
-      <groupId>org.apache.karaf.features</groupId>
-      <artifactId>standard</artifactId>
-      <version>${dependency.karaf.version}</version>
-      <classifier>features</classifier>
-      <type>xml</type>
+      <groupId>org.apache.karaf</groupId>
+      <artifactId>apache-karaf</artifactId>
+      <version>${karaf.version}</version>
       <scope>test</scope>
+      <type>tar.gz</type>
     </dependency>
 
     <dependency>
       <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>1.7.26</version>
       <scope>test</scope>
     </dependency>
-
+    <!-- Required to use shell commands in the tests -->
     <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>6.0.0</version>
-      <scope>provided</scope>
+      <groupId>org.apache.karaf.shell</groupId>
+      <artifactId>org.apache.karaf.shell.core</artifactId>
+      <version>${karaf.version}</version>
+      <scope>test</scope>
     </dependency>
-
-    <!-- Dependencies for pax exam karaf container -->
+    <!-- Provide the PaxExam Karaf support -->
     <dependency>
       <groupId>org.ops4j.pax.exam</groupId>
       <artifactId>pax-exam-container-karaf</artifactId>
       <version>${pax.version}</version>
       <scope>test</scope>
     </dependency>
+    <!-- Provide the PaxExam JUnit extension -->
     <dependency>
       <groupId>org.ops4j.pax.exam</groupId>
       <artifactId>pax-exam-junit4</artifactId>
@@ -68,57 +62,29 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam</artifactId>
-      <version>${pax.version}</version>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-atinject_1.0_spec</artifactId>
+      <version>1.1</version>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.ops4j.pax.url</groupId>
-      <artifactId>pax-url-aether</artifactId>
-      <version>2.6.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>javax.inject</groupId>
-      <artifactId>javax.inject</artifactId>
-      <version>1</version>
-      <scope>test</scope>
+      <groupId>org.awaitility</groupId>
+      <artifactId>awaitility</artifactId>
+      <version>3.1.6</version>
     </dependency>
-
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
+      <groupId>org.apache.servicemix.bundles</groupId>
+      <artifactId>org.apache.servicemix.bundles.hamcrest</artifactId>
+      <version>1.3_1</version>
+      <scope>runtime</scope>
     </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-api</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.karaf.features</groupId>
-      <artifactId>org.apache.karaf.features.core</artifactId>
-      <version>${dependency.karaf.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.karaf.bundle</groupId>
-      <artifactId>org.apache.karaf.bundle.core</artifactId>
-      <version>${dependency.karaf.version}</version>
-      <scope>test</scope>
-    </dependency>
-
   </dependencies>
 
   <build>
     <plugins>
-      <!-- Needed if you use versionAsInProject() -->
       <plugin>
         <groupId>org.apache.servicemix.tooling</groupId>
         <artifactId>depends-maven-plugin</artifactId>
-        <version>1.4.0</version>
         <executions>
           <execution>
             <id>generate-depends-file</id>
@@ -128,14 +94,6 @@
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <systemPropertyVariables>
-            <pax.exam.karaf.version>${dependency.karaf.version}</pax.exam.karaf.version>
-          </systemPropertyVariables>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 
diff --git a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
index 1efc1db..b7a12a6 100644
--- a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
+++ b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
@@ -13,119 +13,137 @@
  */
 package org.apache.plc4x.karaf;
 
-import org.apache.karaf.bundle.core.BundleService;
+import org.apache.karaf.features.Feature;
 import org.apache.karaf.features.FeaturesService;
-import org.apache.plc4x.java.spi.PlcDriver;
+import org.apache.karaf.itests.KarafTestSupport;
+import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.ConfigurationManager;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.container.internal.JavaVersionUtil;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption;
 import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
-import org.ops4j.pax.exam.options.MavenUrlReference;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.ops4j.pax.exam.options.extra.VMOption;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
 
-import javax.inject.Inject;
 import java.io.File;
-import java.util.Arrays;
-import java.util.Optional;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.bundle;
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureSecurity;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
 
 @RunWith(PaxExam.class)
-public class FeatureITest {
-
-    private static Logger LOG = LoggerFactory.getLogger(FeatureITest.class);
-
-    @Inject
-    private FeaturesService featuresService;
-
-    @Inject
-    private BundleContext bundleContext;
+@ExamReactorStrategy(PerClass.class)
+public class FeatureITest extends KarafTestSupport {
 
+    @Override
     @Configuration
     public Option[] config() {
-        MavenArtifactUrlReference karafUrl = maven()
-            .groupId("org.apache.karaf")
-            .artifactId("apache-karaf")
-            .version(karafVersion())
-            .type("zip");
-
-        MavenUrlReference karafStandardRepo = maven()
-            .groupId("org.apache.karaf.features")
-            .artifactId("standard")
-            .version(karafVersion())
-            .classifier("features")
-            .type("xml");
-
-        final MavenArtifactUrlReference plc4xRepo = maven()
-            .groupId("org.apache.plc4x")
-            .artifactId("driver-s7-feature")
-            .version("0.5.0-SNAPSHOT")
-            .classifier("features")
-            .type("xml");
-        return new Option[] {
-            // KarafDistributionOption.debugConfiguration("5005", true),
-            karafDistributionConfiguration()
-                .frameworkUrl(karafUrl)
-                .unpackDirectory(new File("target", "exam"))
-                .useDeployFolder(false),
-            keepRuntimeFolder(),
-            configureConsole().ignoreLocalConsole(),
-            features(karafStandardRepo , "scr"),
-            features(plc4xRepo, "driver-s7-feature"),
-            mavenBundle()
-                .groupId("org.apache.plc4x")
-                .artifactId("plc4j-driver-s7")
-                .version("0.5.0-SNAPSHOT")
-                .start()
-        };
-    }
-
-    public static String karafVersion() {
-        ConfigurationManager cm = new ConfigurationManager();
-        String karafVersion = cm.getProperty("pax.exam.karaf.version", "3.0.0");
-        return karafVersion;
-    }
-
+        MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("tar.gz");
+
+        String httpPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_HTTP_PORT), Integer.parseInt(MAX_HTTP_PORT)));
+        String rmiRegistryPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_REG_PORT), Integer.parseInt(MAX_RMI_REG_PORT)));
+        String rmiServerPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_SERVER_PORT), Integer.parseInt(MAX_RMI_SERVER_PORT)));
+        String sshPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_SSH_PORT), Integer.parseInt(MAX_SSH_PORT)));
+        String localRepository = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
+        if (localRepository == null) {
+            localRepository = "";
+        }
 
-    @Test
-    public void checkFeatureInstalled() throws Exception {
-        assertTrue(
-            featuresService.isInstalled(featuresService.getFeature("driver-s7-feature"))
-        );
+        if (JavaVersionUtil.getMajorVersion() >= 9) {
+            return new Option[]{
+                //KarafDistributionOption.debugConfiguration("8889", true),
+                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
+                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
+                configureSecurity().disableKarafMBeanServerBuilder(),
+                // configureConsole().ignoreLocalConsole(),
+                keepRuntimeFolder(),
+                logLevel(LogLevelOption.LogLevel.INFO),
+                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
+                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
+                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
+                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
+                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
+                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
+                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
+                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository),
+                new VMOption("--add-reads=java.xml=java.logging"),
+                new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
+                new VMOption("--patch-module"),
+                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
+                    + System.getProperty("karaf.version") + ".jar"),
+                new VMOption("--patch-module"),
+                new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
+                    + System.getProperty("karaf.version") + ".jar"),
+                new VMOption("--add-opens"),
+                new VMOption("java.base/java.security=ALL-UNNAMED"),
+                new VMOption("--add-opens"),
+                new VMOption("java.base/java.net=ALL-UNNAMED"),
+                new VMOption("--add-opens"),
+                new VMOption("java.base/java.lang=ALL-UNNAMED"),
+                new VMOption("--add-opens"),
+                new VMOption("java.base/java.util=ALL-UNNAMED"),
+                new VMOption("--add-opens"),
+                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
+                new VMOption("--add-opens"),
+                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
+                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
+                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
+                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
+                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
+                new VMOption("-classpath"),
+                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
+            };
+        } else {
+            return new Option[]{
+                //KarafDistributionOption.debugConfiguration("8889", true),
+                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
+                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
+                configureSecurity().disableKarafMBeanServerBuilder(),
+                // configureConsole().ignoreLocalConsole(),
+                keepRuntimeFolder(),
+                logLevel(LogLevelOption.LogLevel.INFO),
+                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
+                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
+                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
+                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
+                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
+                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
+                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
+                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository)
+            };
+        }
     }
 
     @Test
-    public void checkBundleStarted() throws Exception {
-        for (Bundle bundle : bundleContext.getBundles()) {
-            System.out.println(bundle.getSymbolicName());
-        }
-
-        // Try to find the bundle
-        final Optional<Bundle> optionalBundle = Arrays.stream(bundleContext.getBundles())
-            .filter(bundle -> "org.apache.plc4x.plc4j-driver-s7".equals(bundle.getSymbolicName()))
-            .findFirst();
-
-        // Ensure that the bundle is resolved
-        assertTrue(optionalBundle.isPresent());
-
-        // Check if the bundle is active
-        assertEquals(Bundle.ACTIVE, optionalBundle.get().getState());
+    public void installAndAssertFeature() throws Exception {
+        // ...
+        final MavenArtifactUrlReference featureRepo = maven()
+            .groupId("org.apache.plc4x")
+            .artifactId("driver-s7-feature")
+            .versionAsInProject()
+            .classifier("xml")
+            .type("feature");
+
+        System.out.println(featureRepo.getURL());
+
+        // ...
+        addFeaturesRepository(featureRepo.getURL());
+        // ...
+        installAndAssertFeature("driver-s7-feature");
+        // Print Bundles
+        String bundles = executeCommand("bundle:list -t 0");
+        System.out.println(bundles);
+        // Print features
+        String features = executeCommand("feature:list -i");
+        System.out.print(features);
     }
 
-}
+}
\ No newline at end of file


[plc4x] 01/25: [OSGi] Resolved all split package situations.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 66d3c86ad24b36221fd32315342dd310f83cd80c
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Sun Oct 13 11:32:24 2019 +0200

    [OSGi] Resolved all split package situations.
---
 .../apache/plc4x/java/ads/connection/AdsSerialPlcConnection.java    | 2 +-
 .../src/test/java/org/apache/plc4x/java/ads/AdsPlcDriverTest.java   | 2 +-
 .../apache/plc4x/java/ads/connection/AdsConnectionFactoryTest.java  | 2 +-
 .../plc4x/java/ads/connection/AdsSerialPlcConnectionTest.java       | 4 ++--
 .../plc4x/java/modbus/connection/ModbusSerialPlcConnection.java     | 2 +-
 .../test/java/org/apache/plc4x/java/modbus/ModbusPlcDriverTest.java | 2 +-
 .../plc4x/java/modbus/connection/ModbusConnectionFactoryTest.java   | 2 +-
 .../plc4x/java/modbus/connection/ModbusSerialPlcConnectionTest.java | 4 ++--
 .../org/apache/plc4x/java/s7/connection/S7PlcTestConnection.java    | 2 +-
 .../src/test/java/org/apache/plc4x/edgent/mock/MockConnection.java  | 2 +-
 .../ads/src/test/java/org/apache/plc4x/java/ads/AdsDumper.java      | 2 +-
 .../java/ads/api/commands/types/AdsNotificationSampleTest.java      | 2 +-
 .../plc4x/java/ads/api/commands/types/AdsStampHeaderTest.java       | 2 +-
 .../ads/protocol/Payload2SerialProtocolExampleConversationTest.java | 2 +-
 .../org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocolTest.java   | 4 ++--
 .../org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java     | 2 +-
 .../java/{base => serial/connection}/connection/SerialChannel.java  | 3 +--
 .../connection}/connection/SerialChannelFactory.java                | 3 ++-
 .../connection}/connection/SerialChannelHandler.java                | 2 +-
 .../connection}/connection/SerialPollingSelector.java               | 5 +----
 .../{base => serial/connection}/connection/SerialSelectionKey.java  | 3 +--
 .../connection}/connection/SerialSelectorProvider.java              | 2 +-
 .../{base => serial/connection}/connection/SerialSocketAddress.java | 2 +-
 .../{base => serial/connection}/connection/SerialSocketChannel.java | 2 +-
 .../apache/plc4x/java/base/connection/SerialChannelFactoryTest.java | 3 +++
 .../java/{base => tcp}/connection/TcpSocketChannelFactory.java      | 3 ++-
 .../apache/plc4x/java/{base => mock}/connection/MockConnection.java | 3 ++-
 .../plc4x/java/{base => mock}/connection/TestChannelFactory.java    | 3 ++-
 .../plc4x/java/{base => mock}/connection/tcp/TcpHexDumper.java      | 2 +-
 .../plc4x/java/{base => mock}/protocol/Plc4XSupportedDataTypes.java | 2 +-
 .../main/java/org/apache/plc4x/java/{base => mock}/util/Assert.java | 2 +-
 .../java/org/apache/plc4x/java/{base => mock}/util/HexUtil.java     | 2 +-
 .../java/org/apache/plc4x/java/modbus/ManualPlc4XModbusTest.java    | 2 +-
 .../org/apache/plc4x/java/modbus/netty/Plc4XModbusProtocolTest.java | 6 +++---
 .../org/apache/plc4x/java/df1/connection/SerialDf1Connection.java   | 2 +-
 35 files changed, 46 insertions(+), 44 deletions(-)

diff --git a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsSerialPlcConnection.java b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsSerialPlcConnection.java
index d9094fa..c079647 100644
--- a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsSerialPlcConnection.java
+++ b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsSerialPlcConnection.java
@@ -28,7 +28,7 @@ import org.apache.plc4x.java.ads.protocol.Ads2PayloadProtocol;
 import org.apache.plc4x.java.ads.protocol.Payload2SerialProtocol;
 import org.apache.plc4x.java.ads.protocol.Plc4x2AdsProtocol;
 import org.apache.plc4x.java.ads.protocol.util.SingleMessageRateLimiter;
-import org.apache.plc4x.java.base.connection.SerialChannelFactory;
+import org.apache.plc4x.java.serial.connection.connection.SerialChannelFactory;
 import org.apache.plc4x.java.base.protocol.SingleItemToSingleRequestProtocol;
 
 import java.util.concurrent.CompletableFuture;
diff --git a/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/AdsPlcDriverTest.java b/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/AdsPlcDriverTest.java
index 0894b3c..5fc5185 100644
--- a/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/AdsPlcDriverTest.java
+++ b/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/AdsPlcDriverTest.java
@@ -27,7 +27,7 @@ import org.apache.plc4x.java.api.authentication.PlcUsernamePasswordAuthenticatio
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
 import org.apache.plc4x.java.api.exceptions.PlcException;
 import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
-import org.apache.plc4x.java.base.connection.tcp.TcpHexDumper;
+import org.apache.plc4x.java.mock.connection.tcp.TcpHexDumper;
 import org.apache.plc4x.test.RequireInternetConnection;
 import org.junit.jupiter.api.*;
 
diff --git a/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsConnectionFactoryTest.java b/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsConnectionFactoryTest.java
index e9cff09..3b9beb1 100644
--- a/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsConnectionFactoryTest.java
+++ b/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsConnectionFactoryTest.java
@@ -22,7 +22,7 @@ import org.apache.commons.lang3.reflect.FieldUtils;
 import org.apache.plc4x.java.ads.api.generic.types.AmsNetId;
 import org.apache.plc4x.java.ads.api.generic.types.AmsPort;
 import org.apache.plc4x.java.base.connection.NettyPlcConnection;
-import org.apache.plc4x.java.base.connection.SerialChannelFactory;
+import org.apache.plc4x.java.serial.connection.connection.SerialChannelFactory;
 import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
 import org.junit.Assert;
 import org.junit.Test;
diff --git a/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsSerialPlcConnectionTest.java b/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsSerialPlcConnectionTest.java
index 71f68cc..398b3f2 100644
--- a/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsSerialPlcConnectionTest.java
+++ b/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsSerialPlcConnectionTest.java
@@ -30,8 +30,8 @@ import org.apache.plc4x.java.ads.api.serial.types.*;
 import org.apache.plc4x.java.api.messages.PlcReadRequest;
 import org.apache.plc4x.java.api.messages.PlcReadResponse;
 import org.apache.plc4x.java.base.connection.NettyPlcConnection;
-import org.apache.plc4x.java.base.connection.SerialChannelFactory;
-import org.apache.plc4x.java.base.connection.SerialSocketAddress;
+import org.apache.plc4x.java.serial.connection.connection.SerialChannelFactory;
+import org.apache.plc4x.java.serial.connection.connection.SerialSocketAddress;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/connection/ModbusSerialPlcConnection.java b/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/connection/ModbusSerialPlcConnection.java
index 5b5fa31..e3f0695 100644
--- a/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/connection/ModbusSerialPlcConnection.java
+++ b/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/connection/ModbusSerialPlcConnection.java
@@ -20,7 +20,7 @@ package org.apache.plc4x.java.modbus.connection;
 
 import io.netty.channel.ChannelHandler;
 import org.apache.commons.lang3.NotImplementedException;
-import org.apache.plc4x.java.base.connection.SerialChannelFactory;
+import org.apache.plc4x.java.serial.connection.connection.SerialChannelFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/ModbusPlcDriverTest.java b/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/ModbusPlcDriverTest.java
index d2bea5e..1e2bb72 100644
--- a/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/ModbusPlcDriverTest.java
+++ b/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/ModbusPlcDriverTest.java
@@ -24,7 +24,7 @@ import org.apache.plc4x.java.api.authentication.PlcUsernamePasswordAuthenticatio
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
 import org.apache.plc4x.java.api.exceptions.PlcException;
 import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
-import org.apache.plc4x.java.base.connection.tcp.TcpHexDumper;
+import org.apache.plc4x.java.mock.connection.tcp.TcpHexDumper;
 import org.apache.plc4x.java.modbus.connection.ModbusConnectionFactory;
 import org.apache.plc4x.java.modbus.connection.ModbusTcpPlcConnection;
 import org.junit.Rule;
diff --git a/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusConnectionFactoryTest.java b/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusConnectionFactoryTest.java
index dd04648..8987f13 100644
--- a/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusConnectionFactoryTest.java
+++ b/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusConnectionFactoryTest.java
@@ -20,7 +20,7 @@ package org.apache.plc4x.java.modbus.connection;
 
 import org.apache.commons.lang3.reflect.FieldUtils;
 import org.apache.plc4x.java.base.connection.NettyPlcConnection;
-import org.apache.plc4x.java.base.connection.SerialChannelFactory;
+import org.apache.plc4x.java.serial.connection.connection.SerialChannelFactory;
 import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusSerialPlcConnectionTest.java b/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusSerialPlcConnectionTest.java
index 5d89a54..a7b466b 100644
--- a/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusSerialPlcConnectionTest.java
+++ b/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusSerialPlcConnectionTest.java
@@ -26,8 +26,8 @@ import org.apache.commons.lang3.reflect.MethodUtils;
 import org.apache.plc4x.java.api.messages.PlcReadRequest;
 import org.apache.plc4x.java.api.messages.PlcReadResponse;
 import org.apache.plc4x.java.base.connection.NettyPlcConnection;
-import org.apache.plc4x.java.base.connection.SerialChannelFactory;
-import org.apache.plc4x.java.base.connection.SerialSocketAddress;
+import org.apache.plc4x.java.serial.connection.connection.SerialChannelFactory;
+import org.apache.plc4x.java.serial.connection.connection.SerialSocketAddress;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
diff --git a/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcTestConnection.java b/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcTestConnection.java
index 52b80f3..db28bef 100644
--- a/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcTestConnection.java
+++ b/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcTestConnection.java
@@ -23,7 +23,7 @@ import io.netty.buffer.Unpooled;
 import io.netty.channel.embedded.EmbeddedChannel;
 import org.apache.commons.io.IOUtils;
 import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
-import org.apache.plc4x.java.base.connection.TestChannelFactory;
+import org.apache.plc4x.java.mock.connection.TestChannelFactory;
 import org.junit.jupiter.api.TestInfo;
 import org.pcap4j.core.*;
 import org.pcap4j.packet.Packet;
diff --git a/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockConnection.java b/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockConnection.java
index d30a9bf..05d8b5d 100644
--- a/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockConnection.java
+++ b/plc4j/integrations/apache-edgent/src/test/java/org/apache/plc4x/edgent/mock/MockConnection.java
@@ -36,7 +36,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
-public class MockConnection extends org.apache.plc4x.java.base.connection.MockConnection implements PlcReader, PlcWriter {
+public class MockConnection extends org.apache.plc4x.java.mock.connection.MockConnection implements PlcReader, PlcWriter {
 
     private final String url;
     private final PlcAuthentication authentication;
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/AdsDumper.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/AdsDumper.java
index 52a4b22..5ebd7cb 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/AdsDumper.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/AdsDumper.java
@@ -28,7 +28,7 @@ import org.apache.plc4x.java.ads.api.generic.types.AmsPort;
 import org.apache.plc4x.java.ads.api.generic.types.Invoke;
 import org.apache.plc4x.java.ads.api.tcp.AmsTCPPacket;
 import org.apache.plc4x.java.ads.api.tcp.types.UserData;
-import org.apache.plc4x.java.base.connection.tcp.TcpHexDumper;
+import org.apache.plc4x.java.mock.connection.tcp.TcpHexDumper;
 import org.pcap4j.core.PcapDumper;
 import org.pcap4j.core.PcapHandle;
 import org.pcap4j.core.Pcaps;
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/AdsNotificationSampleTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/AdsNotificationSampleTest.java
index 1627685..be6bed9 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/AdsNotificationSampleTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/AdsNotificationSampleTest.java
@@ -20,7 +20,7 @@ package org.apache.plc4x.java.ads.api.commands.types;
 
 import org.junit.Test;
 
-import static org.apache.plc4x.java.base.util.Assert.assertByteEquals;
+import static org.apache.plc4x.java.mock.util.Assert.assertByteEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/AdsStampHeaderTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/AdsStampHeaderTest.java
index 2cc1e89..abee06d 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/AdsStampHeaderTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/types/AdsStampHeaderTest.java
@@ -22,7 +22,7 @@ import org.junit.Test;
 
 import java.util.Arrays;
 
-import static org.apache.plc4x.java.base.util.Assert.assertByteEquals;
+import static org.apache.plc4x.java.mock.util.Assert.assertByteEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Payload2SerialProtocolExampleConversationTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Payload2SerialProtocolExampleConversationTest.java
index 2bcd132..107d4f9 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Payload2SerialProtocolExampleConversationTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Payload2SerialProtocolExampleConversationTest.java
@@ -51,7 +51,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import static org.apache.plc4x.java.base.util.Assert.byteArrayEqualsTo;
+import static org.apache.plc4x.java.mock.util.Assert.byteArrayEqualsTo;
 import static org.mockito.Mockito.*;
 
 /**
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocolTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocolTest.java
index 69d08d2..0ab4c67 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocolTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/Plc4x2AdsProtocolTest.java
@@ -34,7 +34,7 @@ import org.apache.plc4x.java.ads.api.generic.types.Invoke;
 import org.apache.plc4x.java.ads.model.AdsDataType;
 import org.apache.plc4x.java.ads.model.AdsPlcFieldHandler;
 import org.apache.plc4x.java.base.messages.*;
-import org.apache.plc4x.java.base.protocol.Plc4XSupportedDataTypes;
+import org.apache.plc4x.java.mock.protocol.Plc4XSupportedDataTypes;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Rule;
@@ -59,7 +59,7 @@ import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import static org.apache.plc4x.java.base.protocol.Plc4XSupportedDataTypes.streamOfLittleEndianDataTypePairs;
+import static org.apache.plc4x.java.mock.protocol.Plc4XSupportedDataTypes.streamOfLittleEndianDataTypePairs;
 import static org.hamcrest.Matchers.*;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assume.assumeThat;
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java
index 5271462..b0c99e0 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java
@@ -30,7 +30,7 @@ import java.util.Arrays;
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
 
-import static org.apache.plc4x.java.base.util.Assert.assertByteEquals;
+import static org.apache.plc4x.java.mock.util.Assert.assertByteEquals;
 import static org.junit.Assert.assertEquals;
 
 public class DigestUtilTest {
diff --git a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialChannel.java b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialChannel.java
similarity index 99%
rename from plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialChannel.java
rename to plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialChannel.java
index 0a73edb..762d3f7 100644
--- a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialChannel.java
+++ b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialChannel.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.serial.connection.connection;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
@@ -39,7 +39,6 @@ import java.lang.reflect.Method;
 import java.net.SocketAddress;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.SelectableChannel;
-import java.nio.channels.SocketChannel;
 import java.util.concurrent.RejectedExecutionException;
 
 /**
diff --git a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialChannelFactory.java b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialChannelFactory.java
similarity index 96%
rename from plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialChannelFactory.java
rename to plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialChannelFactory.java
index 2e0e422..0271211 100644
--- a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialChannelFactory.java
+++ b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialChannelFactory.java
@@ -16,7 +16,7 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.serial.connection.connection;
 
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.Channel;
@@ -26,6 +26,7 @@ import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GenericFutureListener;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
+import org.apache.plc4x.java.base.connection.ChannelFactory;
 
 import java.net.SocketAddress;
 import java.util.concurrent.Executor;
diff --git a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialChannelHandler.java b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialChannelHandler.java
similarity index 98%
rename from plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialChannelHandler.java
rename to plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialChannelHandler.java
index 226587b..d57cb3f 100644
--- a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialChannelHandler.java
+++ b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialChannelHandler.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.serial.connection.connection;
 
 import com.fazecast.jSerialComm.SerialPort;
 import com.fazecast.jSerialComm.SerialPortDataListener;
diff --git a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialPollingSelector.java b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialPollingSelector.java
similarity index 97%
rename from plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialPollingSelector.java
rename to plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialPollingSelector.java
index c68524d..38565b0 100644
--- a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialPollingSelector.java
+++ b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialPollingSelector.java
@@ -17,9 +17,8 @@
  * under the License.
  */
 
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.serial.connection.connection;
 
-import io.netty.channel.VoidChannelPromise;
 import io.netty.util.concurrent.DefaultEventExecutor;
 import io.netty.util.concurrent.DefaultPromise;
 import org.apache.commons.lang3.NotImplementedException;
@@ -30,12 +29,10 @@ import java.io.IOException;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.nio.channels.spi.AbstractSelectableChannel;
-import java.nio.channels.spi.AbstractSelectionKey;
 import java.nio.channels.spi.AbstractSelector;
 import java.nio.channels.spi.SelectorProvider;
 import java.util.ArrayList;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
diff --git a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSelectionKey.java b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSelectionKey.java
similarity index 95%
rename from plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSelectionKey.java
rename to plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSelectionKey.java
index 0fb1197..4ffeee4 100644
--- a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSelectionKey.java
+++ b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSelectionKey.java
@@ -17,9 +17,8 @@
  * under the License.
  */
 
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.serial.connection.connection;
 
-import org.apache.commons.lang3.NotImplementedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSelectorProvider.java b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSelectorProvider.java
similarity index 97%
rename from plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSelectorProvider.java
rename to plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSelectorProvider.java
index f7f37a0..6a47284 100644
--- a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSelectorProvider.java
+++ b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSelectorProvider.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.serial.connection.connection;
 
 import org.apache.commons.lang3.NotImplementedException;
 
diff --git a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSocketAddress.java b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSocketAddress.java
similarity index 96%
rename from plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSocketAddress.java
rename to plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSocketAddress.java
index ab3466b..166ab65 100644
--- a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSocketAddress.java
+++ b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSocketAddress.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.serial.connection.connection;
 
 import java.net.SocketAddress;
 import java.util.Objects;
diff --git a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSocketChannel.java b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSocketChannel.java
similarity index 98%
rename from plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSocketChannel.java
rename to plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSocketChannel.java
index 3c17605..340d36b 100644
--- a/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/base/connection/SerialSocketChannel.java
+++ b/plc4j/protocols/driver-bases/serial/src/main/java/org/apache/plc4x/java/serial/connection/connection/SerialSocketChannel.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.serial.connection.connection;
 
 import org.apache.commons.lang3.NotImplementedException;
 import org.slf4j.Logger;
diff --git a/plc4j/protocols/driver-bases/serial/src/test/java/org/apache/plc4x/java/base/connection/SerialChannelFactoryTest.java b/plc4j/protocols/driver-bases/serial/src/test/java/org/apache/plc4x/java/base/connection/SerialChannelFactoryTest.java
index 9648a4e..b62d8d0 100644
--- a/plc4j/protocols/driver-bases/serial/src/test/java/org/apache/plc4x/java/base/connection/SerialChannelFactoryTest.java
+++ b/plc4j/protocols/driver-bases/serial/src/test/java/org/apache/plc4x/java/base/connection/SerialChannelFactoryTest.java
@@ -26,6 +26,9 @@ import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInitializer;
 import io.netty.handler.codec.ByteToMessageCodec;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
+import org.apache.plc4x.java.serial.connection.connection.SerialChannel;
+import org.apache.plc4x.java.serial.connection.connection.SerialChannelFactory;
+import org.apache.plc4x.java.serial.connection.connection.SerialChannelHandler;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
diff --git a/plc4j/protocols/driver-bases/tcp/src/main/java/org/apache/plc4x/java/base/connection/TcpSocketChannelFactory.java b/plc4j/protocols/driver-bases/tcp/src/main/java/org/apache/plc4x/java/tcp/connection/TcpSocketChannelFactory.java
similarity index 97%
rename from plc4j/protocols/driver-bases/tcp/src/main/java/org/apache/plc4x/java/base/connection/TcpSocketChannelFactory.java
rename to plc4j/protocols/driver-bases/tcp/src/main/java/org/apache/plc4x/java/tcp/connection/TcpSocketChannelFactory.java
index 2642af9..ce21c61 100644
--- a/plc4j/protocols/driver-bases/tcp/src/main/java/org/apache/plc4x/java/base/connection/TcpSocketChannelFactory.java
+++ b/plc4j/protocols/driver-bases/tcp/src/main/java/org/apache/plc4x/java/tcp/connection/TcpSocketChannelFactory.java
@@ -16,7 +16,7 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.tcp.connection;
 
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.Channel;
@@ -29,6 +29,7 @@ import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GenericFutureListener;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
 import org.apache.plc4x.java.api.exceptions.PlcException;
+import org.apache.plc4x.java.base.connection.ChannelFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/connection/MockConnection.java b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/connection/MockConnection.java
similarity index 91%
rename from plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/connection/MockConnection.java
rename to plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/connection/MockConnection.java
index 5d265b8..8cf2005 100644
--- a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/connection/MockConnection.java
+++ b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/connection/MockConnection.java
@@ -16,9 +16,10 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.mock.connection;
 
 import io.netty.channel.ChannelHandler;
+import org.apache.plc4x.java.base.connection.NettyPlcConnection;
 
 import java.util.concurrent.CompletableFuture;
 
diff --git a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/connection/TestChannelFactory.java b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/connection/TestChannelFactory.java
similarity index 92%
rename from plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/connection/TestChannelFactory.java
rename to plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/connection/TestChannelFactory.java
index 2b01d74..0a9403d 100644
--- a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/connection/TestChannelFactory.java
+++ b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/connection/TestChannelFactory.java
@@ -16,11 +16,12 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */
-package org.apache.plc4x.java.base.connection;
+package org.apache.plc4x.java.mock.connection;
 
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.embedded.EmbeddedChannel;
+import org.apache.plc4x.java.base.connection.ChannelFactory;
 
 public class TestChannelFactory implements ChannelFactory {
 
diff --git a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/connection/tcp/TcpHexDumper.java b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/connection/tcp/TcpHexDumper.java
similarity index 98%
rename from plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/connection/tcp/TcpHexDumper.java
rename to plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/connection/tcp/TcpHexDumper.java
index dd2a193..0be77df 100644
--- a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/connection/tcp/TcpHexDumper.java
+++ b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/connection/tcp/TcpHexDumper.java
@@ -16,7 +16,7 @@
  specific language governing permissions and limitations
  under the License.
  */
-package org.apache.plc4x.java.base.connection.tcp;
+package org.apache.plc4x.java.mock.connection.tcp;
 
 import org.apache.commons.io.HexDump;
 import org.apache.commons.io.IOUtils;
diff --git a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/protocol/Plc4XSupportedDataTypes.java b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/protocol/Plc4XSupportedDataTypes.java
similarity index 99%
rename from plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/protocol/Plc4XSupportedDataTypes.java
rename to plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/protocol/Plc4XSupportedDataTypes.java
index 614e105..c7ed153 100644
--- a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/protocol/Plc4XSupportedDataTypes.java
+++ b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/protocol/Plc4XSupportedDataTypes.java
@@ -16,7 +16,7 @@
  specific language governing permissions and limitations
  under the License.
  */
-package org.apache.plc4x.java.base.protocol;
+package org.apache.plc4x.java.mock.protocol;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.SerializationUtils;
diff --git a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/util/Assert.java b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/util/Assert.java
similarity index 98%
rename from plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/util/Assert.java
rename to plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/util/Assert.java
index 6913d8e..de32c1d 100644
--- a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/util/Assert.java
+++ b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/util/Assert.java
@@ -16,7 +16,7 @@
  specific language governing permissions and limitations
  under the License.
  */
-package org.apache.plc4x.java.base.util;
+package org.apache.plc4x.java.mock.util;
 
 import org.apache.commons.io.HexDump;
 import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
diff --git a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/util/HexUtil.java b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/util/HexUtil.java
similarity index 97%
rename from plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/util/HexUtil.java
rename to plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/util/HexUtil.java
index 83b425c..cf5bcc0 100644
--- a/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/base/util/HexUtil.java
+++ b/plc4j/protocols/driver-bases/test/src/main/java/org/apache/plc4x/java/mock/util/HexUtil.java
@@ -17,7 +17,7 @@
  under the License.
  */
 
-package org.apache.plc4x.java.base.util;
+package org.apache.plc4x.java.mock.util;
 
 import org.apache.commons.io.HexDump;
 import org.apache.commons.lang3.ArrayUtils;
diff --git a/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/ManualPlc4XModbusTest.java b/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/ManualPlc4XModbusTest.java
index 85c5f2c..a0870bd 100644
--- a/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/ManualPlc4XModbusTest.java
+++ b/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/ManualPlc4XModbusTest.java
@@ -25,7 +25,7 @@ import org.apache.plc4x.java.api.messages.PlcReadRequest;
 import org.apache.plc4x.java.api.messages.PlcReadResponse;
 import org.apache.plc4x.java.api.messages.PlcWriteRequest;
 import org.apache.plc4x.java.api.messages.PlcWriteResponse;
-import org.apache.plc4x.java.base.util.HexUtil;
+import org.apache.plc4x.java.mock.util.HexUtil;
 
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
diff --git a/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/netty/Plc4XModbusProtocolTest.java b/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/netty/Plc4XModbusProtocolTest.java
index c181533..a746a23 100644
--- a/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/netty/Plc4XModbusProtocolTest.java
+++ b/plc4j/protocols/modbus/src/test/java/org/apache/plc4x/java/modbus/netty/Plc4XModbusProtocolTest.java
@@ -28,7 +28,7 @@ import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.plc4x.java.api.messages.PlcResponse;
 import org.apache.plc4x.java.base.messages.*;
-import org.apache.plc4x.java.base.protocol.Plc4XSupportedDataTypes;
+import org.apache.plc4x.java.mock.protocol.Plc4XSupportedDataTypes;
 import org.apache.plc4x.java.modbus.util.ModbusPlcFieldHandler;
 import org.junit.Before;
 import org.junit.Rule;
@@ -45,8 +45,8 @@ import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import static org.apache.plc4x.java.base.protocol.Plc4XSupportedDataTypes.streamOfBigEndianDataTypePairs;
-import static org.apache.plc4x.java.base.util.Assert.assertByteEquals;
+import static org.apache.plc4x.java.mock.protocol.Plc4XSupportedDataTypes.streamOfBigEndianDataTypePairs;
+import static org.apache.plc4x.java.mock.util.Assert.assertByteEquals;
 import static org.hamcrest.Matchers.*;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assume.assumeThat;
diff --git a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/connection/SerialDf1Connection.java b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/connection/SerialDf1Connection.java
index 4a07499..6b738de 100644
--- a/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/connection/SerialDf1Connection.java
+++ b/sandbox/test-java-df1-driver/src/main/java/org/apache/plc4x/java/df1/connection/SerialDf1Connection.java
@@ -25,7 +25,7 @@ import org.apache.plc4x.java.api.messages.PlcReadResponse;
 import org.apache.plc4x.java.api.messages.PlcWriteRequest;
 import org.apache.plc4x.java.api.messages.PlcWriteResponse;
 import org.apache.plc4x.java.base.connection.ChannelFactory;
-import org.apache.plc4x.java.base.connection.SerialChannelFactory;
+import org.apache.plc4x.java.serial.connection.connection.SerialChannelFactory;
 import org.apache.plc4x.java.base.events.ConnectedEvent;
 import org.apache.plc4x.java.base.messages.*;
 import org.apache.plc4x.java.df1.protocol.Df1Protocol;


[plc4x] 02/25: [OSGi] Fixing changed package names.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit e53fb115e1f6e2af88b5f5b375d15595c11e3c65
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Sun Oct 13 12:00:43 2019 +0200

    [OSGi] Fixing changed package names.
---
 .../java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java | 3 ++-
 .../org/apache/plc4x/java/ads/connection/AdsConnectionFactoryTest.java | 2 +-
 .../plc4x/java/ethernetip/connection/EtherNetIpTcpPlcConnection.java   | 3 ++-
 .../apache/plc4x/java/modbus/connection/ModbusTcpPlcConnection.java    | 3 ++-
 .../plc4x/java/modbus/connection/ModbusConnectionFactoryTest.java      | 2 +-
 .../main/java/org/apache/plc4x/java/s7/connection/S7PlcConnection.java | 2 +-
 .../plc4x/java/examples/dummydriver/connection/DummyConnection.java    | 2 +-
 7 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
index a7af2b3..5c5c915 100644
--- a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
+++ b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsTcpPlcConnection.java
@@ -40,7 +40,7 @@ import org.apache.plc4x.java.api.model.PlcConsumerRegistration;
 import org.apache.plc4x.java.api.model.PlcField;
 import org.apache.plc4x.java.api.model.PlcSubscriptionHandle;
 import org.apache.plc4x.java.api.types.PlcResponseCode;
-import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.apache.plc4x.java.base.messages.*;
 import org.apache.plc4x.java.base.messages.items.BaseDefaultFieldItem;
 import org.apache.plc4x.java.base.model.DefaultPlcConsumerRegistration;
@@ -48,6 +48,7 @@ import org.apache.plc4x.java.base.model.InternalPlcConsumerRegistration;
 import org.apache.plc4x.java.base.model.InternalPlcSubscriptionHandle;
 import org.apache.plc4x.java.base.model.SubscriptionPlcField;
 import org.apache.plc4x.java.base.protocol.SingleItemToSingleRequestProtocol;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsConnectionFactoryTest.java b/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsConnectionFactoryTest.java
index 3b9beb1..4f41499 100644
--- a/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsConnectionFactoryTest.java
+++ b/plc4j/drivers/ads/src/test/java/org/apache/plc4x/java/ads/connection/AdsConnectionFactoryTest.java
@@ -23,7 +23,7 @@ import org.apache.plc4x.java.ads.api.generic.types.AmsNetId;
 import org.apache.plc4x.java.ads.api.generic.types.AmsPort;
 import org.apache.plc4x.java.base.connection.NettyPlcConnection;
 import org.apache.plc4x.java.serial.connection.connection.SerialChannelFactory;
-import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/plc4j/drivers/ethernet-ip/src/main/java/org/apache/plc4x/java/ethernetip/connection/EtherNetIpTcpPlcConnection.java b/plc4j/drivers/ethernet-ip/src/main/java/org/apache/plc4x/java/ethernetip/connection/EtherNetIpTcpPlcConnection.java
index e14ac19..ccf1ee1 100644
--- a/plc4j/drivers/ethernet-ip/src/main/java/org/apache/plc4x/java/ethernetip/connection/EtherNetIpTcpPlcConnection.java
+++ b/plc4j/drivers/ethernet-ip/src/main/java/org/apache/plc4x/java/ethernetip/connection/EtherNetIpTcpPlcConnection.java
@@ -20,11 +20,12 @@ package org.apache.plc4x.java.ethernetip.connection;
 
 import io.netty.channel.*;
 import org.apache.plc4x.java.base.connection.ChannelFactory;
-import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.apache.plc4x.java.base.events.ConnectEvent;
 import org.apache.plc4x.java.base.events.ConnectedEvent;
 import org.apache.plc4x.java.ethernetip.netty.EnipCodec;
 import org.apache.plc4x.java.ethernetip.netty.Plc4XEtherNetIpProtocol;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/connection/ModbusTcpPlcConnection.java b/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/connection/ModbusTcpPlcConnection.java
index d71f087..da2c99f 100644
--- a/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/connection/ModbusTcpPlcConnection.java
+++ b/plc4j/drivers/modbus/src/main/java/org/apache/plc4x/java/modbus/connection/ModbusTcpPlcConnection.java
@@ -25,9 +25,10 @@ import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelInitializer;
 import org.apache.plc4x.java.base.connection.ChannelFactory;
-import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.apache.plc4x.java.base.protocol.SingleItemToSingleRequestProtocol;
 import org.apache.plc4x.java.modbus.netty.Plc4XModbusProtocol;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusConnectionFactoryTest.java b/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusConnectionFactoryTest.java
index 8987f13..4c8775b 100644
--- a/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusConnectionFactoryTest.java
+++ b/plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/connection/ModbusConnectionFactoryTest.java
@@ -21,7 +21,7 @@ package org.apache.plc4x.java.modbus.connection;
 import org.apache.commons.lang3.reflect.FieldUtils;
 import org.apache.plc4x.java.base.connection.NettyPlcConnection;
 import org.apache.plc4x.java.serial.connection.connection.SerialChannelFactory;
-import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
diff --git a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/connection/S7PlcConnection.java b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/connection/S7PlcConnection.java
index 18099e6..0de6483 100644
--- a/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/connection/S7PlcConnection.java
+++ b/plc4j/drivers/s7/src/main/java/org/apache/plc4x/java/s7/connection/S7PlcConnection.java
@@ -32,7 +32,7 @@ import org.apache.plc4x.java.api.messages.PlcWriteResponse;
 import org.apache.plc4x.java.api.model.PlcField;
 import org.apache.plc4x.java.base.connection.ChannelFactory;
 import org.apache.plc4x.java.base.connection.NettyPlcConnection;
-import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.apache.plc4x.java.base.events.ConnectEvent;
 import org.apache.plc4x.java.base.events.ConnectedEvent;
 import org.apache.plc4x.java.base.messages.*;
diff --git a/plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java b/plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
index 627ce55..5925f9c 100644
--- a/plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
+++ b/plc4j/examples/dummy-driver/src/main/java/org/apache/plc4x/java/examples/dummydriver/connection/DummyConnection.java
@@ -26,7 +26,7 @@ import org.apache.plc4x.java.api.messages.PlcReadResponse;
 import org.apache.plc4x.java.api.messages.PlcWriteRequest;
 import org.apache.plc4x.java.api.messages.PlcWriteResponse;
 import org.apache.plc4x.java.base.connection.NettyPlcConnection;
-import org.apache.plc4x.java.base.connection.TcpSocketChannelFactory;
+import org.apache.plc4x.java.tcp.connection.TcpSocketChannelFactory;
 import org.apache.plc4x.java.base.messages.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;


[plc4x] 06/25: [OSGi] Added feature for S7 Driver.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 64010d08b3235fe745758bac0a0f9d5f214461dc
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Sun Oct 13 13:59:10 2019 +0200

    [OSGi] Added feature for S7 Driver.
---
 plc4j/drivers/s7/pom.xml                           |  2 +-
 plc4j/karaf-features/pom.xml                       | 69 ++++++++++++++++++++++
 plc4j/karaf-features/s7/pom.xml                    | 48 +++++++++++++++
 .../karaf-features/s7/src/main/feature/feature.xml | 48 +++++++++++++++
 plc4j/pom.xml                                      |  2 +
 5 files changed, 168 insertions(+), 1 deletion(-)

diff --git a/plc4j/drivers/s7/pom.xml b/plc4j/drivers/s7/pom.xml
index 02b393c..4a505cf 100644
--- a/plc4j/drivers/s7/pom.xml
+++ b/plc4j/drivers/s7/pom.xml
@@ -121,7 +121,7 @@
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>osgi.cmpn</artifactId>
-      <version>7.0.0</version>
+      <version>6.0.0</version>
       <scope>provided</scope>
     </dependency>
   </dependencies>
diff --git a/plc4j/karaf-features/pom.xml b/plc4j/karaf-features/pom.xml
new file mode 100644
index 0000000..14d7f56
--- /dev/null
+++ b/plc4j/karaf-features/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  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.
+
+-->
+<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/xsd/maven-4.0.0.xsd">
+  <parent>
+    <!-- TODO Currnelty thats the easeist way to avoid importing of slf4j -->
+    <artifactId>plc4x-parent</artifactId>
+    <groupId>org.apache.plc4x</groupId>
+    <version>0.5.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>karaf-features</artifactId>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>s7</module>
+  </modules>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.karaf.tooling</groupId>
+          <artifactId>karaf-maven-plugin</artifactId>
+          <version>4.2.4</version>
+          <extensions>true</extensions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.karaf.tooling</groupId>
+        <artifactId>karaf-maven-plugin</artifactId>
+      </plugin>
+
+      <!-- No checking needed here -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+
+
+</project>
\ No newline at end of file
diff --git a/plc4j/karaf-features/s7/pom.xml b/plc4j/karaf-features/s7/pom.xml
new file mode 100644
index 0000000..36043d4
--- /dev/null
+++ b/plc4j/karaf-features/s7/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  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.
+
+-->
+<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/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>karaf-features</artifactId>
+    <groupId>org.apache.plc4x</groupId>
+    <version>0.5.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>driver-s7-feature</artifactId>
+  <packaging>feature</packaging>
+
+  <!-- This would be necessary with the kar goal which works not fine, yet -->
+<!--  <dependencies>-->
+<!--    <dependency>-->
+<!--      <groupId>org.apache.plc4x</groupId>-->
+<!--      <artifactId>plc4j-driver-s7</artifactId>-->
+<!--      <version>${project.version}</version>-->
+<!--      <exclusions>-->
+<!--        <exclusion>-->
+<!--          <groupId>org.slf4j</groupId>-->
+<!--          <artifactId>slf4j-api</artifactId>-->
+<!--        </exclusion>-->
+<!--      </exclusions>-->
+<!--    </dependency>-->
+<!--  </dependencies>-->
+
+</project>
\ No newline at end of file
diff --git a/plc4j/karaf-features/s7/src/main/feature/feature.xml b/plc4j/karaf-features/s7/src/main/feature/feature.xml
new file mode 100644
index 0000000..6bf41bb
--- /dev/null
+++ b/plc4j/karaf-features/s7/src/main/feature/feature.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+  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.
+
+-->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.5.0" name="driver-s7-feature">
+  <feature name="driver-s7-feature" description="driver-s7-feature" version="0.5.0.SNAPSHOT">
+    <details>PLC4X is an effort to create a universal library for accessing industrial programmable logic controllers
+      using a variety of protocols using a uniform API.
+    </details>
+    <feature prerequisite="true" dependency="false">wrap</feature>
+    <feature>scr</feature>
+    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.5.0-SNAPSHOT</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-api/0.5.0-SNAPSHOT</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-on-tcp/0.5.0-SNAPSHOT</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-tp/0.5.0-SNAPSHOT</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-protocol-s7/0.5.0-SNAPSHOT</bundle>
+    <bundle>mvn:io.netty/netty-codec/4.1.39.Final</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-protocol-driver-base/0.5.0-SNAPSHOT</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-utils-driver-base-java/0.5.0-SNAPSHOT</bundle>
+    <bundle>wrap:mvn:com.github.jinahya/bit-io/1.4.2</bundle>
+    <bundle>mvn:commons-codec/commons-codec/1.12</bundle>
+    <bundle>mvn:org.apache.plc4x/plc4j-protocol-driver-base-tcp/0.5.0-SNAPSHOT</bundle>
+    <bundle>mvn:io.netty/netty-common/4.1.39.Final</bundle>
+    <bundle>mvn:io.netty/netty-transport/4.1.39.Final</bundle>
+    <bundle>mvn:io.netty/netty-resolver/4.1.39.Final</bundle>
+    <bundle>mvn:io.netty/netty-buffer/4.1.39.Final</bundle>
+    <bundle>mvn:org.apache.commons/commons-configuration2/2.6</bundle>
+    <bundle>mvn:org.apache.commons/commons-text/1.8</bundle>
+    <bundle>mvn:commons-logging/commons-logging/1.2</bundle>
+    <bundle>mvn:org.apache.commons/commons-lang3/3.7</bundle>
+    <bundle>mvn:commons-io/commons-io/2.6</bundle>
+  </feature>
+</features>
diff --git a/plc4j/pom.xml b/plc4j/pom.xml
index ade6306..be7aba9 100644
--- a/plc4j/pom.xml
+++ b/plc4j/pom.xml
@@ -41,6 +41,7 @@
 
     <module>examples</module>
     <module>integrations</module>
+    <module>karaf-features</module>
   </modules>
 
   <build>
@@ -180,6 +181,7 @@
           </execution>
         </executions>
         <configuration>
+            <exportScr>true</exportScr>
             <instructions>
               <_include>-bnd.bnd</_include>
             </instructions>


[plc4x] 22/25: [Karaf] Removed "old" module in integartions.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 0fe46cafdd644dabd001f32f9cab7fe089a97dc7
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Fri Oct 18 13:56:00 2019 +0200

    [Karaf] Removed "old" module in integartions.
---
 plc4j/integrations/pom.xml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/plc4j/integrations/pom.xml b/plc4j/integrations/pom.xml
index f2ba6d0..424eed9 100644
--- a/plc4j/integrations/pom.xml
+++ b/plc4j/integrations/pom.xml
@@ -37,7 +37,6 @@
     <module>apache-edgent</module>
     <module>apache-kafka</module>
     <module>apache-nifi</module>
-    <module>apache-karaf</module>
     <module>apache-calcite</module>
   </modules>
 


[plc4x] 10/25: - Added some more documentation on the plugin execution - Split up one execution of two goals into two separate ones - Added a transformation that injects the "scr" into the gerated feature.xml

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit e41822a2806af355cb4ba86bd6c74901db614242
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Mon Oct 14 09:13:17 2019 +0200

    - Added some more documentation on the plugin execution
    - Split up one execution of two goals into two separate ones
    - Added a transformation that injects the "<feature>scr</feature>" into the gerated feature.xml
---
 .../apache-karaf/karaf-s7-feature/pom.xml          | 29 +++++++++++++
 .../karaf-s7-feature/src/main/feature/feature.xslt | 47 ++++++++++++++++++++++
 plc4j/integrations/apache-karaf/pom.xml            | 20 +++++++--
 3 files changed, 93 insertions(+), 3 deletions(-)

diff --git a/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
index f614f0a..059298b 100644
--- a/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
+++ b/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
@@ -47,6 +47,35 @@
         <artifactId>karaf-maven-plugin</artifactId>
       </plugin>
       <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>xml-maven-plugin</artifactId>
+        <version>1.0.2</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>transform</goal>
+            </goals>
+            <configuration>
+              <transformationSets>
+                <transformationSet>
+                  <dir>${build.directory}/feature</dir>
+                  <outputDir>${build.directory}/feature</outputDir>
+                  <stylesheet>src/main/feature/feature.xslt</stylesheet>
+                </transformationSet>
+              </transformationSets>
+            </configuration>
+          </execution>
+        </executions>
+        <dependencies>
+          <dependency>
+            <groupId>net.sf.saxon</groupId>
+            <artifactId>saxon</artifactId>
+            <version>8.7</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>
         <configuration>
diff --git a/plc4j/integrations/apache-karaf/karaf-s7-feature/src/main/feature/feature.xslt b/plc4j/integrations/apache-karaf/karaf-s7-feature/src/main/feature/feature.xslt
new file mode 100644
index 0000000..1c4b621
--- /dev/null
+++ b/plc4j/integrations/apache-karaf/karaf-s7-feature/src/main/feature/feature.xslt
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+  -->
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"
+                xpath-default-namespace="http://karaf.apache.org/xmlns/features/v1.6.0">
+
+    <xsl:output indent="yes"/>
+
+    <xsl:template match="/features">
+        <features>
+            <xsl:copy-of select="@*"/>
+            <xsl:apply-templates/>
+        </features>
+    </xsl:template>
+
+    <xsl:template match="feature">
+        <feature>
+            <xsl:copy-of select="@*"/>
+            <xsl:copy-of select="details"/>
+            <xsl:copy-of select="feature"/>
+            <feature>scr</feature>
+            <xsl:copy-of select="bundle"/>
+        </feature>
+    </xsl:template>
+
+    <xsl:template match="*">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+
+</xsl:stylesheet>
diff --git a/plc4j/integrations/apache-karaf/pom.xml b/plc4j/integrations/apache-karaf/pom.xml
index 1270a95..2d4a292 100644
--- a/plc4j/integrations/apache-karaf/pom.xml
+++ b/plc4j/integrations/apache-karaf/pom.xml
@@ -86,15 +86,29 @@
           <artifactId>karaf-maven-plugin</artifactId>
           <version>${karaf-maven-plugin.version}</version>
           <extensions>true</extensions>
-          <configuration>
-            <enableGeneration>true</enableGeneration>
-          </configuration>
           <executions>
+            <!--
+              Generate the feature.xml used by the bundle based on the modules dependencies and transitive
+              dependencies.
+            -->
             <execution>
               <id>default-features-generate-descriptor</id>
               <phase>package</phase>
               <goals>
                 <goal>features-generate-descriptor</goal>
+              </goals>
+              <configuration>
+                <enableGeneration>true</enableGeneration>
+              </configuration>
+            </execution>
+            <!--
+              Verifies and validates a features XML descriptor by checking if all the required imports for the
+              bundles defined in the features can be matched to a provided export.
+            -->
+            <execution>
+              <id>default-verify</id>
+              <phase>package</phase>
+              <goals>
                 <goal>verify</goal>
               </goals>
             </execution>


[plc4x] 07/25: [OSGi] Added version replacement to feature.xml.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 23165c0a1d45b7a2f4e0b0d9c840cfc63a3e8968
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Sun Oct 13 14:03:15 2019 +0200

    [OSGi] Added version replacement to feature.xml.
---
 plc4j/karaf-features/pom.xml | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/plc4j/karaf-features/pom.xml b/plc4j/karaf-features/pom.xml
index 14d7f56..76ab877 100644
--- a/plc4j/karaf-features/pom.xml
+++ b/plc4j/karaf-features/pom.xml
@@ -36,6 +36,14 @@
   </modules>
 
   <build>
+    <resources>
+      <resource>
+        <directory>src/main/feature</directory>
+        <filtering>true</filtering>
+        <targetPath>${project.build.directory}/feature</targetPath>
+      </resource>
+    </resources>
+
     <pluginManagement>
       <plugins>
         <plugin>
@@ -53,6 +61,18 @@
         <artifactId>karaf-maven-plugin</artifactId>
       </plugin>
 
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>resources</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
       <!-- No checking needed here -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>


[plc4x] 21/25: [Karaf] Removed "old" module in integartions.C

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit f294e1726a580ebb1fc1718fed4f71ce254dc839
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Fri Oct 18 13:55:07 2019 +0200

    [Karaf] Removed "old" module in integartions.C
---
 .../apache-karaf/karaf-ads-feature/pom.xml         |  61 ----------
 .../apache-karaf/karaf-demo-server/pom.xml         | 128 ---------------------
 .../apache-karaf/karaf-ethernet-ip-feature/pom.xml |  61 ----------
 .../apache-karaf/karaf-modbus-feature/pom.xml      |  61 ----------
 .../apache-karaf/karaf-opcua-feature/pom.xml       |  61 ----------
 .../apache-karaf/karaf-s7-feature/pom.xml          |  61 ----------
 .../apache-karaf/karaf-simulated-feature/pom.xml   |  61 ----------
 plc4j/integrations/apache-karaf/pom.xml            | 121 -------------------
 8 files changed, 615 deletions(-)

diff --git a/plc4j/integrations/apache-karaf/karaf-ads-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-ads-feature/pom.xml
deleted file mode 100644
index f2e706f..0000000
--- a/plc4j/integrations/apache-karaf/karaf-ads-feature/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
-  -->
-
-<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/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.apache.plc4x</groupId>
-    <artifactId>plc4j-apache-karaf</artifactId>
-    <version>0.5.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>plc4j-karaf-ads-feature</artifactId>
-  <packaging>feature</packaging>
-
-  <name>PLC4J: Integrations: Apache Karaf: ADS</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-driver-ads</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>karaf-maven-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <configuration>
-          <usedDependencies>
-            <usedDependency>org.apache.plc4x:plc4j-driver-ads</usedDependency>
-          </usedDependencies>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
\ No newline at end of file
diff --git a/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml b/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
deleted file mode 100644
index ee18822..0000000
--- a/plc4j/integrations/apache-karaf/karaf-demo-server/pom.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
-  -->
-
-<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/xsd/maven-4.0.0.xsd">
-
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.apache.plc4x</groupId>
-    <artifactId>plc4j-apache-karaf</artifactId>
-    <version>0.5.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>plc4j-karaf-demo-server</artifactId>
-  <packaging>karaf-assembly</packaging>
-
-  <name>PLC4J: Integrations: Apache Karaf: Demo Server</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.karaf.features</groupId>
-      <artifactId>framework</artifactId>
-      <version>${karaf.version}</version>
-      <type>kar</type>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.karaf.features</groupId>
-      <artifactId>standard</artifactId>
-      <version>${karaf.version}</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-      <scope>runtime</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-karaf-ads-feature</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-karaf-ethernet-ip-feature</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-karaf-modbus-feature</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-karaf-opcua-feature</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-karaf-s7-feature</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-karaf-simulated-feature</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>karaf-maven-plugin</artifactId>
-        <configuration>
-          <startupFeatures>
-            <feature>wrap</feature>
-          </startupFeatures>
-          <bootFeatures>
-            <feature>standard</feature>
-          </bootFeatures>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <configuration>
-          <usedDependencies>
-            <usedDependency>org.apache.karaf.features:framework</usedDependency>
-            <usedDependency>org.apache.karaf.features:standard</usedDependency>
-            <usedDependency>org.apache.plc4x:plc4j-karaf-ads-feature</usedDependency>
-            <usedDependency>org.apache.plc4x:plc4j-karaf-ethernet-ip-feature</usedDependency>
-            <usedDependency>org.apache.plc4x:plc4j-karaf-modbus-feature</usedDependency>
-            <usedDependency>org.apache.plc4x:plc4j-karaf-opcua-feature</usedDependency>
-            <usedDependency>org.apache.plc4x:plc4j-karaf-s7-feature</usedDependency>
-            <usedDependency>org.apache.plc4x:plc4j-karaf-simulated-feature</usedDependency>
-          </usedDependencies>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
\ No newline at end of file
diff --git a/plc4j/integrations/apache-karaf/karaf-ethernet-ip-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-ethernet-ip-feature/pom.xml
deleted file mode 100644
index c0dd9dc..0000000
--- a/plc4j/integrations/apache-karaf/karaf-ethernet-ip-feature/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
-  -->
-
-<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/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.apache.plc4x</groupId>
-    <artifactId>plc4j-apache-karaf</artifactId>
-    <version>0.5.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>plc4j-karaf-ethernet-ip-feature</artifactId>
-  <packaging>feature</packaging>
-
-  <name>PLC4J: Integrations: Apache Karaf: EtherNet/IP</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-driver-ethernet-ip</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>karaf-maven-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <configuration>
-          <usedDependencies>
-            <usedDependency>org.apache.plc4x:plc4j-driver-ethernet-ip</usedDependency>
-          </usedDependencies>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
\ No newline at end of file
diff --git a/plc4j/integrations/apache-karaf/karaf-modbus-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-modbus-feature/pom.xml
deleted file mode 100644
index 7c3ad36..0000000
--- a/plc4j/integrations/apache-karaf/karaf-modbus-feature/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
-  -->
-
-<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/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.apache.plc4x</groupId>
-    <artifactId>plc4j-apache-karaf</artifactId>
-    <version>0.5.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>plc4j-karaf-modbus-feature</artifactId>
-  <packaging>feature</packaging>
-
-  <name>PLC4J: Integrations: Apache Karaf: Modbus</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-driver-modbus</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>karaf-maven-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <configuration>
-          <usedDependencies>
-            <usedDependency>org.apache.plc4x:plc4j-driver-modbus</usedDependency>
-          </usedDependencies>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
\ No newline at end of file
diff --git a/plc4j/integrations/apache-karaf/karaf-opcua-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-opcua-feature/pom.xml
deleted file mode 100644
index f2602b4..0000000
--- a/plc4j/integrations/apache-karaf/karaf-opcua-feature/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
-  -->
-
-<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/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.apache.plc4x</groupId>
-    <artifactId>plc4j-apache-karaf</artifactId>
-    <version>0.5.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>plc4j-karaf-opcua-feature</artifactId>
-  <packaging>feature</packaging>
-
-  <name>PLC4J: Integrations: Apache Karaf: OPC-UA</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-driver-opcua</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>karaf-maven-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <configuration>
-          <usedDependencies>
-            <usedDependency>org.apache.plc4x:plc4j-driver-opcua</usedDependency>
-          </usedDependencies>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
\ No newline at end of file
diff --git a/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
deleted file mode 100644
index f614f0a..0000000
--- a/plc4j/integrations/apache-karaf/karaf-s7-feature/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
-  -->
-
-<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/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.apache.plc4x</groupId>
-    <artifactId>plc4j-apache-karaf</artifactId>
-    <version>0.5.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>plc4j-karaf-s7-feature</artifactId>
-  <packaging>feature</packaging>
-
-  <name>PLC4J: Integrations: Apache Karaf: S7</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-driver-s7</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>karaf-maven-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <configuration>
-          <usedDependencies>
-            <usedDependency>org.apache.plc4x:plc4j-driver-s7</usedDependency>
-          </usedDependencies>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
\ No newline at end of file
diff --git a/plc4j/integrations/apache-karaf/karaf-simulated-feature/pom.xml b/plc4j/integrations/apache-karaf/karaf-simulated-feature/pom.xml
deleted file mode 100644
index 1b5aae2..0000000
--- a/plc4j/integrations/apache-karaf/karaf-simulated-feature/pom.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
-  -->
-
-<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/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.apache.plc4x</groupId>
-    <artifactId>plc4j-apache-karaf</artifactId>
-    <version>0.5.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>plc4j-karaf-simulated-feature</artifactId>
-  <packaging>feature</packaging>
-
-  <name>PLC4J: Integrations: Apache Karaf: Simulated</name>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-driver-simulated</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>karaf-maven-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <configuration>
-          <usedDependencies>
-            <usedDependency>org.apache.plc4x:plc4j-driver-simulated</usedDependency>
-          </usedDependencies>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
\ No newline at end of file
diff --git a/plc4j/integrations/apache-karaf/pom.xml b/plc4j/integrations/apache-karaf/pom.xml
deleted file mode 100644
index bdbbe6a..0000000
--- a/plc4j/integrations/apache-karaf/pom.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  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.
-  -->
-
-<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/xsd/maven-4.0.0.xsd">
-
-  <modelVersion>4.0.0</modelVersion>
-
-  <parent>
-    <groupId>org.apache.plc4x</groupId>
-    <artifactId>plc4j-integrations</artifactId>
-    <version>0.5.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>plc4j-apache-karaf</artifactId>
-  <packaging>pom</packaging>
-
-  <name>PLC4J: Integrations: Apache Karaf</name>
-  <description>Integration module for integrating PLC4X into Apache Karaf.</description>
-
-  <properties>
-    <karaf.version>4.2.7</karaf.version>
-    <karaf-maven-plugin.version>${karaf.version}</karaf-maven-plugin.version>
-  </properties>
-
-  <modules>
-    <module>karaf-ads-feature</module>
-    <module>karaf-ethernet-ip-feature</module>
-    <module>karaf-modbus-feature</module>
-    <module>karaf-opcua-feature</module>
-    <module>karaf-s7-feature</module>
-    <module>karaf-simulated-feature</module>
-    <module>karaf-demo-server</module>
-  </modules>
-
-  <dependencies>
-    <!-- This is just a way of removing this dependency -->
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <!-- With OSGI there's a lot of stuff with duplicate classes in different versions -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-enforcer-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>enforce-ban-duplicate-classes</id>
-            <phase>validate</phase>
-            <goals>
-              <goal>enforce</goal>
-            </goals>
-            <configuration>
-              <skip>true</skip>
-              <rules/>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.apache.karaf.tooling</groupId>
-          <artifactId>karaf-maven-plugin</artifactId>
-          <version>${karaf-maven-plugin.version}</version>
-          <extensions>true</extensions>
-          <executions>
-            <!--
-              Generate the feature.xml used by the bundle based on the modules dependencies and transitive
-              dependencies.
-            -->
-            <execution>
-              <id>default-features-generate-descriptor</id>
-              <phase>package</phase>
-              <goals>
-                <goal>features-generate-descriptor</goal>
-              </goals>
-              <configuration>
-                <enableGeneration>true</enableGeneration>
-              </configuration>
-            </execution>
-            <!--
-              Verifies and validates a features XML descriptor by checking if all the required imports for the
-              bundles defined in the features can be matched to a provided export.
-            -->
-            <execution>
-              <id>default-verify</id>
-              <phase>package</phase>
-              <goals>
-                <goal>verify</goal>
-              </goals>
-            </execution>
-          </executions>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-
-</project>
\ No newline at end of file


[plc4x] 13/25: [OSGi] Refactoring.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit b289fb9bc2bbc9dcac9f7a6d652196419ef61838
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Thu Oct 17 21:58:28 2019 +0200

    [OSGi] Refactoring.
---
 .../java/org/apache/plc4x/karaf/FeatureITest.java  | 82 ----------------------
 1 file changed, 82 deletions(-)

diff --git a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
index f38cdc1..33a7722 100644
--- a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
+++ b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
@@ -31,8 +31,6 @@ import java.util.stream.Stream;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
 
 @RunWith(PaxExam.class)
@@ -44,88 +42,8 @@ public class FeatureITest extends KarafTestSupport {
         Option[] options = new Option[]{
             logLevel(LogLevelOption.LogLevel.DEBUG),
             KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "plc4x.version", System.getProperty("plc4x.version")),
-//            features("scr"),
-//            mavenBundle()
-//                .groupId("org.ops4j.pax.exam.samples")
-//                .artifactId("pax-exam-sample8-ds")
-//                .version("4.13.1")
-//                .start()
         };
         return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
-
-//
-//        String httpPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_HTTP_PORT), Integer.parseInt(MAX_HTTP_PORT)));
-//        String rmiRegistryPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_REG_PORT), Integer.parseInt(MAX_RMI_REG_PORT)));
-//        String rmiServerPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_SERVER_PORT), Integer.parseInt(MAX_RMI_SERVER_PORT)));
-//        String sshPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_SSH_PORT), Integer.parseInt(MAX_SSH_PORT)));
-//        String localRepository = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
-//        if (localRepository == null) {
-//            localRepository = "";
-//        }
-//
-//        if (JavaVersionUtil.getMajorVersion() >= 9) {
-//            return new Option[]{
-//                //KarafDistributionOption.debugConfiguration("8889", true),
-//                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
-//                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
-//                configureSecurity().disableKarafMBeanServerBuilder(),
-//                // configureConsole().ignoreLocalConsole(),
-//                keepRuntimeFolder(),
-//                logLevel(LogLevelOption.LogLevel.INFO),
-//                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
-//                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
-//                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
-//                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
-//                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository),
-//                new VMOption("--add-reads=java.xml=java.logging"),
-//                new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
-//                new VMOption("--patch-module"),
-//                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
-//                    + System.getProperty("karaf.version") + ".jar"),
-//                new VMOption("--patch-module"),
-//                new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
-//                    + System.getProperty("karaf.version") + ".jar"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.base/java.security=ALL-UNNAMED"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.base/java.net=ALL-UNNAMED"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.base/java.lang=ALL-UNNAMED"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.base/java.util=ALL-UNNAMED"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
-//                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
-//                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
-//                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
-//                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
-//                new VMOption("-classpath"),
-//                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
-//            };
-//        } else {
-//            return new Option[]{
-//                //KarafDistributionOption.debugConfiguration("8889", true),
-//                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
-//                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
-//                configureSecurity().disableKarafMBeanServerBuilder(),
-//                // configureConsole().ignoreLocalConsole(),
-//                keepRuntimeFolder(),
-//                logLevel(LogLevelOption.LogLevel.INFO),
-//                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
-//                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
-//                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
-//                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
-//                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository)
-//            };
-//        }
     }
 
     /**


[plc4x] 18/25: [OSGi] Finally, integration test is running.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit b76c41e1682da5d9ddf08ed25b8c918b367ac6e1
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Thu Oct 17 21:57:44 2019 +0200

    [OSGi] Finally, integration test is running.
---
 plc4j/karaf-features/karaf-itest/pom.xml           |  52 ++++-
 .../java/org/apache/plc4x/karaf/FeatureITest.java  | 227 ++++++++++++---------
 .../karaf-itest/src/test/resources/exam.properties |   1 -
 plc4j/karaf-features/s7/pom.xml                    |  99 ---------
 .../karaf-features/s7/src/main/feature/feature.xml |   2 +-
 5 files changed, 182 insertions(+), 199 deletions(-)

diff --git a/plc4j/karaf-features/karaf-itest/pom.xml b/plc4j/karaf-features/karaf-itest/pom.xml
index 44b2a44..b42c5b6 100644
--- a/plc4j/karaf-features/karaf-itest/pom.xml
+++ b/plc4j/karaf-features/karaf-itest/pom.xml
@@ -1,4 +1,22 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  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.
+
+-->
 <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/xsd/maven-4.0.0.xsd">
@@ -12,7 +30,7 @@
   <artifactId>karaf-itest</artifactId>
 
   <properties>
-    <karaf.version>4.2.1</karaf.version>
+    <karaf.version>4.2.6</karaf.version>
     <pax.version>4.13.1</pax.version>
   </properties>
 
@@ -78,6 +96,12 @@
       <version>1.3_1</version>
       <scope>runtime</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-api</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
@@ -85,6 +109,7 @@
       <plugin>
         <groupId>org.apache.servicemix.tooling</groupId>
         <artifactId>depends-maven-plugin</artifactId>
+        <version>1.4.0</version>
         <executions>
           <execution>
             <id>generate-depends-file</id>
@@ -94,6 +119,31 @@
           </execution>
         </executions>
       </plugin>
+      <!-- See https://issues.apache.org/jira/browse/KARAF-6457 -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <forkCount>1</forkCount>
+          <reuseForks>false</reuseForks>
+          <systemPropertyVariables>
+            <org.ops4j.pax.logging.DefaultServiceLog.level>INFO</org.ops4j.pax.logging.DefaultServiceLog.level>
+            <spring31.version>3.1.4.RELEASE</spring31.version>
+            <spring32.version>3.2.18.RELEASE_1</spring32.version>
+            <spring40.version>4.0.9.RELEASE_1</spring40.version>
+            <spring41.version>4.1.9.RELEASE_1</spring41.version>
+            <spring42.version>4.2.9.RELEASE_1</spring42.version>
+            <spring43.version>4.3.25.RELEASE_1</spring43.version>
+            <spring50.version>5.0.15.RELEASE_1</spring50.version>
+            <spring51.version>5.1.9.RELEASE_1</spring51.version>
+            <spring.security31.version>3.1.4.RELEASE</spring.security31.version>
+            <spring.security42.version>4.2.4.RELEASE_1</spring.security42.version>
+            <spring.security51.version>5.1.5.RELEASE_1</spring.security51.version>
+            <activemq.version>5.15.9</activemq.version>
+            <plc4x.version>${project.version}</plc4x.version>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
index b7a12a6..f38cdc1 100644
--- a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
+++ b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
@@ -13,137 +13,170 @@
  */
 package org.apache.plc4x.karaf;
 
-import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
 import org.apache.karaf.itests.KarafTestSupport;
-import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.karaf.container.internal.JavaVersionUtil;
+import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
 import org.ops4j.pax.exam.karaf.options.LogLevelOption;
 import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
-import org.ops4j.pax.exam.options.extra.VMOption;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+import org.osgi.framework.Bundle;
 
-import java.io.File;
+import java.util.stream.Stream;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureSecurity;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
 
 @RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
+@ExamReactorStrategy(PerMethod.class)
 public class FeatureITest extends KarafTestSupport {
 
-    @Override
     @Configuration
     public Option[] config() {
-        MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf").versionAsInProject().type("tar.gz");
-
-        String httpPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_HTTP_PORT), Integer.parseInt(MAX_HTTP_PORT)));
-        String rmiRegistryPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_REG_PORT), Integer.parseInt(MAX_RMI_REG_PORT)));
-        String rmiServerPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_SERVER_PORT), Integer.parseInt(MAX_RMI_SERVER_PORT)));
-        String sshPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_SSH_PORT), Integer.parseInt(MAX_SSH_PORT)));
-        String localRepository = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
-        if (localRepository == null) {
-            localRepository = "";
-        }
-
-        if (JavaVersionUtil.getMajorVersion() >= 9) {
-            return new Option[]{
-                //KarafDistributionOption.debugConfiguration("8889", true),
-                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
-                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
-                configureSecurity().disableKarafMBeanServerBuilder(),
-                // configureConsole().ignoreLocalConsole(),
-                keepRuntimeFolder(),
-                logLevel(LogLevelOption.LogLevel.INFO),
-                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
-                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
-                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
-                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
-                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
-                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
-                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
-                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository),
-                new VMOption("--add-reads=java.xml=java.logging"),
-                new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
-                new VMOption("--patch-module"),
-                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
-                    + System.getProperty("karaf.version") + ".jar"),
-                new VMOption("--patch-module"),
-                new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
-                    + System.getProperty("karaf.version") + ".jar"),
-                new VMOption("--add-opens"),
-                new VMOption("java.base/java.security=ALL-UNNAMED"),
-                new VMOption("--add-opens"),
-                new VMOption("java.base/java.net=ALL-UNNAMED"),
-                new VMOption("--add-opens"),
-                new VMOption("java.base/java.lang=ALL-UNNAMED"),
-                new VMOption("--add-opens"),
-                new VMOption("java.base/java.util=ALL-UNNAMED"),
-                new VMOption("--add-opens"),
-                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
-                new VMOption("--add-opens"),
-                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
-                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
-                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
-                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
-                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
-                new VMOption("-classpath"),
-                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
-            };
-        } else {
-            return new Option[]{
-                //KarafDistributionOption.debugConfiguration("8889", true),
-                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
-                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
-                configureSecurity().disableKarafMBeanServerBuilder(),
-                // configureConsole().ignoreLocalConsole(),
-                keepRuntimeFolder(),
-                logLevel(LogLevelOption.LogLevel.INFO),
-                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
-                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
-                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
-                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
-                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
-                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
-                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
-                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository)
-            };
-        }
+        Option[] options = new Option[]{
+            logLevel(LogLevelOption.LogLevel.DEBUG),
+            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "plc4x.version", System.getProperty("plc4x.version")),
+//            features("scr"),
+//            mavenBundle()
+//                .groupId("org.ops4j.pax.exam.samples")
+//                .artifactId("pax-exam-sample8-ds")
+//                .version("4.13.1")
+//                .start()
+        };
+        return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
+
+//
+//        String httpPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_HTTP_PORT), Integer.parseInt(MAX_HTTP_PORT)));
+//        String rmiRegistryPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_REG_PORT), Integer.parseInt(MAX_RMI_REG_PORT)));
+//        String rmiServerPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_SERVER_PORT), Integer.parseInt(MAX_RMI_SERVER_PORT)));
+//        String sshPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_SSH_PORT), Integer.parseInt(MAX_SSH_PORT)));
+//        String localRepository = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
+//        if (localRepository == null) {
+//            localRepository = "";
+//        }
+//
+//        if (JavaVersionUtil.getMajorVersion() >= 9) {
+//            return new Option[]{
+//                //KarafDistributionOption.debugConfiguration("8889", true),
+//                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
+//                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
+//                configureSecurity().disableKarafMBeanServerBuilder(),
+//                // configureConsole().ignoreLocalConsole(),
+//                keepRuntimeFolder(),
+//                logLevel(LogLevelOption.LogLevel.INFO),
+//                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
+//                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
+//                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
+//                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
+//                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository),
+//                new VMOption("--add-reads=java.xml=java.logging"),
+//                new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
+//                new VMOption("--patch-module"),
+//                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
+//                    + System.getProperty("karaf.version") + ".jar"),
+//                new VMOption("--patch-module"),
+//                new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
+//                    + System.getProperty("karaf.version") + ".jar"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.base/java.security=ALL-UNNAMED"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.base/java.net=ALL-UNNAMED"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.base/java.lang=ALL-UNNAMED"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.base/java.util=ALL-UNNAMED"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
+//                new VMOption("--add-opens"),
+//                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
+//                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
+//                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
+//                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
+//                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
+//                new VMOption("-classpath"),
+//                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
+//            };
+//        } else {
+//            return new Option[]{
+//                //KarafDistributionOption.debugConfiguration("8889", true),
+//                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
+//                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
+//                configureSecurity().disableKarafMBeanServerBuilder(),
+//                // configureConsole().ignoreLocalConsole(),
+//                keepRuntimeFolder(),
+//                logLevel(LogLevelOption.LogLevel.INFO),
+//                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
+//                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
+//                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
+//                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
+//                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
+//                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository)
+//            };
+//        }
     }
 
+    /**
+     * Checks:
+     * - the feature can be installed
+     * - the Driver Bundle is there and active
+     * - the Bundle contains the DS for PlcDriver
+     * - the feature is installed
+     */
     @Test
     public void installAndAssertFeature() throws Exception {
-        // ...
+        // Assemble Maven URL
         final MavenArtifactUrlReference featureRepo = maven()
             .groupId("org.apache.plc4x")
             .artifactId("driver-s7-feature")
-            .versionAsInProject()
-            .classifier("xml")
-            .type("feature");
-
-        System.out.println(featureRepo.getURL());
+            .version(System.getProperty("plc4x.version"))
+            .type("xml")
+            .classifier("features");
+        System.out.println("Installing feature repo " + featureRepo.getURL());
 
-        // ...
+        // Install the feature-repo
         addFeaturesRepository(featureRepo.getURL());
-        // ...
+
+        // Install the feature
         installAndAssertFeature("driver-s7-feature");
-        // Print Bundles
+
+        // Print Bundles and fetch result
         String bundles = executeCommand("bundle:list -t 0");
+
+        // Find that line
+        // 84 │ Active │  80 │ 0.5.0.SNAPSHOT │ PLC4J: Driver: S7
+        assertContains("PLC4J: Driver: S7", bundles);
         System.out.println(bundles);
-        // Print features
+
+        // Find Bundle for more detailed check
+        final Bundle bundle = findBundleByName("org.apache.plc4x.plc4j-driver-s7");
+
+        // Bundle has to be ACTIVE
+        assertNotNull(bundle);
+        assertEquals(Bundle.ACTIVE, bundle.getState());
+
+        // Check declarative service is present
+        String services = executeCommand("services -p " + bundle.getBundleId());
+        System.out.println("Services: " + services);
+        assertContains("component.name = org.apache.plc4x.java.s7.S7PlcDriver", services);
+        assertContains("objectClass = [org.apache.plc4x.java.spi.PlcDriver]", services);
+
+        // Just for Debugging...
         String features = executeCommand("feature:list -i");
         System.out.print(features);
+        assertContains("driver-s7-feature", features);
     }
 
 }
\ No newline at end of file
diff --git a/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties b/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties
deleted file mode 100644
index db2c7db..0000000
--- a/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties
+++ /dev/null
@@ -1 +0,0 @@
-pax.exam.karaf.version = 4.2.1
\ No newline at end of file
diff --git a/plc4j/karaf-features/s7/pom.xml b/plc4j/karaf-features/s7/pom.xml
index 472b868..36043d4 100644
--- a/plc4j/karaf-features/s7/pom.xml
+++ b/plc4j/karaf-features/s7/pom.xml
@@ -30,105 +30,6 @@
   <artifactId>driver-s7-feature</artifactId>
   <packaging>feature</packaging>
 
-  <dependencies>
-    <dependency>
-      <groupId>org.ops4j.pax.exam.samples</groupId>
-      <artifactId>pax-exam-sample8-ds</artifactId>
-      <version>4.13.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.karaf.features</groupId>
-      <artifactId>standard</artifactId>
-      <version>4.2.1</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam-container-karaf</artifactId>
-      <version>4.13.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam-junit4</artifactId>
-      <version>4.13.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam</artifactId>
-      <version>4.13.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.url</groupId>
-      <artifactId>pax-url-aether</artifactId>
-      <version>1.6.0</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>javax.inject</groupId>
-      <artifactId>javax.inject</artifactId>
-      <version>1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.11</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>6.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <!-- -->
-    <dependency>
-      <groupId>org.apache.plc4x</groupId>
-      <artifactId>plc4j-api</artifactId>
-      <version>0.5.0-SNAPSHOT</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>javax.inject</groupId>
-      <artifactId>javax.inject</artifactId>
-      <version>1</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <!-- Needed if you use versionAsInProject() -->
-      <plugin>
-        <groupId>org.apache.servicemix.tooling</groupId>
-        <artifactId>depends-maven-plugin</artifactId>
-        <version>1.2</version>
-        <executions>
-          <execution>
-            <id>generate-depends-file</id>
-            <goals>
-              <goal>generate-depends-file</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <systemPropertyVariables>
-            <pax.exam.karaf.version>4.2.1</pax.exam.karaf.version>
-          </systemPropertyVariables>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
   <!-- This would be necessary with the kar goal which works not fine, yet -->
 <!--  <dependencies>-->
 <!--    <dependency>-->
diff --git a/plc4j/karaf-features/s7/src/main/feature/feature.xml b/plc4j/karaf-features/s7/src/main/feature/feature.xml
index aebf22a..6bf41bb 100644
--- a/plc4j/karaf-features/s7/src/main/feature/feature.xml
+++ b/plc4j/karaf-features/s7/src/main/feature/feature.xml
@@ -24,7 +24,7 @@
     </details>
     <feature prerequisite="true" dependency="false">wrap</feature>
     <feature>scr</feature>
-<!--    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.5.0-SNAPSHOT</bundle>-->
+    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-api/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-on-tcp/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-tp/0.5.0-SNAPSHOT</bundle>


[plc4x] 24/25: Fixed review comment, removed unused file.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit d6af5c781243416a189c8a657b1298cfadff50e6
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Fri Oct 18 14:04:20 2019 +0200

    Fixed review comment, removed unused file.
---
 .../src/test/resources/etc/system.properties           | 18 ------------------
 1 file changed, 18 deletions(-)

diff --git a/plc4j/karaf-features/karaf-itest/src/test/resources/etc/system.properties b/plc4j/karaf-features/karaf-itest/src/test/resources/etc/system.properties
deleted file mode 100644
index a3caa37..0000000
--- a/plc4j/karaf-features/karaf-itest/src/test/resources/etc/system.properties
+++ /dev/null
@@ -1,18 +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.
-#
-################################################################################
\ No newline at end of file


[plc4x] 16/25: [OSGi] Added initial Implementation of a Exam Test.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 68476f402648c5ab16e6423cbeba85d8bf142659
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Tue Oct 15 21:35:46 2019 +0200

    [OSGi] Added initial Implementation of a Exam Test.
---
 plc4j/karaf-features/karaf-itest/pom.xml           | 124 ++++++++---------
 .../java/org/apache/plc4x/karaf/FeatureITest.java  | 155 ++++++++++++---------
 .../karaf-itest/src/test/resources/exam.properties |   1 +
 plc4j/karaf-features/s7/pom.xml                    |  99 +++++++++++++
 .../karaf-features/s7/src/main/feature/feature.xml |   2 +-
 5 files changed, 252 insertions(+), 129 deletions(-)

diff --git a/plc4j/karaf-features/karaf-itest/pom.xml b/plc4j/karaf-features/karaf-itest/pom.xml
index b42c5b6..9d4e3f5 100644
--- a/plc4j/karaf-features/karaf-itest/pom.xml
+++ b/plc4j/karaf-features/karaf-itest/pom.xml
@@ -1,22 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-  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.
-
--->
 <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/xsd/maven-4.0.0.xsd">
@@ -30,49 +12,55 @@
   <artifactId>karaf-itest</artifactId>
 
   <properties>
-    <karaf.version>4.2.6</karaf.version>
+    <dependency.karaf.version>4.2.1</dependency.karaf.version>
     <pax.version>4.13.1</pax.version>
   </properties>
 
   <dependencies>
-    <!-- Provide the KarafTestSupport -->
+<!--    &lt;!&ndash; S7 Driver for Build &ndash;&gt;-->
+<!--    <dependency>-->
+<!--      <groupId>org.apache.plc4x</groupId>-->
+<!--      <artifactId>driver-s7-feature</artifactId>-->
+<!--      <version>0.5.0-SNAPSHOT</version>-->
+<!--      <scope>test</scope>-->
+<!--    </dependency>-->
+
+    <!-- Pax Exam Test setup -->
     <dependency>
-      <groupId>org.apache.karaf.itests</groupId>
-      <artifactId>common</artifactId>
-      <version>${karaf.version}</version>
+      <groupId>org.ops4j.pax.exam.samples</groupId>
+      <artifactId>pax-exam-sample8-ds</artifactId>
+      <version>${pax.version}</version>
       <scope>test</scope>
     </dependency>
-    <!-- Define the Apache Karaf version to download and use for the test -->
-    <!-- We use a released version here to avoid SNAPSHOT resolution -->
     <dependency>
-      <groupId>org.apache.karaf</groupId>
-      <artifactId>apache-karaf</artifactId>
-      <version>${karaf.version}</version>
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>standard</artifactId>
+      <version>${dependency.karaf.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
       <scope>test</scope>
-      <type>tar.gz</type>
     </dependency>
 
     <dependency>
       <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <version>1.7.26</version>
+      <artifactId>slf4j-api</artifactId>
       <scope>test</scope>
     </dependency>
-    <!-- Required to use shell commands in the tests -->
+
     <dependency>
-      <groupId>org.apache.karaf.shell</groupId>
-      <artifactId>org.apache.karaf.shell.core</artifactId>
-      <version>${karaf.version}</version>
-      <scope>test</scope>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
     </dependency>
-    <!-- Provide the PaxExam Karaf support -->
+
+    <!-- Dependencies for pax exam karaf container -->
     <dependency>
       <groupId>org.ops4j.pax.exam</groupId>
       <artifactId>pax-exam-container-karaf</artifactId>
       <version>${pax.version}</version>
       <scope>test</scope>
     </dependency>
-    <!-- Provide the PaxExam JUnit extension -->
     <dependency>
       <groupId>org.ops4j.pax.exam</groupId>
       <artifactId>pax-exam-junit4</artifactId>
@@ -80,21 +68,28 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-atinject_1.0_spec</artifactId>
-      <version>1.1</version>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam</artifactId>
+      <version>${pax.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.url</groupId>
+      <artifactId>pax-url-aether</artifactId>
+      <version>2.6.1</version>
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.awaitility</groupId>
-      <artifactId>awaitility</artifactId>
-      <version>3.1.6</version>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>test</scope>
     </dependency>
+
     <dependency>
-      <groupId>org.apache.servicemix.bundles</groupId>
-      <artifactId>org.apache.servicemix.bundles.hamcrest</artifactId>
-      <version>1.3_1</version>
-      <scope>runtime</scope>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.apache.plc4x</groupId>
@@ -102,10 +97,24 @@
       <version>0.5.0-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>org.apache.karaf.features.core</artifactId>
+      <version>${dependency.karaf.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.bundle</groupId>
+      <artifactId>org.apache.karaf.bundle.core</artifactId>
+      <version>${dependency.karaf.version}</version>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
     <plugins>
+      <!-- Needed if you use versionAsInProject() -->
       <plugin>
         <groupId>org.apache.servicemix.tooling</groupId>
         <artifactId>depends-maven-plugin</artifactId>
@@ -119,28 +128,11 @@
           </execution>
         </executions>
       </plugin>
-      <!-- See https://issues.apache.org/jira/browse/KARAF-6457 -->
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
-          <forkCount>1</forkCount>
-          <reuseForks>false</reuseForks>
           <systemPropertyVariables>
-            <org.ops4j.pax.logging.DefaultServiceLog.level>INFO</org.ops4j.pax.logging.DefaultServiceLog.level>
-            <spring31.version>3.1.4.RELEASE</spring31.version>
-            <spring32.version>3.2.18.RELEASE_1</spring32.version>
-            <spring40.version>4.0.9.RELEASE_1</spring40.version>
-            <spring41.version>4.1.9.RELEASE_1</spring41.version>
-            <spring42.version>4.2.9.RELEASE_1</spring42.version>
-            <spring43.version>4.3.25.RELEASE_1</spring43.version>
-            <spring50.version>5.0.15.RELEASE_1</spring50.version>
-            <spring51.version>5.1.9.RELEASE_1</spring51.version>
-            <spring.security31.version>3.1.4.RELEASE</spring.security31.version>
-            <spring.security42.version>4.2.4.RELEASE_1</spring.security42.version>
-            <spring.security51.version>5.1.5.RELEASE_1</spring.security51.version>
-            <activemq.version>5.15.9</activemq.version>
-            <plc4x.version>${project.version}</plc4x.version>
+            <pax.exam.karaf.version>${dependency.karaf.version}</pax.exam.karaf.version>
           </systemPropertyVariables>
         </configuration>
       </plugin>
diff --git a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
index 33a7722..1efc1db 100644
--- a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
+++ b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
@@ -13,88 +13,119 @@
  */
 package org.apache.plc4x.karaf;
 
-import org.apache.karaf.itests.KarafTestSupport;
+import org.apache.karaf.bundle.core.BundleService;
+import org.apache.karaf.features.FeaturesService;
+import org.apache.plc4x.java.spi.PlcDriver;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.ConfigurationManager;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption;
 import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerMethod;
+import org.ops4j.pax.exam.options.MavenUrlReference;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-import java.util.stream.Stream;
+import javax.inject.Inject;
+import java.io.File;
+import java.util.Arrays;
+import java.util.Optional;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.ops4j.pax.exam.CoreOptions.bundle;
 import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
 
 @RunWith(PaxExam.class)
-@ExamReactorStrategy(PerMethod.class)
-public class FeatureITest extends KarafTestSupport {
+public class FeatureITest {
+
+    private static Logger LOG = LoggerFactory.getLogger(FeatureITest.class);
+
+    @Inject
+    private FeaturesService featuresService;
+
+    @Inject
+    private BundleContext bundleContext;
 
     @Configuration
     public Option[] config() {
-        Option[] options = new Option[]{
-            logLevel(LogLevelOption.LogLevel.DEBUG),
-            KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "plc4x.version", System.getProperty("plc4x.version")),
+        MavenArtifactUrlReference karafUrl = maven()
+            .groupId("org.apache.karaf")
+            .artifactId("apache-karaf")
+            .version(karafVersion())
+            .type("zip");
+
+        MavenUrlReference karafStandardRepo = maven()
+            .groupId("org.apache.karaf.features")
+            .artifactId("standard")
+            .version(karafVersion())
+            .classifier("features")
+            .type("xml");
+
+        final MavenArtifactUrlReference plc4xRepo = maven()
+            .groupId("org.apache.plc4x")
+            .artifactId("driver-s7-feature")
+            .version("0.5.0-SNAPSHOT")
+            .classifier("features")
+            .type("xml");
+        return new Option[] {
+            // KarafDistributionOption.debugConfiguration("5005", true),
+            karafDistributionConfiguration()
+                .frameworkUrl(karafUrl)
+                .unpackDirectory(new File("target", "exam"))
+                .useDeployFolder(false),
+            keepRuntimeFolder(),
+            configureConsole().ignoreLocalConsole(),
+            features(karafStandardRepo , "scr"),
+            features(plc4xRepo, "driver-s7-feature"),
+            mavenBundle()
+                .groupId("org.apache.plc4x")
+                .artifactId("plc4j-driver-s7")
+                .version("0.5.0-SNAPSHOT")
+                .start()
         };
-        return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
     }
 
-    /**
-     * Checks:
-     * - the feature can be installed
-     * - the Driver Bundle is there and active
-     * - the Bundle contains the DS for PlcDriver
-     * - the feature is installed
-     */
+    public static String karafVersion() {
+        ConfigurationManager cm = new ConfigurationManager();
+        String karafVersion = cm.getProperty("pax.exam.karaf.version", "3.0.0");
+        return karafVersion;
+    }
+
+
     @Test
-    public void installAndAssertFeature() throws Exception {
-        // Assemble Maven URL
-        final MavenArtifactUrlReference featureRepo = maven()
-            .groupId("org.apache.plc4x")
-            .artifactId("driver-s7-feature")
-            .version(System.getProperty("plc4x.version"))
-            .type("xml")
-            .classifier("features");
-        System.out.println("Installing feature repo " + featureRepo.getURL());
-
-        // Install the feature-repo
-        addFeaturesRepository(featureRepo.getURL());
-
-        // Install the feature
-        installAndAssertFeature("driver-s7-feature");
-
-        // Print Bundles and fetch result
-        String bundles = executeCommand("bundle:list -t 0");
-
-        // Find that line
-        // 84 │ Active │  80 │ 0.5.0.SNAPSHOT │ PLC4J: Driver: S7
-        assertContains("PLC4J: Driver: S7", bundles);
-        System.out.println(bundles);
-
-        // Find Bundle for more detailed check
-        final Bundle bundle = findBundleByName("org.apache.plc4x.plc4j-driver-s7");
-
-        // Bundle has to be ACTIVE
-        assertNotNull(bundle);
-        assertEquals(Bundle.ACTIVE, bundle.getState());
-
-        // Check declarative service is present
-        String services = executeCommand("services -p " + bundle.getBundleId());
-        System.out.println("Services: " + services);
-        assertContains("component.name = org.apache.plc4x.java.s7.S7PlcDriver", services);
-        assertContains("objectClass = [org.apache.plc4x.java.spi.PlcDriver]", services);
-
-        // Just for Debugging...
-        String features = executeCommand("feature:list -i");
-        System.out.print(features);
-        assertContains("driver-s7-feature", features);
+    public void checkFeatureInstalled() throws Exception {
+        assertTrue(
+            featuresService.isInstalled(featuresService.getFeature("driver-s7-feature"))
+        );
+    }
+
+    @Test
+    public void checkBundleStarted() throws Exception {
+        for (Bundle bundle : bundleContext.getBundles()) {
+            System.out.println(bundle.getSymbolicName());
+        }
+
+        // Try to find the bundle
+        final Optional<Bundle> optionalBundle = Arrays.stream(bundleContext.getBundles())
+            .filter(bundle -> "org.apache.plc4x.plc4j-driver-s7".equals(bundle.getSymbolicName()))
+            .findFirst();
+
+        // Ensure that the bundle is resolved
+        assertTrue(optionalBundle.isPresent());
+
+        // Check if the bundle is active
+        assertEquals(Bundle.ACTIVE, optionalBundle.get().getState());
     }
 
-}
\ No newline at end of file
+}
diff --git a/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties b/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties
new file mode 100644
index 0000000..db2c7db
--- /dev/null
+++ b/plc4j/karaf-features/karaf-itest/src/test/resources/exam.properties
@@ -0,0 +1 @@
+pax.exam.karaf.version = 4.2.1
\ No newline at end of file
diff --git a/plc4j/karaf-features/s7/pom.xml b/plc4j/karaf-features/s7/pom.xml
index 36043d4..472b868 100644
--- a/plc4j/karaf-features/s7/pom.xml
+++ b/plc4j/karaf-features/s7/pom.xml
@@ -30,6 +30,105 @@
   <artifactId>driver-s7-feature</artifactId>
   <packaging>feature</packaging>
 
+  <dependencies>
+    <dependency>
+      <groupId>org.ops4j.pax.exam.samples</groupId>
+      <artifactId>pax-exam-sample8-ds</artifactId>
+      <version>4.13.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.karaf.features</groupId>
+      <artifactId>standard</artifactId>
+      <version>4.2.1</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-container-karaf</artifactId>
+      <version>4.13.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-junit4</artifactId>
+      <version>4.13.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam</artifactId>
+      <version>4.13.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.url</groupId>
+      <artifactId>pax-url-aether</artifactId>
+      <version>1.6.0</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.11</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>6.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <!-- -->
+    <dependency>
+      <groupId>org.apache.plc4x</groupId>
+      <artifactId>plc4j-api</artifactId>
+      <version>0.5.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <!-- Needed if you use versionAsInProject() -->
+      <plugin>
+        <groupId>org.apache.servicemix.tooling</groupId>
+        <artifactId>depends-maven-plugin</artifactId>
+        <version>1.2</version>
+        <executions>
+          <execution>
+            <id>generate-depends-file</id>
+            <goals>
+              <goal>generate-depends-file</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemPropertyVariables>
+            <pax.exam.karaf.version>4.2.1</pax.exam.karaf.version>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
   <!-- This would be necessary with the kar goal which works not fine, yet -->
 <!--  <dependencies>-->
 <!--    <dependency>-->
diff --git a/plc4j/karaf-features/s7/src/main/feature/feature.xml b/plc4j/karaf-features/s7/src/main/feature/feature.xml
index 6bf41bb..aebf22a 100644
--- a/plc4j/karaf-features/s7/src/main/feature/feature.xml
+++ b/plc4j/karaf-features/s7/src/main/feature/feature.xml
@@ -24,7 +24,7 @@
     </details>
     <feature prerequisite="true" dependency="false">wrap</feature>
     <feature>scr</feature>
-    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.5.0-SNAPSHOT</bundle>
+<!--    <bundle>mvn:org.apache.plc4x/plc4j-driver-s7/0.5.0-SNAPSHOT</bundle>-->
     <bundle>mvn:org.apache.plc4x/plc4j-api/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-on-tcp/0.5.0-SNAPSHOT</bundle>
     <bundle>mvn:org.apache.plc4x/plc4j-protocol-iso-tp/0.5.0-SNAPSHOT</bundle>


[plc4x] 19/25: [OSGi] Refactoring.

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfeinauer pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit a6edd444469c30f448c771a79694703a788d5a35
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Thu Oct 17 21:58:28 2019 +0200

    [OSGi] Refactoring.
---
 .../java/org/apache/plc4x/karaf/FeatureITest.java  | 82 ----------------------
 1 file changed, 82 deletions(-)

diff --git a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
index f38cdc1..33a7722 100644
--- a/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
+++ b/plc4j/karaf-features/karaf-itest/src/test/java/org/apache/plc4x/karaf/FeatureITest.java
@@ -31,8 +31,6 @@ import java.util.stream.Stream;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
 
 @RunWith(PaxExam.class)
@@ -44,88 +42,8 @@ public class FeatureITest extends KarafTestSupport {
         Option[] options = new Option[]{
             logLevel(LogLevelOption.LogLevel.DEBUG),
             KarafDistributionOption.editConfigurationFilePut("etc/system.properties", "plc4x.version", System.getProperty("plc4x.version")),
-//            features("scr"),
-//            mavenBundle()
-//                .groupId("org.ops4j.pax.exam.samples")
-//                .artifactId("pax-exam-sample8-ds")
-//                .version("4.13.1")
-//                .start()
         };
         return Stream.of(super.config(), options).flatMap(Stream::of).toArray(Option[]::new);
-
-//
-//        String httpPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_HTTP_PORT), Integer.parseInt(MAX_HTTP_PORT)));
-//        String rmiRegistryPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_REG_PORT), Integer.parseInt(MAX_RMI_REG_PORT)));
-//        String rmiServerPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_RMI_SERVER_PORT), Integer.parseInt(MAX_RMI_SERVER_PORT)));
-//        String sshPort = Integer.toString(getAvailablePort(Integer.parseInt(MIN_SSH_PORT), Integer.parseInt(MAX_SSH_PORT)));
-//        String localRepository = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
-//        if (localRepository == null) {
-//            localRepository = "";
-//        }
-//
-//        if (JavaVersionUtil.getMajorVersion() >= 9) {
-//            return new Option[]{
-//                //KarafDistributionOption.debugConfiguration("8889", true),
-//                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
-//                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
-//                configureSecurity().disableKarafMBeanServerBuilder(),
-//                // configureConsole().ignoreLocalConsole(),
-//                keepRuntimeFolder(),
-//                logLevel(LogLevelOption.LogLevel.INFO),
-//                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
-//                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
-//                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
-//                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
-//                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository),
-//                new VMOption("--add-reads=java.xml=java.logging"),
-//                new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
-//                new VMOption("--patch-module"),
-//                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
-//                    + System.getProperty("karaf.version") + ".jar"),
-//                new VMOption("--patch-module"),
-//                new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
-//                    + System.getProperty("karaf.version") + ".jar"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.base/java.security=ALL-UNNAMED"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.base/java.net=ALL-UNNAMED"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.base/java.lang=ALL-UNNAMED"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.base/java.util=ALL-UNNAMED"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
-//                new VMOption("--add-opens"),
-//                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
-//                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
-//                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
-//                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
-//                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
-//                new VMOption("-classpath"),
-//                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
-//            };
-//        } else {
-//            return new Option[]{
-//                //KarafDistributionOption.debugConfiguration("8889", true),
-//                karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
-//                // enable JMX RBAC security, thanks to the KarafMBeanServerBuilder
-//                configureSecurity().disableKarafMBeanServerBuilder(),
-//                // configureConsole().ignoreLocalConsole(),
-//                keepRuntimeFolder(),
-//                logLevel(LogLevelOption.LogLevel.INFO),
-//                mavenBundle().groupId("org.awaitility").artifactId("awaitility").versionAsInProject(),
-//                mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
-//                mavenBundle().groupId("org.apache.karaf.itests").artifactId("common").versionAsInProject(),
-//                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", rmiRegistryPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", rmiServerPort),
-//                editConfigurationFilePut("etc/org.apache.karaf.shell.cfg", "sshPort", sshPort),
-//                editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepository)
-//            };
-//        }
     }
 
     /**