sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-testing-osgi-mock] 10/13: SLING-6359 context plugin support
Date Tue, 07 Nov 2017 10:21:39 GMT
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.testing.osgi-mock-2.2.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-osgi-mock.git

commit 284321490c561be244660e0c5bd7a96be39ad6f6
Author: Stefan Seifert <sseifert@apache.org>
AuthorDate: Sat Dec 3 14:41:13 2016 +0000

    SLING-6359 context plugin support
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/osgi-mock@1772469
13f79535-47bb-0310-9956-ffa450edef68
---
 .../sling/testing/mock/osgi/context/ContextPlugins.java  | 15 +++++++++++++++
 .../testing/mock/osgi/context/ContextPluginsTest.java    | 16 ++++++++--------
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/sling/testing/mock/osgi/context/ContextPlugins.java
b/src/main/java/org/apache/sling/testing/mock/osgi/context/ContextPlugins.java
index a4ae2dd..503bf92 100644
--- a/src/main/java/org/apache/sling/testing/mock/osgi/context/ContextPlugins.java
+++ b/src/main/java/org/apache/sling/testing/mock/osgi/context/ContextPlugins.java
@@ -68,6 +68,9 @@ public final class ContextPlugins {
     @SafeVarargs
     public final <T extends OsgiContextImpl> void addPlugin(ContextPlugin<T>...
plugin) {
         for (final ContextPlugin<T> item : plugin) {
+            if (item == null) {
+                continue;
+            }
             plugins.add(item);
         }
     }
@@ -80,6 +83,9 @@ public final class ContextPlugins {
     @SafeVarargs
     public final <T extends OsgiContextImpl> void addBeforeSetUpCallback(final ContextCallback<T>...
beforeSetUpCallback) {
         for (final ContextCallback<T> item : beforeSetUpCallback) {
+            if (item == null) {
+                continue;
+            }
             plugins.add(new AbstractContextPlugin<T>() {
                 @Override
                 public void beforeSetUp(T context) throws Exception {
@@ -101,6 +107,9 @@ public final class ContextPlugins {
     @SafeVarargs
     public final <T extends OsgiContextImpl> void addAfterSetUpCallback(final ContextCallback<T>...
afterSetUpCallback) {
         for (final ContextCallback<T> item : afterSetUpCallback) {
+            if (item == null) {
+                continue;
+            }
             plugins.add(new AbstractContextPlugin<T>() {
                 @Override
                 public void afterSetUp(T context) throws Exception {
@@ -122,6 +131,9 @@ public final class ContextPlugins {
     @SafeVarargs
     public final <T extends OsgiContextImpl> void addBeforeTearDownCallback(final ContextCallback<T>...
beforeTearDownCallback) {
         for (final ContextCallback<T> item : beforeTearDownCallback) {
+            if (item == null) {
+                continue;
+            }
             plugins.add(new AbstractContextPlugin<T>() {
                 @Override
                 public void beforeTearDown(T context) throws Exception {
@@ -143,6 +155,9 @@ public final class ContextPlugins {
     @SafeVarargs
     public final <T extends OsgiContextImpl> void addAfterTearDownCallback(final ContextCallback<T>...
afterTearDownCallback) {
         for (final ContextCallback<T> item : afterTearDownCallback) {
+            if (item == null) {
+                continue;
+            }
             plugins.add(new AbstractContextPlugin<T>() {
                 @Override
                 public void afterTearDown(T context) throws Exception {
diff --git a/src/test/java/org/apache/sling/testing/mock/osgi/context/ContextPluginsTest.java
b/src/test/java/org/apache/sling/testing/mock/osgi/context/ContextPluginsTest.java
index c6b5462..cee77f0 100644
--- a/src/test/java/org/apache/sling/testing/mock/osgi/context/ContextPluginsTest.java
+++ b/src/test/java/org/apache/sling/testing/mock/osgi/context/ContextPluginsTest.java
@@ -71,7 +71,7 @@ public class ContextPluginsTest {
     @Test
     public void testExecuteBeforeSetUpCallback() throws Exception {
         ContextPlugins underTest = new ContextPlugins();
-        underTest.addPlugin(plugin1, plugin2);
+        underTest.addPlugin(plugin1, plugin2, null);
         
         assertEquals(2, underTest.getPlugins().size());
         
@@ -85,7 +85,7 @@ public class ContextPluginsTest {
     @Test
     public void testExecuteAfterSetUpCallback() throws Exception {
         ContextPlugins underTest = new ContextPlugins();
-        underTest.addPlugin(plugin1, plugin2);
+        underTest.addPlugin(plugin1, plugin2, null);
         
         assertEquals(2, underTest.getPlugins().size());
         
@@ -99,7 +99,7 @@ public class ContextPluginsTest {
     @Test
     public void testExecuteBeforeTearDownCallback() throws Exception {
         ContextPlugins underTest = new ContextPlugins();
-        underTest.addPlugin(plugin1, plugin2);
+        underTest.addPlugin(plugin1, plugin2, null);
         
         assertEquals(2, underTest.getPlugins().size());
         
@@ -113,7 +113,7 @@ public class ContextPluginsTest {
     @Test
     public void testExecuteAfterTearDownCallback() throws Exception {
         ContextPlugins underTest = new ContextPlugins();
-        underTest.addPlugin(plugin1, plugin2);
+        underTest.addPlugin(plugin1, plugin2, null);
         
         assertEquals(2, underTest.getPlugins().size());
         
@@ -127,7 +127,7 @@ public class ContextPluginsTest {
     @Test
     public void testAddBeforeSetUpCallback() throws Exception {
         ContextPlugins underTest = new ContextPlugins();
-        underTest.addBeforeSetUpCallback(callback1, callback2);
+        underTest.addBeforeSetUpCallback(callback1, callback2, null);
         
         assertEquals(2, underTest.getPlugins().size());
         
@@ -139,7 +139,7 @@ public class ContextPluginsTest {
     @Test
     public void testAddAfterSetUpCallback() throws Exception {
         ContextPlugins underTest = new ContextPlugins();
-        underTest.addAfterSetUpCallback(callback1, callback2);
+        underTest.addAfterSetUpCallback(callback1, callback2, null);
         
         assertEquals(2, underTest.getPlugins().size());
         
@@ -151,7 +151,7 @@ public class ContextPluginsTest {
     @Test
     public void testAddBeforeTearDownCallback() throws Exception {
         ContextPlugins underTest = new ContextPlugins();
-        underTest.addBeforeTearDownCallback(callback1, callback2);
+        underTest.addBeforeTearDownCallback(callback1, callback2, null);
         
         assertEquals(2, underTest.getPlugins().size());
         
@@ -163,7 +163,7 @@ public class ContextPluginsTest {
     @Test
     public void testAddAfterTearDownCallback() throws Exception {
         ContextPlugins underTest = new ContextPlugins();
-        underTest.addAfterTearDownCallback(callback1, callback2);
+        underTest.addAfterTearDownCallback(callback1, callback2, null);
         
         assertEquals(2, underTest.getPlugins().size());
         

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Mime
View raw message