org.springframework.scripting.ContextScriptBean Java Examples
The following examples show how to use
org.springframework.scripting.ContextScriptBean.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GroovyScriptFactoryTests.java From spring-analysis-note with MIT License | 6 votes |
/** * Tests the SPR-2098 bug whereby no more than 1 property element could be * passed to a scripted bean :( */ @Test public void testCanPassInMoreThanOneProperty() { ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-multiple-properties.xml", getClass()); TestBean tb = (TestBean) ctx.getBean("testBean"); ContextScriptBean bean = (ContextScriptBean) ctx.getBean("bean"); assertEquals("The first property ain't bein' injected.", "Sophie Marceau", bean.getName()); assertEquals("The second property ain't bein' injected.", 31, bean.getAge()); assertEquals(tb, bean.getTestBean()); assertEquals(ctx, bean.getApplicationContext()); ContextScriptBean bean2 = (ContextScriptBean) ctx.getBean("bean2"); assertEquals(tb, bean2.getTestBean()); assertEquals(ctx, bean2.getApplicationContext()); }
Example #2
Source File: GroovyScriptFactoryTests.java From java-technology-stack with MIT License | 6 votes |
/** * Tests the SPR-2098 bug whereby no more than 1 property element could be * passed to a scripted bean :( */ @Test public void testCanPassInMoreThanOneProperty() { ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-multiple-properties.xml", getClass()); TestBean tb = (TestBean) ctx.getBean("testBean"); ContextScriptBean bean = (ContextScriptBean) ctx.getBean("bean"); assertEquals("The first property ain't bein' injected.", "Sophie Marceau", bean.getName()); assertEquals("The second property ain't bein' injected.", 31, bean.getAge()); assertEquals(tb, bean.getTestBean()); assertEquals(ctx, bean.getApplicationContext()); ContextScriptBean bean2 = (ContextScriptBean) ctx.getBean("bean2"); assertEquals(tb, bean2.getTestBean()); assertEquals(ctx, bean2.getApplicationContext()); }
Example #3
Source File: GroovyScriptFactoryTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Tests the SPR-2098 bug whereby no more than 1 property element could be * passed to a scripted bean :( */ @Test public void testCanPassInMoreThanOneProperty() { ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-multiple-properties.xml", getClass()); TestBean tb = (TestBean) ctx.getBean("testBean"); ContextScriptBean bean = (ContextScriptBean) ctx.getBean("bean"); assertEquals("The first property ain't bein' injected.", "Sophie Marceau", bean.getName()); assertEquals("The second property ain't bein' injected.", 31, bean.getAge()); assertEquals(tb, bean.getTestBean()); assertEquals(ctx, bean.getApplicationContext()); ContextScriptBean bean2 = (ContextScriptBean) ctx.getBean("bean2"); assertEquals(tb, bean2.getTestBean()); assertEquals(ctx, bean2.getApplicationContext()); try { ctx.getBean("bean3"); fail("Should have thrown BeanCreationException"); } catch (BeanCreationException ex) { // expected assertTrue(ex.contains(UnsatisfiedDependencyException.class)); } }