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/19 13:38:48 UTC
[1/2] git commit: DELTASPIKE-92 add TCK and OWB ContainerControl impl
Updated Branches:
refs/heads/master b34390141 -> 5f323c2dc
DELTASPIKE-92 add TCK and OWB ContainerControl impl
Project: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/commit/5f323c2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/tree/5f323c2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/diff/5f323c2d
Branch: refs/heads/master
Commit: 5f323c2dc0fb9ec9cdda5fb4d5b51cdc9f10cd3b
Parents: 135a8ac
Author: Mark Struberg <st...@apache.org>
Authored: Sun Feb 19 13:34:50 2012 +0100
Committer: Mark Struberg <st...@apache.org>
Committed: Sun Feb 19 13:34:50 2012 +0100
----------------------------------------------------------------------
deltaspike/containerctrl/impl-owb/pom.xml | 117 +++++++
.../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 | 11 +-
deltaspike/containerctrl/tck/pom.xml | 71 ++++
.../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 ++
12 files changed, 937 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/5f323c2d/deltaspike/containerctrl/impl-owb/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/impl-owb/pom.xml b/deltaspike/containerctrl/impl-owb/pom.xml
new file mode 100644
index 0000000..fce074b
--- /dev/null
+++ b/deltaspike/containerctrl/impl-owb/pom.xml
@@ -0,0 +1,117 @@
+<?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-owb</artifactId>
+ <packaging>jar</packaging>
+
+ <name>CDI ContainerControl OpenWebBeans integration</name>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.deltaspike.containerctrl</groupId>
+ <artifactId>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/5f323c2d/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
new file mode 100644
index 0000000..9206617
--- /dev/null
+++ b/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/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.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/5f323c2d/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
new file mode 100644
index 0000000..f71cf14
--- /dev/null
+++ b/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/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.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/5f323c2d/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
new file mode 100644
index 0000000..647e27e
--- /dev/null
+++ b/deltaspike/containerctrl/impl-owb/src/main/java/org/apache/deltaspike/cditest/containerctrl/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.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() throws Exception
+ {
+ servletContext = new MockServletContext();
+ session = new MockHttpSession();
+ lifecycle = WebBeansContext.getInstance().getService(ContainerLifecycle.class);
+ lifecycle.startApplication(servletContext);
+ }
+
+ public void shutdownContainer() throws Exception
+ {
+ 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/5f323c2d/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
new file mode 100644
index 0000000..fb24a49
--- /dev/null
+++ b/deltaspike/containerctrl/impl-owb/src/main/resources/META-INF/services/org.apache.deltaspike.containerctrl.api.ContainerControl
@@ -0,0 +1 @@
+org.apache.deltaspike.cditest.containerctrl.owb.OpenWebBeansContainerControl
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/5f323c2d/deltaspike/containerctrl/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/pom.xml b/deltaspike/containerctrl/pom.xml
index eee673e..10d9c0e 100644
--- a/deltaspike/containerctrl/pom.xml
+++ b/deltaspike/containerctrl/pom.xml
@@ -22,9 +22,9 @@
<parent>
<groupId>org.apache.deltaspike</groupId>
- <artifactId>parent-code</artifactId>
+ <artifactId>parent</artifactId>
<version>0.2-incubating-SNAPSHOT</version>
- <relativePath>../parent/code/pom.xml</relativePath>
+ <relativePath>../parent/pom.xml</relativePath>
</parent>
<groupId>org.apache.deltaspike.containerctrl</groupId>
@@ -35,9 +35,10 @@
<modules>
<module>api</module>
-<!--
+ <module>tck</module>
<module>impl-owb</module>
- <module>impl-weld</modul>
--->
+ <!--
+ <module>impl-weld</modul>
+ -->
</modules>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/5f323c2d/deltaspike/containerctrl/tck/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/tck/pom.xml b/deltaspike/containerctrl/tck/pom.xml
new file mode 100644
index 0000000..e0517eb
--- /dev/null
+++ b/deltaspike/containerctrl/tck/pom.xml
@@ -0,0 +1,71 @@
+<?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>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>containerctrl-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/5f323c2d/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
new file mode 100644
index 0000000..0b5195f
--- /dev/null
+++ b/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/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.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();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/5f323c2d/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/beans/Car.java
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/beans/Car.java b/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/beans/Car.java
new file mode 100644
index 0000000..cf22eb6
--- /dev/null
+++ b/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/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.containerctrl.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/5f323c2d/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/beans/CarRepair.java
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/beans/CarRepair.java b/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/beans/CarRepair.java
new file mode 100644
index 0000000..c042334
--- /dev/null
+++ b/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/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.containerctrl.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/5f323c2d/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/beans/User.java
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/beans/User.java b/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/tck/beans/User.java
new file mode 100644
index 0000000..62b29b3
--- /dev/null
+++ b/deltaspike/containerctrl/tck/src/main/java/org/apache/deltaspike/containerctrl/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.containerctrl.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/5f323c2d/deltaspike/containerctrl/tck/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/deltaspike/containerctrl/tck/src/main/resources/META-INF/beans.xml b/deltaspike/containerctrl/tck/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..4070730
--- /dev/null
+++ b/deltaspike/containerctrl/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>