25.02.2015 Views

Introducing Spring Framework

Introducing Spring Framework

Introducing Spring Framework

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 14 ■ Using Dynamic Languages<br />

}<br />

boolean isAuthorized(String email, String pass) {<br />

if(username==email &amp;&amp; password==pass)<br />

return true<br />

return false<br />

}<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Listing 14-7 shows you the same Groovy script but now within the XML configuration. If you run the same unit<br />

test (see Listing 14-6), you should get the same result:<br />

2014-05-18 00:10:59,835 DEBUG [Test worker] Testing Security...<br />

2014-05-18 00:10:59,854 DEBUG [Test worker] Validating Credentials > email:john@email.com, pass:doe<br />

com.apress.isf.spring.test.MyDocumentsTest > testBeanShell PASSED<br />

Using JRuby and Bean Shell<br />

Next, let’s see how the JRuby and Bean shell works. Listings 14-8 and 14-9 contain the declaration of the other two<br />

dynamic languages.<br />

Listing 14-8. mydocuments-context.xml<br />

<br />

<br />

<br />

200

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!