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/07/10 13:53:20 UTC

[11/17] git commit: Revert "WICKET-5226 CDI integration fails in Glassfish 4.0 with WELD-000070"

Revert "WICKET-5226 CDI integration fails in Glassfish 4.0 with WELD-000070"

This reverts commit 4bc20743fe628341a7cce407b36fa1984b912f92.

Conflicts:
	wicket-examples/src/main/java/org/apache/wicket/examples/cdi/ConversationPage2.java


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

Branch: refs/heads/event-delegating-behavior
Commit: a2d591676cbcf52ec182b1063701f419da24a6d0
Parents: 07d96ce
Author: Emond Papegaaij <em...@topicus.nl>
Authored: Fri Jul 5 17:01:42 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Jul 10 14:22:22 2013 +0300

----------------------------------------------------------------------
 wicket-cdi/pom.xml                              |   6 -
 .../apache/wicket/cdi/ComponentInjector.java    |  18 +--
 .../wicket/cdi/ComponentInjectorTest.java       | 131 -------------------
 .../wicket/examples/cdi/ConversationPage2.java  |  25 ++--
 4 files changed, 11 insertions(+), 169 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/a2d59167/wicket-cdi/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-cdi/pom.xml b/wicket-cdi/pom.xml
index 54611f1..4e8626a 100644
--- a/wicket-cdi/pom.xml
+++ b/wicket-cdi/pom.xml
@@ -52,12 +52,6 @@
 			<artifactId>junit</artifactId>
 			<scope>test</scope>
 		</dependency>
-		<dependency>
-			<groupId>javax.el</groupId>
-			<artifactId>javax.el-api</artifactId>
-			<version>2.2.4</version>
-			<scope>test</scope>
-		</dependency>
 	</dependencies>
 	<build>
 		<pluginManagement>

http://git-wip-us.apache.org/repos/asf/wicket/blob/a2d59167/wicket-cdi/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
----------------------------------------------------------------------
diff --git a/wicket-cdi/src/main/java/org/apache/wicket/cdi/ComponentInjector.java b/wicket-cdi/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
index 0316004..bc302ef 100644
--- a/wicket-cdi/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
+++ b/wicket-cdi/src/main/java/org/apache/wicket/cdi/ComponentInjector.java
@@ -16,12 +16,8 @@
  */
 package org.apache.wicket.cdi;
 
-import java.lang.reflect.Modifier;
-
 import org.apache.wicket.Component;
 import org.apache.wicket.application.IComponentInstantiationListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Injects components with CDI dependencies
@@ -31,8 +27,6 @@ import org.slf4j.LoggerFactory;
  */
 class ComponentInjector extends AbstractInjector implements IComponentInstantiationListener
 {
-	private static final Logger LOG = LoggerFactory.getLogger(ComponentInjector.class);
-
 	/**
 	 * Constructor
 	 * 
@@ -46,15 +40,7 @@ class ComponentInjector extends AbstractInjector implements IComponentInstantiat
 	@Override
 	public void onInstantiation(Component component)
 	{
-		Class<? extends Component> componentClass = component.getClass();
-
-		if (componentClass.isMemberClass() && Modifier.isStatic(componentClass.getModifiers()) == false)
-		{
-			LOG.debug("Skipping non-static inner class '{}' ", componentClass);
-		}
-		else
-		{
-			inject(component);
-		}
+		inject(component);
 	}
+
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/a2d59167/wicket-cdi/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java
----------------------------------------------------------------------
diff --git a/wicket-cdi/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java b/wicket-cdi/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java
deleted file mode 100644
index 55d00cd..0000000
--- a/wicket-cdi/src/test/java/org/apache/wicket/cdi/ComponentInjectorTest.java
+++ /dev/null
@@ -1,131 +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 static org.mockito.Mockito.any;
-import static org.mockito.Mockito.doAnswer;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Inject;
-
-import org.apache.wicket.markup.html.WebComponent;
-import org.apache.wicket.util.tester.WicketTester;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-/**
- * Tests for ComponentInjector
- */
-public class ComponentInjectorTest extends Assert
-{
-	private WicketTester tester;
-
-	@Before
-	public void before()
-	{
-		// starts an application so we can instantiate components
-		tester = new WicketTester();
-	}
-
-	@After
-	public void after()
-	{
-		tester.destroy();
-		tester = null;
-	}
-
-	/**
-	 * https://issues.apache.org/jira/browse/WICKET-5226
-	 */
-	@Test
-	public void innerNonStaticClass()
-	{
-		BeanManager beanManager = mock(BeanManager.class);
-		INonContextualManager nonContextualManager = mock(INonContextualManager.class);
-		CdiContainer cdiContainer = new CdiContainer(beanManager, nonContextualManager);
-		ComponentInjector injector = new ComponentInjector(cdiContainer);
-
-		TestNonStaticComponent component = new TestNonStaticComponent("someId");
-		assertNull(component.dependency);
-
-		injector.onInstantiation(component);
-
-		verify(nonContextualManager, never()).inject(any());
-	}
-
-	/**
-	 * https://issues.apache.org/jira/browse/WICKET-5226
-	 */
-	@Test
-	public void innerStaticClass()
-	{
-		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));
-
-		CdiContainer cdiContainer = new CdiContainer(beanManager, nonContextualManager);
-		ComponentInjector injector = new ComponentInjector(cdiContainer);
-
-		TestStaticComponent component = new TestStaticComponent("someId");
-		assertNull(component.dependency);
-
-		injector.onInstantiation(component);
-
-		assertEquals(expectedValue, component.dependency);
-	}
-
-	private class TestNonStaticComponent extends WebComponent
-	{
-		@Inject
-		private String dependency;
-
-		public TestNonStaticComponent(String id)
-		{
-			super(id);
-		}
-	}
-
-	private static class TestStaticComponent extends WebComponent
-	{
-		@Inject
-		private String dependency;
-
-		public TestStaticComponent(String id)
-		{
-			super(id);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/wicket/blob/a2d59167/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/ConversationPage2.java
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/ConversationPage2.java b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/ConversationPage2.java
index b7e6363..89b9e6a 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/ConversationPage2.java
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/cdi/ConversationPage2.java
@@ -32,22 +32,15 @@ public class ConversationPage2 extends CdiExamplePage
 	{
 		add(new Label("count", new PropertyModel(this, "counter.count")));
 
-		add(new IncrementLink("increment"));
-
-		add(new BookmarkablePageLink<>("next", ConversationPage3.class));
-	}
-
-	private class IncrementLink extends Link<Void> {
-
-		public IncrementLink(String id)
-		{
-			super(id);
-		}
-
-		@Override
-		public void onClick()
+		add(new Link<Void>("increment")
 		{
-			counter.increment();
-		}
+			@Override
+			public void onClick()
+			{
+				counter.increment();
+			}
+		});
+
+		add(new BookmarkablePageLink<Void>("next", ConversationPage3.class));
 	}
 }