You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by st...@apache.org on 2012/02/20 09:25:53 UTC
[2/3] git commit: DELTASPIKE-92 rename containerctrl to cdise
DELTASPIKE-92 rename containerctrl to cdise
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/16ad0a37
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/16ad0a37
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/16ad0a37
Branch: refs/heads/master
Commit: 16ad0a377a4aefbabd7d9a1d440e8ba96df417d4
Parents: 8d68af6
Author: Mark Struberg <st...@apache.org>
Authored: Mon Feb 20 08:15:20 2012 +0100
Committer: Mark Struberg <st...@apache.org>
Committed: Mon Feb 20 09:14:22 2012 +0100
----------------------------------------------------------------------
deltaspike/cdise/api/pom.xml | 60 ++++
.../apache/deltaspike/cdise/api/CdiContainer.java | 83 +++++
.../deltaspike/cdise/api/CdiContainerLoader.java | 60 ++++
deltaspike/cdise/impl-owb/pom.xml | 116 +++++++
.../deltaspike/cdise/owb/MockHttpSession.java | 112 +++++++
.../deltaspike/cdise/owb/MockServletContext.java | 179 +++++++++++
.../cdise/owb/OpenWebBeansContainerControl.java | 247 +++++++++++++++
.../org.apache.deltaspike.cdise.api.CdiContainer | 1 +
deltaspike/cdise/pom.xml | 44 +++
deltaspike/cdise/tck/pom.xml | 72 +++++
.../deltaspike/cdise/tck/ContainerCtrlTckTest.java | 64 ++++
.../org/apache/deltaspike/cdise/tck/beans/Car.java | 40 +++
.../deltaspike/cdise/tck/beans/CarRepair.java | 39 +++
.../apache/deltaspike/cdise/tck/beans/User.java | 38 +++
.../tck/src/main/resources/META-INF/beans.xml | 23 ++
deltaspike/containerctrl/api/pom.xml | 60 ----
.../containerctrl/api/ContainerControl.java | 83 -----
.../containerctrl/api/ContainerControlLoader.java | 60 ----
deltaspike/containerctrl/impl-owb/pom.xml | 116 -------
.../cditest/containerctrl/owb/MockHttpSession.java | 112 -------
.../containerctrl/owb/MockServletContext.java | 179 -----------
.../owb/OpenWebBeansContainerControl.java | 247 ---------------
...e.deltaspike.containerctrl.api.ContainerControl | 1 -
deltaspike/containerctrl/pom.xml | 44 ---
deltaspike/containerctrl/tck/pom.xml | 72 -----
.../containerctrl/tck/ContainerCtrlTckTest.java | 64 ----
.../deltaspike/containerctrl/tck/beans/Car.java | 40 ---
.../containerctrl/tck/beans/CarRepair.java | 39 ---
.../deltaspike/containerctrl/tck/beans/User.java | 38 ---
.../tck/src/main/resources/META-INF/beans.xml | 23 --
deltaspike/pom.xml | 2 +-
31 files changed, 1179 insertions(+), 1179 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/api/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/api/pom.xml b/deltaspike/cdise/api/pom.xml
new file mode 100644
index 0000000..2489997
--- /dev/null
+++ b/deltaspike/cdise/api/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.deltaspike.cdise</groupId>
+ <artifactId>cdise-project</artifactId>
+ <version>0.2-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>cdise-api</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Apache DeltaSpike CDI ContainerControl API</name>
+
+ <description>
+ This project provides a way to genericly run CDI containers
+ from inside of unit tests or Java SE applications.
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainer.java
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainer.java b/deltaspike/cdise/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainer.java
new file mode 100644
index 0000000..c958856
--- /dev/null
+++ b/deltaspike/cdise/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainer.java
@@ -0,0 +1,83 @@
+/*
+ * 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.deltaspike.cdise.api;
+
+
+import java.lang.annotation.Annotation;
+import javax.enterprise.inject.spi.BeanManager;
+
+
+/**
+ * <p>A CdiTestContainer provides access to an underlying JSR-299 (CDI)
+ * Container. It allows starting and stopping the container and to start
+ * and stop the built-in contexts of that container.</p>
+ *
+ * <p>The intention is to provide a portable control for CDI containers in
+ * Java SE environments. It is <b>not</b> intended for environments in which the
+ * CDI container is under full control of the server already, e.g. in
+ * EE-containers.</p>
+ */
+public interface CdiContainer
+{
+ /**
+ * Booting the CdiTestContainer will scan the whole classpath
+ * for Beans and extensions available.
+ * The container might throw a DeploymentException or similar on startup.
+ */
+ void bootContainer();
+
+ /**
+ * This will shutdown the underlying CDI container.
+ */
+ void shutdownContainer();
+
+ /**
+ * This will start all container built-in Contexts
+ */
+ void startContexts();
+
+ /**
+ * Stop all container built-in Contexts and destroy all beans properly
+ */
+ void stopContexts();
+
+ /**
+ * Start the specified scope. This only works for scopes which are handled
+ * by the CDI container itself. Custom scoped of 3rd party
+ * Context implementations shall be started directly (they are portable anyway).
+ *
+ * @param scopeClass e.g. RequestScoped.class
+ */
+ void startContext(Class<? extends Annotation> scopeClass);
+
+ /**
+ * Stop the specified scope. This only works for scopes which are handled
+ * by the CDI container itself. Custom scoped of 3rd party
+ * Context implementations shall be stopped directly (they are portable anyway).
+ *
+ * @param scopeClass e.g. RequestScoped.class
+ */
+ void stopContext(Class<? extends Annotation> scopeClass);
+
+ /**
+ * @return the {@link BeanManager} or <code>null</code> it not available
+ */
+ BeanManager getBeanManager();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainerLoader.java
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainerLoader.java b/deltaspike/cdise/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainerLoader.java
new file mode 100644
index 0000000..e060cb0
--- /dev/null
+++ b/deltaspike/cdise/api/src/main/java/org/apache/deltaspike/cdise/api/CdiContainerLoader.java
@@ -0,0 +1,60 @@
+/*
+ * 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.deltaspike.cdise.api;
+
+import java.util.Iterator;
+import java.util.ServiceLoader;
+
+/**
+ * <p>This class provides access to the ContainerControl.</p>
+ * <p>It uses the {@code java.util.ServiceLoader} mechanism to
+ * automatically pickup the container providers from the classpath.</p>
+ */
+public final class CdiContainerLoader
+{
+ private CdiContainerLoader()
+ {
+ // private ct to prevent instantiation
+ }
+
+
+ public static CdiContainer getCdiContainer()
+ {
+ CdiContainer testContainer;
+
+ //doesn't support the implementation loader (there is no dependency to owb-impl
+ ServiceLoader<CdiContainer> cdiContainerLoader = ServiceLoader.load(CdiContainer.class);
+ Iterator<CdiContainer> cdiIt = cdiContainerLoader.iterator();
+ if (cdiIt.hasNext())
+ {
+ testContainer = cdiIt.next();
+ }
+ else
+ {
+ throw new RuntimeException("Could not find a CdiContainer available in the classpath!");
+ }
+
+ if (cdiIt.hasNext())
+ {
+ throw new RuntimeException("Too many CdiContainer found in the classpath!");
+ }
+
+ return testContainer;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/impl-owb/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/impl-owb/pom.xml b/deltaspike/cdise/impl-owb/pom.xml
new file mode 100644
index 0000000..6988405
--- /dev/null
+++ b/deltaspike/cdise/impl-owb/pom.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.deltaspike.cdise</groupId>
+ <artifactId>cdise-project</artifactId>
+ <version>0.2-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>cdise-owb</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Apache DeltaSpike CDI OWB-ContainerControl</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.deltaspike.cdise</groupId>
+ <artifactId>cdise-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.deltaspike.cdise</groupId>
+ <artifactId>cdise-tck</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_2.5_spec</artifactId>
+ <version>1.2</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- OWB specific dependencies-->
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-spi</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.deltaspike.cdise</groupId>
+ <artifactId>cdise-tck</artifactId>
+ <version>${project.version}</version>
+ <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+
+
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java b/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
new file mode 100644
index 0000000..195a0df
--- /dev/null
+++ b/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
@@ -0,0 +1,112 @@
+/*
+ * 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.deltaspike.cdise.owb;
+
+import java.util.Enumeration;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+/**
+ * A simple mock HttpSession
+ */
+public class MockHttpSession implements HttpSession
+{
+
+ public long getCreationTime()
+ {
+ return 0;
+ }
+
+ public String getId()
+ {
+ return "sessId1";
+ }
+
+ public long getLastAccessedTime()
+ {
+ return 0;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return null;
+ }
+
+ public void setMaxInactiveInterval(int interval)
+ {
+ }
+
+ public int getMaxInactiveInterval()
+ {
+ return 0;
+ }
+
+ public HttpSessionContext getSessionContext()
+ {
+ return null;
+ }
+
+ public Object getAttribute(String name)
+ {
+ return null;
+ }
+
+ public Object getValue(String name)
+ {
+ return null;
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return null;
+ }
+
+ public String[] getValueNames()
+ {
+ return new String[0];
+ }
+
+ public void setAttribute(String name, Object value)
+ {
+ }
+
+ public void putValue(String name, Object value)
+ {
+ }
+
+ public void removeAttribute(String name)
+ {
+ }
+
+ public void removeValue(String name)
+ {
+ }
+
+ public void invalidate()
+ {
+ }
+
+ public boolean isNew()
+ {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockServletContext.java
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockServletContext.java b/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockServletContext.java
new file mode 100644
index 0000000..b40fb51
--- /dev/null
+++ b/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockServletContext.java
@@ -0,0 +1,179 @@
+/*
+ * 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.deltaspike.cdise.owb;
+
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+/**
+ * Mock ServletContext needed to startup the container.
+ *
+ */
+public class MockServletContext implements ServletContext
+{
+
+ @SuppressWarnings("unchecked")
+ private Hashtable attributes = new Hashtable();
+
+
+
+ public Object getAttribute(String name)
+ {
+ return attributes.get(name);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration getAttributeNames()
+ {
+ return attributes.keys();
+ }
+
+ public ServletContext getContext(String uripath)
+ {
+ return this;
+ }
+
+ public String getContextPath()
+ {
+ return "mockContextpath";
+ }
+
+ public String getInitParameter(String name)
+ {
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration getInitParameterNames()
+ {
+ return new StringTokenizer(""); // 'standard' empty Enumeration
+ }
+
+ public int getMajorVersion()
+ {
+ return 2;
+ }
+
+ public String getMimeType(String file)
+ {
+ return null;
+ }
+
+ public int getMinorVersion()
+ {
+ return 0;
+ }
+
+ public RequestDispatcher getNamedDispatcher(String name)
+ {
+ return null;
+ }
+
+ public String getRealPath(String path)
+ {
+ return "mockRealPath";
+ }
+
+ public RequestDispatcher getRequestDispatcher(String path)
+ {
+ return null;
+ }
+
+ public URL getResource(String path) throws MalformedURLException
+ {
+ return null;
+ }
+
+ public InputStream getResourceAsStream(String path)
+ {
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Set getResourcePaths(String path)
+ {
+ return null;
+ }
+
+ public String getServerInfo()
+ {
+ return "mockServer";
+ }
+
+ public Servlet getServlet(String name) throws ServletException
+ {
+ return null;
+ }
+
+ public String getServletContextName()
+ {
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration getServletNames()
+ {
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration getServlets()
+ {
+ return null;
+ }
+
+ public void log(String msg)
+ {
+ // TODO
+ }
+
+ public void log(Exception exception, String msg)
+ {
+ // TODO
+
+ }
+
+ public void log(String message, Throwable throwable)
+ {
+ // TODO
+
+ }
+
+ public void removeAttribute(String name)
+ {
+ attributes.remove(name);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void setAttribute(String name, Object object)
+ {
+ attributes.put(name, object);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContainerControl.java
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContainerControl.java b/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContainerControl.java
new file mode 100644
index 0000000..84b99cd
--- /dev/null
+++ b/deltaspike/cdise/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContainerControl.java
@@ -0,0 +1,247 @@
+/*
+ * 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.deltaspike.cdise.owb;
+
+import java.lang.annotation.Annotation;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Singleton;
+
+import org.apache.deltaspike.cdise.api.CdiContainer;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.context.ContextFactory;
+import org.apache.webbeans.context.type.ContextTypes;
+import org.apache.webbeans.spi.ContainerLifecycle;
+
+/**
+ * OpenWebBeans specific implementation of {@link org.apache.deltaspike.cdise.api.CdiContainer}.
+ */
+public class OpenWebBeansContainerControl implements CdiContainer
+{
+ private static final Logger logger = Logger.getLogger(OpenWebBeansContainerControl.class.getName());
+
+ private ContainerLifecycle lifecycle = null;
+ private MockServletContext servletContext = null;
+ private MockHttpSession session = null;
+
+ public void bootContainer()
+ {
+ servletContext = new MockServletContext();
+ session = new MockHttpSession();
+ lifecycle = WebBeansContext.getInstance().getService(ContainerLifecycle.class);
+ lifecycle.startApplication(servletContext);
+ }
+
+ public void shutdownContainer()
+ {
+ if (lifecycle != null)
+ {
+ lifecycle.stopApplication(servletContext);
+ }
+ }
+
+ public void startContexts()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ contextFactory.initSingletonContext(servletContext);
+ contextFactory.initApplicationContext(servletContext);
+ contextFactory.initSessionContext(session);
+ contextFactory.initConversationContext(null);
+ contextFactory.initRequestContext(null);
+ }
+
+ private void startApplicationScope()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ contextFactory.initApplicationContext(servletContext);
+ }
+
+ public void startConversationScope()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ contextFactory.initConversationContext(null);
+ }
+
+ public void startContext(Class<? extends Annotation> scopeClass)
+ {
+ if (scopeClass.isAssignableFrom(ApplicationScoped.class))
+ {
+ startApplicationScope();
+ }
+ else if (scopeClass.isAssignableFrom(SessionScoped.class))
+ {
+ startSessionScope();
+ }
+ else if (scopeClass.isAssignableFrom(RequestScoped.class))
+ {
+ startRequestScope();
+ }
+ else if (scopeClass.isAssignableFrom(ConversationScoped.class))
+ {
+ startConversationScope();
+ }
+ }
+
+ private void startRequestScope()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ contextFactory.initRequestContext(null);
+ }
+
+ private void startSessionScope()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ contextFactory.initSessionContext(session);
+ }
+
+ public void stopContexts()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ stopSessionScope();
+ stopConversationScope();
+ stopRequestScope();
+ stopApplicationScope();
+
+ Context context = contextFactory.getStandardContext(ContextTypes.SINGLETON);
+ if (context != null && context.isActive())
+ {
+ contextFactory.destroySingletonContext(servletContext);
+ }
+ else
+ {
+ logger.log(Level.WARNING,
+ "destroy was called for an inactive context (" + Singleton.class.getName() + ")");
+ }
+
+ }
+
+ public void stopApplicationScope()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ Context context = contextFactory.getStandardContext(ContextTypes.APPLICATION);
+ if (context != null && context.isActive())
+ {
+ contextFactory.destroyApplicationContext(servletContext);
+ }
+ else
+ {
+ logger.log(Level.WARNING,
+ "destroy was called for an inactive context (" + ApplicationScoped.class.getName() + ")");
+ }
+ }
+
+ public void stopConversationScope()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ Context context = contextFactory.getStandardContext(ContextTypes.CONVERSATION);
+ if (context != null && context.isActive())
+ {
+ contextFactory.destroyConversationContext();
+ }
+ else
+ {
+ logger.log(Level.WARNING,
+ "destroy was called for an inactive context (" + ConversationScoped.class.getName() + ")");
+ }
+ }
+
+ public void stopContext(Class<? extends Annotation> scopeClass)
+ {
+ if (scopeClass.isAssignableFrom(ApplicationScoped.class))
+ {
+ stopApplicationScope();
+ }
+ else if (scopeClass.isAssignableFrom(SessionScoped.class))
+ {
+ stopSessionScope();
+ }
+ else if (scopeClass.isAssignableFrom(RequestScoped.class))
+ {
+ stopRequestScope();
+ }
+ else if (scopeClass.isAssignableFrom(ConversationScoped.class))
+ {
+ stopConversationScope();
+ }
+ }
+
+ public void stopRequestScope()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ Context context = contextFactory.getStandardContext(ContextTypes.REQUEST);
+ if (context != null && context.isActive())
+ {
+ contextFactory.destroyRequestContext(null);
+ }
+ else
+ {
+ logger.log(Level.WARNING,
+ "destroy was called for an inactive context (" + RequestScoped.class.getName() + ")");
+ }
+ }
+
+ public void stopSessionScope()
+ {
+ WebBeansContext webBeansContext = WebBeansContext.getInstance();
+ ContextFactory contextFactory = webBeansContext.getContextFactory();
+
+ Context context = contextFactory.getStandardContext(ContextTypes.SESSION);
+ if (context != null && context.isActive())
+ {
+ contextFactory.destroySessionContext(session);
+ }
+ else
+ {
+ logger.log(Level.WARNING,
+ "destroy was called for an inactive context (" + SessionScoped.class.getName() + ")");
+ }
+ }
+
+ public BeanManager getBeanManager()
+ {
+ return lifecycle.getBeanManager();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/impl-owb/src/main/resources/META-INF/services/org.apache.deltaspike.cdise.api.CdiContainer
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/impl-owb/src/main/resources/META-INF/services/org.apache.deltaspike.cdise.api.CdiContainer b/deltaspike/cdise/impl-owb/src/main/resources/META-INF/services/org.apache.deltaspike.cdise.api.CdiContainer
new file mode 100644
index 0000000..da0883b
--- /dev/null
+++ b/deltaspike/cdise/impl-owb/src/main/resources/META-INF/services/org.apache.deltaspike.cdise.api.CdiContainer
@@ -0,0 +1 @@
+org.apache.deltaspike.cdise.owb.OpenWebBeansContainerControl
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/pom.xml b/deltaspike/cdise/pom.xml
new file mode 100644
index 0000000..6135f52
--- /dev/null
+++ b/deltaspike/cdise/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.deltaspike</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.2-incubating-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.deltaspike.cdise</groupId>
+ <artifactId>cdise-project</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Apache DeltaSpike ContainerControl parent</name>
+
+ <modules>
+ <module>api</module>
+ <module>tck</module>
+ <module>impl-owb</module>
+ <!--
+ <module>impl-weld</modul>
+ -->
+ </modules>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/tck/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/tck/pom.xml b/deltaspike/cdise/tck/pom.xml
new file mode 100644
index 0000000..a94adcf
--- /dev/null
+++ b/deltaspike/cdise/tck/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.deltaspike.cdise</groupId>
+ <artifactId>cdise-project</artifactId>
+ <version>0.2-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>cdise-tck</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Apache DeltaSpike CDI ContainerControl TCK</name>
+
+ <description>
+ The TCK for testing ContainerControl implementations
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jcdi_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-atinject_1.0_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-interceptor_1.1_spec</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>compile</scope>
+ <optional>true</optional>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.deltaspike.cdise</groupId>
+ <artifactId>cdise-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/ContainerCtrlTckTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/ContainerCtrlTckTest.java b/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/ContainerCtrlTckTest.java
new file mode 100644
index 0000000..0b2be8e
--- /dev/null
+++ b/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/ContainerCtrlTckTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.deltaspike.cdise.tck;
+
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import java.util.Set;
+
+import org.apache.deltaspike.cdise.api.CdiContainer;
+import org.apache.deltaspike.cdise.api.CdiContainerLoader;
+
+import org.apache.deltaspike.cdise.tck.beans.CarRepair;
+import org.junit.Test;
+
+import org.junit.Assert;
+
+/**
+ * TCK test for the {@link org.apache.deltaspike.cdise.api.CdiContainer}
+ */
+public class ContainerCtrlTckTest
+{
+
+ @Test
+ public void testContainerBoot() throws Exception
+ {
+ CdiContainer cc = CdiContainerLoader.getCdiContainer();
+ Assert.assertNotNull(cc);
+
+ cc.bootContainer();
+ cc.startContexts();
+
+ BeanManager bm = cc.getBeanManager();
+ Assert.assertNotNull(bm);
+
+ Set<Bean<?>> beans = bm.getBeans(CarRepair.class);
+ Bean<?> bean = bm.resolve(beans);
+
+ CarRepair carRepair = (CarRepair) bm.getReference(bean, CarRepair.class, bm.createCreationalContext(bean));
+ Assert.assertNotNull(carRepair);
+
+ Assert.assertNotNull(carRepair.getCar());
+ Assert.assertNotNull(carRepair.getCar().getUsr());
+
+ cc.stopContexts();
+ cc.shutdownContainer();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/Car.java
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/Car.java b/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/Car.java
new file mode 100644
index 0000000..8367572
--- /dev/null
+++ b/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/Car.java
@@ -0,0 +1,40 @@
+/*
+ * 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.deltaspike.cdise.tck.beans;
+
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+@RequestScoped
+public class Car
+{
+ @Inject
+ private User usr;
+
+ public User getUsr()
+ {
+ return usr;
+ }
+
+ public void setUsr(User usr)
+ {
+ this.usr = usr;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/CarRepair.java
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/CarRepair.java b/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/CarRepair.java
new file mode 100644
index 0000000..beec2f5
--- /dev/null
+++ b/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/CarRepair.java
@@ -0,0 +1,39 @@
+/*
+ * 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.deltaspike.cdise.tck.beans;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+@ApplicationScoped
+public class CarRepair
+{
+ @Inject
+ private Car car;
+
+ public Car getCar()
+ {
+ return car;
+ }
+
+ public void setCar(Car car)
+ {
+ this.car = car;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/User.java
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/User.java b/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/User.java
new file mode 100644
index 0000000..238437b
--- /dev/null
+++ b/deltaspike/cdise/tck/src/main/java/org/apache/deltaspike/cdise/tck/beans/User.java
@@ -0,0 +1,38 @@
+/*
+ * 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.deltaspike.cdise.tck.beans;
+
+import javax.enterprise.context.SessionScoped;
+import java.io.Serializable;
+
+@SessionScoped
+public class User implements Serializable
+{
+ private String name;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/cdise/tck/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/deltaspike/cdise/tck/src/main/resources/META-INF/beans.xml b/deltaspike/cdise/tck/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..4070730
--- /dev/null
+++ b/deltaspike/cdise/tck/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/api/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/api/pom.xml b/deltaspike/containerctrl/api/pom.xml
deleted file mode 100644
index b2ebea4..0000000
--- a/deltaspike/containerctrl/api/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.deltaspike.containerctrl</groupId>
- <artifactId>containerctrl-project</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>deltaspike-containerctrl-api</artifactId>
- <packaging>jar</packaging>
-
- <name>Apache DeltaSpike CDI ContainerControl API</name>
-
- <description>
- This project provides a way to genericly run CDI containers
- from inside of unit tests or Java SE applications.
- </description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_1.0_spec</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.1_spec</artifactId>
- <optional>true</optional>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/api/src/main/java/org/apache/deltaspike/containerctrl/api/ContainerControl.java
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/api/src/main/java/org/apache/deltaspike/containerctrl/api/ContainerControl.java b/deltaspike/containerctrl/api/src/main/java/org/apache/deltaspike/containerctrl/api/ContainerControl.java
deleted file mode 100644
index d5a36b1..0000000
--- a/deltaspike/containerctrl/api/src/main/java/org/apache/deltaspike/containerctrl/api/ContainerControl.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.deltaspike.containerctrl.api;
-
-
-import java.lang.annotation.Annotation;
-import javax.enterprise.inject.spi.BeanManager;
-
-
-/**
- * <p>A CdiTestContainer provides access to an underlying JSR-299 (CDI)
- * Container. It allows starting and stopping the container and to start
- * and stop the built-in contexts of that container.</p>
- *
- * <p>The intention is to provide a portable control for CDI containers in
- * Java SE environments. It is <b>not</b> intended for environments in which the
- * CDI container is under full control of the server already, e.g. in
- * EE-containers.</p>
- */
-public interface ContainerControl
-{
- /**
- * Booting the CdiTestContainer will scan the whole classpath
- * for Beans and extensions available.
- * The container might throw a DeploymentException or similar on startup.
- */
- void bootContainer();
-
- /**
- * This will shutdown the underlying CDI container.
- */
- void shutdownContainer();
-
- /**
- * This will start all container built-in Contexts
- */
- void startContexts();
-
- /**
- * Stop all container built-in Contexts and destroy all beans properly
- */
- void stopContexts();
-
- /**
- * Start the specified scope. This only works for scopes which are handled
- * by the CDI container itself. Custom scoped of 3rd party
- * Context implementations shall be started directly (they are portable anyway).
- *
- * @param scopeClass e.g. RequestScoped.class
- */
- void startContext(Class<? extends Annotation> scopeClass);
-
- /**
- * Stop the specified scope. This only works for scopes which are handled
- * by the CDI container itself. Custom scoped of 3rd party
- * Context implementations shall be stopped directly (they are portable anyway).
- *
- * @param scopeClass e.g. RequestScoped.class
- */
- void stopContext(Class<? extends Annotation> scopeClass);
-
- /**
- * @return the {@link BeanManager} or <code>null</code> it not available
- */
- BeanManager getBeanManager();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/api/src/main/java/org/apache/deltaspike/containerctrl/api/ContainerControlLoader.java
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/api/src/main/java/org/apache/deltaspike/containerctrl/api/ContainerControlLoader.java b/deltaspike/containerctrl/api/src/main/java/org/apache/deltaspike/containerctrl/api/ContainerControlLoader.java
deleted file mode 100644
index fb9de13..0000000
--- a/deltaspike/containerctrl/api/src/main/java/org/apache/deltaspike/containerctrl/api/ContainerControlLoader.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.deltaspike.containerctrl.api;
-
-import java.util.Iterator;
-import java.util.ServiceLoader;
-
-/**
- * <p>This class provides access to the ContainerControl.</p>
- * <p>It uses the {@code java.util.ServiceLoader} mechanism to
- * automatically pickup the container providers from the classpath.</p>
- */
-public final class ContainerControlLoader
-{
- private ContainerControlLoader()
- {
- // private ct to prevent instantiation
- }
-
-
- public static ContainerControl getCdiContainer()
- {
- ContainerControl testContainer = null;
-
- //doesn't support the implementation loader (there is no dependency to owb-impl
- ServiceLoader<ContainerControl> cdiContainerLoader = ServiceLoader.load(ContainerControl.class);
- Iterator<ContainerControl> cdiIt = cdiContainerLoader.iterator();
- if (cdiIt.hasNext())
- {
- testContainer = cdiIt.next();
- }
- else
- {
- throw new RuntimeException("Could not find a ContainerControl available in the classpath!");
- }
-
- if (cdiIt.hasNext())
- {
- throw new RuntimeException("Too many ContainerControl found in the classpath!");
- }
-
- return testContainer;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/impl-owb/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/impl-owb/pom.xml b/deltaspike/containerctrl/impl-owb/pom.xml
deleted file mode 100644
index aaacc15..0000000
--- a/deltaspike/containerctrl/impl-owb/pom.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
- <!--
- 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.deltaspike.containerctrl</groupId>
- <artifactId>containerctrl-project</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>deltaspike-containerctrl-owb</artifactId>
- <packaging>jar</packaging>
-
- <name>Apache DeltaSpike CDI OWB-ContainerControl</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.deltaspike.containerctrl</groupId>
- <artifactId>deltaspike-containerctrl-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.deltaspike.containerctrl</groupId>
- <artifactId>containerctrl-tck</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_1.0_spec</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_2.5_spec</artifactId>
- <version>1.2</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- OWB specific dependencies-->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-impl</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-spi</artifactId>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <groupId>org.apache.maven.plugins</groupId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.deltaspike.containerctrl</groupId>
- <artifactId>containerctrl-tck</artifactId>
- <version>${project.version}</version>
- <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
-
-
- </plugins>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/MockHttpSession.java
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/MockHttpSession.java b/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/MockHttpSession.java
deleted file mode 100644
index 9206617..0000000
--- a/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/MockHttpSession.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.deltaspike.cditest.containerctrl.owb;
-
-import java.util.Enumeration;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionContext;
-
-/**
- * A simple mock HttpSession
- */
-public class MockHttpSession implements HttpSession
-{
-
- public long getCreationTime()
- {
- return 0;
- }
-
- public String getId()
- {
- return "sessId1";
- }
-
- public long getLastAccessedTime()
- {
- return 0;
- }
-
- public ServletContext getServletContext()
- {
- return null;
- }
-
- public void setMaxInactiveInterval(int interval)
- {
- }
-
- public int getMaxInactiveInterval()
- {
- return 0;
- }
-
- public HttpSessionContext getSessionContext()
- {
- return null;
- }
-
- public Object getAttribute(String name)
- {
- return null;
- }
-
- public Object getValue(String name)
- {
- return null;
- }
-
- public Enumeration getAttributeNames()
- {
- return null;
- }
-
- public String[] getValueNames()
- {
- return new String[0];
- }
-
- public void setAttribute(String name, Object value)
- {
- }
-
- public void putValue(String name, Object value)
- {
- }
-
- public void removeAttribute(String name)
- {
- }
-
- public void removeValue(String name)
- {
- }
-
- public void invalidate()
- {
- }
-
- public boolean isNew()
- {
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/MockServletContext.java
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/MockServletContext.java b/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/MockServletContext.java
deleted file mode 100644
index f71cf14..0000000
--- a/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/MockServletContext.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.deltaspike.cditest.containerctrl.owb;
-
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-/**
- * Mock ServletContext needed to startup the container.
- *
- */
-public class MockServletContext implements ServletContext
-{
-
- @SuppressWarnings("unchecked")
- private Hashtable attributes = new Hashtable();
-
-
-
- public Object getAttribute(String name)
- {
- return attributes.get(name);
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getAttributeNames()
- {
- return attributes.keys();
- }
-
- public ServletContext getContext(String uripath)
- {
- return this;
- }
-
- public String getContextPath()
- {
- return "mockContextpath";
- }
-
- public String getInitParameter(String name)
- {
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getInitParameterNames()
- {
- return new StringTokenizer(""); // 'standard' empty Enumeration
- }
-
- public int getMajorVersion()
- {
- return 2;
- }
-
- public String getMimeType(String file)
- {
- return null;
- }
-
- public int getMinorVersion()
- {
- return 0;
- }
-
- public RequestDispatcher getNamedDispatcher(String name)
- {
- return null;
- }
-
- public String getRealPath(String path)
- {
- return "mockRealPath";
- }
-
- public RequestDispatcher getRequestDispatcher(String path)
- {
- return null;
- }
-
- public URL getResource(String path) throws MalformedURLException
- {
- return null;
- }
-
- public InputStream getResourceAsStream(String path)
- {
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public Set getResourcePaths(String path)
- {
- return null;
- }
-
- public String getServerInfo()
- {
- return "mockServer";
- }
-
- public Servlet getServlet(String name) throws ServletException
- {
- return null;
- }
-
- public String getServletContextName()
- {
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getServletNames()
- {
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getServlets()
- {
- return null;
- }
-
- public void log(String msg)
- {
- // TODO
- }
-
- public void log(Exception exception, String msg)
- {
- // TODO
-
- }
-
- public void log(String message, Throwable throwable)
- {
- // TODO
-
- }
-
- public void removeAttribute(String name)
- {
- attributes.remove(name);
- }
-
- @SuppressWarnings("unchecked")
- public void setAttribute(String name, Object object)
- {
- attributes.put(name, object);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/OpenWebBeansContainerControl.java
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/OpenWebBeansContainerControl.java b/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/OpenWebBeansContainerControl.java
deleted file mode 100644
index 101264c..0000000
--- a/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/owb/OpenWebBeansContainerControl.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * 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.deltaspike.cditest.containerctrl.owb;
-
-import java.lang.annotation.Annotation;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.ConversationScoped;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.context.spi.Context;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Singleton;
-
-import org.apache.deltaspike.containerctrl.api.ContainerControl;
-
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.context.ContextFactory;
-import org.apache.webbeans.context.type.ContextTypes;
-import org.apache.webbeans.spi.ContainerLifecycle;
-
-/**
- * OpenWebBeans specific implementation of {@link ContainerControl}.
- */
-public class OpenWebBeansContainerControl implements ContainerControl
-{
- private static final Logger logger = Logger.getLogger(OpenWebBeansContainerControl.class.getName());
-
- private ContainerLifecycle lifecycle = null;
- private MockServletContext servletContext = null;
- private MockHttpSession session = null;
-
- public void bootContainer()
- {
- servletContext = new MockServletContext();
- session = new MockHttpSession();
- lifecycle = WebBeansContext.getInstance().getService(ContainerLifecycle.class);
- lifecycle.startApplication(servletContext);
- }
-
- public void shutdownContainer()
- {
- if (lifecycle != null)
- {
- lifecycle.stopApplication(servletContext);
- }
- }
-
- public void startContexts()
- {
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
- ContextFactory contextFactory = webBeansContext.getContextFactory();
-
- contextFactory.initSingletonContext(servletContext);
- contextFactory.initApplicationContext(servletContext);
- contextFactory.initSessionContext(session);
- contextFactory.initConversationContext(null);
- contextFactory.initRequestContext(null);
- }
-
- private void startApplicationScope()
- {
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
- ContextFactory contextFactory = webBeansContext.getContextFactory();
-
- contextFactory.initApplicationContext(servletContext);
- }
-
- public void startConversationScope()
- {
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
- ContextFactory contextFactory = webBeansContext.getContextFactory();
-
- contextFactory.initConversationContext(null);
- }
-
- public void startContext(Class<? extends Annotation> scopeClass)
- {
- if (scopeClass.isAssignableFrom(ApplicationScoped.class))
- {
- startApplicationScope();
- }
- else if (scopeClass.isAssignableFrom(SessionScoped.class))
- {
- startSessionScope();
- }
- else if (scopeClass.isAssignableFrom(RequestScoped.class))
- {
- startRequestScope();
- }
- else if (scopeClass.isAssignableFrom(ConversationScoped.class))
- {
- startConversationScope();
- }
- }
-
- private void startRequestScope()
- {
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
- ContextFactory contextFactory = webBeansContext.getContextFactory();
-
- contextFactory.initRequestContext(null);
- }
-
- private void startSessionScope()
- {
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
- ContextFactory contextFactory = webBeansContext.getContextFactory();
-
- contextFactory.initSessionContext(session);
- }
-
- public void stopContexts()
- {
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
- ContextFactory contextFactory = webBeansContext.getContextFactory();
-
- stopSessionScope();
- stopConversationScope();
- stopRequestScope();
- stopApplicationScope();
-
- Context context = contextFactory.getStandardContext(ContextTypes.SINGLETON);
- if (context != null && context.isActive())
- {
- contextFactory.destroySingletonContext(servletContext);
- }
- else
- {
- logger.log(Level.WARNING,
- "destroy was called for an inactive context (" + Singleton.class.getName() + ")");
- }
-
- }
-
- public void stopApplicationScope()
- {
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
- ContextFactory contextFactory = webBeansContext.getContextFactory();
-
- Context context = contextFactory.getStandardContext(ContextTypes.APPLICATION);
- if (context != null && context.isActive())
- {
- contextFactory.destroyApplicationContext(servletContext);
- }
- else
- {
- logger.log(Level.WARNING,
- "destroy was called for an inactive context (" + ApplicationScoped.class.getName() + ")");
- }
- }
-
- public void stopConversationScope()
- {
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
- ContextFactory contextFactory = webBeansContext.getContextFactory();
-
- Context context = contextFactory.getStandardContext(ContextTypes.CONVERSATION);
- if (context != null && context.isActive())
- {
- contextFactory.destroyConversationContext();
- }
- else
- {
- logger.log(Level.WARNING,
- "destroy was called for an inactive context (" + ConversationScoped.class.getName() + ")");
- }
- }
-
- public void stopContext(Class<? extends Annotation> scopeClass)
- {
- if (scopeClass.isAssignableFrom(ApplicationScoped.class))
- {
- stopApplicationScope();
- }
- else if (scopeClass.isAssignableFrom(SessionScoped.class))
- {
- stopSessionScope();
- }
- else if (scopeClass.isAssignableFrom(RequestScoped.class))
- {
- stopRequestScope();
- }
- else if (scopeClass.isAssignableFrom(ConversationScoped.class))
- {
- stopConversationScope();
- }
- }
-
- public void stopRequestScope()
- {
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
- ContextFactory contextFactory = webBeansContext.getContextFactory();
-
- Context context = contextFactory.getStandardContext(ContextTypes.REQUEST);
- if (context != null && context.isActive())
- {
- contextFactory.destroyRequestContext(null);
- }
- else
- {
- logger.log(Level.WARNING,
- "destroy was called for an inactive context (" + RequestScoped.class.getName() + ")");
- }
- }
-
- public void stopSessionScope()
- {
- WebBeansContext webBeansContext = WebBeansContext.getInstance();
- ContextFactory contextFactory = webBeansContext.getContextFactory();
-
- Context context = contextFactory.getStandardContext(ContextTypes.SESSION);
- if (context != null && context.isActive())
- {
- contextFactory.destroySessionContext(session);
- }
- else
- {
- logger.log(Level.WARNING,
- "destroy was called for an inactive context (" + SessionScoped.class.getName() + ")");
- }
- }
-
- public BeanManager getBeanManager()
- {
- return lifecycle.getBeanManager();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/impl-owb/src/main/resources/META-INF/services/org.apache.deltaspike.containerctrl.api.ContainerControl
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/impl-owb/src/main/resources/META-INF/services/org.apache.deltaspike.containerctrl.api.ContainerControl b/deltaspike/containerctrl/impl-owb/src/main/resources/META-INF/services/org.apache.deltaspike.containerctrl.api.ContainerControl
deleted file mode 100644
index fb24a49..0000000
--- a/deltaspike/containerctrl/impl-owb/src/main/resources/META-INF/services/org.apache.deltaspike.containerctrl.api.ContainerControl
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.deltaspike.cditest.containerctrl.owb.OpenWebBeansContainerControl
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/pom.xml b/deltaspike/containerctrl/pom.xml
deleted file mode 100644
index 10d9c0e..0000000
--- a/deltaspike/containerctrl/pom.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.deltaspike</groupId>
- <artifactId>parent</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- <relativePath>../parent/pom.xml</relativePath>
- </parent>
-
- <groupId>org.apache.deltaspike.containerctrl</groupId>
- <artifactId>containerctrl-project</artifactId>
- <packaging>pom</packaging>
-
- <name>Apache DeltaSpike ContainerControl parent</name>
-
- <modules>
- <module>api</module>
- <module>tck</module>
- <module>impl-owb</module>
- <!--
- <module>impl-weld</modul>
- -->
- </modules>
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/tck/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/tck/pom.xml b/deltaspike/containerctrl/tck/pom.xml
deleted file mode 100644
index 9a61b99..0000000
--- a/deltaspike/containerctrl/tck/pom.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.deltaspike.containerctrl</groupId>
- <artifactId>containerctrl-project</artifactId>
- <version>0.2-incubating-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>containerctrl-tck</artifactId>
- <packaging>jar</packaging>
-
- <name>Apache DeltaSpike CDI ContainerControl TCK</name>
-
- <description>
- The TCK for testing ContainerControl implementations
- </description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_1.0_spec</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.1_spec</artifactId>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>compile</scope>
- <optional>true</optional>
- </dependency>
-
- <dependency>
- <groupId>org.apache.deltaspike.containerctrl</groupId>
- <artifactId>deltaspike-containerctrl-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/16ad0a37/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/ContainerCtrlTckTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/ContainerCtrlTckTest.java b/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/ContainerCtrlTckTest.java
deleted file mode 100644
index 0b5195f..0000000
--- a/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/ContainerCtrlTckTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.deltaspike.containerctrl.tck;
-
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import java.util.Set;
-
-import org.apache.deltaspike.containerctrl.api.ContainerControl;
-import org.apache.deltaspike.containerctrl.api.ContainerControlLoader;
-
-import org.apache.deltaspike.containerctrl.tck.beans.CarRepair;
-import org.junit.Test;
-
-import org.junit.Assert;
-
-/**
- * TCK test for the {@link org.apache.deltaspike.containerctrl.api.ContainerControl}
- */
-public class ContainerCtrlTckTest
-{
-
- @Test
- public void testContainerBoot() throws Exception
- {
- ContainerControl cc = ContainerControlLoader.getCdiContainer();
- Assert.assertNotNull(cc);
-
- cc.bootContainer();
- cc.startContexts();
-
- BeanManager bm = cc.getBeanManager();
- Assert.assertNotNull(bm);
-
- Set<Bean<?>> beans = bm.getBeans(CarRepair.class);
- Bean<?> bean = bm.resolve(beans);
-
- CarRepair carRepair = (CarRepair) bm.getReference(bean, CarRepair.class, bm.createCreationalContext(bean));
- Assert.assertNotNull(carRepair);
-
- Assert.assertNotNull(carRepair.getCar());
- Assert.assertNotNull(carRepair.getCar().getUsr());
-
- cc.stopContexts();
- cc.shutdownContainer();
- }
-}