From 58ab8b691c1d01f9237306a55eb835f01c6705c9 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Tue, 26 Feb 2013 12:15:53 +0100 Subject: [PATCH 1/3] Re-enable ignored SecurityManager-related test Prior to this change, CallbacksSecurityTests#testContainerPrivileges was @Ignored because it caused the build to fail under Gradle. After some analysis, the root cause was determined to be the fact that (a) a restrictive SecurityManager is active during the running of this test, and (b), Gradle intercepts System.out and routes it through its internal LogBack-based logging system. LogBack requires a call to Class#getClassLoader when handling logging statements, and the SecurityManager disallows this call, thus raising the error that fails the build. This commit solves the problem by eliminating the System.out.println call in question and removing the @Ignore annotation from the test. The console output was diagnostic in nature anyway, and not required for the successful execution of the test's assertions. Issue: SPR-10074 --- .../support/security/CallbacksSecurityTests.java | 13 +++---------- .../support/security/support/ConstructorBean.java | 4 ++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java index c8c6595e45..d0439fa93e 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/CallbacksSecurityTests.java @@ -16,12 +16,6 @@ package org.springframework.beans.factory.support.security; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import java.lang.reflect.Method; import java.net.URL; import java.security.AccessControlContext; @@ -39,8 +33,8 @@ import javax.security.auth.AuthPermission; import javax.security.auth.Subject; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.BeanCreationException; @@ -60,6 +54,8 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.Resource; +import static org.junit.Assert.*; + /** * Security test case. Checks whether the container uses its privileges for its * internal work but does not leak them when touching/calling user code. @@ -456,9 +452,6 @@ public class CallbacksSecurityTests { } @Test - @Ignore("passes under Eclipse, but fails under Gradle with https://gist.github.com/1664133") - // TODO [SPR-10074] passes under Eclipse, but fails under Gradle with - // https://gist.github.com/1664133 public void testContainerPrivileges() throws Exception { AccessControlContext acc = provider.getAccessControlContext(); diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/ConstructorBean.java b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/ConstructorBean.java index 0b65929fdd..a68028c592 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/ConstructorBean.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/ConstructorBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.springframework.beans.factory.support.security.support; /** @@ -25,6 +26,5 @@ public class ConstructorBean { } public ConstructorBean(Object obj) { - System.out.println("Received object " + obj); } } From 0e8c950f7d57e770d2da6441b836c4ef84623975 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Tue, 26 Feb 2013 12:51:32 +0100 Subject: [PATCH 2/3] Re-enable JaxWsSupportTests These tests still fail under Eclipse for unknown reasons, but do work under Gradle, so are thus re-enabled by removing the @Ignore. Issue: SPR-10074 --- .../remoting/jaxws/JaxWsSupportTests.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java b/spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java index 7ae30114de..66637e04b2 100644 --- a/spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java +++ b/spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ package org.springframework.remoting.jaxws; -import static org.junit.Assert.*; - import java.net.MalformedURLException; import java.net.URL; @@ -28,7 +26,6 @@ import javax.xml.ws.WebServiceClient; import javax.xml.ws.WebServiceRef; import javax.xml.ws.soap.AddressingFeature; -import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.support.GenericBeanDefinition; @@ -36,12 +33,12 @@ import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.annotation.AnnotationConfigUtils; import org.springframework.context.support.GenericApplicationContext; +import static org.junit.Assert.*; + /** * @author Juergen Hoeller * @since 2.5 */ -// TODO [SPR-10074] see https://gist.github.com/1150858 -@Ignore("see https://gist.github.com/1150858") public class JaxWsSupportTests { @Test From 9c2b5b240696431bd5842ed1ea6a66b48f12e197 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Tue, 26 Feb 2013 14:19:07 +0100 Subject: [PATCH 3/3] Update @Ignore'd JPA+AspectJ tests Issue: SPR-10074, SPR-10333 --- ...rFactoryWithAspectJWeavingIntegrationTests.java | 14 +++++--------- ...kMultiEntityManagerFactoryIntegrationTests.java | 6 +++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests.java index 20d9e5f029..ec94bba49f 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/openjpa/OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,17 +19,13 @@ package org.springframework.orm.jpa.openjpa; import org.junit.Ignore; /** - * Test that AspectJ weaving (in particular the currently shipped aspects) work with JPA (see SPR-3873 for more details). + * Test that AspectJ weaving (in particular the currently shipped aspects) work with JPA + * (see SPR-3873 for more details). * * @author Ramnivas Laddad + * @author Chris Beams */ -// TODO [SPR-10074] this test causes gradle to hang. -// When run independently e.g. `./gradlew :spring-orm:test -Dtest.single=OpenJpaEntity...` -// it works fine. When run together with all other tests e.g. `./gradlew :spring-orm:test` -// it hangs on the 'testCanSerializeProxies' test method. Note that this test DOES pass in -// Eclipse, even when the entire 'spring-orm' module is run. Run gradle with '-i' to -// get more details when reproducing the hanging test. -@Ignore("this test causes gradle to hang") +@Ignore("This test causes gradle to hang. See SPR-103333.") public class OpenJpaEntityManagerFactoryWithAspectJWeavingIntegrationTests extends OpenJpaEntityManagerFactoryIntegrationTests { @Override diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/toplink/TopLinkMultiEntityManagerFactoryIntegrationTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/toplink/TopLinkMultiEntityManagerFactoryIntegrationTests.java index 78e8f86af5..13d9226bce 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/toplink/TopLinkMultiEntityManagerFactoryIntegrationTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/toplink/TopLinkMultiEntityManagerFactoryIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,9 @@ import org.springframework.orm.jpa.AbstractContainerEntityManagerFactoryIntegrat * Toplink-specific JPA tests with multiple EntityManagerFactory instances. * * @author Costin Leau + * @author Chris Beams */ -// TODO [SPR-10074] this test causes gradle to hang. See OJEMFWAJWIT. -@Ignore("this test causes gradle to hang. See OJEMFWAJWIT.") +@Ignore("This test causes gradle to hang. See SPR-103333.") public class TopLinkMultiEntityManagerFactoryIntegrationTests extends AbstractContainerEntityManagerFactoryIntegrationTests {