openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject [openwebbeans] branch master updated: OWB-1296 use initParam for SCI enabling/disabling
Date Fri, 02 Aug 2019 06:30:53 GMT
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 600d606  OWB-1296 use initParam for SCI enabling/disabling
600d606 is described below

commit 600d606b47f6cdc292ada25a07b56dc08928c49a
Author: Mark Struberg <struberg@apache.org>
AuthorDate: Fri Aug 2 08:30:10 2019 +0200

    OWB-1296 use initParam for SCI enabling/disabling
---
 .../web/lifecycle/test/MockServletContext.java     | 25 +++++++++++++++++++---
 .../java/WebBeansConfigurationListenerTest.java    |  2 +-
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockServletContext.java
b/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockServletContext.java
index 247f991..164eeac 100644
--- a/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockServletContext.java
+++ b/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/test/MockServletContext.java
@@ -24,6 +24,7 @@ import java.net.URL;
 import java.util.Enumeration;
 import java.util.EventListener;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -47,6 +48,8 @@ public class MockServletContext implements ServletContext
 {
 
     private Map<String, Object> attributes = new HashMap<>();
+    private Map<String, String> initParams = new HashMap<>();
+
 
     @Override
     public String getContextPath()
@@ -159,19 +162,35 @@ public class MockServletContext implements ServletContext
     @Override
     public String getInitParameter(String name)
     {
-        return null;
+        return initParams.get(name);
     }
 
     @Override
     public Enumeration<String> getInitParameterNames()
     {
-        return null;
+        return new Enumeration<String>()
+        {
+            Iterator<String> it = initParams.keySet().iterator();
+
+            @Override
+            public boolean hasMoreElements()
+            {
+                return it.hasNext();
+            }
+
+            @Override
+            public String nextElement()
+            {
+                return it.next();
+            }
+        };
     }
 
     @Override
     public boolean setInitParameter(String name, String value)
     {
-        return false;
+        initParams.put(name, value);
+        return true;
     }
 
     @Override
diff --git a/webbeans-web/src/test/java/WebBeansConfigurationListenerTest.java b/webbeans-web/src/test/java/WebBeansConfigurationListenerTest.java
index e8d54fd..d4c2440 100644
--- a/webbeans-web/src/test/java/WebBeansConfigurationListenerTest.java
+++ b/webbeans-web/src/test/java/WebBeansConfigurationListenerTest.java
@@ -49,7 +49,7 @@ public class WebBeansConfigurationListenerTest
                 listener.set(ServletContextListener.class.cast(t));
             }
         };
-        context.setAttribute("openwebbeans.web.sci.active", "true");
+        context.setInitParameter("openwebbeans.web.sci.active", "true");
         System.setProperty(ScannerService.class.getName(), EmptyScanner.class.getName());
         System.setProperty(ContainerLifecycle.class.getName(), SingleStartContainerLifecycle.class.getName());
         auto.onStartup(emptySet(), context);


Mime
View raw message