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
