Permalink
Browse files

Prove inability to reproduce SPR-8663

  • Loading branch information...
1 parent 13bfceb commit cba7954af008110c77dab9f7174573310723be18 @cbeams cbeams committed Sep 5, 2011
View
89 SPR-8663/pom.xml
@@ -0,0 +1,89 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.springframework.issues</groupId>
+ <artifactId>SPR-8663</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>3.1.0.BUILD-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aspects</artifactId>
+ <version>3.1.0.BUILD-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>1.6.11</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>spring-maven-snapshot</id>
+ <name>Springframework Maven Snapshot Repository</name>
+ <url>http://maven.springframework.org/snapshot</url>
+ <snapshots><enabled>true</enabled></snapshots>
+ </repository>
+ </repositories>
+ <properties>
+ <project.build.sourceEncoding>UTF8</project.build.sourceEncoding>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.7.2</version>
+ <configuration>
+ <includes>
+ <include>**/*Tests.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Abstract*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>aspectj-maven-plugin</artifactId>
+ <version>1.4</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>test-compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
View
9 SPR-8663/src/main/java/c/d/SomeInterface.java
@@ -0,0 +1,9 @@
+package c.d;
+
+import my.ConfigObject;
+
+public interface SomeInterface {
+
+ void setConfigObject(ConfigObject configObject);
+
+}
View
19 SPR-8663/src/main/java/c/d/SubaspectOfGenericInterfaceDrivenDependencyInjectionAspect.aj
@@ -0,0 +1,19 @@
+package c.d;
+
+import my.ConfigObject;
+
+import org.springframework.beans.factory.aspectj.GenericInterfaceDrivenDependencyInjectionAspect;
+
+public aspect SubaspectOfGenericInterfaceDrivenDependencyInjectionAspect
+ extends GenericInterfaceDrivenDependencyInjectionAspect<SomeInterface> {
+
+ protected ConfigObject configObject;
+
+ public void setConfigObject(ConfigObject configObject) {
+ this.configObject = configObject;
+ }
+
+ public void configure(SomeInterface bean) {
+ bean.setConfigObject(this.configObject);
+ }
+}
View
12 SPR-8663/src/main/java/my/ConfigObject.java
@@ -0,0 +1,12 @@
+package my;
+
+import java.util.List;
+
+import some.Dependency;
+
+public class ConfigObject {
+
+ public ConfigObject(List<Dependency> deps) {
+ }
+
+}
View
5 SPR-8663/src/main/java/org/springframework/issues/Bar.java
@@ -0,0 +1,5 @@
+package org.springframework.issues;
+
+public class Bar {
+
+}
View
14 SPR-8663/src/main/java/org/springframework/issues/Foo.java
@@ -0,0 +1,14 @@
+package org.springframework.issues;
+
+public class Foo {
+
+ private final Bar bar;
+
+ public Foo(Bar bar) {
+ this.bar = bar;
+ }
+
+ public Bar getBar() {
+ return this.bar;
+ }
+}
View
5 SPR-8663/src/main/java/some/Dependency.java
@@ -0,0 +1,5 @@
+package some;
+
+public class Dependency {
+
+}
View
27 SPR-8663/src/test/java/org/springframework/issues/ReproTests.java
@@ -0,0 +1,27 @@
+package org.springframework.issues;
+
+import org.junit.Test;
+import org.springframework.context.support.GenericXmlApplicationContext;
+
+/**
+ * Unit test that reproduces an issue reported against SPR JIRA. @Test methods within
+ * need not pass with the green bar! Rather they should fail in such a way that
+ * demonstrates the reported issue.
+ */
+public class ReproTests {
+
+ @Test
+ public void control() {
+ GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
+ ctx.load("classpath:org/springframework/issues/control.xml");
+ ctx.refresh();
+ }
+
+ @Test
+ public void repro() {
+ GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
+ ctx.load("classpath:org/springframework/issues/repro.xml");
+ ctx.refresh();
+ }
+
+}
View
7 SPR-8663/src/test/resources/log4j.properties
@@ -0,0 +1,7 @@
+log4j.rootCategory=ERROR, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
+
+log4j.category.org.springframework=WARN
View
23 SPR-8663/src/test/resources/org/springframework/issues/control.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
+
+ <context:component-scan base-package="a.b" />
+
+ <bean class="c.d.SubaspectOfGenericInterfaceDrivenDependencyInjectionAspect" factory-method="aspectOf">
+ <property name="configObject">
+ <bean class="my.ConfigObject">
+ <constructor-arg>
+ <list>
+ <bean class="some.Dependency"/>
+ </list>
+ </constructor-arg>
+ </bean>
+ </property>
+ </bean>
+
+ <context:component-scan base-package="x.y.z" />
+</beans>
View
22 SPR-8663/src/test/resources/org/springframework/issues/repro.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
+
+ <context:component-scan base-package="a.b" />
+ <context:component-scan base-package="x.y.z" />
+
+ <bean class="c.d.SubaspectOfGenericInterfaceDrivenDependencyInjectionAspect" factory-method="aspectOf">
+ <property name="configObject">
+ <bean class="my.ConfigObject">
+ <constructor-arg>
+ <list>
+ <bean class="some.Dependency"/>
+ </list>
+ </constructor-arg>
+ </bean>
+ </property>
+ </bean>
+</beans>

0 comments on commit cba7954

Please sign in to comment.