openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r748737 - in /incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock: ./ TCKManager.java TCKWebBeansContainerDeployer.java
Date Fri, 27 Feb 2009 23:11:51 GMT
Author: gerdogdu
Date: Fri Feb 27 23:11:51 2009
New Revision: 748737

URL: http://svn.apache.org/viewvc?rev=748737&view=rev
Log:
Adding some mock implementations that are used by SPI implementations.

Added:
    incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/
    incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKManager.java
  (with props)
    incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKWebBeansContainerDeployer.java
  (with props)

Added: incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKManager.java?rev=748737&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKManager.java
(added)
+++ incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKManager.java
Fri Feb 27 23:11:51 2009
@@ -0,0 +1,193 @@
+/*
+ *  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 org.apache.webbeans.test.tck.mock;
+
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.Set;
+
+import javax.context.Context;
+import javax.context.CreationalContext;
+import javax.event.Observer;
+import javax.inject.TypeLiteral;
+import javax.inject.manager.Bean;
+import javax.inject.manager.Decorator;
+import javax.inject.manager.InjectionPoint;
+import javax.inject.manager.InterceptionType;
+import javax.inject.manager.Interceptor;
+import javax.inject.manager.Manager;
+
+import org.apache.webbeans.container.ManagerImpl;
+
+public class TCKManager implements Manager
+{
+    private static TCKManager instance = new TCKManager();
+    private ManagerImpl manager = null;
+    
+    private TCKManager()
+    {
+        this.manager = ManagerImpl.getManager();
+    }
+    
+    public static TCKManager getInstance()
+    {
+        return instance;
+    }
+
+    public Manager addBean(Bean<?> bean)
+    {
+        return this.manager.addBean(bean);
+    }
+
+    public Manager addContext(Context context)
+    {
+        
+        return this.manager.addContext(context);
+    }
+
+    public Manager addDecorator(Decorator decorator)
+    {
+        
+        return this.manager.addDecorator(decorator);
+    }
+
+    public Manager addInterceptor(Interceptor interceptor)
+    {
+        
+        return this.manager.addInterceptor(interceptor);
+    }
+
+    public <T> Manager addObserver(Observer<T> observer, Class<T> eventType,
Annotation... bindings)
+    {
+        
+        return this.manager.addObserver(observer, eventType, bindings);
+    }
+
+    public <T> Manager addObserver(Observer<T> observer, TypeLiteral<T>
eventType, Annotation... bindings)
+    {
+        
+        return this.manager.addObserver(observer, eventType, bindings);
+    }
+
+    public void fireEvent(Object event, Annotation... bindings)
+    {
+        this.manager.fireEvent(event, bindings);
+        
+    }
+
+    public Context getContext(Class<? extends Annotation> scopeType)
+    {
+        
+        return this.manager.getContext(scopeType);
+    }
+
+    public <T> T getInstance(Bean<T> bean)
+    {
+        
+        return this.manager.getInstance(bean);
+    }
+
+    public Object getInstanceByName(String name)
+    {
+        
+        return this.manager.getInstanceByName(name);
+    }
+
+    public <T> T getInstanceByType(Class<T> type, Annotation... bindingTypes)
+    {
+        
+        return this.manager.getInstanceByType(type, bindingTypes);
+    }
+
+    public <T> T getInstanceByType(TypeLiteral<T> type, Annotation... bindingTypes)
+    {
+        
+        return this.manager.getInstanceByType(type, bindingTypes);
+    }
+
+    public <T> T getInstanceToInject(InjectionPoint injectionPoint, CreationalContext<T>
context)
+    {
+        
+        return this.manager.getInstanceToInject(injectionPoint, context);
+    }
+
+    public Object getInstanceToInject(InjectionPoint injectionPoint)
+    {
+        
+        return this.manager.getInstanceToInject(injectionPoint);
+    }
+
+    public Manager parse(InputStream xmlStream)
+    {
+        
+        return this.manager.parse(xmlStream);
+    }
+
+    public <T> Manager removeObserver(Observer<T> observer, Class<T> eventType,
Annotation... bindings)
+    {
+        
+        return this.manager.removeObserver(observer, eventType, bindings);
+    }
+
+    public <T> Manager removeObserver(Observer<T> observer, TypeLiteral<T>
eventType, Annotation... bindings)
+    {
+        
+        return this.manager.removeObserver(observer, eventType, bindings);
+    }
+
+    public Set<Bean<?>> resolveByName(String name)
+    {
+        
+        return this.manager.resolveByName(name);
+    }
+
+    public <T> Set<Bean<T>> resolveByType(Class<T> type, Annotation...
bindings)
+    {
+        
+        return this.manager.resolveByType(type, bindings);
+    }
+
+    public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> apiType,
Annotation... bindingTypes)
+    {
+        
+        return this.manager.resolveByType(apiType, bindingTypes);
+    }
+
+    public List<Decorator> resolveDecorators(Set<Class<?>> types, Annotation...
bindingTypes)
+    {
+        
+        return this.manager.resolveDecorators(types, bindingTypes);
+    }
+
+    public List<Interceptor> resolveInterceptors(InterceptionType type, Annotation...
interceptorBindings)
+    {
+        
+        return this.manager.resolveInterceptors(type, interceptorBindings);
+    }
+
+    public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
bindings)
+    {
+        
+        return this.manager.resolveObservers(event, bindings);
+    }
+
+    public void clear()
+    {
+        manager.getBeans().clear();
+    }
+}

Propchange: incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKWebBeansContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKWebBeansContainerDeployer.java?rev=748737&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKWebBeansContainerDeployer.java
(added)
+++ incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKWebBeansContainerDeployer.java
Fri Feb 27 23:11:51 2009
@@ -0,0 +1,135 @@
+/*
+ *  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 org.apache.webbeans.test.tck.mock;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.webbeans.config.EJBWebBeansConfigurator;
+import org.apache.webbeans.config.SimpleWebBeansConfigurator;
+import org.apache.webbeans.config.WebBeansContainerDeployer;
+import org.apache.webbeans.config.WebBeansScanner;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.xml.WebBeansXMLConfigurator;
+
+public class TCKWebBeansContainerDeployer extends WebBeansContainerDeployer
+{
+    private Set<Class<?>> classes = new HashSet<Class<?>>();
+    private Set<URL> beansXml = new HashSet<URL>();
+    
+    public TCKWebBeansContainerDeployer(WebBeansXMLConfigurator xmlConfigurator)
+    {
+        super(xmlConfigurator);
+    }
+
+    public void addBeanClass(Class<?> clazz)
+    {
+        Asserts.assertNotNull(clazz);
+        classes.add(clazz);
+    }
+    
+    public void addBeanXml(URL url)
+    {
+        Asserts.assertNotNull(url);
+        beansXml.add(url);
+    }
+    
+    public void clear()
+    {
+        this.classes.clear();
+        this.beansXml.clear();
+        this.deployed = false;
+    }
+    
+    protected void deployFromXML(WebBeansScanner scanner)
+    {
+        if(scanner == null)
+        {
+            Iterator<URL> urlIt = beansXml.iterator();
+            while(urlIt.hasNext())
+            {
+                URL url = urlIt.next();
+                try
+                {
+                    this.xmlConfigurator.configure(url.openStream(), url.getFile());
+                }
+                catch (IOException e)
+                {
+                    
+                }
+            }
+        }
+        else
+        {
+            super.deployFromXML(scanner);
+        }
+    }
+    
+    
+    protected void deployFromClassPath(WebBeansScanner scanner) throws ClassNotFoundException
+    {
+        if(scanner == null)
+        {
+            Iterator<Class<?>> it = classes.iterator();
+            while(it.hasNext())
+            {
+                Class<?> clazz = it.next();
+                
+                if (SimpleWebBeansConfigurator.isSimpleWebBean(clazz))
+                {
+                    defineSimpleWebBeans(clazz);
+                }
+                else if (EJBWebBeansConfigurator.isEJBWebBean(clazz))
+                {
+                    defineEnterpriseWebBeans();
+                }
+                
+            }
+        }
+        else
+        {
+            super.deployFromClassPath(scanner);
+        }
+    }    
+
+    
+    protected void checkStereoTypes(WebBeansScanner scanner)
+    {
+        
+    }
+
+    
+    protected void checkSpecializations(WebBeansScanner scanner)
+    {
+    }
+
+    
+    protected void configureDecorators(WebBeansScanner scanner) throws ClassNotFoundException
+    {
+        
+    }
+
+    
+    protected void configureInterceptors(WebBeansScanner scanner) throws ClassNotFoundException
+    {
+        
+    }
+    
+}
\ No newline at end of file

Propchange: incubator/openwebbeans/trunk/webbeans-tck/src/test/java/org/apache/webbeans/test/tck/mock/TCKWebBeansContainerDeployer.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message