use of org.springframework.scripting.Messenger in project spring-framework by spring-projects.
the class StandardScriptFactoryTests method testInlineJsr223FromTagWithInterface.
@Test
public void testInlineJsr223FromTagWithInterface() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("jsr223-with-xsd.xml", getClass());
assertTrue(Arrays.asList(ctx.getBeanNamesForType(Messenger.class)).contains("inlineMessengerWithInterface"));
Messenger messenger = (Messenger) ctx.getBean("inlineMessengerWithInterface");
assertFalse(AopUtils.isAopProxy(messenger));
assertEquals("Hello World!", messenger.getMessage());
}
use of org.springframework.scripting.Messenger in project spring-framework by spring-projects.
the class StandardScriptFactoryTests method testRefreshableJsr223FromTagWithInterface.
@Test
public void testRefreshableJsr223FromTagWithInterface() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("jsr223-with-xsd.xml", getClass());
assertTrue(Arrays.asList(ctx.getBeanNamesForType(Messenger.class)).contains("refreshableMessengerWithInterface"));
Messenger messenger = (Messenger) ctx.getBean("refreshableMessengerWithInterface");
assertTrue(AopUtils.isAopProxy(messenger));
assertTrue(messenger instanceof Refreshable);
assertEquals("Hello World!", messenger.getMessage());
}
use of org.springframework.scripting.Messenger in project spring-framework by spring-projects.
the class StandardScriptFactoryTests method testJsr223FromTagWithInterface.
@Test
public void testJsr223FromTagWithInterface() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("jsr223-with-xsd.xml", getClass());
assertTrue(Arrays.asList(ctx.getBeanNamesForType(Messenger.class)).contains("messengerWithInterface"));
Messenger messenger = (Messenger) ctx.getBean("messengerWithInterface");
assertFalse(AopUtils.isAopProxy(messenger));
assertEquals("Hello World!", messenger.getMessage());
}
use of org.springframework.scripting.Messenger in project spring-framework by spring-projects.
the class GroovyScriptFactoryTests method testInlineJsr223FromTag.
@Test
public void testInlineJsr223FromTag() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd-jsr223.xml", getClass());
assertTrue(Arrays.asList(ctx.getBeanNamesForType(Messenger.class)).contains("inlineMessenger"));
Messenger messenger = (Messenger) ctx.getBean("inlineMessenger");
assertFalse(AopUtils.isAopProxy(messenger));
}
use of org.springframework.scripting.Messenger in project spring-framework by spring-projects.
the class GroovyScriptFactoryTests method testStaticScript.
@Test
public void testStaticScript() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovyContext.xml", getClass());
assertTrue(Arrays.asList(ctx.getBeanNamesForType(Calculator.class)).contains("calculator"));
assertTrue(Arrays.asList(ctx.getBeanNamesForType(Messenger.class)).contains("messenger"));
Calculator calc = (Calculator) ctx.getBean("calculator");
Messenger messenger = (Messenger) ctx.getBean("messenger");
assertFalse("Shouldn't get proxy when refresh is disabled", AopUtils.isAopProxy(calc));
assertFalse("Shouldn't get proxy when refresh is disabled", AopUtils.isAopProxy(messenger));
assertFalse("Scripted object should not be instance of Refreshable", calc instanceof Refreshable);
assertFalse("Scripted object should not be instance of Refreshable", messenger instanceof Refreshable);
assertEquals(calc, calc);
assertEquals(messenger, messenger);
assertTrue(!messenger.equals(calc));
assertTrue(messenger.hashCode() != calc.hashCode());
assertTrue(!messenger.toString().equals(calc.toString()));
String desiredMessage = "Hello World!";
assertEquals("Message is incorrect", desiredMessage, messenger.getMessage());
assertTrue(ctx.getBeansOfType(Calculator.class).values().contains(calc));
assertTrue(ctx.getBeansOfType(Messenger.class).values().contains(messenger));
}
Aggregations