You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/06/28 10:53:50 UTC
[3/9] git commit: Updated CdiConfiguration and added Unit Tests
Updated CdiConfiguration and added Unit Tests
Changed method signature for add|removePackagesToIgnore and made it
accept vararg String. Added unit tests based on JGlue. Thanks Martin
excellent suggestion. Updated version to 0.2-SNAPSHOT
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/434a7089
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/434a7089
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/434a7089
Branch: refs/heads/5257-css-settings
Commit: 434a7089701ca4294260f8a2319d904c4332e2ce
Parents: a7fd850
Author: John Sarman <jo...@gmail.com>
Authored: Thu Jun 27 15:57:14 2013 -0400
Committer: John Sarman <jo...@gmail.com>
Committed: Thu Jun 27 15:57:14 2013 -0400
----------------------------------------------------------------------
wicket-examples/pom.xml | 2 +-
wicket-experimental/wicket-cdi-1.1/pom.xml | 2 +-
.../wicket-cdi-1.1/wicket-cdi-1.1-core/pom.xml | 10 +-
.../org/apache/wicket/cdi/AbstractInjector.java | 5 +
.../org/apache/wicket/cdi/CdiConfiguration.java | 2 +-
.../wicket/cdi/ConversationPropagator.java | 9 ++
.../apache/wicket/cdi/CdiConfigurationTest.java | 125 +++++++++++++++++++
.../wicket/cdi/ComponentInjectorTest.java | 112 +++++++++++------
.../org/apache/wicket/cdi/MockContainer.java | 70 +++++++++++
.../apache/wicket/cdi/testapp/TestAppScope.java | 41 ++++++
.../wicket/cdi/testapp/TestApplication.java | 43 +++++++
.../cdi/testapp/TestConversationBean.java | 42 +++++++
.../cdi/testapp/TestConversationPage.html | 12 ++
.../cdi/testapp/TestConversationPage.java | 66 ++++++++++
.../org/apache/wicket/cdi/testapp/TestPage.html | 10 ++
.../org/apache/wicket/cdi/testapp/TestPage.java | 39 ++++++
.../wicket/cdi/testapp/TestQualifier.java | 36 ++++++
.../wicket-cdi-1.1/wicket-cdi-1.1-weld/pom.xml | 6 +-
18 files changed, 581 insertions(+), 51 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/wicket-examples/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-examples/pom.xml b/wicket-examples/pom.xml
index 699886f..f280d00 100644
--- a/wicket-examples/pom.xml
+++ b/wicket-examples/pom.xml
@@ -134,7 +134,7 @@
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-cdi-1.1-weld</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <version>0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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 c0f9995..4f578f0 100644
--- a/wicket-experimental/wicket-cdi-1.1/pom.xml
+++ b/wicket-experimental/wicket-cdi-1.1/pom.xml
@@ -24,7 +24,7 @@
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>wicket-cdi-1.1</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <version>0.2-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Wicket CDI 1.1</name>
<description>Wicket CDI 1.1 Parent.</description>
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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
index d46b0ae..dd2106e 100644
--- 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
@@ -20,12 +20,12 @@
<parent>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-cdi-1.1</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <version>0.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>wicket-cdi-1.1-core</artifactId>
<packaging>jar</packaging>
- <version>0.1-SNAPSHOT</version>
+ <version>0.2-SNAPSHOT</version>
<name>Wicket CDI 1.1 Core</name>
<description>
Provides integration between Wicket and CDI containers. Enables injection of
@@ -49,9 +49,9 @@
<artifactId>junit</artifactId>
</dependency>
<dependency>
- <groupId>javax.el</groupId>
- <artifactId>javax.el-api</artifactId>
- <version>2.2.4</version>
+ <groupId>org.jglue.cdi-unit</groupId>
+ <artifactId>cdi-unit</artifactId>
+ <version>2.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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
index 63523f4..139606e 100644
--- 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
@@ -80,4 +80,9 @@ class AbstractInjector <T>
}
+ public String[] getIgnorePackages()
+ {
+ return ignorePackages.get();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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 667b1a9..3f82585 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
@@ -204,7 +204,7 @@ public class CdiConfiguration
ignoredPackages.addAll(Arrays.asList(packageNames));
}
- public void removePackageToIgnore(String ... packageNames)
+ public void removePackagesToIgnore(String ... packageNames)
{
ignoredPackages.removeAll(Arrays.asList(packageNames));
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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 e5d2b0f..9ee7ec8 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
@@ -438,4 +438,13 @@ public class ConversationPropagator extends AbstractRequestCycleListener impleme
}
return null;
}
+
+ Boolean getAuto() {
+ return auto.get();
+ }
+
+ ConversationPropagation getPropagation() {
+ return (ConversationPropagation)propagationSource.get();
+ }
+
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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
new file mode 100644
index 0000000..2461e05
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/CdiConfigurationTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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 javax.servlet.http.HttpServletRequest;
+
+import org.apache.wicket.cdi.testapp.TestAppScope;
+import org.apache.wicket.cdi.testapp.TestApplication;
+import org.apache.wicket.cdi.testapp.TestConversationBean;
+import org.apache.wicket.cdi.testapp.TestConversationPage;
+import org.apache.wicket.util.tester.WicketTester;
+import org.jglue.cdiunit.AdditionalClasses;
+import org.jglue.cdiunit.CdiRunner;
+import org.jglue.cdiunit.ContextController;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author jsarman
+ */
+@RunWith(CdiRunner.class)
+@AdditionalClasses({BehaviorInjector.class,
+ CdiConfiguration.class,
+ CdiShutdownCleaner.class,
+ ComponentInjector.class,
+ ConversationExpiryChecker.class,
+ ConversationPropagator.class,
+ DetachEventEmitter.class,
+ NonContextualManager.class,
+ SessionInjector.class,
+ MockContainer.class,
+ TestAppScope.class,
+ TestConversationBean.class})
+public class CdiConfigurationTest extends Assert
+{
+
+ private WicketTester tester;
+ @Inject
+ ContextController contextController;
+ @Inject
+ ConversationPropagator conversationPropagator;
+ @Inject
+ ComponentInjector componentInjector;
+
+ @Before
+ public void before()
+ {
+ tester = new WicketTester(new TestApplication());
+ prepareRequest(tester.getRequest());
+ }
+
+ @After
+ public void after()
+ {
+ tester.destroy();
+ tester = null;
+ }
+
+ public void prepareRequest(HttpServletRequest request)
+ {
+ contextController.openRequest(request);
+ contextController.openSession(request);
+ contextController.openConversation(request);
+ }
+
+ @Test
+ public void testApplicationScope()
+ {
+ tester.startPage(tester.getApplication().getHomePage());
+ tester.assertLabel("appscope", "Test ok");
+ }
+
+ @Test
+ public void testConversationScope()
+ {
+ tester.startPage(TestConversationPage.class);
+ for (int i = 0; i < 20; i++)
+ {
+ tester.assertLabel("count", i + "");
+ tester.clickLink("increment");
+ }
+ }
+
+ @Test
+ public void testDynamicConfigureChange()
+ {
+ // CdiConfiguration is configured at begin auto is false
+ assertEquals(false, conversationPropagator.getAuto());
+ // set auto to true in configuration
+ CdiConfiguration.get().setAutoConversationManagement(true);
+ assertEquals(true, conversationPropagator.getAuto());
+ // Test Changing Propagation
+ for (ConversationPropagation propagation : ConversationPropagation.values())
+ {
+ CdiConfiguration.get().setPropagation(propagation);
+ assertEquals(propagation, conversationPropagator.getPropagation());
+ }
+
+ int ignoreCnt = componentInjector.getIgnorePackages().length;
+
+ CdiConfiguration.get().addPackagesToIgnore("test1", "test2", "test3");
+ assertEquals(ignoreCnt + 3, componentInjector.getIgnorePackages().length);
+
+ CdiConfiguration.get().removePackagesToIgnore("test1", "test2");
+ assertEquals(ignoreCnt + 1, componentInjector.getIgnorePackages().length);
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java
index c038614..fb1210e 100644
--- a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java
@@ -17,26 +17,59 @@
package org.apache.wicket.cdi;
import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.wicket.cdi.testapp.TestAppScope;
+import org.apache.wicket.cdi.testapp.TestApplication;
+import org.apache.wicket.cdi.testapp.TestConversationBean;
+import org.apache.wicket.cdi.testapp.TestConversationPage;
+import org.apache.wicket.cdi.testapp.TestQualifier;
import org.apache.wicket.markup.html.WebComponent;
import org.apache.wicket.util.tester.WicketTester;
+import org.jglue.cdiunit.AdditionalClasses;
+import org.jglue.cdiunit.CdiRunner;
+import org.jglue.cdiunit.ContextController;
import org.junit.After;
import org.junit.Assert;
+
+import static org.junit.Assert.assertEquals;
+
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Tests for ComponentInjector
*/
+@RunWith(CdiRunner.class)
+@AdditionalClasses({
+ BehaviorInjector.class,
+ CdiConfiguration.class,
+ CdiShutdownCleaner.class,
+ ComponentInjector.class,
+ ConversationExpiryChecker.class,
+ ConversationPropagator.class,
+ DetachEventEmitter.class,
+ NonContextualManager.class,
+ SessionInjector.class,
+ MockContainer.class,
+ TestAppScope.class,
+ TestConversationBean.class})
public class ComponentInjectorTest extends Assert
{
+
private WicketTester tester;
+ @Inject
+ ContextController contextController;
+ @Inject
+ ComponentInjector componentInjector;
@Before
public void before()
{
- // starts an application so we can instantiate components
- tester = new WicketTester();
+ tester = new WicketTester(new TestApplication());
+ prepareRequest(tester.getRequest());
}
@After
@@ -46,24 +79,24 @@ public class ComponentInjectorTest extends Assert
tester = null;
}
+ public void prepareRequest(HttpServletRequest request)
+ {
+ contextController.openRequest(request);
+ contextController.openSession(request);
+ contextController.openConversation(request);
+ }
+
/**
* https://issues.apache.org/jira/browse/WICKET-5226
*/
@Test
public void innerNonStaticClass()
{
- //Disabled for now
-// BeanManager beanManager = mock(BeanManager.class);
-// INonContextualManager nonContextualManager = mock(INonContextualManager.class);
-// AbstractCdiContainer cdiContainer = new AbstractCdiContainer(beanManager, nonContextualManager);
-// ComponentInjector injector = new ComponentInjector(cdiContainer);
-//
-// TestNonStaticComponent component = new TestNonStaticComponent("someId");
-// assertNull(component.dependency);
-//
-// injector.onInstantiation(component);
-//
-// verify(nonContextualManager, never()).inject(any());
+
+ TestNonStaticComponent component = new TestNonStaticComponent("someId");
+ assertNull(component.dependency);
+ componentInjector.onInstantiation(component);
+ assertNull(component.dependency);
}
/**
@@ -72,36 +105,33 @@ public class ComponentInjectorTest extends Assert
@Test
public void innerStaticClass()
{
- //Disabled for now need to add injectable test dependencies
-// BeanManager beanManager = mock(BeanManager.class);
-// INonContextualManager nonContextualManager = mock(INonContextualManager.class);
-// final String expectedValue = "injected";
-//
-// doAnswer(new Answer<Void>()
-// {
-// @Override
-// public Void answer(InvocationOnMock invocation) throws Throwable
-// {
-// TestStaticComponent component = (TestStaticComponent) invocation.getArguments()[0];
-// component.dependency = expectedValue;
-//
-// return null;
-// }
-// }).when(nonContextualManager).inject(any(TestStaticComponent.class));
-//
-// AbstractCdiContainer cdiContainer = new AbstractCdiContainer(beanManager, nonContextualManager);
-// ComponentInjector injector = new ComponentInjector(cdiContainer);
-//
-// TestStaticComponent component = new TestStaticComponent("someId");
-// assertNull(component.dependency);
-//
-// injector.onInstantiation(component);
-//
-// assertEquals(expectedValue, component.dependency);
+ TestStaticComponent component = new TestStaticComponent("someId");
+ componentInjector.onInstantiation(component);
+ assertEquals(component.dependency, "Test String");
+ }
+
+ @Test
+ public void anonymousInnerClass()
+ {
+
+ WebComponent component = new WebComponent("someId")
+ {
+ @Inject
+ private String dependency;
+
+ @Override
+ public String toString()
+ {
+ return dependency;
+ }
+ };
+ componentInjector.onInstantiation(component);
+ assertNull(component.toString());
}
private class TestNonStaticComponent extends WebComponent
{
+
@Inject
private String dependency;
@@ -113,7 +143,9 @@ public class ComponentInjectorTest extends Assert
private static class TestStaticComponent extends WebComponent
{
+
@Inject
+ @TestQualifier
private String dependency;
public TestStaticComponent(String id)
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockContainer.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockContainer.java b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockContainer.java
new file mode 100644
index 0000000..dc1ddd1
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/MockContainer.java
@@ -0,0 +1,70 @@
+/*
+ * 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.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.jboss.weld.context.http.HttpConversationContext;
+
+/**
+ * @author jsarman
+ */
+@ApplicationScoped
+public class MockContainer extends AbstractCdiContainer
+{
+
+ @Inject
+ private Instance<HttpConversationContext> conversationContextSource;
+
+ @Override
+ public void deactivateConversationalContext(RequestCycle cycle)
+ {
+ HttpConversationContext conversationContext = conversationContextSource.get();
+ conversationContext.deactivate();
+ conversationContext.dissociate(getRequest(cycle));
+ }
+
+ /**
+ * Activates the conversational context and starts the conversation with the
+ * specified cid
+ *
+ * @param cycle
+ * @param cid
+ */
+ @Override
+ public void activateConversationalContext(RequestCycle cycle, String cid)
+ {
+ HttpConversationContext conversationContext = conversationContextSource.get();
+ conversationContext.associate(getRequest(cycle));
+ if (conversationContext.isActive())
+ {
+ // Only reactivate if transient and cid is set
+ if (conversationContext.getCurrentConversation().isTransient()
+ && cid != null && !cid.isEmpty())
+ {
+ conversationContext.deactivate();
+ conversationContext.activate(cid);
+ }
+ } else
+ {
+ conversationContext.activate(cid);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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
new file mode 100644
index 0000000..2097f52
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestAppScope.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.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/434a7089/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
new file mode 100644
index 0000000..e70d3a7
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestApplication.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.testapp;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.cdi.CdiConfiguration;
+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();
+ CdiConfiguration.get().configure(this);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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
new file mode 100644
index 0000000..92bf9bf
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationBean.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.testapp;
+
+import java.io.Serializable;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.enterprise.context.ConversationScoped;
+
+/**
+ * @author jsarman
+ */
+@ConversationScoped
+public class TestConversationBean implements Serializable
+{
+
+ private AtomicInteger counter = new AtomicInteger();
+
+ public int getCount()
+ {
+ return counter.get();
+ }
+
+ public void increment()
+ {
+ counter.incrementAndGet();
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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
new file mode 100644
index 0000000..06d96a2
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<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="reset">Reset</a>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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
new file mode 100644
index 0000000..9d9ccad
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestConversationPage.java
@@ -0,0 +1,66 @@
+/*
+ * 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.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;
+
+/**
+ * @author jsarman
+ */
+public class TestConversationPage extends WebPage
+{
+
+ @Inject
+ Conversation conversation;
+
+ @Inject
+ TestConversationBean counter;
+
+ public TestConversationPage()
+ {
+
+ conversation.begin();
+
+ add(new Label("count", new PropertyModel(this, "counter.count")));
+
+ add(new Link<Void>("increment")
+ {
+ @Override
+ public void onClick()
+ {
+ counter.increment();
+ }
+ });
+ add(new Link<Void>("reset")
+ {
+ @Override
+ public void onClick()
+ {
+ conversation.end();
+ setResponsePage(TestPage.class);
+ }
+ });
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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
new file mode 100644
index 0000000..0439c9e
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestPage.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<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/434a7089/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
new file mode 100644
index 0000000..742400a
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestPage.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 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
+{
+
+ @Inject
+ TestAppScope appScope;
+
+ public TestPage()
+ {
+
+ add(new Label("appscope", appScope.test()));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/434a7089/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
new file mode 100644
index 0000000..3d9b361
--- /dev/null
+++ b/wicket-experimental/wicket-cdi-1.1/wicket-cdi-1.1-core/src/test/java/org/apache/wicket/cdi/testapp/TestQualifier.java
@@ -0,0 +1,36 @@
+/*
+ * 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/434a7089/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
index 9c657e2..ddd1ae6 100644
--- 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
@@ -20,12 +20,12 @@
<parent>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-cdi-1.1</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <version>0.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>wicket-cdi-1.1-weld</artifactId>
<packaging>jar</packaging>
- <version>0.1-SNAPSHOT</version>
+ <version>0.2-SNAPSHOT</version>
<name>Wicket CDI 1.1 Weld</name>
<description>
Provides integration between Wicket and CDI containers. Adds support for weld
@@ -35,7 +35,7 @@
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-cdi-1.1-core</artifactId>
- <version>0.1-SNAPSHOT</version>
+ <version>0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>