Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding repro test for SPR-9670 (need to toggle spring version in pom …

…to see difference between 3.0.x and 3.1.x)
  • Loading branch information...
commit 7946b331af5301ea0ef05496e7065350b18d8b90 1 parent 3b665c3
@kmudrick kmudrick authored
View
62 SPR-9670/pom.xml
@@ -0,0 +1,62 @@
+<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-9670</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>3.1.2.RELEASE</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://repo.springsource.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>
+ </plugins>
+ </build>
+</project>
+
View
67 SPR-9670/src/main/java/org/springframework/issues/SampleBean.java
@@ -0,0 +1,67 @@
+package org.springframework.issues;
+
+import java.util.List;
+
+public class SampleBean {
+
+ private String title;
+
+ private String id;
+
+ private String loc;
+
+ private String trackerId;
+
+ private boolean visible;
+
+ private List<SampleBean> children;
+
+ public List<SampleBean> getChildren() {
+ return children;
+ }
+
+ public void setChildren(List<SampleBean> children) {
+ this.children = children;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLoc() {
+ return loc;
+ }
+
+ public void setLoc(String loc) {
+ this.loc = loc;
+ }
+
+ public String getTrackerId() {
+ return trackerId;
+ }
+
+ public void setTrackerId(String trackerId) {
+ this.trackerId = trackerId;
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
+}
View
0  SPR-9670/src/main/resources/.gitignore
No changes.
View
36 SPR-9670/src/test/java/org/springframework/issues/ReproTests.java
@@ -0,0 +1,36 @@
+package org.springframework.issues;
+
+import org.junit.Test;
+import org.springframework.context.support.GenericXmlApplicationContext;
+import org.springframework.util.StopWatch;
+
+/**
+ * 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 {
+
+ private static final int ITERATIONS = 10000;
+
+ @Test
+ public void repro() {
+ StopWatch stopWatch = new StopWatch("Prototyped Bean Creation");
+
+ // initial load
+ stopWatch.start("Initializing");
+ GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
+ ctx.load("classpath:org/springframework/issues/ReproTests-context.xml");
+ ctx.refresh();
+ ctx.getBean("ParentBeanGroup");
+ stopWatch.stop();
+
+ stopWatch.start("Creating");
+ for (int i = 0; i < ITERATIONS; i++) {
+ ctx.getBean("ParentBeanGroup");
+ }
+ stopWatch.stop();
+ System.out.println(stopWatch.prettyPrint());
+ }
+
+}
View
7 SPR-9670/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
148 SPR-9670/src/test/resources/org/springframework/issues/ReproTests-context.xml
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
+
+ <bean id="ParentBeanGroup" class="java.util.ArrayList" scope="prototype">
+ <constructor-arg index="0">
+ <list>
+ <ref bean="SampleBean1"/>
+ <ref bean="SampleBean2"/>
+ <ref bean="SampleBean3"/>
+ <ref bean="SampleBean4"/>
+ </list>
+ </constructor-arg>
+ </bean>
+
+ <bean id="SampleBean1" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="id" value="SampleBean1" />
+ <property name="children" ref="SampleChildren1"/>
+ </bean>
+
+ <bean id="SampleBean2" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="id" value="SampleBean2" />
+ <property name="children" ref="SampleChildren1"/>
+ </bean>
+
+ <bean id="SampleBean3" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="id" value="SampleBean3" />
+ <property name="children" ref="SampleChildren2"/>
+ </bean>
+
+ <bean id="SampleBean4" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="id" value="SampleBean4" />
+ <property name="children" ref="SampleChildren2"/>
+ </bean>
+
+
+ <bean id="SampleChildren1" class="java.util.ArrayList" scope="prototype">
+ <constructor-arg index="0">
+ <list>
+ <ref bean="Child1SampleBean1"/>
+ <ref bean="Child1SampleBean2"/>
+ <ref bean="SharedChildSampleBean1"/>
+ <ref bean="SharedChildSampleBean2"/>
+ <ref bean="SharedChildSampleBean3"/>
+ <ref bean="SharedChildSampleBean4"/>
+ <ref bean="Child1SampleBean3"/>
+ </list>
+ </constructor-arg>
+ </bean>
+
+ <bean id="SampleChildren2" class="java.util.ArrayList" scope="prototype">
+ <constructor-arg index="0">
+ <list>
+ <ref bean="Child2SampleBean1"/>
+ <ref bean="Child2SampleBean2"/>
+ <ref bean="SharedChildSampleBean1"/>
+ <ref bean="SharedChildSampleBean2"/>
+ <ref bean="SharedChildSampleBean3"/>
+ <ref bean="SharedChildSampleBean4"/>
+ <ref bean="Child2SampleBean3"/>
+ </list>
+ </constructor-arg>
+ </bean>
+
+ <bean id="Child1SampleBean1" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="title" value="Child1SampleBean1 Title" />
+ <property name="id" value="Child1SampleBean1 Id" />
+ <property name="loc" value="/some/location/should/possibly/go/here"/>
+ <property name="trackerId" value="some_tracker_id" />
+ <property name="visible" value="true"/>
+ </bean>
+
+ <bean id="Child1SampleBean2" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="title" value="Child1SampleBean2 Title" />
+ <property name="id" value="Child1SampleBean2 Id" />
+ <property name="loc" value="/some/location/should/possibly/go/here"/>
+ <property name="trackerId" value="some_tracker_id" />
+ <property name="visible" value="true"/>
+ </bean>
+
+ <bean id="SharedChildSampleBean1" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="title" value="SharedChildSampleBean1 Title" />
+ <property name="id" value="SharedChildSampleBean1 Id" />
+ <property name="loc" value="/some/location/should/possibly/go/here"/>
+ <property name="trackerId" value="some_tracker_id" />
+ <property name="visible" value="true"/>
+ </bean>
+
+ <bean id="SharedChildSampleBean2" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="title" value="SharedChildSampleBean2 Title" />
+ <property name="id" value="SharedChildSampleBean2 Id" />
+ <property name="loc" value="/some/location/should/possibly/go/here"/>
+ <property name="trackerId" value="some_tracker_id" />
+ <property name="visible" value="true"/>
+ </bean>
+
+ <bean id="SharedChildSampleBean3" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="title" value="SharedChildSampleBean3 Title" />
+ <property name="id" value="Child1SampleBean1 Id" />
+ <property name="loc" value="/some/location/should/possibly/go/here"/>
+ <property name="trackerId" value="some_tracker_id" />
+ <property name="visible" value="true"/>
+ </bean>
+
+ <bean id="SharedChildSampleBean4" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="title" value="SharedChildSampleBean4 Title" />
+ <property name="id" value="SharedChildSampleBean4 Id" />
+ <property name="loc" value="/some/location/should/possibly/go/here"/>
+ <property name="trackerId" value="some_tracker_id" />
+ <property name="visible" value="true"/>
+ </bean>
+
+ <bean id="Child1SampleBean3" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="title" value="CChild1SampleBean3 Title" />
+ <property name="id" value="Child1SampleBean3 Id" />
+ <property name="loc" value="/some/location/should/possibly/go/here"/>
+ <property name="trackerId" value="some_tracker_id" />
+ <property name="visible" value="true"/>
+ </bean>
+
+ <bean id="Child2SampleBean3" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="title" value="Child 2 Sample Bean 3 Title" />
+ <property name="id" value="Child 2 Sample Bean 3 Id" />
+ <property name="loc" value="/some/location/should/possibly/go/here"/>
+ <property name="trackerId" value="some_tracker_id" />
+ <property name="visible" value="true"/>
+ </bean>
+
+ <bean id="Child2SampleBean1" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="title" value="Child 2 Sample Bean 1 Title" />
+ <property name="id" value="Child 2 Sample Bean 1 Id" />
+ <property name="loc" value="/some/location/should/possibly/go/here"/>
+ <property name="trackerId" value="some_tracker_id" />
+ <property name="visible" value="true"/>
+ </bean>
+
+ <bean id="Child2SampleBean2" class="org.springframework.issues.SampleBean" scope="prototype">
+ <property name="title" value="Child 2 Sample Bean 2 Title" />
+ <property name="id" value="Child 2 Sample Bean 2 Id" />
+ <property name="loc" value="/some/location/should/possibly/go/here"/>
+ <property name="trackerId" value="some_tracker_id" />
+ <property name="visible" value="true"/>
+ </bean>
+
+</beans>
Please sign in to comment.
Something went wrong with that request. Please try again.