You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by bo...@apache.org on 2022/12/31 09:59:12 UTC

[streampipes] branch dev updated: Add example junit test to archetype extensions-jvm (#907)

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

bossenti pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new e33f042b4 Add example junit test to archetype extensions-jvm (#907)
e33f042b4 is described below

commit e33f042b49a04b86ecfefbf3fe01ff5e2b9e9e25
Author: Stefan Obermeier <ob...@apache.org>
AuthorDate: Sat Dec 31 10:59:08 2022 +0100

    Add example junit test to archetype extensions-jvm (#907)
---
 .../src/main/resources/archetype-resources/pom.xml | 22 ++++++++++++--
 .../src/test/java/InitTest.java                    | 34 ++++++++++++++++++++++
 2 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/archetypes/streampipes-archetype-extensions-jvm/src/main/resources/archetype-resources/pom.xml b/archetypes/streampipes-archetype-extensions-jvm/src/main/resources/archetype-resources/pom.xml
index 98eac28ea..dd9ec81cb 100644
--- a/archetypes/streampipes-archetype-extensions-jvm/src/main/resources/archetype-resources/pom.xml
+++ b/archetypes/streampipes-archetype-extensions-jvm/src/main/resources/archetype-resources/pom.xml
@@ -17,8 +17,7 @@
   ~
   -->
 
-<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>
     <groupId>${groupId}</groupId>
     <artifactId>${artifactId}</artifactId>
@@ -26,6 +25,7 @@
 
     <properties>
         <sp.version>0.91.0-SNAPSHOT</sp.version>
+        <junit-jupiter.version>5.9.1</junit-jupiter.version>
     </properties>
 
     <dependencies>
@@ -44,6 +44,12 @@
             <artifactId>streampipes-sources</artifactId>
             <version>${sp.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <version>${junit-jupiter.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
@@ -78,6 +84,18 @@
                     <encoding>UTF-8</encoding>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>3.0.0-M7</version>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.junit.jupiter</groupId>
+                        <artifactId>junit-jupiter-engine</artifactId>
+                        <version>${junit-jupiter.version}</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
         </plugins>
         <finalName>${artifactId}</finalName>
     </build>
diff --git a/archetypes/streampipes-archetype-extensions-jvm/src/main/resources/archetype-resources/src/test/java/InitTest.java b/archetypes/streampipes-archetype-extensions-jvm/src/main/resources/archetype-resources/src/test/java/InitTest.java
new file mode 100644
index 000000000..a52541b13
--- /dev/null
+++ b/archetypes/streampipes-archetype-extensions-jvm/src/main/resources/archetype-resources/src/test/java/InitTest.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package ${package};
+
+import static org.junit.Assert.assertFalse;
+import org.junit.jupiter.api.Test;
+
+public class InitTest {
+
+	@Test
+	public void checkIfServiceDescriptionExists() {
+		Init init = new Init();
+
+		// A human readable service description should exist
+		assertFalse(init.provideServiceDefinition().getServiceDescription().isEmpty());
+	}
+
+}