From cf53bc6585fa2f2f439de060cacf5643ed3a6064 Mon Sep 17 00:00:00 2001 From: slavisa-baeldung Date: Sat, 17 Sep 2016 13:07:39 +0200 Subject: [PATCH] BAEL-226 - Source code for wicket --- pom.xml | 2 +- .../examples/ApplicationConfiguration.java | 10 ---- .../wicket/examples/WebAppInitializer.java | 26 --------- {wicket-intro => wicket}/README.md | 0 {wicket-intro/WicketIntro => wicket}/pom.xml | 54 ++++++------------- .../baeldung/wicket/examples/Examples.html | 0 .../baeldung/wicket/examples/Examples.java | 0 .../wicket/examples/ExamplesApplication.java | 0 .../examples/cafeaddress/CafeAddress.html | 0 .../examples/cafeaddress/CafeAddress.java | 0 .../examples/helloworld/HelloWorld.html | 0 .../examples/helloworld/HelloWorld.java | 0 .../wicket/examples/TestHomePage.java | 23 ++++++++ wicket/src/main/webapp/WEB-INF/web.xml | 32 +++++++++++ 14 files changed, 73 insertions(+), 74 deletions(-) delete mode 100644 wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ApplicationConfiguration.java delete mode 100644 wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/WebAppInitializer.java rename {wicket-intro => wicket}/README.md (100%) rename {wicket-intro/WicketIntro => wicket}/pom.xml (70%) rename {wicket-intro/WicketIntro => wicket}/src/main/java/com/baeldung/wicket/examples/Examples.html (100%) rename {wicket-intro/WicketIntro => wicket}/src/main/java/com/baeldung/wicket/examples/Examples.java (100%) rename {wicket-intro/WicketIntro => wicket}/src/main/java/com/baeldung/wicket/examples/ExamplesApplication.java (100%) rename {wicket-intro/WicketIntro => wicket}/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html (100%) rename {wicket-intro/WicketIntro => wicket}/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.java (100%) rename {wicket-intro/WicketIntro => wicket}/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.html (100%) rename {wicket-intro/WicketIntro => wicket}/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.java (100%) create mode 100644 wicket/src/main/test/java/com/baeldung/wicket/examples/TestHomePage.java create mode 100644 wicket/src/main/webapp/WEB-INF/web.xml diff --git a/pom.xml b/pom.xml index 8533a0d976..97a164b5b2 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ lombok redis webjars - wicket-intro + wicket mutation-testing spring-mvc-velocity diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ApplicationConfiguration.java b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ApplicationConfiguration.java deleted file mode 100644 index 2b42af9065..0000000000 --- a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ApplicationConfiguration.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.wicket.examples; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ComponentScan -public class ApplicationConfiguration { - -} diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/WebAppInitializer.java b/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/WebAppInitializer.java deleted file mode 100644 index 1b2d06d2dc..0000000000 --- a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/WebAppInitializer.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baeldung.wicket.examples; - -import javax.servlet.FilterRegistration; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; - -import org.apache.wicket.protocol.http.WicketFilter; -import org.springframework.web.WebApplicationInitializer; -import org.springframework.web.context.ContextLoaderListener; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; - -public class WebAppInitializer implements WebApplicationInitializer { - - @Override - public void onStartup(ServletContext container) throws ServletException { - AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); - container.addListener(new ContextLoaderListener(context)); - context.register(ApplicationConfiguration.class); - - FilterRegistration filter = container.addFilter("ExamplesApplication", WicketFilter.class); - filter.setInitParameter("applicationClassName", ExamplesApplication.class.getName()); - filter.setInitParameter(WicketFilter.FILTER_MAPPING_PARAM, "/*"); - filter.addMappingForUrlPatterns(null, false, "/*"); - } - -} \ No newline at end of file diff --git a/wicket-intro/README.md b/wicket/README.md similarity index 100% rename from wicket-intro/README.md rename to wicket/README.md diff --git a/wicket-intro/WicketIntro/pom.xml b/wicket/pom.xml similarity index 70% rename from wicket-intro/WicketIntro/pom.xml rename to wicket/pom.xml index f4b1d0e11c..929f723c2c 100644 --- a/wicket-intro/WicketIntro/pom.xml +++ b/wicket/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 com.baeldung.wicket.examples @@ -13,13 +13,9 @@ 9.2.13.v20150730 2.5 4.12 - 4.1.1.RELEASE - 3.1.0 - 8.0.0-M1 3.5.1 2.6 UTF-8 - none @@ -29,24 +25,6 @@ ${wicket.version} - - - - org.springframework - spring-web - ${spring-web.version} - - - javax.servlet - javax.servlet-api - ${javax.servlet-api.version} - - - org.apache.wicket - wicket-spring - ${wicket-spring.version} - - junit @@ -64,7 +42,6 @@ - WicketIntro false @@ -81,6 +58,22 @@ + + + false + src/test/resources + + + false + src/test/java + + ** + + + **/*.java + + + true @@ -110,17 +103,4 @@ - - - - Apache Nexus - https://repository.apache.org/content/repositories/snapshots/ - - false - - - true - - - diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/Examples.html b/wicket/src/main/java/com/baeldung/wicket/examples/Examples.html similarity index 100% rename from wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/Examples.html rename to wicket/src/main/java/com/baeldung/wicket/examples/Examples.html diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/Examples.java b/wicket/src/main/java/com/baeldung/wicket/examples/Examples.java similarity index 100% rename from wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/Examples.java rename to wicket/src/main/java/com/baeldung/wicket/examples/Examples.java diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ExamplesApplication.java b/wicket/src/main/java/com/baeldung/wicket/examples/ExamplesApplication.java similarity index 100% rename from wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/ExamplesApplication.java rename to wicket/src/main/java/com/baeldung/wicket/examples/ExamplesApplication.java diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html b/wicket/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html similarity index 100% rename from wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html rename to wicket/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.html diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.java b/wicket/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.java similarity index 100% rename from wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.java rename to wicket/src/main/java/com/baeldung/wicket/examples/cafeaddress/CafeAddress.java diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.html b/wicket/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.html similarity index 100% rename from wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.html rename to wicket/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.html diff --git a/wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.java b/wicket/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.java similarity index 100% rename from wicket-intro/WicketIntro/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.java rename to wicket/src/main/java/com/baeldung/wicket/examples/helloworld/HelloWorld.java diff --git a/wicket/src/main/test/java/com/baeldung/wicket/examples/TestHomePage.java b/wicket/src/main/test/java/com/baeldung/wicket/examples/TestHomePage.java new file mode 100644 index 0000000000..a393f1d178 --- /dev/null +++ b/wicket/src/main/test/java/com/baeldung/wicket/examples/TestHomePage.java @@ -0,0 +1,23 @@ +package com.baeldung.wicket.examples; + +import org.apache.wicket.util.tester.WicketTester; +import org.junit.Before; +import org.junit.Test; + +public class TestHomePage { + private WicketTester tester; + + @Before + public void setUp() { + tester = new WicketTester(new ExamplesApplication()); + } + + @Test + public void whenPageInvoked_thanRenderedOK() { + //start and render the test page + tester.startPage(Examples.class); + + //assert rendered page class + tester.assertRenderedPage(Examples.class); + } +} diff --git a/wicket/src/main/webapp/WEB-INF/web.xml b/wicket/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..8a4451c80e --- /dev/null +++ b/wicket/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,32 @@ + + + + CafeAddress + + + + + wicket.examples + org.apache.wicket.protocol.http.WicketFilter + + applicationClassName + com.baeldung.wicket.examples.ExamplesApplication + + + + + wicket.examples + /* + + \ No newline at end of file