22
Thursday, April 28, 2011

Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

Thursday, April 28, 2011

Page 2: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

JavaEE and Google AppEngine

Aleš Justin, JBoss by Red Hat

Thursday, April 28, 2011

Page 3: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•What is GAE and CDI?•Why GAE and CDI?•Other JavaEE technologies•Development vs. Production•Problems vs. Solutions•Testing•Q & A

Agenda

Thursday, April 28, 2011

Page 4: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•Old school JBoss-ian•Microcontainer co-author•Weld lead•RHT Cloud “guinea pig”

•Eager PaaS user•While still GAE amateur

About me

Thursday, April 28, 2011

Page 5: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•Forked Jetty•Many (logical) restrictions•RDBMS → BigTable•Simple Map(Reduce)•Good administration•Free basic usage

GAE

Thursday, April 28, 2011

Page 6: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•Context and Dependency Injection•JSR-299 → JBoss Weld RI•“type-safe” programming•“contexts” concept•Easy to extend: “Extensions”•“CDI extension n00b ...” up next

CDI

Thursday, April 28, 2011

Page 7: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•Simple reason: sandbox app•Android app with server back-end•Tattletale (Tožibaba)

•Zero administration / configuration•Reliable up-time•No more “boiler-plate” code → CDI

Why GAE and CDI?

Thursday, April 28, 2011

Page 8: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•@Inject•@Qualifier•@Named•@Scope•Interceptors•InjectionPoint•Instance•@Produces

•@Observes•@ConversationS.•@Decorator•@Alternative•@Sterotype

•Catch @Any CDI session!

CDI #2

Thursday, April 28, 2011

Page 9: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•JPA•JSF2•BeanValidation•javax.cache•JSON•ShrinkWrap + Arquillian

Other technologies

Thursday, April 28, 2011

Page 10: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•Know (all) restrictions!•30sec, white-list, no threads, ...

•How portable should my app be?•Development vs. Production Env!•Frameworks have problems•But they mostly have (easy) solutions → fork?

Project Kick-Off

Thursday, April 28, 2011

Page 11: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•Abstract away GAE API•Pure JavaEE•Port app to JBossAS (6 & 7)

•Use CDI as much as possible•Test it all, same as other JavaEE apps

The Goal

Thursday, April 28, 2011

Page 12: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•CDI•“Entry” mechanism•Request / response binding•Lack of “lifecycle” handling

Bean

ProxyInitial problems

Thursday, April 28, 2011

Page 13: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•JPA•Limited relationships (Entity groups)•Proxying layer vs. Custom “ORM”

•Transaction per “Entity group”•Old DataNucleus version•Long vs. Key entity key•“Enhanced” entities•GeoModel hashing queries (“IN”)

Initial problems

Thursday, April 28, 2011

Page 14: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•JSF2•Context parameter settings•“new InitialContext” patch•“built-in” EL 1.0 → workaround

Initial problems

Thursday, April 28, 2011

Page 15: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•BeanValidation•Static usage with JPA•Size•Configuration

Initial problems

Thursday, April 28, 2011

Page 16: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•javax.cache (GCache)•No partition•NUCCORE-540 → fork

•JSON•Different versions; client vs. server

•Arquillian•Missing GAE container

Initial problems

Thursday, April 28, 2011

Page 17: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•CDI•“Bean scanning” → exact listing•“Lazy beans” → MVC re-write•GZIP + Base64 usage•“Fall-back / repeat” mechanism

“Production” problems

Thursday, April 28, 2011

Page 18: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•JPA•Explicit entity listing•Maximize cache usage•“Caching” → Lazy EMF

•javax.cache•serialVersionUID•Non-primitive variables•Cache evict / clear mechanism

“Production” problems

Thursday, April 28, 2011

Page 19: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•ShrinkWrap•Binaries abstraction

•Arquillian•Runtime / Env abstraction•https://github.com/alesj/arquillian

Testing

Thursday, April 28, 2011

Page 20: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•Lhotse POC•https://github.com/alesj/lhotse

Server-API

Server-JEEServer-GAE

Tattletale

Lhotse

Tattletale

Thursday, April 28, 2011

Page 21: Thursday, April 28, 2011 · •Testing •Q & A Agenda Thursday, April 28, 2011 ... •Test it all, same as other JavaEE apps The Goal Thursday, April 28, 2011 •CDI •“Entry”

•Integrated & tested•GAE•JBossAS v6 & v7•GlassFish 3.1

•Important differences•Libraries usage

•Configuration ➚•Bugs, ...

•@Entity on @MappedSuperclass•Enhanced entities + JDO

Lhotse POC

Thursday, April 28, 2011