SlideShare uma empresa Scribd logo
1 de 47
Baixar para ler offline
Get your application
     in production...




               ...and keep your
               weekends free
                        Martijn Dashorst
                                 Topicus
6 WAYS TO KEEP YOUR JOB
OUT OF YOUR WEEKEND
1. USE WICKET TESTER
WICKETTESTER

• Test   components directly, or their markup

• Runs   tests without starting server

• Ajax   testing (server side)

• Runs   in IDE, ant, maven builds

• Achieves   high code coverage
HELLOWORLD TEST
@Test
public void labelContainsHelloWorld() {
}
HELLOWORLD TEST
@Test
public void labelContainsHelloWorld() {
  WicketTester tester = new WicketTester();
}
HELLOWORLD TEST
@Test
public void labelContainsHelloWorld() {
  WicketTester tester = new WicketTester();
  tester.startPage(HelloWorld.class);
}
HELLOWORLD TEST
@Test
public void labelContainsHelloWorld() {
  WicketTester tester = new WicketTester();
  tester.startPage(HelloWorld.class);
  tester.assertLabel(quot;messagequot;, quot;Hello, World!quot;);
}
LINK TEST
@Test
public void countingLinkClickTest() {
}
LINK TEST
@Test
public void countingLinkClickTest() {
  WicketTester tester = new WicketTester();
}
LINK TEST
@Test
public void countingLinkClickTest() {
  WicketTester tester = new WicketTester();
  tester.startPage(LinkCounter.class);
}
LINK TEST
@Test
public void countingLinkClickTest() {
  WicketTester tester = new WicketTester();
  tester.startPage(LinkCounter.class);
  tester.assertModelValue(quot;labelquot;, 0);
}
LINK TEST
@Test
public void countingLinkClickTest() {
  WicketTester tester = new WicketTester();
  tester.startPage(LinkCounter.class);
  tester.assertModelValue(quot;labelquot;, 0);
  tester.clickLink(quot;linkquot;);
}
LINK TEST
@Test
public void countingLinkClickTest() {
  WicketTester tester = new WicketTester();
  tester.startPage(LinkCounter.class);
  tester.assertModelValue(quot;labelquot;, 0);
  tester.clickLink(quot;linkquot;);
  tester.assertModelValue(quot;labelquot;, 1);
}
NAVIGATION TEST
@Test
public void navigateToSecondPage() {
}
NAVIGATION TEST
@Test
public void navigateToSecondPage() {
  WicketTester tester = new WicketTester();
  tester.startPage(new FirstPage());
}
NAVIGATION TEST
@Test
public void navigateToSecondPage() {
  WicketTester tester = new WicketTester();
  tester.startPage(new FirstPage());
  tester.clickLink(quot;linkquot;);
}
NAVIGATION TEST
@Test
public void navigateToSecondPage() {
  WicketTester tester = new WicketTester();
  tester.startPage(new FirstPage());
  tester.clickLink(quot;linkquot;);
  tester.assertRenderedPage(SecondPage.class);
}
2. PAGE CHECK
PAGES IN EDUARTE


• Pages    must have @PageInfo annotation

• Policy   file must contain existing pages

• All   secure pages must be in the policy file
PAGE INFO ANNOTATION
@PageInfo(
  title = quot;Intake stap 1 van 4quot;,
  menu = {quot;Deelnemer > intakequot;}
)
public class IntakePersonalia extends IntakeWizardPage
{
  ...
}
Our build fails for any
 of these problems...
3. ENTITY CHECKER
Storing Hibernate entities in
your pages is bad...



                   ...mkay
WICKET SERIALIZABLE
                 CHECKER


• Runs    when page is serialized

• Tries   to find non-serializable objects attached to page

• Helpful   stacktraces
EXAMPLE STACKTRACE

Unable to serialize class: nl.topicus.project.entities.personen.Persoon
Field hierarchy is:
  2 [class=nl.topicus.project.SomePage, path=2]
   nl.topicus.project.entities.personen.Persoon
       nl.topicus.project.SomePage.persoon <----- Entity
WICKET SERIALIZER CHECK
public class TopicusRequestCycle extends WebRequestCycle {
  public void onEndRequest() {
      Page requestPage = getRequest().getPage();
      testDetachedObjects(requestPage);

        if (getRequestTarget() instanceof IPageRequestTarget) {
             Page responsePage = getRequestTarget().getPage();
             if (responsePage != requestPage) {
                 testDetachedObjects(responsePage);
             }
         }
    }
}
WICKET SERIALIZER CHECK
if (page == null || page.isErrorPage()) {
    return;
}

try {
   checker = new EntityAndSerializableChecker(
         new NotSerializableException());
   checker.writeObject(page);
} catch (Exception e) {
   log.error(quot;Couldn't serialize: quot; + page + quot;, error: quot; + ex);
}
WICKET SERIALIZER CHECK
private void check(Object obj) {
   Class cls = obj.getClass();
   nameStack.add(simpleName);
   traceStack.add(new TraceSlot(obj, fieldDescription));

    if (!(obj instanceof Serializable) && (!Proxy.isProxyClass(cls)))
    {
         throw new WicketNotSerializableException(/* ... */);
    }
    ... complicated stuff ...
}
WICKET SERIALIZER CHECK
if (!(obj instanceof Serializable) && (!Proxy.isProxyClass(cls))) {
    throw new WicketNotSerializableException(/* .. */)
        .toString(), exception);
}
if (obj instanceof IdObject) {
    Serializable id = ((IdObject) obj).getIdAsSerializable();
    if (id != null && !(id instanceof Long && ((Long) id) <= 0)) {
        throw new WicketContainsEntityException(/* ... */);
    }
}

... complicated stuff ...
To ensure developers
have to fix it immediately...


     ...an Ajax callback checks for these
        errors and renders an ErrorPage
4. MARKUP VALIDATOR
VALID MARKUP...



• Nobody   cares about valid markup

• XHTML    is dead
INVALID MARKUP...


             do care
• Browsers

• Subtle   differences between browser DOM handling

• Ajax   becomes a pain
WICKET STUFF HTML
              VALIDATOR


• http://github.com/dashorst/wicket-stuff-markup-validator

• Based   on: http://tuckey.org/validation
ADD DEPENDENCY TO POM
<dependency>
  <groupId>org.wicketstuff</groupId>
  <artifactId>htmlvalidator</artifactId>
  <version>1.0</version>
  <scope>test</scope>
</dependency>
ADD FILTER TO WEBAPP
public class MyApplication extends WebApplication {
  // ...

    @Override
    protected void init() {
      // only enable the markup filter in DEVELOPMENT mode
      if(DEVELOPMENT.equals(getConfigurationType())) {
          getRequestCycleSettings()
             .addResponseFilter(new HtmlValidationResponseFilter());
      }
    }
}
DEFINE PROPER DOCTYPE
<!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Transitional//EN
  quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdquot;>
<html xmlns=quot;http://www.w3.org/1999/xhtmlquot;>
<head>
  <title>Foo</title>
</head>
<body>
</body>
</html>
... AND ENDURE THE HORRORS
OF VALID MARKUP
5. REQUESTLOGGER
REQUEST LOGGER

• HTTPD   logs are (mostly) useless for Wicket applications

 • POST   /vocus/app?wicket:interface=:4:lijst::IBehaviorListener...

 • GET   /vocus/app?wicket:interface=:1084::

• RequestLogger   provides decoded information:

 • Page, Listener, RequestTarget, SessionID, etc.
14:00:19 time=101,
   event=Interface[
      target:DefaultMenuLink(menu:personalia:dropitem
      page: nl.topicus.gui.student.ToonPersonaliaPage(4)
      interface: ILinkListener:onLinkClicked],
   response=PageRequest[
      nl.topicus.gui.student.ToonLeerlingRelatiesPage(6)]
   sessioninfo=[
      sessionId=D574D35FF49C047E4F290FE
      clientInfo=ClientProperties{
          remoteAddress=192.0.2.50,
          browserVersionMajor=7,
          browserInternetExplorer=true},
      organization=Demo School
      username=administrator],
   sessionstart=Fri Dec 14 13:59:14 CET 2008,
   requests=14,
   totaltime=3314
REQUEST LOST PARSER
6. RABID MONITORING
NABAZTAG


• Availability   of production applications

• Performance       of production applications

• Hudson     builds

• Issue   tracker
THANK YOU!

Mais conteúdo relacionado

Mais procurados

Developing modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular jsDeveloping modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular js
Shekhar Gulati
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011
Shreedhar Ganapathy
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud
Shekhar Gulati
 

Mais procurados (20)

Developing modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular jsDeveloping modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular js
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011
 
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
#NoXML: Eliminating XML in Spring Projects - SpringOne 2GX 2015
 
Spark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RSSpark IT 2011 - Developing RESTful Web services with JAX-RS
Spark IT 2011 - Developing RESTful Web services with JAX-RS
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud
 
Node.JS error handling best practices
Node.JS error handling best practicesNode.JS error handling best practices
Node.JS error handling best practices
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
From JavaEE to AngularJS
From JavaEE to AngularJSFrom JavaEE to AngularJS
From JavaEE to AngularJS
 
Aligning Ember.js with Web Standards
Aligning Ember.js with Web StandardsAligning Ember.js with Web Standards
Aligning Ember.js with Web Standards
 
A Gentle Introduction to Angular Schematics - Angular SF 2019
A Gentle Introduction to Angular Schematics - Angular SF 2019A Gentle Introduction to Angular Schematics - Angular SF 2019
A Gentle Introduction to Angular Schematics - Angular SF 2019
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
Intoduction to Play Framework
Intoduction to Play FrameworkIntoduction to Play Framework
Intoduction to Play Framework
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 
Hack the Future
Hack the FutureHack the Future
Hack the Future
 
Spark IT 2011 - Java EE 6 Workshop
Spark IT 2011 - Java EE 6 WorkshopSpark IT 2011 - Java EE 6 Workshop
Spark IT 2011 - Java EE 6 Workshop
 
Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021Java REST API Framework Comparison - PWX 2021
Java REST API Framework Comparison - PWX 2021
 
Agility Requires Safety
Agility Requires SafetyAgility Requires Safety
Agility Requires Safety
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 

Semelhante a Keep your Wicket application in production

Ajax World Comet Talk
Ajax World Comet TalkAjax World Comet Talk
Ajax World Comet Talk
rajivmordani
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
Carles Farré
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
Tomek Kaczanowski
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Robot Media
 

Semelhante a Keep your Wicket application in production (20)

My java file
My java fileMy java file
My java file
 
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Pattern
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2Migrating from Struts 1 to Struts 2
Migrating from Struts 1 to Struts 2
 
Retrofitting
RetrofittingRetrofitting
Retrofitting
 
Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018Testing for fun in production Into The Box 2018
Testing for fun in production Into The Box 2018
 
Ajax World Comet Talk
Ajax World Comet TalkAjax World Comet Talk
Ajax World Comet Talk
 
Mpg Dec07 Gian Lorenzetto
Mpg Dec07 Gian Lorenzetto Mpg Dec07 Gian Lorenzetto
Mpg Dec07 Gian Lorenzetto
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
 
What's Coming in Spring 3.0
What's Coming in Spring 3.0What's Coming in Spring 3.0
What's Coming in Spring 3.0
 
Software engineering ⊇ Software testing
Software engineering ⊇ Software testingSoftware engineering ⊇ Software testing
Software engineering ⊇ Software testing
 
Clean Code - A&BP CC
Clean Code - A&BP CCClean Code - A&BP CC
Clean Code - A&BP CC
 
General Principles of Web Security
General Principles of Web SecurityGeneral Principles of Web Security
General Principles of Web Security
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
Android testing
Android testingAndroid testing
Android testing
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Revolution or Evolution in Page Object
Revolution or Evolution in Page ObjectRevolution or Evolution in Page Object
Revolution or Evolution in Page Object
 

Mais de Martijn Dashorst

Mais de Martijn Dashorst (19)

HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
HTMX: Web 1.0 with the benefits of Web 2.0 without the grift of Web 3.0
 
From Floppy Disks to Cloud Deployments
From Floppy Disks to Cloud DeploymentsFrom Floppy Disks to Cloud Deployments
From Floppy Disks to Cloud Deployments
 
SOLID principles
SOLID principlesSOLID principles
SOLID principles
 
Converting 85% of Dutch Primary Schools from Oracle to PostgreSQL
Converting 85% of Dutch Primary Schools from Oracle to PostgreSQLConverting 85% of Dutch Primary Schools from Oracle to PostgreSQL
Converting 85% of Dutch Primary Schools from Oracle to PostgreSQL
 
Solutions for when documentation fails
Solutions for when documentation fails Solutions for when documentation fails
Solutions for when documentation fails
 
Code review drinking game
Code review drinking gameCode review drinking game
Code review drinking game
 
Java Serialization Deep Dive
Java Serialization Deep DiveJava Serialization Deep Dive
Java Serialization Deep Dive
 
Code review drinking game
Code review drinking gameCode review drinking game
Code review drinking game
 
Scrum: van praktijk naar onderwijs
Scrum: van praktijk naar onderwijsScrum: van praktijk naar onderwijs
Scrum: van praktijk naar onderwijs
 
Who Automates the Automators? (Quis Automatiet Ipsos Automates?)
Who Automates the Automators? (Quis Automatiet Ipsos Automates?)Who Automates the Automators? (Quis Automatiet Ipsos Automates?)
Who Automates the Automators? (Quis Automatiet Ipsos Automates?)
 
De schone coder
De schone coderDe schone coder
De schone coder
 
Apache Wicket and Java EE sitting in a tree
Apache Wicket and Java EE sitting in a treeApache Wicket and Java EE sitting in a tree
Apache Wicket and Java EE sitting in a tree
 
Wicket 2010
Wicket 2010Wicket 2010
Wicket 2010
 
Vakmanschap is meesterschap
Vakmanschap is meesterschapVakmanschap is meesterschap
Vakmanschap is meesterschap
 
Wicket In Action - oredev2008
Wicket In Action - oredev2008Wicket In Action - oredev2008
Wicket In Action - oredev2008
 
Guide To Successful Graduation at Apache
Guide To Successful Graduation at ApacheGuide To Successful Graduation at Apache
Guide To Successful Graduation at Apache
 
Wicket In Action
Wicket In ActionWicket In Action
Wicket In Action
 
Apache Wicket: Web Applications With Just Java
Apache Wicket: Web Applications With Just JavaApache Wicket: Web Applications With Just Java
Apache Wicket: Web Applications With Just Java
 
Wicket Live on Stage
Wicket Live on StageWicket Live on Stage
Wicket Live on Stage
 

Último

Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
lizamodels9
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
daisycvs
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
amitlee9823
 
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
amitlee9823
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
allensay1
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
daisycvs
 
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
lizamodels9
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
dlhescort
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
Abortion pills in Kuwait Cytotec pills in Kuwait
 

Último (20)

Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
 
Falcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in indiaFalcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in india
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
 
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
Call Girls Electronic City Just Call 👗 7737669865 👗 Top Class Call Girl Servi...
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 MonthsSEO Case Study: How I Increased SEO Traffic & Ranking by 50-60%  in 6 Months
SEO Case Study: How I Increased SEO Traffic & Ranking by 50-60% in 6 Months
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
 
Whitefield CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
Whitefield CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLWhitefield CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
Whitefield CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Nelamangala Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptx
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
 
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
Call Girls From Raj Nagar Extension Ghaziabad❤️8448577510 ⊹Best Escorts Servi...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
Cheap Rate Call Girls In Noida Sector 62 Metro 959961乂3876
 
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort ServiceEluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
Eluru Call Girls Service ☎ ️93326-06886 ❤️‍🔥 Enjoy 24/7 Escort Service
 

Keep your Wicket application in production

  • 1. Get your application in production... ...and keep your weekends free Martijn Dashorst Topicus
  • 2. 6 WAYS TO KEEP YOUR JOB OUT OF YOUR WEEKEND
  • 3. 1. USE WICKET TESTER
  • 4. WICKETTESTER • Test components directly, or their markup • Runs tests without starting server • Ajax testing (server side) • Runs in IDE, ant, maven builds • Achieves high code coverage
  • 5. HELLOWORLD TEST @Test public void labelContainsHelloWorld() { }
  • 6. HELLOWORLD TEST @Test public void labelContainsHelloWorld() { WicketTester tester = new WicketTester(); }
  • 7. HELLOWORLD TEST @Test public void labelContainsHelloWorld() { WicketTester tester = new WicketTester(); tester.startPage(HelloWorld.class); }
  • 8. HELLOWORLD TEST @Test public void labelContainsHelloWorld() { WicketTester tester = new WicketTester(); tester.startPage(HelloWorld.class); tester.assertLabel(quot;messagequot;, quot;Hello, World!quot;); }
  • 9. LINK TEST @Test public void countingLinkClickTest() { }
  • 10. LINK TEST @Test public void countingLinkClickTest() { WicketTester tester = new WicketTester(); }
  • 11. LINK TEST @Test public void countingLinkClickTest() { WicketTester tester = new WicketTester(); tester.startPage(LinkCounter.class); }
  • 12. LINK TEST @Test public void countingLinkClickTest() { WicketTester tester = new WicketTester(); tester.startPage(LinkCounter.class); tester.assertModelValue(quot;labelquot;, 0); }
  • 13. LINK TEST @Test public void countingLinkClickTest() { WicketTester tester = new WicketTester(); tester.startPage(LinkCounter.class); tester.assertModelValue(quot;labelquot;, 0); tester.clickLink(quot;linkquot;); }
  • 14. LINK TEST @Test public void countingLinkClickTest() { WicketTester tester = new WicketTester(); tester.startPage(LinkCounter.class); tester.assertModelValue(quot;labelquot;, 0); tester.clickLink(quot;linkquot;); tester.assertModelValue(quot;labelquot;, 1); }
  • 15. NAVIGATION TEST @Test public void navigateToSecondPage() { }
  • 16. NAVIGATION TEST @Test public void navigateToSecondPage() { WicketTester tester = new WicketTester(); tester.startPage(new FirstPage()); }
  • 17. NAVIGATION TEST @Test public void navigateToSecondPage() { WicketTester tester = new WicketTester(); tester.startPage(new FirstPage()); tester.clickLink(quot;linkquot;); }
  • 18. NAVIGATION TEST @Test public void navigateToSecondPage() { WicketTester tester = new WicketTester(); tester.startPage(new FirstPage()); tester.clickLink(quot;linkquot;); tester.assertRenderedPage(SecondPage.class); }
  • 20. PAGES IN EDUARTE • Pages must have @PageInfo annotation • Policy file must contain existing pages • All secure pages must be in the policy file
  • 21. PAGE INFO ANNOTATION @PageInfo( title = quot;Intake stap 1 van 4quot;, menu = {quot;Deelnemer > intakequot;} ) public class IntakePersonalia extends IntakeWizardPage { ... }
  • 22. Our build fails for any of these problems...
  • 24. Storing Hibernate entities in your pages is bad... ...mkay
  • 25. WICKET SERIALIZABLE CHECKER • Runs when page is serialized • Tries to find non-serializable objects attached to page • Helpful stacktraces
  • 26. EXAMPLE STACKTRACE Unable to serialize class: nl.topicus.project.entities.personen.Persoon Field hierarchy is: 2 [class=nl.topicus.project.SomePage, path=2] nl.topicus.project.entities.personen.Persoon nl.topicus.project.SomePage.persoon <----- Entity
  • 27. WICKET SERIALIZER CHECK public class TopicusRequestCycle extends WebRequestCycle { public void onEndRequest() { Page requestPage = getRequest().getPage(); testDetachedObjects(requestPage); if (getRequestTarget() instanceof IPageRequestTarget) { Page responsePage = getRequestTarget().getPage(); if (responsePage != requestPage) { testDetachedObjects(responsePage); } } } }
  • 28. WICKET SERIALIZER CHECK if (page == null || page.isErrorPage()) { return; } try { checker = new EntityAndSerializableChecker( new NotSerializableException()); checker.writeObject(page); } catch (Exception e) { log.error(quot;Couldn't serialize: quot; + page + quot;, error: quot; + ex); }
  • 29. WICKET SERIALIZER CHECK private void check(Object obj) { Class cls = obj.getClass(); nameStack.add(simpleName); traceStack.add(new TraceSlot(obj, fieldDescription)); if (!(obj instanceof Serializable) && (!Proxy.isProxyClass(cls))) { throw new WicketNotSerializableException(/* ... */); } ... complicated stuff ... }
  • 30. WICKET SERIALIZER CHECK if (!(obj instanceof Serializable) && (!Proxy.isProxyClass(cls))) { throw new WicketNotSerializableException(/* .. */) .toString(), exception); } if (obj instanceof IdObject) { Serializable id = ((IdObject) obj).getIdAsSerializable(); if (id != null && !(id instanceof Long && ((Long) id) <= 0)) { throw new WicketContainsEntityException(/* ... */); } } ... complicated stuff ...
  • 31. To ensure developers have to fix it immediately... ...an Ajax callback checks for these errors and renders an ErrorPage
  • 33. VALID MARKUP... • Nobody cares about valid markup • XHTML is dead
  • 34. INVALID MARKUP... do care • Browsers • Subtle differences between browser DOM handling • Ajax becomes a pain
  • 35. WICKET STUFF HTML VALIDATOR • http://github.com/dashorst/wicket-stuff-markup-validator • Based on: http://tuckey.org/validation
  • 36. ADD DEPENDENCY TO POM <dependency> <groupId>org.wicketstuff</groupId> <artifactId>htmlvalidator</artifactId> <version>1.0</version> <scope>test</scope> </dependency>
  • 37. ADD FILTER TO WEBAPP public class MyApplication extends WebApplication { // ... @Override protected void init() { // only enable the markup filter in DEVELOPMENT mode if(DEVELOPMENT.equals(getConfigurationType())) { getRequestCycleSettings() .addResponseFilter(new HtmlValidationResponseFilter()); } } }
  • 38. DEFINE PROPER DOCTYPE <!DOCTYPE html PUBLIC quot;-//W3C//DTD XHTML 1.0 Transitional//EN quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdquot;> <html xmlns=quot;http://www.w3.org/1999/xhtmlquot;> <head> <title>Foo</title> </head> <body> </body> </html>
  • 39. ... AND ENDURE THE HORRORS OF VALID MARKUP
  • 41. REQUEST LOGGER • HTTPD logs are (mostly) useless for Wicket applications • POST /vocus/app?wicket:interface=:4:lijst::IBehaviorListener... • GET /vocus/app?wicket:interface=:1084:: • RequestLogger provides decoded information: • Page, Listener, RequestTarget, SessionID, etc.
  • 42. 14:00:19 time=101, event=Interface[ target:DefaultMenuLink(menu:personalia:dropitem page: nl.topicus.gui.student.ToonPersonaliaPage(4) interface: ILinkListener:onLinkClicked], response=PageRequest[ nl.topicus.gui.student.ToonLeerlingRelatiesPage(6)] sessioninfo=[ sessionId=D574D35FF49C047E4F290FE clientInfo=ClientProperties{ remoteAddress=192.0.2.50, browserVersionMajor=7, browserInternetExplorer=true}, organization=Demo School username=administrator], sessionstart=Fri Dec 14 13:59:14 CET 2008, requests=14, totaltime=3314
  • 45.
  • 46. NABAZTAG • Availability of production applications • Performance of production applications • Hudson builds • Issue tracker