You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/10/18 13:17:33 UTC
[plc4x] 09/15: [Karaf] Improved maven config for IT, added readme.
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/resolve-split-package-osgi
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 3b41e54469531359833d22b45a03d6bb6e827215
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>