[RESTORED] Spring Support: Implement Spring-specific references

This commit is contained in:
Alexey Sedunov
2016-02-25 14:02:43 +03:00
parent 196b484cd7
commit f2e2220560
45 changed files with 906 additions and 80 deletions
@@ -0,0 +1,7 @@
// ELEMENT: singleton
package test
import org.springframework.context.annotation.Scope
@Scope("<caret>")
class ScopedBean
@@ -0,0 +1,7 @@
// ELEMENT: singleton
package test
import org.springframework.context.annotation.Scope
@Scope("singleton")
class ScopedBean
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="fooBean" class="java.lang.String"/>
<bean id="barBean" class="java.lang.String"/>
<bean id="scopedBean" class="test.ScopedBean"/>
</beans>
@@ -0,0 +1,14 @@
// ELEMENT: fooBean
// CHAR: \n
import org.springframework.beans.factory.BeanFactory
import org.springframework.beans.factory.xml.XmlBeanFactory
import org.springframework.core.io.FileSystemResource
import org.springframework.core.io.Resource
class FooBeanClass {
init {
val configFile = FileSystemResource("spring-config.xml")
val factory = XmlBeanFactory(configFile)
factory.getBean("fo<caret>o")
}
}
@@ -0,0 +1,14 @@
// ELEMENT: fooBean
// CHAR: \n
import org.springframework.beans.factory.BeanFactory
import org.springframework.beans.factory.xml.XmlBeanFactory
import org.springframework.core.io.FileSystemResource
import org.springframework.core.io.Resource
class FooBeanClass {
init {
val configFile = FileSystemResource("spring-config.xml")
val factory = XmlBeanFactory(configFile)
factory.getBean("fooBeano")
}
}
@@ -0,0 +1,14 @@
// ELEMENT: fooBean
// CHAR: \t
import org.springframework.beans.factory.BeanFactory
import org.springframework.beans.factory.xml.XmlBeanFactory
import org.springframework.core.io.FileSystemResource
import org.springframework.core.io.Resource
class FooBeanClass {
init {
val configFile = FileSystemResource("spring-config.xml")
val factory = XmlBeanFactory(configFile)
factory.getBean("fo<caret>o")
}
}
@@ -0,0 +1,14 @@
// ELEMENT: fooBean
// CHAR: \t
import org.springframework.beans.factory.BeanFactory
import org.springframework.beans.factory.xml.XmlBeanFactory
import org.springframework.core.io.FileSystemResource
import org.springframework.core.io.Resource
class FooBeanClass {
init {
val configFile = FileSystemResource("spring-config.xml")
val factory = XmlBeanFactory(configFile)
factory.getBean("fooBean")
}
}
@@ -0,0 +1,9 @@
// NUMBER: 2
// EXIST: { lookupString:"singleton" }
// EXIST: { lookupString:"prototype" }
package test
import org.springframework.context.annotation.Scope
@Scope("<caret>")
class ScopedBean
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="fooBean" class="java.lang.String"/>
<bean id="fooBean2" class="java.lang.String"/>
<bean id="barBean" class="java.lang.String"/>
<bean id="scopedBean" class="test.ScopedBean"/>
</beans>
@@ -0,0 +1,15 @@
// NUMBER: 2
// EXIST: { lookupString:"fooBean" }
// EXIST: { lookupString:"fooBean2" }
import org.springframework.beans.factory.BeanFactory
import org.springframework.beans.factory.xml.XmlBeanFactory
import org.springframework.core.io.FileSystemResource
import org.springframework.core.io.Resource
class FooBeanClass {
init {
val configFile = FileSystemResource("spring-config.xml")
val factory = XmlBeanFactory(configFile)
factory.getBean("fo<caret>o")
}
}
@@ -0,0 +1,9 @@
// NO_XML_CONFIG
// REF: /src.fileReferenceInClasspathResource.test.xml
import org.springframework.core.io.ClassPathResource
class Bean {
init {
ClassPathResource("<caret>fileReferenceInClasspathResource.test.xml")
}
}
@@ -0,0 +1,3 @@
<test>
<foo/>
</test>
@@ -0,0 +1,9 @@
// NO_XML_CONFIG
// REF: /src.fileReferenceInClasspathXmlContext.test.xml
import org.springframework.context.support.ClassPathXmlApplicationContext
class Bean {
init {
ClassPathXmlApplicationContext("<caret>fileReferenceInClasspathXmlContext.test.xml")
}
}
@@ -0,0 +1,3 @@
<test>
<foo/>
</test>
@@ -0,0 +1,7 @@
// REF: singleton
package test
import org.springframework.context.annotation.Scope
@Scope("<caret>singleton")
class Bean
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="fooBean" class="test.Bean"/>
</beans>
@@ -0,0 +1,13 @@
// REF: <bean id="fooBean" class="java.lang.String"/>
import org.springframework.beans.factory.BeanFactory
import org.springframework.beans.factory.xml.XmlBeanFactory
import org.springframework.core.io.FileSystemResource
import org.springframework.core.io.Resource
class FooBeanClass {
init {
val configFile = FileSystemResource("spring-config.xml")
val factory = XmlBeanFactory(configFile)
if (factory.containsBean("<caret>fooBean")) println("FooBean")
}
}
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="fooBean" class="java.lang.String"/>
</beans>
@@ -0,0 +1,13 @@
// REF: <bean id="fooBean" class="java.lang.String"/>
import org.springframework.beans.factory.BeanFactory
import org.springframework.beans.factory.xml.XmlBeanFactory
import org.springframework.core.io.FileSystemResource
import org.springframework.core.io.Resource
class FooBeanClass {
init {
val configFile = FileSystemResource("spring-config.xml")
val factory = XmlBeanFactory(configFile)
factory.getBean("<caret>fooBean")
}
}
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="fooBean" class="java.lang.String"/>
</beans>
@@ -0,0 +1,11 @@
// JAVAX_ANNOTATION_RESOURCE
// REF: <bean id="fooBean" class="test.Bean"/>
package test
import javax.annotation.Resource
class Bean
class Test {
@Resource(name= "<caret>fooBean") lateinit var name: String
}
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="fooBean" class="test.Bean"/>
</beans>
@@ -0,0 +1,11 @@
// JAVAX_ANNOTATION_RESOURCE
// REF: <bean id="fooBean" class="test.Bean"/>
package test
import javax.annotation.Resource
class Bean
class Test {
@Resource(name= "<caret>&fooBean") lateinit var name: String
}
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="fooBean" class="test.Bean"/>
</beans>