openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1503783 - in /openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone: OwbArquillianSingletonService.java OwbStandaloneConfiguration.java OwbStandaloneContainer.java
Date Tue, 16 Jul 2013 16:25:56 GMT
Author: rmannibucau
Date: Tue Jul 16 16:25:55 2013
New Revision: 1503783

URL: http://svn.apache.org/r1503783
Log:
OWB-879 owb conf for arquillian adapter

Modified:
    openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianSingletonService.java
    openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneConfiguration.java
    openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java

Modified: openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianSingletonService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianSingletonService.java?rev=1503783&r1=1503782&r2=1503783&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianSingletonService.java
(original)
+++ openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbArquillianSingletonService.java
Tue Jul 16 16:25:55 2013
@@ -34,15 +34,23 @@ import org.apache.webbeans.spi.Singleton
 public class OwbArquillianSingletonService implements SingletonService<WebBeansContext>
 {
 
+    private final Properties initialConfig;
+
     private WebBeansContext webBeansContext;
 
-    public OwbArquillianSingletonService()
+    public OwbArquillianSingletonService(final Properties props)
     {
-        initOwb();
+        initialConfig = props;
+        initOwb(props);
     }
 
     public synchronized void initOwb()
     {
+        initOwb(initialConfig);
+    }
+
+    public synchronized void initOwb(final Properties initialConfig)
+    {
         ScannerService dummyScannerService = new OwbArquillianScannerService();
 
         Map<Class<?>, Object> initialServices = new HashMap<Class<?>,
Object>();
@@ -51,8 +59,6 @@ public class OwbArquillianSingletonServi
         // this is needed because of a dirty hack in the OpenWebBeansConfiguration
         initialServices.put(SecurityService.class, new SimpleSecurityService());
 
-        Properties initialConfig = new Properties();
-
         webBeansContext = new WebBeansContext(initialServices, initialConfig);
         webBeansContext.getOpenWebBeansConfiguration().parseConfiguration();
     }

Modified: openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneConfiguration.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneConfiguration.java?rev=1503783&r1=1503782&r2=1503783&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneConfiguration.java
(original)
+++ openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneConfiguration.java
Tue Jul 16 16:25:55 2013
@@ -21,6 +21,10 @@ package org.apache.webbeans.arquillian.s
 import org.jboss.arquillian.container.spi.ConfigurationException;
 import org.jboss.arquillian.container.spi.client.container.ContainerConfiguration;
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
 /**
  * Validate if the Owb Container is correctly configured
  */
@@ -33,6 +37,11 @@ public class OwbStandaloneConfiguration 
     private boolean useOnlyArchiveResources = false;
     private String useOnlyArchiveResourcesExcludes = null;
 
+    /**
+     * config
+     */
+    private String properties = null;
+
     @Override
     public void validate() throws ConfigurationException
     {
@@ -58,4 +67,35 @@ public class OwbStandaloneConfiguration 
     {
         this.useOnlyArchiveResourcesExcludes = useOnlyArchiveResourcesExcludes;
     }
+
+    public String getProperties()
+    {
+        return properties;
+    }
+
+    public void setProperties(final String properties)
+    {
+        this.properties = properties;
+    }
+
+    public Properties properties()
+    {
+        final Properties instance = new Properties();
+        if (properties == null)
+        {
+            return instance;
+        }
+
+        final ByteArrayInputStream bais = new ByteArrayInputStream(properties.getBytes());
+        try
+        {
+            instance.load(bais);
+        }
+        catch (final IOException e)
+        {
+            // no-op
+        }
+
+        return instance;
+    }
 }

Modified: openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java?rev=1503783&r1=1503782&r2=1503783&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java
(original)
+++ openwebbeans/trunk/webbeans-arquillian/owb-arquillian-standalone/src/main/java/org/apache/webbeans/arquillian/standalone/OwbStandaloneContainer.java
Tue Jul 16 16:25:55 2013
@@ -79,7 +79,7 @@ public class OwbStandaloneContainer impl
     {
         LOG.fine("OpenWebBeans Arquillian setup started");
 
-        singletonService = new OwbArquillianSingletonService();
+        singletonService = new OwbArquillianSingletonService(owbStandaloneConfiguration.properties());
         WebBeansFinder.setSingletonService(singletonService);
 
         useOnlyArchiveResources = owbStandaloneConfiguration.isUseOnlyArchiveResources();



Mime
View raw message