You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by pa...@apache.org on 2013/11/19 20:14:07 UTC

[1/5] git commit: Use specified, portable conversation propagation via cid parameter

Updated Branches:
  refs/heads/wicket-cdi-1.1-rewrite 0de87fdce -> ecf2c9fe2 (forced update)


Use specified, portable conversation propagation via cid parameter


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/9def8e36
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/9def8e36
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/9def8e36

Branch: refs/heads/wicket-cdi-1.1-rewrite
Commit: 9def8e363f6a311f1fe87117bb4a821db5dfd3e0
Parents: 6564bc9
Author: Emond Papegaaij <em...@topicus.nl>
Authored: Mon Nov 18 20:35:28 2013 +0100
Committer: Emond Papegaaij <em...@topicus.nl>
Committed: Tue Nov 19 17:57:57 2013 +0100

----------------------------------------------------------------------
 wicket-experimental/wicket-cdi-1.1/pom.xml      |   2 -
 .../apache/wicket/cdi/AbstractCdiContainer.java | 139 -------------
 .../org/apache/wicket/cdi/AutoConversation.java |   2 +
 .../org/apache/wicket/cdi/CdiConfiguration.java |  28 ++-
 .../cdi/ConversationExpiredException.java       |   1 +
 .../wicket/cdi/ConversationExpiryChecker.java   |   8 +-
 .../wicket/cdi/ConversationIdMetaKey.java       |  24 ---
 .../wicket/cdi/ConversationPropagation.java     |  35 ++--
 .../wicket/cdi/ConversationPropagator.java      | 207 ++++---------------
 .../apache/wicket/cdi/DetachEventEmitter.java   |   4 +-
 .../wicket/cdi/IConversationPropagation.java    |  13 --
 .../apache/wicket/cdi/CdiConfigurationTest.java |   4 +-
 .../org/apache/wicket/cdi/MockCdiContainer.java |  77 -------
 .../apache/wicket/cdi/WicketCdiTestCase.java    |   8 +-
 .../wicket/cdi/testapp/TestApplication.java     |   3 -
 .../wicket/cdi/testapp/TestCdiApplication.java  |   3 +-
 .../cdi/testapp/TestConversationalPage.html     |   2 +-
 .../testapp/TestNonAutoConversationalPage.html  |   2 +-
 .../cdi/testapp/TestNonConversationalPage.html  |   2 +-
 .../wicket/cdi/util/tester/CdiWicketTester.java |  27 ++-
 .../wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml  |  88 --------
 .../wicket/cdi/weld/WeldCdiContainer.java       |  68 ------
 .../src/main/resources/META-INF/beans.xml       |   0
 .../cdi/weld/ApacheLicenceHeaderTest.java       |  41 ----
 24 files changed, 116 insertions(+), 672 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/pom.xml b/wicket-experimental/wicket-cdi-1.1/pom.xml
index 7344e1c..ae75c0d 100644
--- a/wicket-experimental/wicket-cdi-1.1/pom.xml
+++ b/wicket-experimental/wicket-cdi-1.1/pom.xml
@@ -30,7 +30,5 @@
 	<description>Wicket CDI 1.1 Parent.</description>
 	<modules>
 		<module>wicket-cdi-1.1-core</module>
-		<module>wicket-cdi-1.1-weld</module>
-		<!--<module>wicket-cdi-1.1-owb</module>-->
 	</modules>
 </project>

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractCdiContainer.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractCdiContainer.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractCdiContainer.java
deleted file mode 100644
index 7df6553..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractCdiContainer.java
+++ /dev/null
@@ -1,139 +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.wicket.cdi;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.MetaDataKey;
-import org.apache.wicket.Page;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.util.lang.Args;
-
-/**
- * Provides access to CDI features from inside a Wicket request
- * 
- * @author igor
- */
-public abstract class AbstractCdiContainer
-{
-	private static MetaDataKey<AbstractCdiContainer> CONTEXT_KEY = new MetaDataKey<AbstractCdiContainer>()
-	{
-		private static final long serialVersionUID = 1L;
-	};
-
-	/**
-	 * Constructor
-	 */
-	public AbstractCdiContainer()
-	{
-	}
-
-	/**
-	 * Deactivates conversational context
-	 * 
-	 * @param cycle
-	 */
-	public abstract void deactivateConversationalContext(RequestCycle cycle);
-
-	/**
-	 * Activates the conversational context and starts the conversation with the
-	 * specified cid
-	 * 
-	 * @param cycle
-	 * @param cid
-	 */
-	public abstract void activateConversationalContext(RequestCycle cycle, String cid);
-
-	protected HttpServletRequest getRequest(RequestCycle cycle)
-	{
-		return (HttpServletRequest)cycle.getRequest().getContainerRequest();
-	}
-
-	/**
-	 * Retrieves a conversation id, if any, that is associated with a
-	 * {@link Page} instance
-	 * 
-	 * @param page
-	 *            page instance
-	 * @return conversation id, if any
-	 */
-	public String getConversationMarker(Page page)
-	{
-		return page.getMetaData(ConversationIdMetaKey.INSTANCE);
-	}
-
-	/**
-	 * Removes conversation marker from the page instance which prevents the
-	 * conversation from propagating to the page. This method should usually be
-	 * called from page's {@code onDetach()} method.
-	 * 
-	 * @param page
-	 */
-	public void removeConversationMarker(Page page)
-	{
-		Args.notNull(page, "page");
-
-		page.setMetaData(ConversationIdMetaKey.INSTANCE, null);
-		page.getPageParameters().remove(ConversationPropagator.CID);
-	}
-
-	/**
-	 * Binds this container instance to the {@link Application}, making it
-	 * possible to retrieve it later
-	 * 
-	 * @param application
-	 */
-	protected void bind(Application application)
-	{
-		if (application.getMetaData(CONTEXT_KEY) != null)
-		{
-			throw new IllegalStateException("A CDI container is already bound to this "
-					+ "application, which probably means you tried to configure the "
-					+ "application twice");
-		}
-		application.setMetaData(CONTEXT_KEY, this);
-	}
-
-	/**
-	 * Retrieves container instance stored in the application
-	 * 
-	 * @param application
-	 * @return container instance or {@code null} if none
-	 */
-	public static AbstractCdiContainer get(Application application)
-	{
-		AbstractCdiContainer ctx = application.getMetaData(CONTEXT_KEY);
-		if (ctx == null)
-		{
-			throw new IllegalStateException("No CDI Context bound to application");
-		}
-		return ctx;
-	}
-
-	/**
-	 * Retrieves container instance stored in the current thread's application
-	 * 
-	 * @return container instance or {@code null} if none
-	 */
-	public static AbstractCdiContainer get()
-	{
-		return get(Application.get());
-	}
-
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AutoConversation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AutoConversation.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AutoConversation.java
index 0193a7d..6138ac2 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AutoConversation.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AutoConversation.java
@@ -30,6 +30,8 @@ import org.apache.wicket.util.io.IClusterable;
 @ConversationScoped
 public class AutoConversation implements IClusterable
 {
+	private static final long serialVersionUID = 1L;
+	
 	private boolean automatic;
 
 	public AutoConversation()

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
index 9b6b4b3..3ac4abf 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
@@ -17,6 +17,7 @@
 package org.apache.wicket.cdi;
 
 import org.apache.wicket.Application;
+import org.apache.wicket.MetaDataKey;
 import org.apache.wicket.request.cycle.RequestCycleListenerCollection;
 
 /**
@@ -27,7 +28,12 @@ import org.apache.wicket.request.cycle.RequestCycleListenerCollection;
  */
 public class CdiConfiguration
 {
-	private IConversationPropagation propagation = ConversationPropagation.NONBOOKMARKABLE;
+	private static final MetaDataKey<CdiConfiguration> CDI_CONFIGURATION_KEY = new MetaDataKey<CdiConfiguration>()
+	{
+		private static final long serialVersionUID = 1L;
+	};
+
+	private IConversationPropagation propagation = ConversationPropagation.ALL;
 
 	private boolean injectComponents = true;
 	private boolean injectApplication = true;
@@ -136,9 +142,13 @@ public class CdiConfiguration
 	 * @param application
 	 * @return
 	 */
-	public AbstractCdiContainer configure(Application application, AbstractCdiContainer container)
+	public void configure(Application application)
 	{
-		container.bind(application);
+		if (application.getMetaData(CDI_CONFIGURATION_KEY) != null)
+		{
+			throw new IllegalStateException("Cdi already configured for this application");
+		}
+		application.setMetaData(CDI_CONFIGURATION_KEY, this);
 
 		RequestCycleListenerCollection listeners = new RequestCycleListenerCollection();
 		application.getRequestCycleListeners().add(listeners);
@@ -146,14 +156,14 @@ public class CdiConfiguration
 		// enable conversation propagation
 		if (getPropagation() != ConversationPropagation.NONE)
 		{
-			listeners.add(new ConversationPropagator(application, container, getPropagation(),
+			listeners.add(new ConversationPropagator(application, getPropagation(),
 					autoConversationManagement));
 			application.getComponentPreOnBeforeRenderListeners().add(
-					new ConversationExpiryChecker(container));
+					new ConversationExpiryChecker());
 		}
 
 		// enable detach event
-		listeners.add(new DetachEventEmitter(container));
+		listeners.add(new DetachEventEmitter());
 
 
 		// inject application instance
@@ -182,8 +192,10 @@ public class CdiConfiguration
 		// enable cleanup
 
 		application.getApplicationListeners().add(new CdiShutdownCleaner(isInjectApplication()));
-
-		return container;
 	}
 
+	public static CdiConfiguration get(Application application)
+	{
+		return application.getMetaData(CDI_CONFIGURATION_KEY);
+	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
index 7993ae4..a9c7eb1 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
@@ -21,6 +21,7 @@ import org.apache.wicket.request.IRequestHandler;
 
 public class ConversationExpiredException extends RuntimeException
 {
+	private static final long serialVersionUID = 1L;
 	private String cid;
 	private Page page;
 	private IRequestHandler handler;

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
index 394ad29..e79f938 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
@@ -45,12 +45,8 @@ public class ConversationExpiryChecker implements IComponentOnBeforeRenderListen
 	@Inject
 	private Conversation conversation;
 
-	private final AbstractCdiContainer container;
-
-	public ConversationExpiryChecker(AbstractCdiContainer container)
+	public ConversationExpiryChecker()
 	{
-		this.container = container;
-
 		NonContextual.of(ConversationExpiryChecker.class).inject(this);
 	}
 
@@ -60,7 +56,7 @@ public class ConversationExpiryChecker implements IComponentOnBeforeRenderListen
 		if (component instanceof Page || RequestCycle.get().find(AjaxRequestTarget.class) != null)
 		{
 			Page page = component.getPage();
-			String cid = container.getConversationMarker(page);
+			String cid = ConversationPropagator.getConversationIdFromPage(page);
 			if (cid != null && !Objects.isEqual(conversation.getId(), cid))
 			{
 				logger.info("Conversation {} has expired for {}", cid, page);

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationIdMetaKey.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationIdMetaKey.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationIdMetaKey.java
deleted file mode 100644
index 94cc70f..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationIdMetaKey.java
+++ /dev/null
@@ -1,24 +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.wicket.cdi;
-
-import org.apache.wicket.MetaDataKey;
-
-final class ConversationIdMetaKey extends MetaDataKey<String>
-{
-	static final ConversationIdMetaKey INSTANCE = new ConversationIdMetaKey();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
index e70ff9c..502b6e5 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
@@ -18,7 +18,8 @@ package org.apache.wicket.cdi;
 
 import javax.enterprise.context.ConversationScoped;
 
-import org.apache.wicket.Page;
+import org.apache.wicket.core.request.handler.BookmarkableListenerInterfaceRequestHandler;
+import org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler;
 import org.apache.wicket.request.IRequestHandler;
 
 /**
@@ -32,44 +33,34 @@ public enum ConversationPropagation implements IConversationPropagation {
 	/** No conversational propagation takes place */
 	NONE {
 		@Override
-		public boolean propagatesViaPage(Page page, IRequestHandler handler)
-		{
-			return false;
-		}
-
-		@Override
 		public boolean propagatesViaParameters(IRequestHandler handler)
 		{
 			return false;
 		}
 	},
 	/**
-	 * Pesistent conversations are propagated between non-bookmarkable pages only
+	 * Pesistent conversations are propagated between non-bookmarkable pages
+	 * only
+	 * 
+	 * @deprecated as of cdi-1.1, it is specified that conversations are
+	 *             propagated via the cid query parameter even for
+	 *             non-bookmarkable pages
 	 */
+	@Deprecated
 	NONBOOKMARKABLE {
 		@Override
-		public boolean propagatesViaPage(Page page, IRequestHandler handler)
-		{
-			return true;
-		}
-
-		@Override
 		public boolean propagatesViaParameters(IRequestHandler handler)
 		{
-			return false;
+			return !(handler instanceof BookmarkableListenerInterfaceRequestHandler)
+					&& !(handler instanceof BookmarkablePageRequestHandler);
 		}
 	},
 	/**
-	 * Persistent conversations are propagated between bookmarkable and non-bookmarkable pages
+	 * Persistent conversations are propagated between bookmarkable and
+	 * non-bookmarkable pages
 	 */
 	ALL {
 		@Override
-		public boolean propagatesViaPage(Page page, IRequestHandler handler)
-		{
-			return true;
-		}
-
-		@Override
 		public boolean propagatesViaParameters(IRequestHandler handler)
 		{
 			return true;

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
index 60f46a6..2f43931 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
@@ -18,7 +18,6 @@ package org.apache.wicket.cdi;
 
 import javax.enterprise.context.Conversation;
 import javax.enterprise.context.ConversationScoped;
-import javax.enterprise.context.NonexistentConversationException;
 import javax.inject.Inject;
 
 import org.apache.wicket.Application;
@@ -28,11 +27,9 @@ import org.apache.wicket.Page;
 import org.apache.wicket.core.request.handler.BufferedResponseRequestHandler;
 import org.apache.wicket.core.request.handler.IPageClassRequestHandler;
 import org.apache.wicket.core.request.handler.IPageRequestHandler;
-import org.apache.wicket.core.request.mapper.StalePageException;
 import org.apache.wicket.request.IRequestHandler;
 import org.apache.wicket.request.IRequestHandlerDelegate;
 import org.apache.wicket.request.Url;
-import org.apache.wicket.request.component.IRequestablePage;
 import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
 import org.apache.wicket.request.cycle.IRequestCycleListener;
 import org.apache.wicket.request.cycle.RequestCycle;
@@ -40,7 +37,6 @@ import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandle
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.resource.PackageResourceReference;
 import org.apache.wicket.util.lang.Args;
-import org.apache.wicket.util.lang.Objects;
 import org.apache.wicket.util.visit.IVisit;
 import org.apache.wicket.util.visit.IVisitor;
 import org.apache.wicket.util.visit.Visits;
@@ -59,17 +55,18 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 {
 	private static final Logger logger = LoggerFactory.getLogger(ConversationPropagator.class);
 
-	private static final MetaDataKey<String> CID_KEY = ConversationIdMetaKey.INSTANCE;
-
 	private static final MetaDataKey<Boolean> CONVERSATION_STARTED_KEY = new MetaDataKey<Boolean>()
 	{
+		private static final long serialVersionUID = 1L;
 	};
 
+	private static final MetaDataKey<String> CONVERSATION_ID_KEY = new MetaDataKey<String>()
+	{
+		private static final long serialVersionUID = 1L;
+	};
 
 	public static final String CID = "cid";
 
-	private final AbstractCdiContainer container;
-
 	/** propagation mode to use */
 	private final IConversationPropagation propagation;
 
@@ -78,10 +75,10 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 	private final boolean auto;
 
 	@Inject
-	Conversation conversation_;
+	private Conversation conversation;
 
 	@Inject
-	AutoConversation autoConversation;
+	private AutoConversation autoConversation;
 
 	/**
 	 * Constructor
@@ -89,24 +86,21 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 	 * @param container
 	 * @param propagation
 	 */
-	public ConversationPropagator(Application application, AbstractCdiContainer container,
-			IConversationPropagation propagation)
+	public ConversationPropagator(Application application, IConversationPropagation propagation)
 	{
-		this(application, container, propagation, false);
+		this(application, propagation, false);
 	}
 
-
 	/**
 	 * Constructor
 	 * 
 	 * @param container
 	 * @param propagation
 	 */
-	public ConversationPropagator(Application application, AbstractCdiContainer container,
-			IConversationPropagation propagation, boolean auto)
+	public ConversationPropagator(Application application, IConversationPropagation propagation,
+			boolean auto)
 	{
 		Args.notNull(application, "application");
-		Args.notNull(container, "container");
 		Args.notNull(propagation, "propagation");
 
 		if (propagation == ConversationPropagation.NONE)
@@ -116,103 +110,30 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 		}
 
 		this.application = application;
-		this.container = container;
 		this.propagation = propagation;
 		this.auto = auto;
 
 		NonContextual.of(ConversationPropagator.class).postConstruct(this);
 	}
-
-	private Conversation getConversation(RequestCycle cycle)
+	
+	public IConversationPropagation getPropagation()
 	{
-		return Boolean.TRUE.equals(cycle.getMetaData(CONVERSATION_STARTED_KEY))
-				? conversation_
-				: null;
+		return propagation;
 	}
 
 	@Override
 	public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
 	{
-		String cid = cycle.getRequest().getRequestParameters().getParameterValue(CID).toString();
-		Page page = getPage(handler);
-
-		if (cid == null && page != null)
-		{
-			cid = page.getMetaData(CID_KEY);
-		}
-
-		Conversation current = getConversation(cycle);
-		if (current != null && !Objects.isEqual(current.getId(), cid))
+		if (activateForHandler(handler))
 		{
-			logger.info("Conversation {} has expired for {}", cid, page);
-			throw new ConversationExpiredException(null, cid, page, handler);
-		}
-
-		activateConversationIfNeeded(cycle, handler, cid);
-	}
-
-	@Override
-	public IRequestHandler onException(RequestCycle cycle, Exception ex)
-	{
-		// if we are handling a stale page exception then use its conversation
-		// since we are most
-		// likely about to rerender it.
-
-		if (ex instanceof StalePageException)
-		{
-			IRequestablePage requestable = ((StalePageException)ex).getPage();
-			if (requestable instanceof Page)
-			{
-				String cid = container.getConversationMarker((Page)requestable);
-				if (cid != null)
-				{
-					try
-					{
-						activateConversationIfNeeded(cycle, null, cid);
-						return null;
-					}
-					catch (ConversationExpiredException e)
-					{
-						// ignore, we will start a new one below
-					}
-				}
-			}
-		}
-
-		activateConversationIfNeeded(cycle, null, null);
-		return null;
-	}
-
-	private void activateConversationIfNeeded(RequestCycle cycle, IRequestHandler handler,
-			String cid)
-	{
-		Conversation current = getConversation(cycle);
-
-		if (current != null || !activateForHandler(handler))
-		{
-			return;
-		}
-
-		logger.debug("Activating conversation {}", cid);
-
-		try
-		{
-			container.activateConversationalContext(cycle, cid);
-			fireOnAfterConversationStarted(cycle);
-		}
-		catch (NonexistentConversationException e)
-		{
-			logger.info("Unable to restore conversation with id {}", cid, e.getMessage());
-			logger.debug("Unable to restore conversation", e);
+			logger.debug("Activating conversation {}", conversation.getId());
 			fireOnAfterConversationStarted(cycle);
-			throw new ConversationExpiredException(e, cid, getPage(handler), handler);
 		}
-
-		cycle.setMetaData(CONVERSATION_STARTED_KEY, true);
 	}
 
 	private void fireOnAfterConversationStarted(RequestCycle cycle)
 	{
+		cycle.setMetaData(CONVERSATION_STARTED_KEY, true);
 		for (IRequestCycleListener listener : application.getRequestCycleListeners())
 		{
 			if (listener instanceof ICdiAwareRequestCycleListener)
@@ -225,13 +146,6 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 	@Override
 	public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
 	{
-		Conversation conversation = getConversation(cycle);
-
-		if (conversation == null)
-		{
-			return;
-		}
-
 		Page page = getPage(handler);
 
 		if (page == null)
@@ -243,12 +157,6 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 
 		autoEndIfNecessary(page, handler, conversation);
 		autoBeginIfNecessary(page, handler, conversation);
-
-		if (propagation.propagatesViaPage(page, handler))
-		{
-			// propagate a conversation across non-bookmarkable page instances
-			setConversationOnPage(conversation, page);
-		}
 	}
 
 	@Override
@@ -256,29 +164,13 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 	{
 		// propagate current non-transient conversation to the newly scheduled
 		// page
-
-		Conversation conversation = getConversation(cycle);
-
-		if (conversation == null || conversation.isTransient())
+		if (conversation.isTransient())
 		{
 			return;
 		}
 
-		Page page = getPage(handler);
-		if (page != null)
-		{
-			if (propagation.propagatesViaPage(page, handler))
-			{
-				// propagate a conversation across non-bookmarkable page
-				// instances
-				setConversationOnPage(conversation, page);
-			}
-		}
-
 		if (propagation.propagatesViaParameters(handler))
 		{
-			// propagate cid to a scheduled bookmarkable page
-
 			logger.debug(
 					"Propagating non-transient conversation {} via page parameters of handler {}",
 					conversation.getId(), handler);
@@ -287,28 +179,11 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 			if (parameters != null)
 			{
 				parameters.set(CID, conversation.getId());
+				markPageWithConversationId(handler, conversation.getId());
 			}
 		}
 	}
 
-	protected void setConversationOnPage(Conversation conversation, Page page)
-	{
-		if (conversation == null || conversation.isTransient())
-		{
-			logger.debug("Detaching transient conversation {} via meta of page instance {}",
-					(conversation == null ? "null" : conversation.getId()), page);
-
-			page.setMetaData(CID_KEY, null);
-		}
-		else
-		{
-
-			logger.debug("Propagating non-transient conversation {} via meta of page instance {}",
-					conversation.getId(), page);
-
-			page.setMetaData(CID_KEY, conversation.getId());
-		}
-	}
 
 	@Override
 	public void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url)
@@ -323,42 +198,34 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 			}
 		}
 
-		Conversation conversation = getConversation(cycle);
-
-		if (conversation == null || conversation.isTransient())
+		if (conversation.isTransient())
 		{
 			return;
 		}
 
 		if (propagation.propagatesViaParameters(handler))
 		{
-			// propagate cid to bookmarkable pages via urls
-
 			logger.debug("Propagating non-transient conversation {} via url", conversation.getId());
-
 			url.setQueryParameter(CID, conversation.getId());
+			markPageWithConversationId(handler, conversation.getId());
 		}
 	}
 
 	@Override
 	public void onDetach(RequestCycle cycle)
 	{
-		Conversation conversation = getConversation(cycle);
-		if (conversation != null)
+		if (!Boolean.TRUE.equals(cycle.getMetaData(CONVERSATION_STARTED_KEY)))
 		{
-			logger.debug("Deactivating conversation {}", conversation.getId());
+			return;
+		}
 
-			for (IRequestCycleListener listener : application.getRequestCycleListeners())
+		logger.debug("Deactivating conversation {}", conversation.getId());
+		for (IRequestCycleListener listener : application.getRequestCycleListeners())
+		{
+			if (listener instanceof ICdiAwareRequestCycleListener)
 			{
-				if (listener instanceof ICdiAwareRequestCycleListener)
-				{
-					((ICdiAwareRequestCycleListener)listener)
-							.onBeforeConversationDeactivated(cycle);
-				}
+				((ICdiAwareRequestCycleListener)listener).onBeforeConversationDeactivated(cycle);
 			}
-			container.deactivateConversationalContext(cycle);
-
-			cycle.setMetaData(CONVERSATION_STARTED_KEY, null);
 		}
 	}
 
@@ -389,7 +256,6 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 			Conversation conversation)
 	{
 		if (!auto || conversation == null || !conversation.isTransient() || page == null
-				|| !propagation.propagatesViaPage(page, handler)
 				|| !hasConversationalComponent(page))
 		{
 			return;
@@ -406,7 +272,6 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 	protected void autoEndIfNecessary(Page page, IRequestHandler handler, Conversation conversation)
 	{
 		if (!auto || conversation == null || conversation.isTransient() || page == null
-				|| !propagation.propagatesViaPage(page, handler)
 				|| hasConversationalComponent(page) || autoConversation.isAutomatic() == false)
 		{
 			return;
@@ -440,6 +305,20 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 		return hasConversational == null ? false : hasConversational;
 	}
 
+	public static void markPageWithConversationId(IRequestHandler handler, String cid)
+	{
+		Page page = getPage(handler);
+		if (page != null)
+		{
+			page.setMetaData(CONVERSATION_ID_KEY, cid);
+		}
+	}
+
+	public static String getConversationIdFromPage(Page page)
+	{
+		return page.getMetaData(CONVERSATION_ID_KEY);
+	}
+
 	/**
 	 * Resolves a page instance from the request handler iff the page instance
 	 * is already created

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
index 2de1d76..601b155 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
@@ -23,7 +23,6 @@ import org.apache.wicket.MetaDataKey;
 import org.apache.wicket.request.IRequestHandler;
 import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
 import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.util.lang.Args;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -39,6 +38,7 @@ public class DetachEventEmitter extends AbstractRequestCycleListener
 
 	private static final MetaDataKey<Boolean> DETACH_SCHEDULED_KEY = new MetaDataKey<Boolean>()
 	{
+		private static final long serialVersionUID = 1L;
 	};
 
 	@Inject
@@ -47,7 +47,7 @@ public class DetachEventEmitter extends AbstractRequestCycleListener
 	/**
 	 * Constructor
 	 */
-	public DetachEventEmitter(AbstractCdiContainer container)
+	public DetachEventEmitter()
 	{
 		NonContextual.of(DetachEventEmitter.class).postConstruct(this);
 	}

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
index 154b077..09e39a9 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
@@ -16,7 +16,6 @@
  */
 package org.apache.wicket.cdi;
 
-import org.apache.wicket.Page;
 import org.apache.wicket.request.IRequestHandler;
 
 /**
@@ -28,18 +27,6 @@ import org.apache.wicket.request.IRequestHandler;
 public interface IConversationPropagation
 {
 	/**
-	 * Indicates if the conversation should be propagated via page metadata (on an instance) for the
-	 * given page and request handler.
-	 * 
-	 * @param page
-	 *            The page on which the tag will be set.
-	 * @param handler
-	 *            The current request handler
-	 * @return true if the conversation should be propagated to the given page instance.
-	 */
-	public boolean propagatesViaPage(Page page, IRequestHandler handler);
-
-	/**
 	 * Indicates if the conversation should be propagated via url-parameters for the given request
 	 * handler. This can either be a get parameter in a rendered url, or via page parameters.
 	 * 

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
index 9d10e62..0c30f70 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
@@ -50,7 +50,7 @@ public class CdiConfigurationTest extends WicketCdiTestCase
 	public void testConfigureTwice()
 	{
 		configure(new CdiConfiguration());
-		new CdiConfiguration().configure(tester.getApplication(), new MockCdiContainer());
+		new CdiConfiguration().configure(tester.getApplication());
 	}
 
 	@Test
@@ -83,6 +83,6 @@ public class CdiConfigurationTest extends WicketCdiTestCase
 			config.setPropagation(cp);
 			assertEquals(cp, config.getPropagation());
 		}
-		config.configure(tester.getApplication(), new MockCdiContainer());
+		config.configure(tester.getApplication());
 	}
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockCdiContainer.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockCdiContainer.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockCdiContainer.java
deleted file mode 100644
index 9b7fc48..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockCdiContainer.java
+++ /dev/null
@@ -1,77 +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.wicket.cdi;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.jboss.weld.context.http.HttpConversationContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author jsarman
- */
-@ApplicationScoped
-public class MockCdiContainer extends AbstractCdiContainer
-{
-	private static final Logger logger = LoggerFactory.getLogger(MockCdiContainer.class);
-
-	@Inject
-	private HttpConversationContext conversationContext;
-
-	public MockCdiContainer()
-	{
-		NonContextual.of(MockCdiContainer.class).inject(this);
-	}
-
-	/**
-	 * Activates the conversational context and starts the conversation with the
-	 * specified cid
-	 * 
-	 * @param cycle
-	 * @param cid
-	 */
-	@Override
-	public void activateConversationalContext(RequestCycle cycle, String cid)
-	{
-        conversationContext.associate(getRequest(cycle));
-        if (conversationContext.isActive())
-        {
-                conversationContext.invalidate();
-                conversationContext.deactivate();
-                conversationContext.activate(cid);
-        } else
-        {
-                conversationContext.activate(cid);
-        }
-	}
-
-	@Override
-	public void deactivateConversationalContext(RequestCycle cycle)
-	{
-		// try
-		// {
-		// conversationContext.deactivate();
-		// }
-		// finally
-		// {
-		// conversationContext.dissociate(getRequest(cycle));
-		// }
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
index 3bc9c87..ef862c6 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
@@ -16,7 +16,6 @@
  */
 package org.apache.wicket.cdi;
 
-import javax.enterprise.context.Conversation;
 import javax.inject.Inject;
 
 import org.apache.wicket.WicketTestCase;
@@ -39,13 +38,12 @@ import org.junit.runner.RunWith;
 @AdditionalClasses({ CdiWicketTester.class, BehaviorInjector.class, CdiConfiguration.class,
 		CdiShutdownCleaner.class, ComponentInjector.class, ConversationExpiryChecker.class,
 		ConversationPropagator.class, DetachEventEmitter.class, SessionInjector.class,
-		MockCdiContainer.class, TestAppScope.class, TestConversationBean.class,
-		TestCdiApplication.class })
+		TestAppScope.class, TestConversationBean.class, TestCdiApplication.class })
 public abstract class WicketCdiTestCase extends WicketTestCase
 {
 	@Inject
 	private ContextManager contextManager;
-	
+
 	@Override
 	protected WicketTester newWicketTester(WebApplication app)
 	{
@@ -54,7 +52,7 @@ public abstract class WicketCdiTestCase extends WicketTestCase
 
 	public void configure(CdiConfiguration configuration)
 	{
-		configuration.configure(tester.getApplication(), new MockCdiContainer());
+		configuration.configure(tester.getApplication());
 	}
 
 	@After

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
index 14a85a4..7b82203 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
@@ -17,9 +17,6 @@
 package org.apache.wicket.cdi.testapp;
 
 import org.apache.wicket.Page;
-import org.apache.wicket.cdi.CdiConfiguration;
-import org.apache.wicket.cdi.ConversationPropagation;
-import org.apache.wicket.cdi.MockCdiContainer;
 import org.apache.wicket.protocol.http.WebApplication;
 
 /**

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
index 6ea1916..1bd8656 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
@@ -20,7 +20,6 @@ import javax.inject.Inject;
 
 import org.apache.wicket.Page;
 import org.apache.wicket.cdi.CdiConfiguration;
-import org.apache.wicket.cdi.MockCdiContainer;
 import org.apache.wicket.protocol.http.WebApplication;
 
 /**
@@ -44,7 +43,7 @@ public class TestCdiApplication extends WebApplication
 	protected void init()
 	{
 		super.init();
-		new CdiConfiguration().configure(this, new MockCdiContainer());
+		new CdiConfiguration().configure(this);
 	}
 
 	public String getInjectedTestString()

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
index dfd545d..b3550f1 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html>
+<html xmlns:wicket>
 <head>
     <title></title>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
index dfd545d..b3550f1 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html>
+<html xmlns:wicket>
 <head>
     <title></title>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
index 9857fca..fd58f2d 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html>
+<html xmlns:wicket>
 <head>
     <title></title>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
index 4052110..8efd59b 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
@@ -21,10 +21,14 @@ import java.util.concurrent.atomic.AtomicInteger;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 
+import org.apache.wicket.Page;
+import org.apache.wicket.cdi.CdiConfiguration;
+import org.apache.wicket.cdi.ConversationPropagator;
 import org.apache.wicket.cdi.NonContextual;
 import org.apache.wicket.protocol.http.WebApplication;
 import org.apache.wicket.protocol.http.mock.MockHttpServletRequest;
 import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.request.Url;
 import org.apache.wicket.util.tester.WicketTester;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,7 +39,7 @@ import org.slf4j.LoggerFactory;
 public class CdiWicketTester extends WicketTester
 {
 	private static final Logger logger = LoggerFactory.getLogger(CdiWicketTester.class);
-	
+
 	@Inject
 	ContextManager contextManager;
 
@@ -46,7 +50,7 @@ public class CdiWicketTester extends WicketTester
 		super(app);
 		NonContextual.of(CdiWicketTester.class).inject(this);
 	}
-	
+
 	/**
 	 * Process the request by first activating the contexts on initial call.
 	 * This call is called recursively in the super class so keep track of the
@@ -69,7 +73,7 @@ public class CdiWicketTester extends WicketTester
 			{
 				contextManager.deactivateContexts();
 			}
-			contextManager.activateContexts(getRequest());
+			contextManager.activateContexts(forcedRequest == null ? getRequest() : forcedRequest);
 		}
 		try
 		{
@@ -81,6 +85,23 @@ public class CdiWicketTester extends WicketTester
 		}
 	}
 
+	@Override
+	public Url urlFor(IRequestHandler handler)
+	{
+		Url ret = super.urlFor(handler);
+		final CdiConfiguration configuration = CdiConfiguration.get(getApplication());
+		if (configuration.getPropagation().propagatesViaParameters(handler))
+		{
+			Page page = ConversationPropagator.getPage(handler);
+			if (page != null)
+			{
+				String cid = ConversationPropagator.getConversationIdFromPage(page);
+				ret.addQueryParameter(ConversationPropagator.CID, cid);
+			}
+		}
+		return ret;
+	}
+
 	@PreDestroy
 	public void finish()
 	{

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml
deleted file mode 100644
index 98f8b3f..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml
+++ /dev/null
@@ -1,88 +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.wicket</groupId>
-        <artifactId>wicket-cdi-1.1</artifactId>
-        <version>0.2-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    <artifactId>wicket-cdi-1.1-weld</artifactId>
-    <packaging>jar</packaging>
-    <version>0.2-SNAPSHOT</version>
-    <name>Wicket CDI 1.1 Weld</name>
-    <description>
-        Provides integration between Wicket and CDI containers. Adds support for weld
-        based containers.
-    </description>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.wicket</groupId>
-            <artifactId>wicket-cdi-1.1-core</artifactId>
-            <version>0.2-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.weld</groupId>
-            <artifactId>weld-api</artifactId>
-            <version>2.0.Final</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>javax.el</groupId>
-            <artifactId>javax.el-api</artifactId>
-            <version>2.2.4</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-    <build>
-        <pluginManagement>
-            <plugins>
-                <plugin>
-                    <groupId>org.codehaus.mojo</groupId>
-                    <artifactId>clirr-maven-plugin</artifactId>
-                    <executions>
-                        <execution>
-                            <id>clirr-check</id>
-                            <phase>compile</phase>
-                            <goals>
-                                <goal>check</goal>
-                            </goals>
-                            <configuration>
-                                <comparisonVersion>6.1.0</comparisonVersion>
-                                <failOnError>true</failOnError>
-                                <logResults>true</logResults>
-                            </configuration>
-                        </execution>
-                    </executions>
-                    <configuration>
-                        <comparisonVersion>6.1.0</comparisonVersion>
-                        <failOnError>true</failOnError>
-                        <logResults>true</logResults>
-                    </configuration>
-                </plugin>
-            </plugins>
-        </pluginManagement>
-    </build>
-</project>

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/java/org/apache/wicket/cdi/weld/WeldCdiContainer.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/java/org/apache/wicket/cdi/weld/WeldCdiContainer.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/java/org/apache/wicket/cdi/weld/WeldCdiContainer.java
deleted file mode 100644
index 4dcbdb9..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/java/org/apache/wicket/cdi/weld/WeldCdiContainer.java
+++ /dev/null
@@ -1,68 +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.wicket.cdi.weld;
-
-import javax.inject.Inject;
-
-import org.apache.wicket.cdi.AbstractCdiContainer;
-import org.apache.wicket.cdi.NonContextual;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.jboss.weld.context.http.HttpConversationContext;
-
-/**
- * Provides access to CDI features from inside a Wicket request
- * 
- * @author jsarman
- */
-public class WeldCdiContainer extends AbstractCdiContainer
-{
-	@Inject
-	private HttpConversationContext conversationContext;
-
-	public WeldCdiContainer()
-	{
-		NonContextual.of(WeldCdiContainer.class).inject(this);
-	}
-
-	/**
-	 * Activates the conversational context and starts the conversation with the
-	 * specified cid
-	 * 
-	 * @param cycle
-	 * @param cid
-	 */
-	@Override
-	public void activateConversationalContext(RequestCycle cycle, String cid)
-	{
-		conversationContext.associate(getRequest(cycle));
-		if (conversationContext.isActive())
-		{
-			conversationContext.invalidate();
-			conversationContext.deactivate();
-			conversationContext.activate(cid);
-		}
-		else
-		{
-			conversationContext.activate(cid);
-		}
-	}
-
-	@Override
-	public void deactivateConversationalContext(RequestCycle cycle)
-	{
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/resources/META-INF/beans.xml b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/main/resources/META-INF/beans.xml
deleted file mode 100644
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/wicket/blob/9def8e36/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/test/java/org/apache/wicket/cdi/weld/ApacheLicenceHeaderTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/test/java/org/apache/wicket/cdi/weld/ApacheLicenceHeaderTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/test/java/org/apache/wicket/cdi/weld/ApacheLicenceHeaderTest.java
deleted file mode 100644
index d2761ba..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-weld/src/test/java/org/apache/wicket/cdi/weld/ApacheLicenceHeaderTest.java
+++ /dev/null
@@ -1,41 +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.wicket.cdi.weld;
-
-import java.util.Arrays;
-
-import org.apache.wicket.util.license.ApacheLicenseHeaderTestCase;
-
-/**
- * Test that the license headers are in place in this project. The tests are run
- * from {@link ApacheLicenseHeaderTestCase}, but you can add project specific
- * tests here if needed.
- * 
- * @author Frank Bille Jensen (frankbille)
- */
-public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase
-{
-	/**
-	 * Construct.
-	 */
-	public ApacheLicenceHeaderTest()
-	{
-		xmlIgnore.add(".settings");
-		xmlIgnore.add("src/main/resources/META-INF/beans.xml");
-		xmlPrologIgnore = Arrays.asList("src");
-	}
-}


[2/5] git commit: removed settings to disable injection

Posted by pa...@apache.org.
removed settings to disable injection


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/15930182
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/15930182
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/15930182

Branch: refs/heads/wicket-cdi-1.1-rewrite
Commit: 15930182aa83f7e2cef9d6127e2a5d5a1ebeeb4d
Parents: 9def8e3
Author: Emond Papegaaij <em...@topicus.nl>
Authored: Tue Nov 19 17:53:03 2013 +0100
Committer: Emond Papegaaij <em...@topicus.nl>
Committed: Tue Nov 19 17:58:11 2013 +0100

----------------------------------------------------------------------
 .../org/apache/wicket/cdi/CdiConfiguration.java | 112 +------------------
 .../apache/wicket/cdi/CdiShutdownCleaner.java   |  11 +-
 .../wicket/cdi/ConversationPropagator.java      |  21 +---
 .../apache/wicket/cdi/CdiConfigurationTest.java |  20 ----
 .../wicket/cdi/ConversationPropagatorTest.java  |   8 +-
 5 files changed, 15 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/15930182/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
index 3ac4abf..93675f7 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
@@ -35,12 +35,6 @@ public class CdiConfiguration
 
 	private IConversationPropagation propagation = ConversationPropagation.ALL;
 
-	private boolean injectComponents = true;
-	private boolean injectApplication = true;
-	private boolean injectSession = true;
-	private boolean injectBehaviors = true;
-	private boolean autoConversationManagement = false;
-
 	/**
 	 * Constructor
 	 */
@@ -53,38 +47,6 @@ public class CdiConfiguration
 		return propagation;
 	}
 
-	/**
-	 * Checks if auto conversation management is enabled. See
-	 * {@link #setAutoConversationManagement(boolean)} for details.
-	 */
-	public boolean isAutoConversationManagement()
-	{
-		return autoConversationManagement;
-	}
-
-	/**
-	 * Toggles automatic conversation management feature.
-	 * 
-	 * Automatic conversation management controls the lifecycle of the
-	 * conversation based on presence of components implementing the
-	 * {@link ConversationalComponent} interface. If such components are found
-	 * in the page a conversation is marked persistent, and if they are not the
-	 * conversation is marked transient. This greatly simplifies the management
-	 * of conversation lifecycle.
-	 * 
-	 * Sometimes it is necessary to manually control the application. For these
-	 * cases, once a conversation is started {@link AutoConversation} bean can
-	 * be used to mark the conversation as manually-managed.
-	 * 
-	 * @param enabled
-	 * 
-	 * @return {@code this} for easy chaining
-	 */
-	public CdiConfiguration setAutoConversationManagement(boolean enabled)
-	{
-		autoConversationManagement = enabled;
-		return this;
-	}
 
 	public CdiConfiguration setPropagation(IConversationPropagation propagation)
 	{
@@ -92,49 +54,6 @@ public class CdiConfiguration
 		return this;
 	}
 
-	public boolean isInjectComponents()
-	{
-		return injectComponents;
-	}
-
-	public CdiConfiguration setInjectComponents(boolean injectComponents)
-	{
-		this.injectComponents = injectComponents;
-		return this;
-	}
-
-	public boolean isInjectApplication()
-	{
-		return injectApplication;
-	}
-
-	public CdiConfiguration setInjectApplication(boolean injectApplication)
-	{
-		this.injectApplication = injectApplication;
-		return this;
-	}
-
-	public boolean isInjectSession()
-	{
-		return injectSession;
-	}
-
-	public CdiConfiguration setInjectSession(boolean injectSession)
-	{
-		this.injectSession = injectSession;
-		return this;
-	}
-
-	public boolean isInjectBehaviors()
-	{
-		return injectBehaviors;
-	}
-
-	public CdiConfiguration setInjectBehaviors(boolean injectBehaviors)
-	{
-		this.injectBehaviors = injectBehaviors;
-		return this;
-	}
 
 	/**
 	 * Configures the specified application
@@ -156,8 +75,7 @@ public class CdiConfiguration
 		// enable conversation propagation
 		if (getPropagation() != ConversationPropagation.NONE)
 		{
-			listeners.add(new ConversationPropagator(application, getPropagation(),
-					autoConversationManagement));
+			listeners.add(new ConversationPropagator(application, getPropagation()));
 			application.getComponentPreOnBeforeRenderListeners().add(
 					new ConversationExpiryChecker());
 		}
@@ -165,33 +83,15 @@ public class CdiConfiguration
 		// enable detach event
 		listeners.add(new DetachEventEmitter());
 
-
-		// inject application instance
-		if (isInjectApplication())
-		{
-			NonContextual.of(application.getClass()).postConstruct(application);
-		}
+		NonContextual.of(application.getClass()).postConstruct(application);
 
 		// enable injection of various framework components
-
-		if (isInjectSession())
-		{
-			application.getSessionListeners().add(new SessionInjector());
-		}
-
-		if (isInjectComponents())
-		{
-			application.getComponentInstantiationListeners().add(new ComponentInjector());
-		}
-
-		if (isInjectBehaviors())
-		{
-			application.getBehaviorInstantiationListeners().add(new BehaviorInjector());
-		}
+		application.getSessionListeners().add(new SessionInjector());
+		application.getComponentInstantiationListeners().add(new ComponentInjector());
+		application.getBehaviorInstantiationListeners().add(new BehaviorInjector());
 
 		// enable cleanup
-
-		application.getApplicationListeners().add(new CdiShutdownCleaner(isInjectApplication()));
+		application.getApplicationListeners().add(new CdiShutdownCleaner());
 	}
 
 	public static CdiConfiguration get(Application application)

http://git-wip-us.apache.org/repos/asf/wicket/blob/15930182/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
index 625a016..8d2c97c 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
@@ -26,11 +26,8 @@ import org.apache.wicket.IApplicationListener;
  */
 class CdiShutdownCleaner implements IApplicationListener
 {
-	private final boolean preDestroyApplication;
-
-	public CdiShutdownCleaner(boolean preDestroyApplication)
+	public CdiShutdownCleaner()
 	{
-		this.preDestroyApplication = preDestroyApplication;
 	}
 
 	@Override
@@ -42,11 +39,7 @@ class CdiShutdownCleaner implements IApplicationListener
 	@Override
 	public void onBeforeDestroyed(Application application)
 	{
-		if (preDestroyApplication)
-		{
-			NonContextual.of(application.getClass()).preDestroy(application);
-		}
+		NonContextual.of(application.getClass()).preDestroy(application);
 		NonContextual.undeploy();
 	}
-
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/15930182/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
index 2f43931..690710b 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
@@ -72,8 +72,6 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 
 	private final Application application;
 
-	private final boolean auto;
-
 	@Inject
 	private Conversation conversation;
 
@@ -88,18 +86,6 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 	 */
 	public ConversationPropagator(Application application, IConversationPropagation propagation)
 	{
-		this(application, propagation, false);
-	}
-
-	/**
-	 * Constructor
-	 * 
-	 * @param container
-	 * @param propagation
-	 */
-	public ConversationPropagator(Application application, IConversationPropagation propagation,
-			boolean auto)
-	{
 		Args.notNull(application, "application");
 		Args.notNull(propagation, "propagation");
 
@@ -111,11 +97,10 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 
 		this.application = application;
 		this.propagation = propagation;
-		this.auto = auto;
 
 		NonContextual.of(ConversationPropagator.class).postConstruct(this);
 	}
-	
+
 	public IConversationPropagation getPropagation()
 	{
 		return propagation;
@@ -255,7 +240,7 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 	protected void autoBeginIfNecessary(Page page, IRequestHandler handler,
 			Conversation conversation)
 	{
-		if (!auto || conversation == null || !conversation.isTransient() || page == null
+		if (conversation == null || !conversation.isTransient() || page == null
 				|| !hasConversationalComponent(page))
 		{
 			return;
@@ -271,7 +256,7 @@ public class ConversationPropagator extends AbstractRequestCycleListener
 
 	protected void autoEndIfNecessary(Page page, IRequestHandler handler, Conversation conversation)
 	{
-		if (!auto || conversation == null || conversation.isTransient() || page == null
+		if (conversation == null || conversation.isTransient() || page == null
 				|| hasConversationalComponent(page) || autoConversation.isAutomatic() == false)
 		{
 			return;

http://git-wip-us.apache.org/repos/asf/wicket/blob/15930182/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
index 0c30f70..7e89c10 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
@@ -58,26 +58,6 @@ public class CdiConfigurationTest extends WicketCdiTestCase
 	{
 		WicketTester tester = new WicketTester();
 		CdiConfiguration config = new CdiConfiguration();
-		config.setAutoConversationManagement(true);
-		assertTrue(config.isAutoConversationManagement());
-		config.setAutoConversationManagement(false);
-		assertFalse(config.isAutoConversationManagement());
-		config.setInjectApplication(false);
-		assertFalse(config.isInjectApplication());
-		config.setInjectApplication(true);
-		assertTrue(config.isInjectApplication());
-		config.setInjectBehaviors(false);
-		assertFalse(config.isInjectBehaviors());
-		config.setInjectBehaviors(true);
-		assertTrue(config.isInjectBehaviors());
-		config.setInjectComponents(false);
-		assertFalse(config.isInjectComponents());
-		config.setInjectComponents(true);
-		assertTrue(config.isInjectComponents());
-		config.setInjectSession(false);
-		assertFalse(config.isInjectSession());
-		config.setInjectSession(true);
-		assertTrue(config.isInjectSession());
 		for (ConversationPropagation cp : ConversationPropagation.values())
 		{
 			config.setPropagation(cp);

http://git-wip-us.apache.org/repos/asf/wicket/blob/15930182/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
index b385344..d827b11 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
@@ -31,7 +31,7 @@ public class ConversationPropagatorTest extends WicketCdiTestCase
 	@Ignore("Testcase and auto conversations do not match")
 	public void testAutoConversationNonBookmarkable()
 	{
-		configure(new CdiConfiguration().setAutoConversationManagement(true));
+		configure(new CdiConfiguration());
 
 		tester.startPage(TestConversationalPage.class);
 		int i;
@@ -67,7 +67,7 @@ public class ConversationPropagatorTest extends WicketCdiTestCase
 	@Ignore("Testcase and auto conversations do not match")
 	public void testAutoConversationBookmarkable()
 	{
-		configure(new CdiConfiguration().setAutoConversationManagement(true));
+		configure(new CdiConfiguration());
 
 		tester.startPage(TestConversationalPage.class,
 				new PageParameters().add("pageType", "bookmarkable"));
@@ -158,7 +158,7 @@ public class ConversationPropagatorTest extends WicketCdiTestCase
 	@Ignore("Testcase and auto conversations do not match")
 	public void testGlobalAutoSettingNonBookmarkable()
 	{
-		configure(new CdiConfiguration().setAutoConversationManagement(true));
+		configure(new CdiConfiguration());
 
 		tester.startPage(TestConversationPage.class, new PageParameters().add("auto", true));
 		int i;
@@ -179,7 +179,7 @@ public class ConversationPropagatorTest extends WicketCdiTestCase
 	@Ignore("Testcase and auto conversations do not match")
 	public void testGlobalAutoSettingBookmarkable()
 	{
-		configure(new CdiConfiguration().setAutoConversationManagement(true));
+		configure(new CdiConfiguration());
 
 		tester.startPage(TestConversationPage.class,
 				new PageParameters().add("auto", true).add("pageType", "bookmarkable"));


[4/5] moved wicket-cdi from core into parent

Posted by pa...@apache.org.
http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
new file mode 100644
index 0000000..cb0138d
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
@@ -0,0 +1,89 @@
+/*
+ * 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.wicket.cdi.testapp;
+
+import java.util.Random;
+
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+
+/**
+ * @author jsarman
+ */
+public class TestConversationPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+
+	@Inject
+	Conversation conversation;
+
+	@Inject
+	TestConversationBean counter;
+
+	Random random = new Random();
+
+	public TestConversationPage()
+	{
+		this(new PageParameters());
+	}
+
+	public TestConversationPage(final PageParameters parameters)
+	{
+		super(parameters);
+
+		if (!parameters.get("auto").toBoolean())
+		{
+			conversation.begin();
+
+			System.out.println("Opened Conversion with id = " + conversation.getId());
+		}
+		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
+
+		add(new Link<Void>("increment")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				counter.increment();
+			}
+		});
+		add(new Link<Void>("next")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				String pageType = parameters.get("pageType").toString("nonbookmarkable");
+				if ("bookmarkable".equals(pageType.toLowerCase()))
+					setResponsePage(TestNonConversationalPage.class);
+				else
+					setResponsePage(new TestNonConversationalPage());
+			}
+		});
+
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
new file mode 100644
index 0000000..b3550f1
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html xmlns:wicket>
+<head>
+    <title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<span wicket:id="count">100</span>
+<a wicket:id="increment">increment</a>
+<a wicket:id="next">next</a>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java
new file mode 100644
index 0000000..a106936
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java
@@ -0,0 +1,82 @@
+/*
+ * 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.wicket.cdi.testapp;
+
+import java.util.Random;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.cdi.ConversationalComponent;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author jsarman
+ */
+public class TestConversationalPage extends WebPage implements ConversationalComponent
+{
+	private static final long serialVersionUID = 1L;
+
+	private static final Logger logger = LoggerFactory.getLogger(TestConversationPage.class);
+	@Inject
+	TestConversationBean counter;
+
+	Random random = new Random();
+
+	public TestConversationalPage()
+	{
+		this(new PageParameters());
+	}
+
+
+	public TestConversationalPage(final PageParameters pp)
+	{
+		logger.debug("Starting TestConversationalPage");
+
+		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
+
+		add(new Link<Void>("increment")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				counter.increment();
+			}
+		});
+		add(new Link<Void>("next")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				String pageType = pp.get("pageType").toString("nonbookmarkable");
+				if ("bookmarkable".equals(pageType.toLowerCase()))
+					setResponsePage(TestNonConversationalPage.class);
+				else
+					setResponsePage(new TestNonConversationalPage());
+			}
+		});
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
new file mode 100644
index 0000000..b3550f1
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html xmlns:wicket>
+<head>
+    <title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<span wicket:id="count">100</span>
+<a wicket:id="increment">increment</a>
+<a wicket:id="next">next</a>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java
new file mode 100644
index 0000000..2a78914
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java
@@ -0,0 +1,88 @@
+/*
+ * 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.wicket.cdi.testapp;
+
+import java.util.Random;
+
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author jsarman
+ */
+public class TestNonAutoConversationalPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+	private static final Logger logger = LoggerFactory.getLogger(TestConversationPage.class);
+	@Inject
+	TestConversationBean counter;
+
+	@Inject
+	Conversation conversation;
+
+	Random random = new Random();
+
+	public TestNonAutoConversationalPage()
+	{
+		this(new PageParameters());
+	}
+
+
+	public TestNonAutoConversationalPage(final PageParameters pp)
+	{
+		if (pp.get("startConveration").toBoolean(true))
+		{
+			conversation.begin();
+		}
+		logger.debug("Starting TestConversationalPage");
+
+		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
+
+		add(new Link<Void>("increment")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				counter.increment();
+			}
+		});
+		add(new Link<Void>("next")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				String pageType = pp.get("pageType").toString("nonbookmarkable");
+				if ("bookmarkable".equals(pageType.toLowerCase()))
+					setResponsePage(TestNonConversationalPage.class);
+				else
+					setResponsePage(new TestNonConversationalPage());
+			}
+		});
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
new file mode 100644
index 0000000..fd58f2d
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns:wicket>
+<head>
+    <title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<span wicket:id="count">100</span>
+<a wicket:id="increment">increment</a>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java
new file mode 100644
index 0000000..8af7bac
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java
@@ -0,0 +1,59 @@
+/*
+ * 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.wicket.cdi.testapp;
+
+import java.util.Random;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author jsarman
+ */
+public class TestNonConversationalPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+	private static final Logger logger = LoggerFactory.getLogger(TestConversationPage.class);
+	@Inject
+	TestConversationBean counter;
+
+	Random random = new Random();
+
+	public TestNonConversationalPage()
+	{
+		logger.debug("Starting TestConversationalPage");
+		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
+
+		add(new Link<Void>("increment")
+		{
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void onClick()
+			{
+				counter.increment();
+			}
+		});
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestPage.html b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestPage.html
new file mode 100644
index 0000000..4689c49
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestPage.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html xmlns:wicket>
+<head>
+    <title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<div wicket:id="appscope">Fail</div>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestPage.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestPage.java
new file mode 100644
index 0000000..cf5108b
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestPage.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.wicket.cdi.testapp;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+
+/**
+ * @author jsarman
+ */
+public class TestPage extends WebPage
+{
+	private static final long serialVersionUID = 1L;
+
+	@Inject
+	TestAppScope appScope;
+
+	public TestPage()
+	{
+
+		add(new Label("appscope", appScope.test()));
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestQualifier.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestQualifier.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestQualifier.java
new file mode 100644
index 0000000..dcd0289
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestQualifier.java
@@ -0,0 +1,35 @@
+/*
+ * 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.wicket.cdi.testapp;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * @author jsarman
+ */
+@Qualifier
+@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TestQualifier {
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
new file mode 100644
index 0000000..8efd59b
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
@@ -0,0 +1,122 @@
+/*
+ * 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.wicket.cdi.util.tester;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.cdi.CdiConfiguration;
+import org.apache.wicket.cdi.ConversationPropagator;
+import org.apache.wicket.cdi.NonContextual;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.mock.MockHttpServletRequest;
+import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.util.tester.WicketTester;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author jsarman
+ */
+public class CdiWicketTester extends WicketTester
+{
+	private static final Logger logger = LoggerFactory.getLogger(CdiWicketTester.class);
+
+	@Inject
+	ContextManager contextManager;
+
+	private AtomicInteger count = new AtomicInteger();
+
+	public CdiWicketTester(WebApplication app)
+	{
+		super(app);
+		NonContextual.of(CdiWicketTester.class).inject(this);
+	}
+
+	/**
+	 * Process the request by first activating the contexts on initial call.
+	 * This call is called recursively in the super class so keep track of the
+	 * topmost call and only activate and deactivate the contexts during that
+	 * time.
+	 * 
+	 * @param forcedRequest
+	 * @param forcedRequestHandler
+	 * @param redirect
+	 * @return
+	 */
+	@Override
+	protected boolean processRequest(final MockHttpServletRequest forcedRequest,
+			final IRequestHandler forcedRequestHandler, final boolean redirect)
+	{
+		if (count.getAndIncrement() == 0)
+		{
+
+			if (getLastRequest() != null)
+			{
+				contextManager.deactivateContexts();
+			}
+			contextManager.activateContexts(forcedRequest == null ? getRequest() : forcedRequest);
+		}
+		try
+		{
+			return super.processRequest(forcedRequest, forcedRequestHandler, redirect);
+		}
+		finally
+		{
+			count.decrementAndGet();
+		}
+	}
+
+	@Override
+	public Url urlFor(IRequestHandler handler)
+	{
+		Url ret = super.urlFor(handler);
+		final CdiConfiguration configuration = CdiConfiguration.get(getApplication());
+		if (configuration.getPropagation().propagatesViaParameters(handler))
+		{
+			Page page = ConversationPropagator.getPage(handler);
+			if (page != null)
+			{
+				String cid = ConversationPropagator.getConversationIdFromPage(page);
+				ret.addQueryParameter(ConversationPropagator.CID, cid);
+			}
+		}
+		return ret;
+	}
+
+	@PreDestroy
+	public void finish()
+	{
+		try
+		{
+			logger.debug("Destroying Cdi Wicket Tester");
+			if (getLastRequest() != null)
+			{
+				contextManager.deactivateContexts();
+			}
+			contextManager.destroy();
+			destroy();
+		}
+		catch (Throwable t)
+		{
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java
new file mode 100644
index 0000000..fb9eeb1
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java
@@ -0,0 +1,105 @@
+/*
+ * 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.wicket.cdi.util.tester;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.jboss.weld.bean.builtin.BeanManagerProxy;
+import org.jboss.weld.servlet.HttpContextLifecycle;
+import org.jboss.weld.servlet.spi.helpers.AcceptingHttpContextActivationFilter;
+import org.jglue.cdiunit.internal.LifecycleAwareRequest;
+
+/**
+ * @author jsarman
+ */
+@ApplicationScoped
+public class ContextManager
+{
+	private HttpServletRequest currentRequest;
+
+	@Inject
+	private BeanManager beanManager;
+
+	private HttpContextLifecycle lifecycle;
+
+	private HttpSession currentSession;
+
+	@PostConstruct
+	public void setup()
+	{
+		try
+		{
+			lifecycle = new HttpContextLifecycle(BeanManagerProxy.unwrap(beanManager),
+					AcceptingHttpContextActivationFilter.INSTANCE, true, true);
+		}
+		catch (NoSuchMethodError e)
+		{
+			try
+			{
+				lifecycle = HttpContextLifecycle.class.getConstructor(BeanManager.class,
+						AcceptingHttpContextActivationFilter.class).newInstance(
+						BeanManagerProxy.unwrap(beanManager),
+						AcceptingHttpContextActivationFilter.INSTANCE);
+			}
+			catch (Exception e1)
+			{
+				throw new RuntimeException(e1);
+			}
+		}
+		lifecycle.setConversationActivationEnabled(true);
+	}
+
+	public void activateContexts(HttpServletRequest request)
+	{
+		if (currentRequest != null)
+			return;
+
+		currentRequest = new LifecycleAwareRequest(lifecycle, request, currentSession);
+		lifecycle.requestInitialized(currentRequest, null);
+	}
+
+	public void deactivateContexts()
+	{
+		lifecycle.requestDestroyed(currentRequest);
+		currentSession = currentRequest.getSession(false);
+		currentRequest = null;
+	}
+
+	public void destroy()
+	{
+		if (currentRequest != null)
+		{
+			currentSession = currentRequest.getSession(false);
+		}
+
+		if (currentSession != null)
+		{
+			lifecycle.sessionDestroyed(currentSession);
+			currentSession = null;
+		}
+	}
+
+	public boolean isRequestActive()
+	{
+		return currentRequest != null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/simplelogger.properties
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/simplelogger.properties b/wicket-experimental/wicket-cdi-1.1/src/test/java/simplelogger.properties
new file mode 100644
index 0000000..17c5fe6
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/simplelogger.properties
@@ -0,0 +1 @@
+org.slf4j.simpleLogger.log.org.apache.wicket.cdi=info
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/pom.xml b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/pom.xml
deleted file mode 100644
index d488750..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/pom.xml
+++ /dev/null
@@ -1,58 +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.wicket</groupId>
-		<artifactId>wicket-cdi-1.1</artifactId>
-		<version>0.2-SNAPSHOT</version>
-		<relativePath>../pom.xml</relativePath>
-	</parent>
-	<artifactId>wicket-cdi-1.1-core</artifactId>
-	<packaging>jar</packaging>
-	<version>0.2-SNAPSHOT</version>
-	<name>Wicket CDI 1.1 Core</name>
-	<description>
-		Provides integration between Wicket and CDI containers. Enables injection of
-		components and behaviors, as well as other non-contextual object instances.
-		Also enables propagation of conversations between wicket artifacts such as pages
-		and resources.
-	</description>
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.wicket</groupId>
-			<artifactId>wicket-core</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>javax.enterprise</groupId>
-			<artifactId>cdi-api</artifactId>
-			<version>1.1</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.jglue.cdi-unit</groupId>
-			<artifactId>cdi-unit</artifactId>
-			<version>2.2.1</version>
-			<scope>test</scope>
-		</dependency>
-	</dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractInjector.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractInjector.java
deleted file mode 100644
index c6c38b6..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AbstractInjector.java
+++ /dev/null
@@ -1,39 +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.wicket.cdi;
-
-/**
- * Base class for injectors
- * 
- * @author igor
- */
-class AbstractInjector
-{
-	public AbstractInjector()
-	{
-	}
-
-	protected <T> void postConstruct(T instance)
-	{
-		NonContextual.of(instance.getClass()).postConstruct(instance);
-	}
-
-	protected <T> void inject(T instance)
-	{
-		NonContextual.of(instance.getClass()).inject(instance);
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AutoConversation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AutoConversation.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AutoConversation.java
deleted file mode 100644
index 6138ac2..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/AutoConversation.java
+++ /dev/null
@@ -1,51 +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.wicket.cdi;
-
-import javax.enterprise.context.ConversationScoped;
-
-import org.apache.wicket.util.io.IClusterable;
-
-/**
- * A bean that can be used to override whether the lifecycle of the conversation should be managed
- * automatically or not. See {@link CdiConfiguration#setAutoConversationManagement(boolean)} for
- * details.
- * 
- * @author igor
- */
-@ConversationScoped
-public class AutoConversation implements IClusterable
-{
-	private static final long serialVersionUID = 1L;
-	
-	private boolean automatic;
-
-	public AutoConversation()
-	{
-		automatic = false;
-	}
-
-	public void setAutomatic(boolean automatic)
-	{
-		this.automatic = automatic;
-	}
-
-	public boolean isAutomatic()
-	{
-		return automatic;
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BeanManagerLookup.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BeanManagerLookup.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BeanManagerLookup.java
deleted file mode 100644
index d9051ba..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BeanManagerLookup.java
+++ /dev/null
@@ -1,40 +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.wicket.cdi;
-
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.CDI;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-public final class BeanManagerLookup
-{
-	private BeanManagerLookup()
-	{
-	}
-
-	public static BeanManager lookup() {
-		try
-		{
-			return InitialContext.doLookup("java:comp/BeanManager");
-		}
-		catch (NamingException e)
-		{
-			return CDI.current().getBeanManager();
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java
deleted file mode 100644
index 15979f6..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java
+++ /dev/null
@@ -1,42 +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.wicket.cdi;
-
-import org.apache.wicket.IBehaviorInstantiationListener;
-import org.apache.wicket.behavior.Behavior;
-
-/**
- * Injects components with CDI dependencies
- * 
- * @author igor
- * 
- */
-public class BehaviorInjector extends AbstractInjector implements IBehaviorInstantiationListener
-{
-	/**
-	 * Constructor
-	 */
-	public BehaviorInjector()
-	{
-	}
-
-	@Override
-	public void onInstantiation(Behavior behavior)
-	{
-		inject(behavior);
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
deleted file mode 100644
index 93675f7..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
+++ /dev/null
@@ -1,101 +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.wicket.cdi;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.MetaDataKey;
-import org.apache.wicket.request.cycle.RequestCycleListenerCollection;
-
-/**
- * Configures CDI integration
- * 
- * @author igor
- * 
- */
-public class CdiConfiguration
-{
-	private static final MetaDataKey<CdiConfiguration> CDI_CONFIGURATION_KEY = new MetaDataKey<CdiConfiguration>()
-	{
-		private static final long serialVersionUID = 1L;
-	};
-
-	private IConversationPropagation propagation = ConversationPropagation.ALL;
-
-	/**
-	 * Constructor
-	 */
-	public CdiConfiguration()
-	{
-	}
-
-	public IConversationPropagation getPropagation()
-	{
-		return propagation;
-	}
-
-
-	public CdiConfiguration setPropagation(IConversationPropagation propagation)
-	{
-		this.propagation = propagation;
-		return this;
-	}
-
-
-	/**
-	 * Configures the specified application
-	 * 
-	 * @param application
-	 * @return
-	 */
-	public void configure(Application application)
-	{
-		if (application.getMetaData(CDI_CONFIGURATION_KEY) != null)
-		{
-			throw new IllegalStateException("Cdi already configured for this application");
-		}
-		application.setMetaData(CDI_CONFIGURATION_KEY, this);
-
-		RequestCycleListenerCollection listeners = new RequestCycleListenerCollection();
-		application.getRequestCycleListeners().add(listeners);
-
-		// enable conversation propagation
-		if (getPropagation() != ConversationPropagation.NONE)
-		{
-			listeners.add(new ConversationPropagator(application, getPropagation()));
-			application.getComponentPreOnBeforeRenderListeners().add(
-					new ConversationExpiryChecker());
-		}
-
-		// enable detach event
-		listeners.add(new DetachEventEmitter());
-
-		NonContextual.of(application.getClass()).postConstruct(application);
-
-		// enable injection of various framework components
-		application.getSessionListeners().add(new SessionInjector());
-		application.getComponentInstantiationListeners().add(new ComponentInjector());
-		application.getBehaviorInstantiationListeners().add(new BehaviorInjector());
-
-		// enable cleanup
-		application.getApplicationListeners().add(new CdiShutdownCleaner());
-	}
-
-	public static CdiConfiguration get(Application application)
-	{
-		return application.getMetaData(CDI_CONFIGURATION_KEY);
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
deleted file mode 100644
index 8d2c97c..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
+++ /dev/null
@@ -1,45 +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.wicket.cdi;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.IApplicationListener;
-
-/**
- * Listens to application shutdown and cleans up
- * 
- * @author igor
- */
-class CdiShutdownCleaner implements IApplicationListener
-{
-	public CdiShutdownCleaner()
-	{
-	}
-
-	@Override
-	public void onAfterInitialized(Application application)
-	{
-		// noop
-	}
-
-	@Override
-	public void onBeforeDestroyed(Application application)
-	{
-		NonContextual.of(application.getClass()).preDestroy(application);
-		NonContextual.undeploy();
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ComponentInjector.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
deleted file mode 100644
index 65a4879..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
+++ /dev/null
@@ -1,43 +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.wicket.cdi;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.application.IComponentInstantiationListener;
-
-/**
- * Injects components with CDI dependencies
- * 
- * @author igor
- * 
- */
-class ComponentInjector extends AbstractInjector implements IComponentInstantiationListener
-{
-	/**
-	 * Constructor
-	 */
-	public ComponentInjector()
-	{
-	}
-
-	@Override
-	public void onInstantiation(Component component)
-	{
-		inject(component);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
deleted file mode 100644
index a9c7eb1..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
+++ /dev/null
@@ -1,52 +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.wicket.cdi;
-
-import org.apache.wicket.Page;
-import org.apache.wicket.request.IRequestHandler;
-
-public class ConversationExpiredException extends RuntimeException
-{
-	private static final long serialVersionUID = 1L;
-	private String cid;
-	private Page page;
-	private IRequestHandler handler;
-
-	public ConversationExpiredException(Throwable cause, String cid, Page page,
-		IRequestHandler handler)
-	{
-		super(cause);
-		this.cid = cid;
-		this.page = page;
-		this.handler = handler;
-	}
-
-	public String getCid()
-	{
-		return cid;
-	}
-
-	public Page getPage()
-	{
-		return page;
-	}
-
-	public IRequestHandler getHandler()
-	{
-		return handler;
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
deleted file mode 100644
index e79f938..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
+++ /dev/null
@@ -1,68 +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.wicket.cdi;
-
-import javax.enterprise.context.Conversation;
-import javax.inject.Inject;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.Page;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.application.IComponentOnBeforeRenderListener;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.util.lang.Objects;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Checks for conversation expiration during page render and throws a
- * {@link ConversationExpiredException} when an expired conversation is detected.
- * 
- * For example a link that calls {@link Conversation#end()} but does not redirect to a
- * non-conversation-dependent page will be caught by this listener.
- * 
- * @author igor
- * 
- */
-public class ConversationExpiryChecker implements IComponentOnBeforeRenderListener
-{
-	private static final Logger logger = LoggerFactory.getLogger(ConversationExpiryChecker.class);
-	
-	@Inject
-	private Conversation conversation;
-
-	public ConversationExpiryChecker()
-	{
-		NonContextual.of(ConversationExpiryChecker.class).inject(this);
-	}
-
-	@Override
-	public void onBeforeRender(Component component)
-	{
-		if (component instanceof Page || RequestCycle.get().find(AjaxRequestTarget.class) != null)
-		{
-			Page page = component.getPage();
-			String cid = ConversationPropagator.getConversationIdFromPage(page);
-			if (cid != null && !Objects.isEqual(conversation.getId(), cid))
-			{
-				logger.info("Conversation {} has expired for {}", cid, page);
-				throw new ConversationExpiredException(null, cid, page, RequestCycle.get()
-					.getActiveRequestHandler());
-			}
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
deleted file mode 100644
index 502b6e5..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
+++ /dev/null
@@ -1,69 +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.wicket.cdi;
-
-import javax.enterprise.context.ConversationScoped;
-
-import org.apache.wicket.core.request.handler.BookmarkableListenerInterfaceRequestHandler;
-import org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler;
-import org.apache.wicket.request.IRequestHandler;
-
-/**
- * Various modes of propagating persistent conversations across requests.
- * 
- * @see ConversationScoped
- * 
- * @author igor
- */
-public enum ConversationPropagation implements IConversationPropagation {
-	/** No conversational propagation takes place */
-	NONE {
-		@Override
-		public boolean propagatesViaParameters(IRequestHandler handler)
-		{
-			return false;
-		}
-	},
-	/**
-	 * Pesistent conversations are propagated between non-bookmarkable pages
-	 * only
-	 * 
-	 * @deprecated as of cdi-1.1, it is specified that conversations are
-	 *             propagated via the cid query parameter even for
-	 *             non-bookmarkable pages
-	 */
-	@Deprecated
-	NONBOOKMARKABLE {
-		@Override
-		public boolean propagatesViaParameters(IRequestHandler handler)
-		{
-			return !(handler instanceof BookmarkableListenerInterfaceRequestHandler)
-					&& !(handler instanceof BookmarkablePageRequestHandler);
-		}
-	},
-	/**
-	 * Persistent conversations are propagated between bookmarkable and
-	 * non-bookmarkable pages
-	 */
-	ALL {
-		@Override
-		public boolean propagatesViaParameters(IRequestHandler handler)
-		{
-			return true;
-		}
-	};
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
deleted file mode 100644
index 690710b..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
+++ /dev/null
@@ -1,347 +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.wicket.cdi;
-
-import javax.enterprise.context.Conversation;
-import javax.enterprise.context.ConversationScoped;
-import javax.inject.Inject;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.Component;
-import org.apache.wicket.MetaDataKey;
-import org.apache.wicket.Page;
-import org.apache.wicket.core.request.handler.BufferedResponseRequestHandler;
-import org.apache.wicket.core.request.handler.IPageClassRequestHandler;
-import org.apache.wicket.core.request.handler.IPageRequestHandler;
-import org.apache.wicket.request.IRequestHandler;
-import org.apache.wicket.request.IRequestHandlerDelegate;
-import org.apache.wicket.request.Url;
-import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
-import org.apache.wicket.request.cycle.IRequestCycleListener;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.request.resource.PackageResourceReference;
-import org.apache.wicket.util.lang.Args;
-import org.apache.wicket.util.visit.IVisit;
-import org.apache.wicket.util.visit.IVisitor;
-import org.apache.wicket.util.visit.Visits;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A request cycle listener that takes care of propagating persistent
- * conversations.
- * 
- * @see ConversationScoped
- * 
- * @author igor
- */
-public class ConversationPropagator extends AbstractRequestCycleListener
-{
-	private static final Logger logger = LoggerFactory.getLogger(ConversationPropagator.class);
-
-	private static final MetaDataKey<Boolean> CONVERSATION_STARTED_KEY = new MetaDataKey<Boolean>()
-	{
-		private static final long serialVersionUID = 1L;
-	};
-
-	private static final MetaDataKey<String> CONVERSATION_ID_KEY = new MetaDataKey<String>()
-	{
-		private static final long serialVersionUID = 1L;
-	};
-
-	public static final String CID = "cid";
-
-	/** propagation mode to use */
-	private final IConversationPropagation propagation;
-
-	private final Application application;
-
-	@Inject
-	private Conversation conversation;
-
-	@Inject
-	private AutoConversation autoConversation;
-
-	/**
-	 * Constructor
-	 * 
-	 * @param container
-	 * @param propagation
-	 */
-	public ConversationPropagator(Application application, IConversationPropagation propagation)
-	{
-		Args.notNull(application, "application");
-		Args.notNull(propagation, "propagation");
-
-		if (propagation == ConversationPropagation.NONE)
-		{
-			throw new IllegalArgumentException(
-					"If propagation is NONE do not set up the propagator");
-		}
-
-		this.application = application;
-		this.propagation = propagation;
-
-		NonContextual.of(ConversationPropagator.class).postConstruct(this);
-	}
-
-	public IConversationPropagation getPropagation()
-	{
-		return propagation;
-	}
-
-	@Override
-	public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
-	{
-		if (activateForHandler(handler))
-		{
-			logger.debug("Activating conversation {}", conversation.getId());
-			fireOnAfterConversationStarted(cycle);
-		}
-	}
-
-	private void fireOnAfterConversationStarted(RequestCycle cycle)
-	{
-		cycle.setMetaData(CONVERSATION_STARTED_KEY, true);
-		for (IRequestCycleListener listener : application.getRequestCycleListeners())
-		{
-			if (listener instanceof ICdiAwareRequestCycleListener)
-			{
-				((ICdiAwareRequestCycleListener)listener).onAfterConversationActivated(cycle);
-			}
-		}
-	}
-
-	@Override
-	public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
-	{
-		Page page = getPage(handler);
-
-		if (page == null)
-		{
-			return;
-		}
-
-		// apply auto semantics
-
-		autoEndIfNecessary(page, handler, conversation);
-		autoBeginIfNecessary(page, handler, conversation);
-	}
-
-	@Override
-	public void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler)
-	{
-		// propagate current non-transient conversation to the newly scheduled
-		// page
-		if (conversation.isTransient())
-		{
-			return;
-		}
-
-		if (propagation.propagatesViaParameters(handler))
-		{
-			logger.debug(
-					"Propagating non-transient conversation {} via page parameters of handler {}",
-					conversation.getId(), handler);
-
-			PageParameters parameters = getPageParameters(handler);
-			if (parameters != null)
-			{
-				parameters.set(CID, conversation.getId());
-				markPageWithConversationId(handler, conversation.getId());
-			}
-		}
-	}
-
-
-	@Override
-	public void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url)
-	{
-		// no need to propagate the conversation to packaged resources, they
-		// should never change
-		if (handler instanceof ResourceReferenceRequestHandler)
-		{
-			if (((ResourceReferenceRequestHandler)handler).getResourceReference() instanceof PackageResourceReference)
-			{
-				return;
-			}
-		}
-
-		if (conversation.isTransient())
-		{
-			return;
-		}
-
-		if (propagation.propagatesViaParameters(handler))
-		{
-			logger.debug("Propagating non-transient conversation {} via url", conversation.getId());
-			url.setQueryParameter(CID, conversation.getId());
-			markPageWithConversationId(handler, conversation.getId());
-		}
-	}
-
-	@Override
-	public void onDetach(RequestCycle cycle)
-	{
-		if (!Boolean.TRUE.equals(cycle.getMetaData(CONVERSATION_STARTED_KEY)))
-		{
-			return;
-		}
-
-		logger.debug("Deactivating conversation {}", conversation.getId());
-		for (IRequestCycleListener listener : application.getRequestCycleListeners())
-		{
-			if (listener instanceof ICdiAwareRequestCycleListener)
-			{
-				((ICdiAwareRequestCycleListener)listener).onBeforeConversationDeactivated(cycle);
-			}
-		}
-	}
-
-	/**
-	 * Determines whether or not a conversation should be activated fro the
-	 * specified handler. This method is used to filter out conversation
-	 * activation for utility handlers such as the
-	 * {@link BufferedResponseRequestHandler}
-	 * 
-	 * @param handler
-	 * @return {@code true} iff a conversation should be activated
-	 */
-	protected boolean activateForHandler(IRequestHandler handler)
-	{
-		if (handler != null)
-		{
-			if (handler instanceof BufferedResponseRequestHandler)
-			{
-				// we do not care about pages that are being rendered from a
-				// buffer
-				return false;
-			}
-		}
-		return true;
-	}
-
-	protected void autoBeginIfNecessary(Page page, IRequestHandler handler,
-			Conversation conversation)
-	{
-		if (conversation == null || !conversation.isTransient() || page == null
-				|| !hasConversationalComponent(page))
-		{
-			return;
-		}
-
-		// auto activate conversation
-
-		conversation.begin();
-		autoConversation.setAutomatic(true);
-
-		logger.debug("Auto-began conversation {} for page {}", conversation.getId(), page);
-	}
-
-	protected void autoEndIfNecessary(Page page, IRequestHandler handler, Conversation conversation)
-	{
-		if (conversation == null || conversation.isTransient() || page == null
-				|| hasConversationalComponent(page) || autoConversation.isAutomatic() == false)
-		{
-			return;
-		}
-
-		// auto de-activate conversation
-
-		String cid = conversation.getId();
-
-		autoConversation.setAutomatic(false);
-		conversation.end();
-
-		logger.debug("Auto-ended conversation {} for page {}", cid, page);
-	}
-
-
-	protected boolean hasConversationalComponent(Page page)
-	{
-		Boolean hasConversational = Visits.visit(page, new IVisitor<Component, Boolean>()
-		{
-			@Override
-			public void component(Component object, IVisit<Boolean> visit)
-			{
-				if (object instanceof ConversationalComponent)
-				{
-					visit.stop(true);
-				}
-			}
-		});
-
-		return hasConversational == null ? false : hasConversational;
-	}
-
-	public static void markPageWithConversationId(IRequestHandler handler, String cid)
-	{
-		Page page = getPage(handler);
-		if (page != null)
-		{
-			page.setMetaData(CONVERSATION_ID_KEY, cid);
-		}
-	}
-
-	public static String getConversationIdFromPage(Page page)
-	{
-		return page.getMetaData(CONVERSATION_ID_KEY);
-	}
-
-	/**
-	 * Resolves a page instance from the request handler iff the page instance
-	 * is already created
-	 * 
-	 * @param handler
-	 * @return page or {@code null} if none
-	 */
-	public static Page getPage(IRequestHandler handler)
-	{
-		while (handler instanceof IRequestHandlerDelegate)
-		{
-			handler = ((IRequestHandlerDelegate)handler).getDelegateHandler();
-		}
-
-		if (handler instanceof IPageRequestHandler)
-		{
-			IPageRequestHandler pageHandler = (IPageRequestHandler)handler;
-			if (pageHandler.isPageInstanceCreated())
-			{
-				return (Page)pageHandler.getPage();
-			}
-		}
-		return null;
-	}
-
-	/**
-	 * Resolves page parameters from a request handler
-	 * 
-	 * @param handler
-	 * @return page parameters or {@code null} if none
-	 */
-	protected PageParameters getPageParameters(IRequestHandler handler)
-	{
-		if (handler instanceof IPageClassRequestHandler)
-		{
-			IPageClassRequestHandler pageHandler = (IPageClassRequestHandler)handler;
-			return pageHandler.getPageParameters();
-		}
-		return null;
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java
deleted file mode 100644
index e041a87..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java
+++ /dev/null
@@ -1,30 +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.wicket.cdi;
-
-/**
- * Marks a component that requires a conversation. This marker is used by the automatic conversation
- * management feature ({@link CdiConfiguration#setAutoConversationManagement(boolean)}) to
- * automatically begin and end conversations based on the presence of these components in the
- * component hierarchy of pages (can be applied to the page itself).
- * 
- * @author igor
- */
-public interface ConversationalComponent
-{
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEvent.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEvent.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEvent.java
deleted file mode 100644
index ac99ec3..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEvent.java
+++ /dev/null
@@ -1,28 +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.wicket.cdi;
-
-/**
- * Fired when request cycle is detached
- * 
- * @author igor
- * 
- */
-public class DetachEvent
-{
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
deleted file mode 100644
index 601b155..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
+++ /dev/null
@@ -1,75 +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.wicket.cdi;
-
-import javax.enterprise.event.Event;
-import javax.inject.Inject;
-
-import org.apache.wicket.MetaDataKey;
-import org.apache.wicket.request.IRequestHandler;
-import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Request cycle listener that fires the {@link DetachEvent} event
- * 
- * @author igor
- * 
- */
-public class DetachEventEmitter extends AbstractRequestCycleListener
-{
-	private static final Logger logger = LoggerFactory.getLogger(DetachEventEmitter.class);
-
-	private static final MetaDataKey<Boolean> DETACH_SCHEDULED_KEY = new MetaDataKey<Boolean>()
-	{
-		private static final long serialVersionUID = 1L;
-	};
-
-	@Inject
-	Event<DetachEvent> detachEvent;
-
-	/**
-	 * Constructor
-	 */
-	public DetachEventEmitter()
-	{
-		NonContextual.of(DetachEventEmitter.class).postConstruct(this);
-	}
-
-	@Override
-	public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
-	{
-		// this is a wicket request, schedule detach event to be fired
-
-		cycle.setMetaData(DETACH_SCHEDULED_KEY, true);
-	}
-
-	@Override
-	public void onDetach(RequestCycle cycle)
-	{
-		if (Boolean.TRUE.equals(cycle.getMetaData(DETACH_SCHEDULED_KEY)))
-		{
-			logger.debug("Firing Detach event {}", cycle.getRequest().getUrl());
-
-			detachEvent.fire(new DetachEvent());
-
-			cycle.setMetaData(DETACH_SCHEDULED_KEY, null);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
deleted file mode 100644
index d3ded47..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
+++ /dev/null
@@ -1,39 +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.wicket.cdi;
-
-import org.apache.wicket.request.cycle.IRequestCycleListener;
-import org.apache.wicket.request.cycle.RequestCycle;
-
-public interface ICdiAwareRequestCycleListener extends IRequestCycleListener
-{
-	/**
-	 * Called right after a conversation context for this request is activated
-	 * 
-	 * @param cycle
-	 *            request cycle
-	 */
-	void onAfterConversationActivated(RequestCycle cycle);
-
-	/**
-	 * Called right before the current conversation context is deactivated
-	 * 
-	 * @param cycle
-	 *            request cycle
-	 */
-	void onBeforeConversationDeactivated(RequestCycle cycle);
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
deleted file mode 100644
index 09e39a9..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
+++ /dev/null
@@ -1,38 +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.wicket.cdi;
-
-import org.apache.wicket.request.IRequestHandler;
-
-/**
- * A strategy that specifies how conversations should be propagated between pages/resources.
- * {@link ConversationPropagation} provides sensible default implementations of this interface.
- * 
- * @author papegaaij
- */
-public interface IConversationPropagation
-{
-	/**
-	 * Indicates if the conversation should be propagated via url-parameters for the given request
-	 * handler. This can either be a get parameter in a rendered url, or via page parameters.
-	 * 
-	 * @param handler
-	 *            The current request handler
-	 * @return true if the conversation should be propagated for the given request handler.
-	 */
-	public boolean propagatesViaParameters(IRequestHandler handler);
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextual.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextual.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextual.java
deleted file mode 100644
index 4dea0ac..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/NonContextual.java
+++ /dev/null
@@ -1,154 +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.wicket.cdi;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionTarget;
-
-import org.apache.wicket.util.collections.ClassMetaCache;
-
-/**
- * Manages lifecycle of non-contextual (non-CDI-managed) objects
- * 
- * @param <T>
- * @author igor
- */
-public class NonContextual<T>
-{
-	private static final Object lock = new Object();
-	private static volatile Map<BeanManager, ClassMetaCache<NonContextual<?>>> cache = Collections
-			.emptyMap();
-
-	final InjectionTarget<T> it;
-
-	/**
-	 * Undeploys specified bean manager from cache
-	 * 
-	 * @param beanManager
-	 */
-	public static void undeploy()
-	{
-		if (cache.containsKey(BeanManagerLookup.lookup()))
-		{
-			synchronized (lock)
-			{
-				// copy-on-write the cache
-				Map<BeanManager, ClassMetaCache<NonContextual<?>>> newCache = new WeakHashMap<BeanManager, ClassMetaCache<NonContextual<?>>>(
-						cache);
-				newCache.remove(BeanManagerLookup.lookup());
-				cache = Collections.unmodifiableMap(newCache);
-			}
-		}
-	}
-
-	/**
-	 * Factory method for creating noncontextual instances
-	 * 
-	 * @param <T>
-	 * @param clazz
-	 * @param manager
-	 * @return
-	 */
-	public static <T> NonContextual<T> of(Class<? extends T> clazz)
-	{
-		ClassMetaCache<NonContextual<?>> meta = getCache();
-
-		@SuppressWarnings("unchecked")
-		NonContextual<T> nc = (NonContextual<T>)meta.get(clazz);
-
-		if (nc == null)
-		{
-			nc = new NonContextual<T>(clazz);
-			meta.put(clazz, nc);
-		}
-		return nc;
-	}
-
-	private static ClassMetaCache<NonContextual<?>> getCache()
-	{
-		ClassMetaCache<NonContextual<?>> meta = cache.get(BeanManagerLookup.lookup());
-		if (meta == null)
-		{
-			synchronized (lock)
-			{
-				BeanManager manager = BeanManagerLookup.lookup();
-				meta = cache.get(manager);
-				if (meta == null)
-				{
-					meta = new ClassMetaCache<NonContextual<?>>();
-
-					// copy-on-write the cache
-					Map<BeanManager, ClassMetaCache<NonContextual<?>>> newCache = new WeakHashMap<BeanManager, ClassMetaCache<NonContextual<?>>>(
-							cache);
-					newCache.put(manager, meta);
-					cache = Collections.unmodifiableMap(newCache);
-				}
-			}
-		}
-		return meta;
-	}
-
-	@SuppressWarnings("unchecked")
-	private NonContextual(Class<? extends T> clazz)
-	{
-		BeanManager manager = BeanManagerLookup.lookup();
-		AnnotatedType<? extends T> type = manager.createAnnotatedType(clazz);
-		this.it = (InjectionTarget<T>)manager.createInjectionTarget(type);
-	}
-
-	/**
-	 * Injects the instance and calls any {@link PostConstruct} methods
-	 * 
-	 * @param instance
-	 */
-	public void postConstruct(T instance)
-	{
-		CreationalContext<T> cc = BeanManagerLookup.lookup().createCreationalContext(null);
-		it.inject(instance, cc);
-		it.postConstruct(instance);
-	}
-
-	/**
-	 * Injects the instance
-	 * 
-	 * @param instance
-	 */
-	public void inject(T instance)
-	{
-		CreationalContext<T> cc = BeanManagerLookup.lookup().createCreationalContext(null);
-		it.inject(instance, cc);
-	}
-
-	/**
-	 * Calls any {@link PreDestroy} methods and destroys any injected
-	 * dependencies that need to be destroyed.
-	 * 
-	 * @param instance
-	 */
-	public void preDestroy(T instance)
-	{
-		it.preDestroy(instance);
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/SessionInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/SessionInjector.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/SessionInjector.java
deleted file mode 100644
index a6fb4d2..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/java/org/apache/wicket/cdi/SessionInjector.java
+++ /dev/null
@@ -1,42 +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.wicket.cdi;
-
-import org.apache.wicket.ISessionListener;
-import org.apache.wicket.Session;
-
-/**
- * Injects components with CDI dependencies
- * 
- * @author igor
- * 
- */
-class SessionInjector extends AbstractInjector implements ISessionListener
-{
-	/**
-	 * Constructor
-	 */
-	public SessionInjector()
-	{
-	}
-
-	@Override
-	public void onCreated(Session session)
-	{
-		postConstruct(session);
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/resources/META-INF/beans.xml b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/resources/META-INF/beans.xml
deleted file mode 100644
index 6a2f1ec..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/main/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
-	version="1.1" bean-discovery-mode="annotated" />
\ No newline at end of file


[3/5] moved wicket-cdi from core into parent

Posted by pa...@apache.org.
http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/WicketTestCase.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/WicketTestCase.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/WicketTestCase.java
deleted file mode 100644
index eaed456..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/WicketTestCase.java
+++ /dev/null
@@ -1,161 +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.wicket;
-
-import org.apache.wicket.behavior.AbstractAjaxBehavior;
-import org.apache.wicket.mock.MockApplication;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.util.tester.WicketTester;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-
-/**
- * Base class for tests which require comparing wicket response with a file.
- * <p>
- * To create/replace the expected result file with the new content, define the system property like
- * -Dwicket.replace.expected.results=true
- */
-public abstract class WicketTestCase extends Assert
-{
-	/** */
-	protected WicketTester tester;
-
-	/**
-	 * @see junit.framework.TestCase#setUp()
-	 */
-	@Before
-	public void commonBefore()
-	{
-		// make sure no leaked threadlocals are present
-		ThreadContext.detach();
-
-		WebApplication application = newApplication();
-		tester = newWicketTester(application);
-	}
-
-	/**
-	 * @return the application that should be used for the test
-	 */
-	protected WebApplication newApplication()
-	{
-		return new MockApplication();
-	}
-
-	/**
-	 * In case you need to subclass WicketTester and want to be independent on possible changes in
-	 * setUp().
-	 * 
-	 * @param app
-	 * @return WIcketTester
-	 */
-	protected WicketTester newWicketTester(final WebApplication app)
-	{
-		return new WicketTester(app);
-	}
-
-	/**
-	 * 
-	 */
-	@After
-	public void commonAfter()
-	{
-		tester.destroy();
-	}
-
-	/**
-	 * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected
-	 * output file.
-	 * 
-	 * @param <T>
-	 * 
-	 * @param pageClass
-	 * @param filename
-	 * @throws Exception
-	 */
-	protected <T extends Page> void executeTest(final Class<T> pageClass, final String filename)
-		throws Exception
-	{
-		tester.executeTest(getClass(), pageClass, filename);
-	}
-
-	/**
-	 * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected
-	 * output file.
-	 * 
-	 * @param page
-	 * @param filename
-	 * @throws Exception
-	 */
-	protected void executeTest(final Page page, final String filename) throws Exception
-	{
-		tester.executeTest(getClass(), page, filename);
-	}
-
-	/**
-	 * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected
-	 * output file.
-	 * 
-	 * @param <T>
-	 * 
-	 * @param pageClass
-	 * @param parameters
-	 * @param filename
-	 * @throws Exception
-	 */
-	protected <T extends Page> void executeTest(final Class<T> pageClass,
-		PageParameters parameters, final String filename) throws Exception
-	{
-		tester.executeTest(getClass(), pageClass, parameters, filename);
-	}
-
-	/**
-	 * 
-	 * @param component
-	 * @param filename
-	 * @throws Exception
-	 */
-	protected void executeListener(final Component component, final String filename)
-		throws Exception
-	{
-		tester.executeListener(getClass(), component, filename);
-	}
-
-	/**
-	 * 
-	 * @param behavior
-	 * @param filename
-	 * @throws Exception
-	 */
-	protected void executeBehavior(final AbstractAjaxBehavior behavior, final String filename)
-		throws Exception
-	{
-		tester.executeBehavior(getClass(), behavior, filename);
-	}
-
-	/**
-	 * Returns the current Maven build directory taken from the <tt>basedir</tt> system property, or
-	 * null if not set
-	 * 
-	 * @return path with a trailing slash
-	 */
-	public String getBasedir()
-	{
-		return WicketTester.getBasedir();
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java
deleted file mode 100644
index e612055..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java
+++ /dev/null
@@ -1,41 +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.wicket.cdi;
-
-import java.util.Arrays;
-
-import org.apache.wicket.util.license.ApacheLicenseHeaderTestCase;
-
-/**
- * Test that the license headers are in place in this project. The tests are run
- * from {@link ApacheLicenseHeaderTestCase}, but you can add project specific
- * tests here if needed.
- * 
- * @author Frank Bille Jensen (frankbille)
- */
-public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase
-{
-	/**
-	 * Construct.
-	 */
-	public ApacheLicenceHeaderTest()
-	{
-		xmlIgnore.add(".settings");
-		xmlIgnore.add("src/main/resources/META-INF/beans.xml");
-		xmlPrologIgnore = Arrays.asList("src");
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
deleted file mode 100644
index 7e89c10..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
+++ /dev/null
@@ -1,68 +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.wicket.cdi;
-
-import org.apache.wicket.cdi.testapp.TestConversationPage;
-import org.apache.wicket.cdi.testapp.TestPage;
-import org.apache.wicket.util.tester.WicketTester;
-import org.junit.Test;
-
-/**
- * @author jsarman
- */
-public class CdiConfigurationTest extends WicketCdiTestCase
-{
-	@Test
-	public void testApplicationScope()
-	{
-		configure(new CdiConfiguration());
-		tester.startPage(TestPage.class);
-		tester.assertLabel("appscope", "Test ok");
-	}
-
-	@Test
-	public void testConversationScope()
-	{
-		configure(new CdiConfiguration());
-		tester.startPage(TestConversationPage.class);
-		for (int i = 0; i < 20; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-	}
-
-	@Test(expected = Exception.class)
-	public void testConfigureTwice()
-	{
-		configure(new CdiConfiguration());
-		new CdiConfiguration().configure(tester.getApplication());
-	}
-
-	@Test
-	public void testApplicationLevelConfiguration()
-	{
-		WicketTester tester = new WicketTester();
-		CdiConfiguration config = new CdiConfiguration();
-		for (ConversationPropagation cp : ConversationPropagation.values())
-		{
-			config.setPropagation(cp);
-			assertEquals(cp, config.getPropagation());
-		}
-		config.configure(tester.getApplication());
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
deleted file mode 100644
index d827b11..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
+++ /dev/null
@@ -1,199 +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.wicket.cdi;
-
-import org.apache.wicket.cdi.testapp.TestConversationPage;
-import org.apache.wicket.cdi.testapp.TestConversationalPage;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * @author jsarman
- */
-public class ConversationPropagatorTest extends WicketCdiTestCase
-{
-	@Test
-	@Ignore("Testcase and auto conversations do not match")
-	public void testAutoConversationNonBookmarkable()
-	{
-		configure(new CdiConfiguration());
-
-		tester.startPage(TestConversationalPage.class);
-		int i;
-		for (i = 0; i < 3; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-		tester.clickLink("next");
-		// at this point counter = 3, auto conversation is still enabled and
-		// remains enabled, because TestConversationalPage is part of this
-		// request
-		for (; i < 6; i++)
-		{
-			// first iteration: i == 3, counter == 3, conversation active
-			// second iteration: i == 4, counter == 4, conversation transient
-			// third iteration: i == 5, counter == 1: FAIL
-			tester.assertLabel("count", i + "");
-
-			// first iteration: conversation is still long-running, counter is
-			// incremented, after which auto conversation is disabled and the
-			// conversation ended
-
-			// second iteration: transient conversation, counter starts at 1,
-			// conversation remains transient
-			tester.clickLink("increment");
-
-		}
-
-	}
-
-	@Test
-	@Ignore("Testcase and auto conversations do not match")
-	public void testAutoConversationBookmarkable()
-	{
-		configure(new CdiConfiguration());
-
-		tester.startPage(TestConversationalPage.class,
-				new PageParameters().add("pageType", "bookmarkable"));
-
-		int i;
-		for (i = 0; i < 3; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-		tester.clickLink("next");
-		// The conversation should auto end and not create another one
-		// so the next page just keeps getting 1 because the conversationscoped
-		// bean
-		// doesnt persist across requests.
-		for (i = 0; i < 3; i++)
-		{
-			tester.clickLink("increment");
-			tester.assertLabel("count", 1 + "");
-		}
-	}
-
-	@Test
-	public void testPropagationAllNonBookmarkable()
-	{
-		configure(new CdiConfiguration().setPropagation(ConversationPropagation.ALL));
-
-		tester.startPage(TestConversationPage.class);
-		int i;
-		for (i = 0; i < 3; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-		tester.clickLink("next");
-		for (; i < 6; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-
-	}
-
-	@Test
-	public void testPropagationAllBookmarkable()
-	{
-		configure(new CdiConfiguration().setPropagation(ConversationPropagation.ALL));
-
-		tester.startPage(TestConversationPage.class,
-				new PageParameters().add("pageType", "bookmarkable"));
-		int i;
-		for (i = 0; i < 3; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-		tester.clickLink("next");
-		for (; i < 6; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-
-	}
-
-	@Test
-	public void testPropagationNone()
-	{
-		configure(new CdiConfiguration().setPropagation(ConversationPropagation.NONE));
-
-		tester.startPage(TestConversationPage.class);
-		int i;
-		for (i = 0; i < 3; i++)
-		{
-			tester.clickLink("increment");
-			tester.assertLabel("count", "1");
-		}
-		tester.clickLink("next");
-		for (; i < 6; i++)
-		{
-			tester.clickLink("increment");
-			tester.assertLabel("count", "1");
-		}
-
-	}
-
-	@Test
-	@Ignore("Testcase and auto conversations do not match")
-	public void testGlobalAutoSettingNonBookmarkable()
-	{
-		configure(new CdiConfiguration());
-
-		tester.startPage(TestConversationPage.class, new PageParameters().add("auto", true));
-		int i;
-		for (i = 0; i < 3; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-		tester.clickLink("next");
-		for (; i < 6; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-	}
-
-	@Test
-	@Ignore("Testcase and auto conversations do not match")
-	public void testGlobalAutoSettingBookmarkable()
-	{
-		configure(new CdiConfiguration());
-
-		tester.startPage(TestConversationPage.class,
-				new PageParameters().add("auto", true).add("pageType", "bookmarkable"));
-		int i;
-		for (i = 0; i < 3; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-		tester.clickLink("next");
-		for (i = 0; i < 3; i++)
-		{
-			tester.assertLabel("count", i + "");
-			tester.clickLink("increment");
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
deleted file mode 100644
index ef862c6..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
+++ /dev/null
@@ -1,67 +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.wicket.cdi;
-
-import javax.inject.Inject;
-
-import org.apache.wicket.WicketTestCase;
-import org.apache.wicket.cdi.testapp.TestAppScope;
-import org.apache.wicket.cdi.testapp.TestCdiApplication;
-import org.apache.wicket.cdi.testapp.TestConversationBean;
-import org.apache.wicket.cdi.util.tester.CdiWicketTester;
-import org.apache.wicket.cdi.util.tester.ContextManager;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.util.tester.WicketTester;
-import org.jglue.cdiunit.AdditionalClasses;
-import org.jglue.cdiunit.CdiRunner;
-import org.junit.After;
-import org.junit.runner.RunWith;
-
-/**
- * @author jsarman
- */
-@RunWith(CdiRunner.class)
-@AdditionalClasses({ CdiWicketTester.class, BehaviorInjector.class, CdiConfiguration.class,
-		CdiShutdownCleaner.class, ComponentInjector.class, ConversationExpiryChecker.class,
-		ConversationPropagator.class, DetachEventEmitter.class, SessionInjector.class,
-		TestAppScope.class, TestConversationBean.class, TestCdiApplication.class })
-public abstract class WicketCdiTestCase extends WicketTestCase
-{
-	@Inject
-	private ContextManager contextManager;
-
-	@Override
-	protected WicketTester newWicketTester(WebApplication app)
-	{
-		return new CdiWicketTester(app);
-	}
-
-	public void configure(CdiConfiguration configuration)
-	{
-		configuration.configure(tester.getApplication());
-	}
-
-	@After
-	public void end()
-	{
-		if (contextManager.isRequestActive())
-		{
-			contextManager.deactivateContexts();
-			contextManager.destroy();
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestAppScope.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestAppScope.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestAppScope.java
deleted file mode 100644
index b36f8a7..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestAppScope.java
+++ /dev/null
@@ -1,40 +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.wicket.cdi.testapp;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Produces;
-
-/**
- * @author jsarman
- */
-@ApplicationScoped
-public class TestAppScope
-{
-
-	public String test()
-	{
-		return "Test ok";
-	}
-
-	public @Produces
-	@TestQualifier
-	String testString()
-	{
-		return "Test String";
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
deleted file mode 100644
index 7b82203..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
+++ /dev/null
@@ -1,39 +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.wicket.cdi.testapp;
-
-import org.apache.wicket.Page;
-import org.apache.wicket.protocol.http.WebApplication;
-
-/**
- * @author jsarman
- */
-public class TestApplication extends WebApplication
-{
-
-	@Override
-	public Class<? extends Page> getHomePage()
-	{
-		return TestPage.class;
-	}
-
-	@Override
-	protected void init()
-	{
-		super.init();
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
deleted file mode 100644
index 1bd8656..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
+++ /dev/null
@@ -1,54 +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.wicket.cdi.testapp;
-
-import javax.inject.Inject;
-
-import org.apache.wicket.Page;
-import org.apache.wicket.cdi.CdiConfiguration;
-import org.apache.wicket.protocol.http.WebApplication;
-
-/**
- * @author jsarman
- */
-public class TestCdiApplication extends WebApplication
-{
-
-	@Inject
-	@TestQualifier
-	String testString;
-
-
-	@Override
-	public Class<? extends Page> getHomePage()
-	{
-		return TestPage.class;
-	}
-
-	@Override
-	protected void init()
-	{
-		super.init();
-		new CdiConfiguration().configure(this);
-	}
-
-	public String getInjectedTestString()
-	{
-		return testString;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java
deleted file mode 100644
index ef61441..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java
+++ /dev/null
@@ -1,51 +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.wicket.cdi.testapp;
-
-import java.io.Serializable;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.enterprise.context.ConversationScoped;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author jsarman
- */
-@ConversationScoped
-public class TestConversationBean implements Serializable
-{
-	private static final long serialVersionUID = 1L;
-
-	private static final Logger logger = LoggerFactory.getLogger(TestConversationBean.class);
-
-	private AtomicInteger counter = new AtomicInteger();
-
-	public int getCount()
-	{
-		logger.debug("Count = {}", counter.get());
-		return counter.get();
-	}
-
-	public void increment()
-	{
-
-		counter.incrementAndGet();
-
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
deleted file mode 100644
index e7f3de7..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket>
-<head>
-    <title></title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-</head>
-<body>
-<span wicket:id="count">100</span>
-<a wicket:id="increment">increment</a>
-<a wicket:id="next">Reset</a>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
deleted file mode 100644
index cb0138d..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
+++ /dev/null
@@ -1,89 +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.wicket.cdi.testapp;
-
-import java.util.Random;
-
-import javax.enterprise.context.Conversation;
-import javax.inject.Inject;
-
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-
-/**
- * @author jsarman
- */
-public class TestConversationPage extends WebPage
-{
-	private static final long serialVersionUID = 1L;
-
-	@Inject
-	Conversation conversation;
-
-	@Inject
-	TestConversationBean counter;
-
-	Random random = new Random();
-
-	public TestConversationPage()
-	{
-		this(new PageParameters());
-	}
-
-	public TestConversationPage(final PageParameters parameters)
-	{
-		super(parameters);
-
-		if (!parameters.get("auto").toBoolean())
-		{
-			conversation.begin();
-
-			System.out.println("Opened Conversion with id = " + conversation.getId());
-		}
-		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
-
-		add(new Link<Void>("increment")
-		{
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			public void onClick()
-			{
-				counter.increment();
-			}
-		});
-		add(new Link<Void>("next")
-		{
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			public void onClick()
-			{
-				String pageType = parameters.get("pageType").toString("nonbookmarkable");
-				if ("bookmarkable".equals(pageType.toLowerCase()))
-					setResponsePage(TestNonConversationalPage.class);
-				else
-					setResponsePage(new TestNonConversationalPage());
-			}
-		});
-
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
deleted file mode 100644
index b3550f1..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket>
-<head>
-    <title></title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-</head>
-<body>
-<span wicket:id="count">100</span>
-<a wicket:id="increment">increment</a>
-<a wicket:id="next">next</a>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java
deleted file mode 100644
index a106936..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationalPage.java
+++ /dev/null
@@ -1,82 +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.wicket.cdi.testapp;
-
-import java.util.Random;
-
-import javax.inject.Inject;
-
-import org.apache.wicket.cdi.ConversationalComponent;
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author jsarman
- */
-public class TestConversationalPage extends WebPage implements ConversationalComponent
-{
-	private static final long serialVersionUID = 1L;
-
-	private static final Logger logger = LoggerFactory.getLogger(TestConversationPage.class);
-	@Inject
-	TestConversationBean counter;
-
-	Random random = new Random();
-
-	public TestConversationalPage()
-	{
-		this(new PageParameters());
-	}
-
-
-	public TestConversationalPage(final PageParameters pp)
-	{
-		logger.debug("Starting TestConversationalPage");
-
-		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
-
-		add(new Link<Void>("increment")
-		{
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			public void onClick()
-			{
-				counter.increment();
-			}
-		});
-		add(new Link<Void>("next")
-		{
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			public void onClick()
-			{
-				String pageType = pp.get("pageType").toString("nonbookmarkable");
-				if ("bookmarkable".equals(pageType.toLowerCase()))
-					setResponsePage(TestNonConversationalPage.class);
-				else
-					setResponsePage(new TestNonConversationalPage());
-			}
-		});
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
deleted file mode 100644
index b3550f1..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket>
-<head>
-    <title></title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-</head>
-<body>
-<span wicket:id="count">100</span>
-<a wicket:id="increment">increment</a>
-<a wicket:id="next">next</a>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java
deleted file mode 100644
index 2a78914..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonAutoConversationalPage.java
+++ /dev/null
@@ -1,88 +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.wicket.cdi.testapp;
-
-import java.util.Random;
-
-import javax.enterprise.context.Conversation;
-import javax.inject.Inject;
-
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author jsarman
- */
-public class TestNonAutoConversationalPage extends WebPage
-{
-	private static final long serialVersionUID = 1L;
-	private static final Logger logger = LoggerFactory.getLogger(TestConversationPage.class);
-	@Inject
-	TestConversationBean counter;
-
-	@Inject
-	Conversation conversation;
-
-	Random random = new Random();
-
-	public TestNonAutoConversationalPage()
-	{
-		this(new PageParameters());
-	}
-
-
-	public TestNonAutoConversationalPage(final PageParameters pp)
-	{
-		if (pp.get("startConveration").toBoolean(true))
-		{
-			conversation.begin();
-		}
-		logger.debug("Starting TestConversationalPage");
-
-		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
-
-		add(new Link<Void>("increment")
-		{
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			public void onClick()
-			{
-				counter.increment();
-			}
-		});
-		add(new Link<Void>("next")
-		{
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			public void onClick()
-			{
-				String pageType = pp.get("pageType").toString("nonbookmarkable");
-				if ("bookmarkable".equals(pageType.toLowerCase()))
-					setResponsePage(TestNonConversationalPage.class);
-				else
-					setResponsePage(new TestNonConversationalPage());
-			}
-		});
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
deleted file mode 100644
index fd58f2d..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket>
-<head>
-    <title></title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-</head>
-<body>
-<span wicket:id="count">100</span>
-<a wicket:id="increment">increment</a>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java
deleted file mode 100644
index 8af7bac..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestNonConversationalPage.java
+++ /dev/null
@@ -1,59 +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.wicket.cdi.testapp;
-
-import java.util.Random;
-
-import javax.inject.Inject;
-
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.model.PropertyModel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @author jsarman
- */
-public class TestNonConversationalPage extends WebPage
-{
-	private static final long serialVersionUID = 1L;
-	private static final Logger logger = LoggerFactory.getLogger(TestConversationPage.class);
-	@Inject
-	TestConversationBean counter;
-
-	Random random = new Random();
-
-	public TestNonConversationalPage()
-	{
-		logger.debug("Starting TestConversationalPage");
-		add(new Label("count", new PropertyModel<Integer>(this, "counter.count")));
-
-		add(new Link<Void>("increment")
-		{
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			public void onClick()
-			{
-				counter.increment();
-			}
-		});
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestPage.html b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestPage.html
deleted file mode 100644
index 4689c49..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestPage.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket>
-<head>
-    <title></title>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-</head>
-<body>
-<div wicket:id="appscope">Fail</div>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestPage.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestPage.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestPage.java
deleted file mode 100644
index cf5108b..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestPage.java
+++ /dev/null
@@ -1,40 +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.wicket.cdi.testapp;
-
-import javax.inject.Inject;
-
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.basic.Label;
-
-/**
- * @author jsarman
- */
-public class TestPage extends WebPage
-{
-	private static final long serialVersionUID = 1L;
-
-	@Inject
-	TestAppScope appScope;
-
-	public TestPage()
-	{
-
-		add(new Label("appscope", appScope.test()));
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestQualifier.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestQualifier.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestQualifier.java
deleted file mode 100644
index dcd0289..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestQualifier.java
+++ /dev/null
@@ -1,35 +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.wicket.cdi.testapp;
-
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * @author jsarman
- */
-@Qualifier
-@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface TestQualifier {
-
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
deleted file mode 100644
index 8efd59b..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/CdiWicketTester.java
+++ /dev/null
@@ -1,122 +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.wicket.cdi.util.tester;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-
-import org.apache.wicket.Page;
-import org.apache.wicket.cdi.CdiConfiguration;
-import org.apache.wicket.cdi.ConversationPropagator;
-import org.apache.wicket.cdi.NonContextual;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.protocol.http.mock.MockHttpServletRequest;
-import org.apache.wicket.request.IRequestHandler;
-import org.apache.wicket.request.Url;
-import org.apache.wicket.util.tester.WicketTester;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author jsarman
- */
-public class CdiWicketTester extends WicketTester
-{
-	private static final Logger logger = LoggerFactory.getLogger(CdiWicketTester.class);
-
-	@Inject
-	ContextManager contextManager;
-
-	private AtomicInteger count = new AtomicInteger();
-
-	public CdiWicketTester(WebApplication app)
-	{
-		super(app);
-		NonContextual.of(CdiWicketTester.class).inject(this);
-	}
-
-	/**
-	 * Process the request by first activating the contexts on initial call.
-	 * This call is called recursively in the super class so keep track of the
-	 * topmost call and only activate and deactivate the contexts during that
-	 * time.
-	 * 
-	 * @param forcedRequest
-	 * @param forcedRequestHandler
-	 * @param redirect
-	 * @return
-	 */
-	@Override
-	protected boolean processRequest(final MockHttpServletRequest forcedRequest,
-			final IRequestHandler forcedRequestHandler, final boolean redirect)
-	{
-		if (count.getAndIncrement() == 0)
-		{
-
-			if (getLastRequest() != null)
-			{
-				contextManager.deactivateContexts();
-			}
-			contextManager.activateContexts(forcedRequest == null ? getRequest() : forcedRequest);
-		}
-		try
-		{
-			return super.processRequest(forcedRequest, forcedRequestHandler, redirect);
-		}
-		finally
-		{
-			count.decrementAndGet();
-		}
-	}
-
-	@Override
-	public Url urlFor(IRequestHandler handler)
-	{
-		Url ret = super.urlFor(handler);
-		final CdiConfiguration configuration = CdiConfiguration.get(getApplication());
-		if (configuration.getPropagation().propagatesViaParameters(handler))
-		{
-			Page page = ConversationPropagator.getPage(handler);
-			if (page != null)
-			{
-				String cid = ConversationPropagator.getConversationIdFromPage(page);
-				ret.addQueryParameter(ConversationPropagator.CID, cid);
-			}
-		}
-		return ret;
-	}
-
-	@PreDestroy
-	public void finish()
-	{
-		try
-		{
-			logger.debug("Destroying Cdi Wicket Tester");
-			if (getLastRequest() != null)
-			{
-				contextManager.deactivateContexts();
-			}
-			contextManager.destroy();
-			destroy();
-		}
-		catch (Throwable t)
-		{
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java
deleted file mode 100644
index fb9eeb1..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/util/tester/ContextManager.java
+++ /dev/null
@@ -1,105 +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.wicket.cdi.util.tester;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-import org.jboss.weld.bean.builtin.BeanManagerProxy;
-import org.jboss.weld.servlet.HttpContextLifecycle;
-import org.jboss.weld.servlet.spi.helpers.AcceptingHttpContextActivationFilter;
-import org.jglue.cdiunit.internal.LifecycleAwareRequest;
-
-/**
- * @author jsarman
- */
-@ApplicationScoped
-public class ContextManager
-{
-	private HttpServletRequest currentRequest;
-
-	@Inject
-	private BeanManager beanManager;
-
-	private HttpContextLifecycle lifecycle;
-
-	private HttpSession currentSession;
-
-	@PostConstruct
-	public void setup()
-	{
-		try
-		{
-			lifecycle = new HttpContextLifecycle(BeanManagerProxy.unwrap(beanManager),
-					AcceptingHttpContextActivationFilter.INSTANCE, true, true);
-		}
-		catch (NoSuchMethodError e)
-		{
-			try
-			{
-				lifecycle = HttpContextLifecycle.class.getConstructor(BeanManager.class,
-						AcceptingHttpContextActivationFilter.class).newInstance(
-						BeanManagerProxy.unwrap(beanManager),
-						AcceptingHttpContextActivationFilter.INSTANCE);
-			}
-			catch (Exception e1)
-			{
-				throw new RuntimeException(e1);
-			}
-		}
-		lifecycle.setConversationActivationEnabled(true);
-	}
-
-	public void activateContexts(HttpServletRequest request)
-	{
-		if (currentRequest != null)
-			return;
-
-		currentRequest = new LifecycleAwareRequest(lifecycle, request, currentSession);
-		lifecycle.requestInitialized(currentRequest, null);
-	}
-
-	public void deactivateContexts()
-	{
-		lifecycle.requestDestroyed(currentRequest);
-		currentSession = currentRequest.getSession(false);
-		currentRequest = null;
-	}
-
-	public void destroy()
-	{
-		if (currentRequest != null)
-		{
-			currentSession = currentRequest.getSession(false);
-		}
-
-		if (currentSession != null)
-		{
-			lifecycle.sessionDestroyed(currentSession);
-			currentSession = null;
-		}
-	}
-
-	public boolean isRequestActive()
-	{
-		return currentRequest != null;
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/simplelogger.properties
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/simplelogger.properties b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/simplelogger.properties
deleted file mode 100644
index 17c5fe6..0000000
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/simplelogger.properties
+++ /dev/null
@@ -1 +0,0 @@
-org.slf4j.simpleLogger.log.org.apache.wicket.cdi=info
\ No newline at end of file


[5/5] git commit: moved wicket-cdi from core into parent

Posted by pa...@apache.org.
moved wicket-cdi from core into parent


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/ecf2c9fe
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/ecf2c9fe
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/ecf2c9fe

Branch: refs/heads/wicket-cdi-1.1-rewrite
Commit: ecf2c9fe26f2b814f7369054badc2f8515ce8508
Parents: 1593018
Author: Emond Papegaaij <em...@topicus.nl>
Authored: Tue Nov 19 17:56:42 2013 +0100
Committer: Emond Papegaaij <em...@topicus.nl>
Committed: Tue Nov 19 17:58:11 2013 +0100

----------------------------------------------------------------------
 wicket-experimental/wicket-cdi-1.1/pom.xml      |  34 +-
 .../org/apache/wicket/cdi/AbstractInjector.java |  39 +++
 .../org/apache/wicket/cdi/AutoConversation.java |  51 +++
 .../apache/wicket/cdi/BeanManagerLookup.java    |  40 +++
 .../org/apache/wicket/cdi/BehaviorInjector.java |  42 +++
 .../org/apache/wicket/cdi/CdiConfiguration.java | 101 ++++++
 .../apache/wicket/cdi/CdiShutdownCleaner.java   |  45 +++
 .../apache/wicket/cdi/ComponentInjector.java    |  43 +++
 .../cdi/ConversationExpiredException.java       |  52 +++
 .../wicket/cdi/ConversationExpiryChecker.java   |  68 ++++
 .../wicket/cdi/ConversationPropagation.java     |  69 ++++
 .../wicket/cdi/ConversationPropagator.java      | 347 +++++++++++++++++++
 .../wicket/cdi/ConversationalComponent.java     |  30 ++
 .../java/org/apache/wicket/cdi/DetachEvent.java |  28 ++
 .../apache/wicket/cdi/DetachEventEmitter.java   |  75 ++++
 .../cdi/ICdiAwareRequestCycleListener.java      |  39 +++
 .../wicket/cdi/IConversationPropagation.java    |  38 ++
 .../org/apache/wicket/cdi/NonContextual.java    | 154 ++++++++
 .../org/apache/wicket/cdi/SessionInjector.java  |  42 +++
 .../src/main/resources/META-INF/beans.xml       |   4 +
 .../java/org/apache/wicket/WicketTestCase.java  | 161 +++++++++
 .../wicket/cdi/ApacheLicenceHeaderTest.java     |  41 +++
 .../apache/wicket/cdi/CdiConfigurationTest.java |  68 ++++
 .../wicket/cdi/ConversationPropagatorTest.java  | 199 +++++++++++
 .../apache/wicket/cdi/WicketCdiTestCase.java    |  67 ++++
 .../apache/wicket/cdi/testapp/TestAppScope.java |  40 +++
 .../wicket/cdi/testapp/TestApplication.java     |  39 +++
 .../wicket/cdi/testapp/TestCdiApplication.java  |  54 +++
 .../cdi/testapp/TestConversationBean.java       |  51 +++
 .../cdi/testapp/TestConversationPage.html       |  12 +
 .../cdi/testapp/TestConversationPage.java       |  89 +++++
 .../cdi/testapp/TestConversationalPage.html     |  12 +
 .../cdi/testapp/TestConversationalPage.java     |  82 +++++
 .../testapp/TestNonAutoConversationalPage.html  |  12 +
 .../testapp/TestNonAutoConversationalPage.java  |  88 +++++
 .../cdi/testapp/TestNonConversationalPage.html  |  11 +
 .../cdi/testapp/TestNonConversationalPage.java  |  59 ++++
 .../org/apache/wicket/cdi/testapp/TestPage.html |  10 +
 .../org/apache/wicket/cdi/testapp/TestPage.java |  40 +++
 .../wicket/cdi/testapp/TestQualifier.java       |  35 ++
 .../wicket/cdi/util/tester/CdiWicketTester.java | 122 +++++++
 .../wicket/cdi/util/tester/ContextManager.java  | 105 ++++++
 .../src/test/java/simplelogger.properties       |   1 +
 .../wicket-cdi-1.1/wicket-cdi-1.1-core/pom.xml  |  58 ----
 .../org/apache/wicket/cdi/AbstractInjector.java |  39 ---
 .../org/apache/wicket/cdi/AutoConversation.java |  51 ---
 .../apache/wicket/cdi/BeanManagerLookup.java    |  40 ---
 .../org/apache/wicket/cdi/BehaviorInjector.java |  42 ---
 .../org/apache/wicket/cdi/CdiConfiguration.java | 101 ------
 .../apache/wicket/cdi/CdiShutdownCleaner.java   |  45 ---
 .../apache/wicket/cdi/ComponentInjector.java    |  43 ---
 .../cdi/ConversationExpiredException.java       |  52 ---
 .../wicket/cdi/ConversationExpiryChecker.java   |  68 ----
 .../wicket/cdi/ConversationPropagation.java     |  69 ----
 .../wicket/cdi/ConversationPropagator.java      | 347 -------------------
 .../wicket/cdi/ConversationalComponent.java     |  30 --
 .../java/org/apache/wicket/cdi/DetachEvent.java |  28 --
 .../apache/wicket/cdi/DetachEventEmitter.java   |  75 ----
 .../cdi/ICdiAwareRequestCycleListener.java      |  39 ---
 .../wicket/cdi/IConversationPropagation.java    |  38 --
 .../org/apache/wicket/cdi/NonContextual.java    | 154 --------
 .../org/apache/wicket/cdi/SessionInjector.java  |  42 ---
 .../src/main/resources/META-INF/beans.xml       |   4 -
 .../java/org/apache/wicket/WicketTestCase.java  | 161 ---------
 .../wicket/cdi/ApacheLicenceHeaderTest.java     |  41 ---
 .../apache/wicket/cdi/CdiConfigurationTest.java |  68 ----
 .../wicket/cdi/ConversationPropagatorTest.java  | 199 -----------
 .../apache/wicket/cdi/WicketCdiTestCase.java    |  67 ----
 .../apache/wicket/cdi/testapp/TestAppScope.java |  40 ---
 .../wicket/cdi/testapp/TestApplication.java     |  39 ---
 .../wicket/cdi/testapp/TestCdiApplication.java  |  54 ---
 .../cdi/testapp/TestConversationBean.java       |  51 ---
 .../cdi/testapp/TestConversationPage.html       |  12 -
 .../cdi/testapp/TestConversationPage.java       |  89 -----
 .../cdi/testapp/TestConversationalPage.html     |  12 -
 .../cdi/testapp/TestConversationalPage.java     |  82 -----
 .../testapp/TestNonAutoConversationalPage.html  |  12 -
 .../testapp/TestNonAutoConversationalPage.java  |  88 -----
 .../cdi/testapp/TestNonConversationalPage.html  |  11 -
 .../cdi/testapp/TestNonConversationalPage.java  |  59 ----
 .../org/apache/wicket/cdi/testapp/TestPage.html |  10 -
 .../org/apache/wicket/cdi/testapp/TestPage.java |  40 ---
 .../wicket/cdi/testapp/TestQualifier.java       |  35 --
 .../wicket/cdi/util/tester/CdiWicketTester.java | 122 -------
 .../wicket/cdi/util/tester/ContextManager.java  | 105 ------
 .../src/test/java/simplelogger.properties       |   1 -
 86 files changed, 2734 insertions(+), 2768 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/pom.xml b/wicket-experimental/wicket-cdi-1.1/pom.xml
index ae75c0d..6bc08fb 100644
--- a/wicket-experimental/wicket-cdi-1.1/pom.xml
+++ b/wicket-experimental/wicket-cdi-1.1/pom.xml
@@ -24,11 +24,35 @@
 		<relativePath>../pom.xml</relativePath>
 	</parent>
 	<artifactId>wicket-cdi-1.1</artifactId>
+	<packaging>jar</packaging>
 	<version>0.2-SNAPSHOT</version>
-	<packaging>pom</packaging>
 	<name>Wicket CDI 1.1</name>
-	<description>Wicket CDI 1.1 Parent.</description>
-	<modules>
-		<module>wicket-cdi-1.1-core</module>
-	</modules>
+	<description>
+		Provides integration between Wicket and CDI containers. Enables injection of
+		components and behaviors, as well as other non-contextual object instances.
+		Also enables propagation of conversations between wicket artifacts such as pages
+		and resources.
+	</description>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.wicket</groupId>
+			<artifactId>wicket-core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>javax.enterprise</groupId>
+			<artifactId>cdi-api</artifactId>
+			<version>1.1</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.jglue.cdi-unit</groupId>
+			<artifactId>cdi-unit</artifactId>
+			<version>2.2.1</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/AbstractInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/AbstractInjector.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/AbstractInjector.java
new file mode 100644
index 0000000..c6c38b6
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/AbstractInjector.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.wicket.cdi;
+
+/**
+ * Base class for injectors
+ * 
+ * @author igor
+ */
+class AbstractInjector
+{
+	public AbstractInjector()
+	{
+	}
+
+	protected <T> void postConstruct(T instance)
+	{
+		NonContextual.of(instance.getClass()).postConstruct(instance);
+	}
+
+	protected <T> void inject(T instance)
+	{
+		NonContextual.of(instance.getClass()).inject(instance);
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/AutoConversation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/AutoConversation.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/AutoConversation.java
new file mode 100644
index 0000000..6138ac2
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/AutoConversation.java
@@ -0,0 +1,51 @@
+/*
+ * 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.wicket.cdi;
+
+import javax.enterprise.context.ConversationScoped;
+
+import org.apache.wicket.util.io.IClusterable;
+
+/**
+ * A bean that can be used to override whether the lifecycle of the conversation should be managed
+ * automatically or not. See {@link CdiConfiguration#setAutoConversationManagement(boolean)} for
+ * details.
+ * 
+ * @author igor
+ */
+@ConversationScoped
+public class AutoConversation implements IClusterable
+{
+	private static final long serialVersionUID = 1L;
+	
+	private boolean automatic;
+
+	public AutoConversation()
+	{
+		automatic = false;
+	}
+
+	public void setAutomatic(boolean automatic)
+	{
+		this.automatic = automatic;
+	}
+
+	public boolean isAutomatic()
+	{
+		return automatic;
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/BeanManagerLookup.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/BeanManagerLookup.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/BeanManagerLookup.java
new file mode 100644
index 0000000..d9051ba
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/BeanManagerLookup.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.wicket.cdi;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.CDI;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+public final class BeanManagerLookup
+{
+	private BeanManagerLookup()
+	{
+	}
+
+	public static BeanManager lookup() {
+		try
+		{
+			return InitialContext.doLookup("java:comp/BeanManager");
+		}
+		catch (NamingException e)
+		{
+			return CDI.current().getBeanManager();
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java
new file mode 100644
index 0000000..15979f6
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/BehaviorInjector.java
@@ -0,0 +1,42 @@
+/*
+ * 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.wicket.cdi;
+
+import org.apache.wicket.IBehaviorInstantiationListener;
+import org.apache.wicket.behavior.Behavior;
+
+/**
+ * Injects components with CDI dependencies
+ * 
+ * @author igor
+ * 
+ */
+public class BehaviorInjector extends AbstractInjector implements IBehaviorInstantiationListener
+{
+	/**
+	 * Constructor
+	 */
+	public BehaviorInjector()
+	{
+	}
+
+	@Override
+	public void onInstantiation(Behavior behavior)
+	{
+		inject(behavior);
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
new file mode 100644
index 0000000..93675f7
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java
@@ -0,0 +1,101 @@
+/*
+ * 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.wicket.cdi;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.MetaDataKey;
+import org.apache.wicket.request.cycle.RequestCycleListenerCollection;
+
+/**
+ * Configures CDI integration
+ * 
+ * @author igor
+ * 
+ */
+public class CdiConfiguration
+{
+	private static final MetaDataKey<CdiConfiguration> CDI_CONFIGURATION_KEY = new MetaDataKey<CdiConfiguration>()
+	{
+		private static final long serialVersionUID = 1L;
+	};
+
+	private IConversationPropagation propagation = ConversationPropagation.ALL;
+
+	/**
+	 * Constructor
+	 */
+	public CdiConfiguration()
+	{
+	}
+
+	public IConversationPropagation getPropagation()
+	{
+		return propagation;
+	}
+
+
+	public CdiConfiguration setPropagation(IConversationPropagation propagation)
+	{
+		this.propagation = propagation;
+		return this;
+	}
+
+
+	/**
+	 * Configures the specified application
+	 * 
+	 * @param application
+	 * @return
+	 */
+	public void configure(Application application)
+	{
+		if (application.getMetaData(CDI_CONFIGURATION_KEY) != null)
+		{
+			throw new IllegalStateException("Cdi already configured for this application");
+		}
+		application.setMetaData(CDI_CONFIGURATION_KEY, this);
+
+		RequestCycleListenerCollection listeners = new RequestCycleListenerCollection();
+		application.getRequestCycleListeners().add(listeners);
+
+		// enable conversation propagation
+		if (getPropagation() != ConversationPropagation.NONE)
+		{
+			listeners.add(new ConversationPropagator(application, getPropagation()));
+			application.getComponentPreOnBeforeRenderListeners().add(
+					new ConversationExpiryChecker());
+		}
+
+		// enable detach event
+		listeners.add(new DetachEventEmitter());
+
+		NonContextual.of(application.getClass()).postConstruct(application);
+
+		// enable injection of various framework components
+		application.getSessionListeners().add(new SessionInjector());
+		application.getComponentInstantiationListeners().add(new ComponentInjector());
+		application.getBehaviorInstantiationListeners().add(new BehaviorInjector());
+
+		// enable cleanup
+		application.getApplicationListeners().add(new CdiShutdownCleaner());
+	}
+
+	public static CdiConfiguration get(Application application)
+	{
+		return application.getMetaData(CDI_CONFIGURATION_KEY);
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
new file mode 100644
index 0000000..8d2c97c
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/CdiShutdownCleaner.java
@@ -0,0 +1,45 @@
+/*
+ * 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.wicket.cdi;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.IApplicationListener;
+
+/**
+ * Listens to application shutdown and cleans up
+ * 
+ * @author igor
+ */
+class CdiShutdownCleaner implements IApplicationListener
+{
+	public CdiShutdownCleaner()
+	{
+	}
+
+	@Override
+	public void onAfterInitialized(Application application)
+	{
+		// noop
+	}
+
+	@Override
+	public void onBeforeDestroyed(Application application)
+	{
+		NonContextual.of(application.getClass()).preDestroy(application);
+		NonContextual.undeploy();
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ComponentInjector.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
new file mode 100644
index 0000000..65a4879
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
@@ -0,0 +1,43 @@
+/*
+ * 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.wicket.cdi;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.application.IComponentInstantiationListener;
+
+/**
+ * Injects components with CDI dependencies
+ * 
+ * @author igor
+ * 
+ */
+class ComponentInjector extends AbstractInjector implements IComponentInstantiationListener
+{
+	/**
+	 * Constructor
+	 */
+	public ComponentInjector()
+	{
+	}
+
+	@Override
+	public void onInstantiation(Component component)
+	{
+		inject(component);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
new file mode 100644
index 0000000..a9c7eb1
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationExpiredException.java
@@ -0,0 +1,52 @@
+/*
+ * 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.wicket.cdi;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.request.IRequestHandler;
+
+public class ConversationExpiredException extends RuntimeException
+{
+	private static final long serialVersionUID = 1L;
+	private String cid;
+	private Page page;
+	private IRequestHandler handler;
+
+	public ConversationExpiredException(Throwable cause, String cid, Page page,
+		IRequestHandler handler)
+	{
+		super(cause);
+		this.cid = cid;
+		this.page = page;
+		this.handler = handler;
+	}
+
+	public String getCid()
+	{
+		return cid;
+	}
+
+	public Page getPage()
+	{
+		return page;
+	}
+
+	public IRequestHandler getHandler()
+	{
+		return handler;
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
new file mode 100644
index 0000000..e79f938
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationExpiryChecker.java
@@ -0,0 +1,68 @@
+/*
+ * 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.wicket.cdi;
+
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.application.IComponentOnBeforeRenderListener;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.util.lang.Objects;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Checks for conversation expiration during page render and throws a
+ * {@link ConversationExpiredException} when an expired conversation is detected.
+ * 
+ * For example a link that calls {@link Conversation#end()} but does not redirect to a
+ * non-conversation-dependent page will be caught by this listener.
+ * 
+ * @author igor
+ * 
+ */
+public class ConversationExpiryChecker implements IComponentOnBeforeRenderListener
+{
+	private static final Logger logger = LoggerFactory.getLogger(ConversationExpiryChecker.class);
+	
+	@Inject
+	private Conversation conversation;
+
+	public ConversationExpiryChecker()
+	{
+		NonContextual.of(ConversationExpiryChecker.class).inject(this);
+	}
+
+	@Override
+	public void onBeforeRender(Component component)
+	{
+		if (component instanceof Page || RequestCycle.get().find(AjaxRequestTarget.class) != null)
+		{
+			Page page = component.getPage();
+			String cid = ConversationPropagator.getConversationIdFromPage(page);
+			if (cid != null && !Objects.isEqual(conversation.getId(), cid))
+			{
+				logger.info("Conversation {} has expired for {}", cid, page);
+				throw new ConversationExpiredException(null, cid, page, RequestCycle.get()
+					.getActiveRequestHandler());
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
new file mode 100644
index 0000000..502b6e5
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationPropagation.java
@@ -0,0 +1,69 @@
+/*
+ * 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.wicket.cdi;
+
+import javax.enterprise.context.ConversationScoped;
+
+import org.apache.wicket.core.request.handler.BookmarkableListenerInterfaceRequestHandler;
+import org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler;
+import org.apache.wicket.request.IRequestHandler;
+
+/**
+ * Various modes of propagating persistent conversations across requests.
+ * 
+ * @see ConversationScoped
+ * 
+ * @author igor
+ */
+public enum ConversationPropagation implements IConversationPropagation {
+	/** No conversational propagation takes place */
+	NONE {
+		@Override
+		public boolean propagatesViaParameters(IRequestHandler handler)
+		{
+			return false;
+		}
+	},
+	/**
+	 * Pesistent conversations are propagated between non-bookmarkable pages
+	 * only
+	 * 
+	 * @deprecated as of cdi-1.1, it is specified that conversations are
+	 *             propagated via the cid query parameter even for
+	 *             non-bookmarkable pages
+	 */
+	@Deprecated
+	NONBOOKMARKABLE {
+		@Override
+		public boolean propagatesViaParameters(IRequestHandler handler)
+		{
+			return !(handler instanceof BookmarkableListenerInterfaceRequestHandler)
+					&& !(handler instanceof BookmarkablePageRequestHandler);
+		}
+	},
+	/**
+	 * Persistent conversations are propagated between bookmarkable and
+	 * non-bookmarkable pages
+	 */
+	ALL {
+		@Override
+		public boolean propagatesViaParameters(IRequestHandler handler)
+		{
+			return true;
+		}
+	};
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
new file mode 100644
index 0000000..690710b
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java
@@ -0,0 +1,347 @@
+/*
+ * 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.wicket.cdi;
+
+import javax.enterprise.context.Conversation;
+import javax.enterprise.context.ConversationScoped;
+import javax.inject.Inject;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.MetaDataKey;
+import org.apache.wicket.Page;
+import org.apache.wicket.core.request.handler.BufferedResponseRequestHandler;
+import org.apache.wicket.core.request.handler.IPageClassRequestHandler;
+import org.apache.wicket.core.request.handler.IPageRequestHandler;
+import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.request.IRequestHandlerDelegate;
+import org.apache.wicket.request.Url;
+import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
+import org.apache.wicket.request.cycle.IRequestCycleListener;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.request.resource.PackageResourceReference;
+import org.apache.wicket.util.lang.Args;
+import org.apache.wicket.util.visit.IVisit;
+import org.apache.wicket.util.visit.IVisitor;
+import org.apache.wicket.util.visit.Visits;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A request cycle listener that takes care of propagating persistent
+ * conversations.
+ * 
+ * @see ConversationScoped
+ * 
+ * @author igor
+ */
+public class ConversationPropagator extends AbstractRequestCycleListener
+{
+	private static final Logger logger = LoggerFactory.getLogger(ConversationPropagator.class);
+
+	private static final MetaDataKey<Boolean> CONVERSATION_STARTED_KEY = new MetaDataKey<Boolean>()
+	{
+		private static final long serialVersionUID = 1L;
+	};
+
+	private static final MetaDataKey<String> CONVERSATION_ID_KEY = new MetaDataKey<String>()
+	{
+		private static final long serialVersionUID = 1L;
+	};
+
+	public static final String CID = "cid";
+
+	/** propagation mode to use */
+	private final IConversationPropagation propagation;
+
+	private final Application application;
+
+	@Inject
+	private Conversation conversation;
+
+	@Inject
+	private AutoConversation autoConversation;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param container
+	 * @param propagation
+	 */
+	public ConversationPropagator(Application application, IConversationPropagation propagation)
+	{
+		Args.notNull(application, "application");
+		Args.notNull(propagation, "propagation");
+
+		if (propagation == ConversationPropagation.NONE)
+		{
+			throw new IllegalArgumentException(
+					"If propagation is NONE do not set up the propagator");
+		}
+
+		this.application = application;
+		this.propagation = propagation;
+
+		NonContextual.of(ConversationPropagator.class).postConstruct(this);
+	}
+
+	public IConversationPropagation getPropagation()
+	{
+		return propagation;
+	}
+
+	@Override
+	public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
+	{
+		if (activateForHandler(handler))
+		{
+			logger.debug("Activating conversation {}", conversation.getId());
+			fireOnAfterConversationStarted(cycle);
+		}
+	}
+
+	private void fireOnAfterConversationStarted(RequestCycle cycle)
+	{
+		cycle.setMetaData(CONVERSATION_STARTED_KEY, true);
+		for (IRequestCycleListener listener : application.getRequestCycleListeners())
+		{
+			if (listener instanceof ICdiAwareRequestCycleListener)
+			{
+				((ICdiAwareRequestCycleListener)listener).onAfterConversationActivated(cycle);
+			}
+		}
+	}
+
+	@Override
+	public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
+	{
+		Page page = getPage(handler);
+
+		if (page == null)
+		{
+			return;
+		}
+
+		// apply auto semantics
+
+		autoEndIfNecessary(page, handler, conversation);
+		autoBeginIfNecessary(page, handler, conversation);
+	}
+
+	@Override
+	public void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler)
+	{
+		// propagate current non-transient conversation to the newly scheduled
+		// page
+		if (conversation.isTransient())
+		{
+			return;
+		}
+
+		if (propagation.propagatesViaParameters(handler))
+		{
+			logger.debug(
+					"Propagating non-transient conversation {} via page parameters of handler {}",
+					conversation.getId(), handler);
+
+			PageParameters parameters = getPageParameters(handler);
+			if (parameters != null)
+			{
+				parameters.set(CID, conversation.getId());
+				markPageWithConversationId(handler, conversation.getId());
+			}
+		}
+	}
+
+
+	@Override
+	public void onUrlMapped(RequestCycle cycle, IRequestHandler handler, Url url)
+	{
+		// no need to propagate the conversation to packaged resources, they
+		// should never change
+		if (handler instanceof ResourceReferenceRequestHandler)
+		{
+			if (((ResourceReferenceRequestHandler)handler).getResourceReference() instanceof PackageResourceReference)
+			{
+				return;
+			}
+		}
+
+		if (conversation.isTransient())
+		{
+			return;
+		}
+
+		if (propagation.propagatesViaParameters(handler))
+		{
+			logger.debug("Propagating non-transient conversation {} via url", conversation.getId());
+			url.setQueryParameter(CID, conversation.getId());
+			markPageWithConversationId(handler, conversation.getId());
+		}
+	}
+
+	@Override
+	public void onDetach(RequestCycle cycle)
+	{
+		if (!Boolean.TRUE.equals(cycle.getMetaData(CONVERSATION_STARTED_KEY)))
+		{
+			return;
+		}
+
+		logger.debug("Deactivating conversation {}", conversation.getId());
+		for (IRequestCycleListener listener : application.getRequestCycleListeners())
+		{
+			if (listener instanceof ICdiAwareRequestCycleListener)
+			{
+				((ICdiAwareRequestCycleListener)listener).onBeforeConversationDeactivated(cycle);
+			}
+		}
+	}
+
+	/**
+	 * Determines whether or not a conversation should be activated fro the
+	 * specified handler. This method is used to filter out conversation
+	 * activation for utility handlers such as the
+	 * {@link BufferedResponseRequestHandler}
+	 * 
+	 * @param handler
+	 * @return {@code true} iff a conversation should be activated
+	 */
+	protected boolean activateForHandler(IRequestHandler handler)
+	{
+		if (handler != null)
+		{
+			if (handler instanceof BufferedResponseRequestHandler)
+			{
+				// we do not care about pages that are being rendered from a
+				// buffer
+				return false;
+			}
+		}
+		return true;
+	}
+
+	protected void autoBeginIfNecessary(Page page, IRequestHandler handler,
+			Conversation conversation)
+	{
+		if (conversation == null || !conversation.isTransient() || page == null
+				|| !hasConversationalComponent(page))
+		{
+			return;
+		}
+
+		// auto activate conversation
+
+		conversation.begin();
+		autoConversation.setAutomatic(true);
+
+		logger.debug("Auto-began conversation {} for page {}", conversation.getId(), page);
+	}
+
+	protected void autoEndIfNecessary(Page page, IRequestHandler handler, Conversation conversation)
+	{
+		if (conversation == null || conversation.isTransient() || page == null
+				|| hasConversationalComponent(page) || autoConversation.isAutomatic() == false)
+		{
+			return;
+		}
+
+		// auto de-activate conversation
+
+		String cid = conversation.getId();
+
+		autoConversation.setAutomatic(false);
+		conversation.end();
+
+		logger.debug("Auto-ended conversation {} for page {}", cid, page);
+	}
+
+
+	protected boolean hasConversationalComponent(Page page)
+	{
+		Boolean hasConversational = Visits.visit(page, new IVisitor<Component, Boolean>()
+		{
+			@Override
+			public void component(Component object, IVisit<Boolean> visit)
+			{
+				if (object instanceof ConversationalComponent)
+				{
+					visit.stop(true);
+				}
+			}
+		});
+
+		return hasConversational == null ? false : hasConversational;
+	}
+
+	public static void markPageWithConversationId(IRequestHandler handler, String cid)
+	{
+		Page page = getPage(handler);
+		if (page != null)
+		{
+			page.setMetaData(CONVERSATION_ID_KEY, cid);
+		}
+	}
+
+	public static String getConversationIdFromPage(Page page)
+	{
+		return page.getMetaData(CONVERSATION_ID_KEY);
+	}
+
+	/**
+	 * Resolves a page instance from the request handler iff the page instance
+	 * is already created
+	 * 
+	 * @param handler
+	 * @return page or {@code null} if none
+	 */
+	public static Page getPage(IRequestHandler handler)
+	{
+		while (handler instanceof IRequestHandlerDelegate)
+		{
+			handler = ((IRequestHandlerDelegate)handler).getDelegateHandler();
+		}
+
+		if (handler instanceof IPageRequestHandler)
+		{
+			IPageRequestHandler pageHandler = (IPageRequestHandler)handler;
+			if (pageHandler.isPageInstanceCreated())
+			{
+				return (Page)pageHandler.getPage();
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Resolves page parameters from a request handler
+	 * 
+	 * @param handler
+	 * @return page parameters or {@code null} if none
+	 */
+	protected PageParameters getPageParameters(IRequestHandler handler)
+	{
+		if (handler instanceof IPageClassRequestHandler)
+		{
+			IPageClassRequestHandler pageHandler = (IPageClassRequestHandler)handler;
+			return pageHandler.getPageParameters();
+		}
+		return null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java
new file mode 100644
index 0000000..e041a87
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ConversationalComponent.java
@@ -0,0 +1,30 @@
+/*
+ * 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.wicket.cdi;
+
+/**
+ * Marks a component that requires a conversation. This marker is used by the automatic conversation
+ * management feature ({@link CdiConfiguration#setAutoConversationManagement(boolean)}) to
+ * automatically begin and end conversations based on the presence of these components in the
+ * component hierarchy of pages (can be applied to the page itself).
+ * 
+ * @author igor
+ */
+public interface ConversationalComponent
+{
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/DetachEvent.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/DetachEvent.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/DetachEvent.java
new file mode 100644
index 0000000..ac99ec3
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/DetachEvent.java
@@ -0,0 +1,28 @@
+/*
+ * 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.wicket.cdi;
+
+/**
+ * Fired when request cycle is detached
+ * 
+ * @author igor
+ * 
+ */
+public class DetachEvent
+{
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
new file mode 100644
index 0000000..601b155
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/DetachEventEmitter.java
@@ -0,0 +1,75 @@
+/*
+ * 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.wicket.cdi;
+
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+
+import org.apache.wicket.MetaDataKey;
+import org.apache.wicket.request.IRequestHandler;
+import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Request cycle listener that fires the {@link DetachEvent} event
+ * 
+ * @author igor
+ * 
+ */
+public class DetachEventEmitter extends AbstractRequestCycleListener
+{
+	private static final Logger logger = LoggerFactory.getLogger(DetachEventEmitter.class);
+
+	private static final MetaDataKey<Boolean> DETACH_SCHEDULED_KEY = new MetaDataKey<Boolean>()
+	{
+		private static final long serialVersionUID = 1L;
+	};
+
+	@Inject
+	Event<DetachEvent> detachEvent;
+
+	/**
+	 * Constructor
+	 */
+	public DetachEventEmitter()
+	{
+		NonContextual.of(DetachEventEmitter.class).postConstruct(this);
+	}
+
+	@Override
+	public void onRequestHandlerResolved(RequestCycle cycle, IRequestHandler handler)
+	{
+		// this is a wicket request, schedule detach event to be fired
+
+		cycle.setMetaData(DETACH_SCHEDULED_KEY, true);
+	}
+
+	@Override
+	public void onDetach(RequestCycle cycle)
+	{
+		if (Boolean.TRUE.equals(cycle.getMetaData(DETACH_SCHEDULED_KEY)))
+		{
+			logger.debug("Firing Detach event {}", cycle.getRequest().getUrl());
+
+			detachEvent.fire(new DetachEvent());
+
+			cycle.setMetaData(DETACH_SCHEDULED_KEY, null);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.java
new file mode 100644
index 0000000..d3ded47
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/ICdiAwareRequestCycleListener.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.wicket.cdi;
+
+import org.apache.wicket.request.cycle.IRequestCycleListener;
+import org.apache.wicket.request.cycle.RequestCycle;
+
+public interface ICdiAwareRequestCycleListener extends IRequestCycleListener
+{
+	/**
+	 * Called right after a conversation context for this request is activated
+	 * 
+	 * @param cycle
+	 *            request cycle
+	 */
+	void onAfterConversationActivated(RequestCycle cycle);
+
+	/**
+	 * Called right before the current conversation context is deactivated
+	 * 
+	 * @param cycle
+	 *            request cycle
+	 */
+	void onBeforeConversationDeactivated(RequestCycle cycle);
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/IConversationPropagation.java
new file mode 100644
index 0000000..09e39a9
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/IConversationPropagation.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.wicket.cdi;
+
+import org.apache.wicket.request.IRequestHandler;
+
+/**
+ * A strategy that specifies how conversations should be propagated between pages/resources.
+ * {@link ConversationPropagation} provides sensible default implementations of this interface.
+ * 
+ * @author papegaaij
+ */
+public interface IConversationPropagation
+{
+	/**
+	 * Indicates if the conversation should be propagated via url-parameters for the given request
+	 * handler. This can either be a get parameter in a rendered url, or via page parameters.
+	 * 
+	 * @param handler
+	 *            The current request handler
+	 * @return true if the conversation should be propagated for the given request handler.
+	 */
+	public boolean propagatesViaParameters(IRequestHandler handler);
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/NonContextual.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/NonContextual.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/NonContextual.java
new file mode 100644
index 0000000..4dea0ac
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/NonContextual.java
@@ -0,0 +1,154 @@
+/*
+ * 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.wicket.cdi;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.wicket.util.collections.ClassMetaCache;
+
+/**
+ * Manages lifecycle of non-contextual (non-CDI-managed) objects
+ * 
+ * @param <T>
+ * @author igor
+ */
+public class NonContextual<T>
+{
+	private static final Object lock = new Object();
+	private static volatile Map<BeanManager, ClassMetaCache<NonContextual<?>>> cache = Collections
+			.emptyMap();
+
+	final InjectionTarget<T> it;
+
+	/**
+	 * Undeploys specified bean manager from cache
+	 * 
+	 * @param beanManager
+	 */
+	public static void undeploy()
+	{
+		if (cache.containsKey(BeanManagerLookup.lookup()))
+		{
+			synchronized (lock)
+			{
+				// copy-on-write the cache
+				Map<BeanManager, ClassMetaCache<NonContextual<?>>> newCache = new WeakHashMap<BeanManager, ClassMetaCache<NonContextual<?>>>(
+						cache);
+				newCache.remove(BeanManagerLookup.lookup());
+				cache = Collections.unmodifiableMap(newCache);
+			}
+		}
+	}
+
+	/**
+	 * Factory method for creating noncontextual instances
+	 * 
+	 * @param <T>
+	 * @param clazz
+	 * @param manager
+	 * @return
+	 */
+	public static <T> NonContextual<T> of(Class<? extends T> clazz)
+	{
+		ClassMetaCache<NonContextual<?>> meta = getCache();
+
+		@SuppressWarnings("unchecked")
+		NonContextual<T> nc = (NonContextual<T>)meta.get(clazz);
+
+		if (nc == null)
+		{
+			nc = new NonContextual<T>(clazz);
+			meta.put(clazz, nc);
+		}
+		return nc;
+	}
+
+	private static ClassMetaCache<NonContextual<?>> getCache()
+	{
+		ClassMetaCache<NonContextual<?>> meta = cache.get(BeanManagerLookup.lookup());
+		if (meta == null)
+		{
+			synchronized (lock)
+			{
+				BeanManager manager = BeanManagerLookup.lookup();
+				meta = cache.get(manager);
+				if (meta == null)
+				{
+					meta = new ClassMetaCache<NonContextual<?>>();
+
+					// copy-on-write the cache
+					Map<BeanManager, ClassMetaCache<NonContextual<?>>> newCache = new WeakHashMap<BeanManager, ClassMetaCache<NonContextual<?>>>(
+							cache);
+					newCache.put(manager, meta);
+					cache = Collections.unmodifiableMap(newCache);
+				}
+			}
+		}
+		return meta;
+	}
+
+	@SuppressWarnings("unchecked")
+	private NonContextual(Class<? extends T> clazz)
+	{
+		BeanManager manager = BeanManagerLookup.lookup();
+		AnnotatedType<? extends T> type = manager.createAnnotatedType(clazz);
+		this.it = (InjectionTarget<T>)manager.createInjectionTarget(type);
+	}
+
+	/**
+	 * Injects the instance and calls any {@link PostConstruct} methods
+	 * 
+	 * @param instance
+	 */
+	public void postConstruct(T instance)
+	{
+		CreationalContext<T> cc = BeanManagerLookup.lookup().createCreationalContext(null);
+		it.inject(instance, cc);
+		it.postConstruct(instance);
+	}
+
+	/**
+	 * Injects the instance
+	 * 
+	 * @param instance
+	 */
+	public void inject(T instance)
+	{
+		CreationalContext<T> cc = BeanManagerLookup.lookup().createCreationalContext(null);
+		it.inject(instance, cc);
+	}
+
+	/**
+	 * Calls any {@link PreDestroy} methods and destroys any injected
+	 * dependencies that need to be destroyed.
+	 * 
+	 * @param instance
+	 */
+	public void preDestroy(T instance)
+	{
+		it.preDestroy(instance);
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/SessionInjector.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/SessionInjector.java b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/SessionInjector.java
new file mode 100644
index 0000000..a6fb4d2
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/java/org/apache/wicket/cdi/SessionInjector.java
@@ -0,0 +1,42 @@
+/*
+ * 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.wicket.cdi;
+
+import org.apache.wicket.ISessionListener;
+import org.apache.wicket.Session;
+
+/**
+ * Injects components with CDI dependencies
+ * 
+ * @author igor
+ * 
+ */
+class SessionInjector extends AbstractInjector implements ISessionListener
+{
+	/**
+	 * Constructor
+	 */
+	public SessionInjector()
+	{
+	}
+
+	@Override
+	public void onCreated(Session session)
+	{
+		postConstruct(session);
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/main/resources/META-INF/beans.xml b/wicket-experimental/wicket-cdi-1.1/src/main/resources/META-INF/beans.xml
new file mode 100644
index 0000000..6a2f1ec
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/main/resources/META-INF/beans.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
+	version="1.1" bean-discovery-mode="annotated" />
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/WicketTestCase.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/WicketTestCase.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/WicketTestCase.java
new file mode 100644
index 0000000..eaed456
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/WicketTestCase.java
@@ -0,0 +1,161 @@
+/*
+ * 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.wicket;
+
+import org.apache.wicket.behavior.AbstractAjaxBehavior;
+import org.apache.wicket.mock.MockApplication;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.util.tester.WicketTester;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+
+/**
+ * Base class for tests which require comparing wicket response with a file.
+ * <p>
+ * To create/replace the expected result file with the new content, define the system property like
+ * -Dwicket.replace.expected.results=true
+ */
+public abstract class WicketTestCase extends Assert
+{
+	/** */
+	protected WicketTester tester;
+
+	/**
+	 * @see junit.framework.TestCase#setUp()
+	 */
+	@Before
+	public void commonBefore()
+	{
+		// make sure no leaked threadlocals are present
+		ThreadContext.detach();
+
+		WebApplication application = newApplication();
+		tester = newWicketTester(application);
+	}
+
+	/**
+	 * @return the application that should be used for the test
+	 */
+	protected WebApplication newApplication()
+	{
+		return new MockApplication();
+	}
+
+	/**
+	 * In case you need to subclass WicketTester and want to be independent on possible changes in
+	 * setUp().
+	 * 
+	 * @param app
+	 * @return WIcketTester
+	 */
+	protected WicketTester newWicketTester(final WebApplication app)
+	{
+		return new WicketTester(app);
+	}
+
+	/**
+	 * 
+	 */
+	@After
+	public void commonAfter()
+	{
+		tester.destroy();
+	}
+
+	/**
+	 * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected
+	 * output file.
+	 * 
+	 * @param <T>
+	 * 
+	 * @param pageClass
+	 * @param filename
+	 * @throws Exception
+	 */
+	protected <T extends Page> void executeTest(final Class<T> pageClass, final String filename)
+		throws Exception
+	{
+		tester.executeTest(getClass(), pageClass, filename);
+	}
+
+	/**
+	 * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected
+	 * output file.
+	 * 
+	 * @param page
+	 * @param filename
+	 * @throws Exception
+	 */
+	protected void executeTest(final Page page, final String filename) throws Exception
+	{
+		tester.executeTest(getClass(), page, filename);
+	}
+
+	/**
+	 * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected
+	 * output file.
+	 * 
+	 * @param <T>
+	 * 
+	 * @param pageClass
+	 * @param parameters
+	 * @param filename
+	 * @throws Exception
+	 */
+	protected <T extends Page> void executeTest(final Class<T> pageClass,
+		PageParameters parameters, final String filename) throws Exception
+	{
+		tester.executeTest(getClass(), pageClass, parameters, filename);
+	}
+
+	/**
+	 * 
+	 * @param component
+	 * @param filename
+	 * @throws Exception
+	 */
+	protected void executeListener(final Component component, final String filename)
+		throws Exception
+	{
+		tester.executeListener(getClass(), component, filename);
+	}
+
+	/**
+	 * 
+	 * @param behavior
+	 * @param filename
+	 * @throws Exception
+	 */
+	protected void executeBehavior(final AbstractAjaxBehavior behavior, final String filename)
+		throws Exception
+	{
+		tester.executeBehavior(getClass(), behavior, filename);
+	}
+
+	/**
+	 * Returns the current Maven build directory taken from the <tt>basedir</tt> system property, or
+	 * null if not set
+	 * 
+	 * @return path with a trailing slash
+	 */
+	public String getBasedir()
+	{
+		return WicketTester.getBasedir();
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java
new file mode 100644
index 0000000..e612055
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/ApacheLicenceHeaderTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.wicket.cdi;
+
+import java.util.Arrays;
+
+import org.apache.wicket.util.license.ApacheLicenseHeaderTestCase;
+
+/**
+ * Test that the license headers are in place in this project. The tests are run
+ * from {@link ApacheLicenseHeaderTestCase}, but you can add project specific
+ * tests here if needed.
+ * 
+ * @author Frank Bille Jensen (frankbille)
+ */
+public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase
+{
+	/**
+	 * Construct.
+	 */
+	public ApacheLicenceHeaderTest()
+	{
+		xmlIgnore.add(".settings");
+		xmlIgnore.add("src/main/resources/META-INF/beans.xml");
+		xmlPrologIgnore = Arrays.asList("src");
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
new file mode 100644
index 0000000..7e89c10
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.wicket.cdi;
+
+import org.apache.wicket.cdi.testapp.TestConversationPage;
+import org.apache.wicket.cdi.testapp.TestPage;
+import org.apache.wicket.util.tester.WicketTester;
+import org.junit.Test;
+
+/**
+ * @author jsarman
+ */
+public class CdiConfigurationTest extends WicketCdiTestCase
+{
+	@Test
+	public void testApplicationScope()
+	{
+		configure(new CdiConfiguration());
+		tester.startPage(TestPage.class);
+		tester.assertLabel("appscope", "Test ok");
+	}
+
+	@Test
+	public void testConversationScope()
+	{
+		configure(new CdiConfiguration());
+		tester.startPage(TestConversationPage.class);
+		for (int i = 0; i < 20; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+	}
+
+	@Test(expected = Exception.class)
+	public void testConfigureTwice()
+	{
+		configure(new CdiConfiguration());
+		new CdiConfiguration().configure(tester.getApplication());
+	}
+
+	@Test
+	public void testApplicationLevelConfiguration()
+	{
+		WicketTester tester = new WicketTester();
+		CdiConfiguration config = new CdiConfiguration();
+		for (ConversationPropagation cp : ConversationPropagation.values())
+		{
+			config.setPropagation(cp);
+			assertEquals(cp, config.getPropagation());
+		}
+		config.configure(tester.getApplication());
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
new file mode 100644
index 0000000..d827b11
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/ConversationPropagatorTest.java
@@ -0,0 +1,199 @@
+/*
+ * 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.wicket.cdi;
+
+import org.apache.wicket.cdi.testapp.TestConversationPage;
+import org.apache.wicket.cdi.testapp.TestConversationalPage;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author jsarman
+ */
+public class ConversationPropagatorTest extends WicketCdiTestCase
+{
+	@Test
+	@Ignore("Testcase and auto conversations do not match")
+	public void testAutoConversationNonBookmarkable()
+	{
+		configure(new CdiConfiguration());
+
+		tester.startPage(TestConversationalPage.class);
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		// at this point counter = 3, auto conversation is still enabled and
+		// remains enabled, because TestConversationalPage is part of this
+		// request
+		for (; i < 6; i++)
+		{
+			// first iteration: i == 3, counter == 3, conversation active
+			// second iteration: i == 4, counter == 4, conversation transient
+			// third iteration: i == 5, counter == 1: FAIL
+			tester.assertLabel("count", i + "");
+
+			// first iteration: conversation is still long-running, counter is
+			// incremented, after which auto conversation is disabled and the
+			// conversation ended
+
+			// second iteration: transient conversation, counter starts at 1,
+			// conversation remains transient
+			tester.clickLink("increment");
+
+		}
+
+	}
+
+	@Test
+	@Ignore("Testcase and auto conversations do not match")
+	public void testAutoConversationBookmarkable()
+	{
+		configure(new CdiConfiguration());
+
+		tester.startPage(TestConversationalPage.class,
+				new PageParameters().add("pageType", "bookmarkable"));
+
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		// The conversation should auto end and not create another one
+		// so the next page just keeps getting 1 because the conversationscoped
+		// bean
+		// doesnt persist across requests.
+		for (i = 0; i < 3; i++)
+		{
+			tester.clickLink("increment");
+			tester.assertLabel("count", 1 + "");
+		}
+	}
+
+	@Test
+	public void testPropagationAllNonBookmarkable()
+	{
+		configure(new CdiConfiguration().setPropagation(ConversationPropagation.ALL));
+
+		tester.startPage(TestConversationPage.class);
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		for (; i < 6; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+
+	}
+
+	@Test
+	public void testPropagationAllBookmarkable()
+	{
+		configure(new CdiConfiguration().setPropagation(ConversationPropagation.ALL));
+
+		tester.startPage(TestConversationPage.class,
+				new PageParameters().add("pageType", "bookmarkable"));
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		for (; i < 6; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+
+	}
+
+	@Test
+	public void testPropagationNone()
+	{
+		configure(new CdiConfiguration().setPropagation(ConversationPropagation.NONE));
+
+		tester.startPage(TestConversationPage.class);
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.clickLink("increment");
+			tester.assertLabel("count", "1");
+		}
+		tester.clickLink("next");
+		for (; i < 6; i++)
+		{
+			tester.clickLink("increment");
+			tester.assertLabel("count", "1");
+		}
+
+	}
+
+	@Test
+	@Ignore("Testcase and auto conversations do not match")
+	public void testGlobalAutoSettingNonBookmarkable()
+	{
+		configure(new CdiConfiguration());
+
+		tester.startPage(TestConversationPage.class, new PageParameters().add("auto", true));
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		for (; i < 6; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+	}
+
+	@Test
+	@Ignore("Testcase and auto conversations do not match")
+	public void testGlobalAutoSettingBookmarkable()
+	{
+		configure(new CdiConfiguration());
+
+		tester.startPage(TestConversationPage.class,
+				new PageParameters().add("auto", true).add("pageType", "bookmarkable"));
+		int i;
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+		tester.clickLink("next");
+		for (i = 0; i < 3; i++)
+		{
+			tester.assertLabel("count", i + "");
+			tester.clickLink("increment");
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
new file mode 100644
index 0000000..ef862c6
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/WicketCdiTestCase.java
@@ -0,0 +1,67 @@
+/*
+ * 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.wicket.cdi;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.WicketTestCase;
+import org.apache.wicket.cdi.testapp.TestAppScope;
+import org.apache.wicket.cdi.testapp.TestCdiApplication;
+import org.apache.wicket.cdi.testapp.TestConversationBean;
+import org.apache.wicket.cdi.util.tester.CdiWicketTester;
+import org.apache.wicket.cdi.util.tester.ContextManager;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.util.tester.WicketTester;
+import org.jglue.cdiunit.AdditionalClasses;
+import org.jglue.cdiunit.CdiRunner;
+import org.junit.After;
+import org.junit.runner.RunWith;
+
+/**
+ * @author jsarman
+ */
+@RunWith(CdiRunner.class)
+@AdditionalClasses({ CdiWicketTester.class, BehaviorInjector.class, CdiConfiguration.class,
+		CdiShutdownCleaner.class, ComponentInjector.class, ConversationExpiryChecker.class,
+		ConversationPropagator.class, DetachEventEmitter.class, SessionInjector.class,
+		TestAppScope.class, TestConversationBean.class, TestCdiApplication.class })
+public abstract class WicketCdiTestCase extends WicketTestCase
+{
+	@Inject
+	private ContextManager contextManager;
+
+	@Override
+	protected WicketTester newWicketTester(WebApplication app)
+	{
+		return new CdiWicketTester(app);
+	}
+
+	public void configure(CdiConfiguration configuration)
+	{
+		configuration.configure(tester.getApplication());
+	}
+
+	@After
+	public void end()
+	{
+		if (contextManager.isRequestActive())
+		{
+			contextManager.deactivateContexts();
+			contextManager.destroy();
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestAppScope.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestAppScope.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestAppScope.java
new file mode 100644
index 0000000..b36f8a7
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestAppScope.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.wicket.cdi.testapp;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+/**
+ * @author jsarman
+ */
+@ApplicationScoped
+public class TestAppScope
+{
+
+	public String test()
+	{
+		return "Test ok";
+	}
+
+	public @Produces
+	@TestQualifier
+	String testString()
+	{
+		return "Test String";
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.java
new file mode 100644
index 0000000..7b82203
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.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.wicket.cdi.testapp;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.protocol.http.WebApplication;
+
+/**
+ * @author jsarman
+ */
+public class TestApplication extends WebApplication
+{
+
+	@Override
+	public Class<? extends Page> getHomePage()
+	{
+		return TestPage.class;
+	}
+
+	@Override
+	protected void init()
+	{
+		super.init();
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
new file mode 100644
index 0000000..1bd8656
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestCdiApplication.java
@@ -0,0 +1,54 @@
+/*
+ * 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.wicket.cdi.testapp;
+
+import javax.inject.Inject;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.cdi.CdiConfiguration;
+import org.apache.wicket.protocol.http.WebApplication;
+
+/**
+ * @author jsarman
+ */
+public class TestCdiApplication extends WebApplication
+{
+
+	@Inject
+	@TestQualifier
+	String testString;
+
+
+	@Override
+	public Class<? extends Page> getHomePage()
+	{
+		return TestPage.class;
+	}
+
+	@Override
+	protected void init()
+	{
+		super.init();
+		new CdiConfiguration().configure(this);
+	}
+
+	public String getInjectedTestString()
+	{
+		return testString;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java
new file mode 100644
index 0000000..ef61441
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.java
@@ -0,0 +1,51 @@
+/*
+ * 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.wicket.cdi.testapp;
+
+import java.io.Serializable;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.enterprise.context.ConversationScoped;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author jsarman
+ */
+@ConversationScoped
+public class TestConversationBean implements Serializable
+{
+	private static final long serialVersionUID = 1L;
+
+	private static final Logger logger = LoggerFactory.getLogger(TestConversationBean.class);
+
+	private AtomicInteger counter = new AtomicInteger();
+
+	public int getCount()
+	{
+		logger.debug("Count = {}", counter.get());
+		return counter.get();
+	}
+
+	public void increment()
+	{
+
+		counter.incrementAndGet();
+
+	}
+}

http://git-wip-us.apache.org/repos/asf/wicket/blob/ecf2c9fe/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
new file mode 100644
index 0000000..e7f3de7
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html xmlns:wicket>
+<head>
+    <title></title>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body>
+<span wicket:id="count">100</span>
+<a wicket:id="increment">increment</a>
+<a wicket:id="next">Reset</a>
+</body>
+</html>