You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by da...@apache.org on 2021/05/14 12:48:37 UTC

[sling-whiteboard] branch master updated: Additional test

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

davidb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git


The following commit(s) were added to refs/heads/master by this push:
     new 1aebba6  Additional test
1aebba6 is described below

commit 1aebba605335287a246ae1e016b415582d53f0cc
Author: David Bosschaert <da...@apache.org>
AuthorDate: Fri May 14 13:48:22 2021 +0100

    Additional test
---
 .../util/features/impl/FeatureServiceImplTest.java | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/osgi-featuremodel/src/test/java/org/osgi/util/features/impl/FeatureServiceImplTest.java b/osgi-featuremodel/src/test/java/org/osgi/util/features/impl/FeatureServiceImplTest.java
index 0cc83c0..8552a47 100644
--- a/osgi-featuremodel/src/test/java/org/osgi/util/features/impl/FeatureServiceImplTest.java
+++ b/osgi-featuremodel/src/test/java/org/osgi/util/features/impl/FeatureServiceImplTest.java
@@ -19,6 +19,7 @@ package org.osgi.util.features.impl;
 import org.junit.Test;
 import org.osgi.util.features.BuilderFactory;
 import org.osgi.util.features.Feature;
+import org.osgi.util.features.FeatureBuilder;
 import org.osgi.util.features.FeatureBundle;
 import org.osgi.util.features.FeatureConfiguration;
 import org.osgi.util.features.FeatureExtension;
@@ -168,4 +169,50 @@ public class FeatureServiceImplTest {
         assertEquals(FeatureExtension.Type.JSON, jsonEx.getType());
         assertEquals("{\"foo\":[1,2,3]}", jsonEx.getJSON());
     }
+
+    @Test
+    public void testCreateFeature() {
+        BuilderFactory factory = Features.getBuilderFactory();
+
+        FeatureBuilder builder = factory.newFeatureBuilder(new ID("org.acme", "acmeapp", "1.0.0"));
+        builder.setName("The ACME app");
+        builder.setDescription("This is the main ACME app, "
+                + "from where all functionality can be reached.");
+
+        Feature f = builder.build();
+        System.out.println("***" + f);
+    }
+
+    @Test
+    public void testCreateFeatureBundle() {
+        BuilderFactory factory = Features.getBuilderFactory();
+
+        FeatureBuilder builder = factory.newFeatureBuilder(
+            new ID("org.acme", "acmeapp", "1.0.1"));
+        builder.setName("The Acme Application");
+        builder.setLicense("https://opensource.org/licenses/Apache-2.0");
+        builder.setComplete(true);
+
+        FeatureBundle b1 = factory.newBundleBuilder(
+                ID.fromMavenID("org.osgi:org.osgi.util.function:1.1.0"))
+                .build();
+        FeatureBundle b2 = factory.newBundleBuilder(
+                ID.fromMavenID("org.osgi:org.osgi.util.promise:1.1.1"))
+                .build();
+
+        FeatureBundle b3 = factory.newBundleBuilder(
+                ID.fromMavenID("org.apache.commons:commons-email:1.1.5"))
+                .addMetadata("org.acme.javadoc.link",
+                        "https://commons.apache.org/proper/commons-email/javadocs/api-1.5")
+                .build();
+
+        FeatureBundle b4 = factory.newBundleBuilder(
+                ID.fromMavenID("com.acme:acmelib:1.7.2"))
+                .build();
+
+        builder.addBundles(b1, b2, b3, b4);
+
+        Feature f = builder.build();
+        System.out.println("***" + f);
+    }
 }