Browse Source

Upgraded Wicket to 7.1 and other deps as well

Martijn Dashorst 9 years ago
parent
commit
a08515ceb0

+ 24 - 30
frameworks/Java/wicket/pom.xml

@@ -5,13 +5,12 @@
 	<artifactId>hellowicket</artifactId>
 	<packaging>war</packaging>
 	<version>1.0-SNAPSHOT</version>
-	<!-- TODO project name  -->
-	<name>quickstart</name>
-	<description></description>
-	<!--
-		TODO <organization> <name>company name</name> <url>company url</url>
-		</organization>
-	-->
+	<name>Hello Wicket</name>
+	<description>Wicket project for the TechEmpower Benchmark</description>
+	<organization>
+		<name>TechEmpower</name>
+		<url>https://github.com/TechEmpower/FrameworkBenchmarks</url>
+	</organization>
 	<licenses>
 		<license>
 			<name>The Apache Software License, Version 2.0</name>
@@ -21,12 +20,12 @@
 	</licenses>
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<wicket.version>6.16.0</wicket.version>
-		<jetty.version>8.1.14.v20131031</jetty.version>
-		<slf4j.version>1.7.7</slf4j.version>
+		<wicket.version>7.1.0</wicket.version>
+		<jetty.version>8.1.18.v20150929</jetty.version>
+		<slf4j.version>1.7.12</slf4j.version>
 	</properties>
 	<dependencies>
-		<!--  WICKET DEPENDENCIES -->
+		<!-- WICKET DEPENDENCIES -->
 		<dependency>
 			<groupId>org.apache.wicket</groupId>
 			<artifactId>wicket-core</artifactId>
@@ -37,7 +36,7 @@
 		<dependency>
 			<groupId>com.zaxxer</groupId>
 			<artifactId>HikariCP</artifactId>
-			<version>1.4.0</version>
+			<version>2.4.3</version>
 			<scope>compile</scope>
 		</dependency>
 
@@ -53,32 +52,32 @@
 			<version>1.2.17</version>
 		</dependency>
 
-		<!--  JUNIT DEPENDENCY FOR TESTING -->
+		<!-- JUNIT DEPENDENCY FOR TESTING -->
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
-			<version>4.11</version>
+			<version>4.12</version>
 			<scope>test</scope>
 		</dependency>
 
-		<!--  JETTY DEPENDENCIES FOR TESTING  -->
+		<!-- JETTY DEPENDENCIES FOR TESTING -->
 		<dependency>
 			<groupId>org.eclipse.jetty.aggregate</groupId>
 			<artifactId>jetty-all-server</artifactId>
 			<version>${jetty.version}</version>
 			<scope>provided</scope>
 		</dependency>
-		
-		 <dependency>
+
+		<dependency>
 			<groupId>com.fasterxml.jackson.core</groupId>
 			<artifactId>jackson-databind</artifactId>
-			<version>2.3.2</version>
+			<version>2.7.0</version>
 		</dependency>
 
 		<dependency>
-		  <groupId>mysql</groupId>
-		  <artifactId>mysql-connector-java</artifactId>
-		  <version>5.1.31</version>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<version>5.1.38</version>
 		</dependency>
 	</dependencies>
 	<build>
@@ -137,13 +136,9 @@
 							<port>8080</port>
 							<maxIdleTime>3600000</maxIdleTime>
 						</connector>
-						<!--connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector">
-							<port>8443</port>
-							<maxIdleTime>3600000</maxIdleTime>
-							<keystore>${project.build.directory}/test-classes/keystore</keystore>
-							<password>wicket</password>
-							<keyPassword>wicket</keyPassword>
-						</connector-->
+						<!--connector implementation="org.eclipse.jetty.server.ssl.SslSocketConnector"> 
+							<port>8443</port> <maxIdleTime>3600000</maxIdleTime> <keystore>${project.build.directory}/test-classes/keystore</keystore> 
+							<password>wicket</password> <keyPassword>wicket</keyPassword> </connector -->
 					</connectors>
 				</configuration>
 			</plugin>
@@ -162,5 +157,4 @@
 			</snapshots>
 		</repository>
 	</repositories>
-
-	</project>
+</project>

+ 1 - 1
frameworks/Java/wicket/src/main/java/hellowicket/BasePage.java

@@ -4,5 +4,5 @@ import org.apache.wicket.markup.html.WebPage;
 
 public class BasePage extends WebPage
 {
-  
+  private static final long serialVersionUID = 1L;
 }

+ 5 - 5
frameworks/Java/wicket/src/main/java/hellowicket/WicketApplication.java

@@ -4,7 +4,7 @@ import javax.naming.InitialContext;
 import javax.sql.DataSource;
 
 import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.settings.IRequestCycleSettings;
+import org.apache.wicket.settings.RequestCycleSettings;
 
 import com.zaxxer.hikari.HikariDataSource;
 
@@ -42,7 +42,7 @@ public class WicketApplication extends WebApplication
 
 		// disable response caching to be more close to other
 		// test applications' behavior
-		IRequestCycleSettings requestCycleSettings = getRequestCycleSettings();
+		RequestCycleSettings requestCycleSettings = getRequestCycleSettings();
 		requestCycleSettings.setBufferResponse(false);
 
 		// set UTF-8 for /fortunes test
@@ -85,17 +85,17 @@ public class WicketApplication extends WebApplication
 				InitialContext jndiContext = new InitialContext();
 				dataSource = (DataSource) jndiContext.lookup("java:comp/env/jdbc/hello_world");
 			}
-			else
+			else try(HikariDataSource ds = new HikariDataSource();)
 			{
 				// use faster DataSource impl
-				HikariDataSource ds = new HikariDataSource();
 				ds.setJdbcUrl("jdbc:mysql://localhost:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true");
 				ds.setDriverClassName("com.mysql.jdbc.Driver");
 				ds.setUsername("benchmarkdbuser");
 				ds.setPassword("benchmarkdbpass");
 				dataSource = ds;
 			}
-		} catch (Exception x)
+		}
+        catch (Exception x)
 		{
 			throw new RuntimeException("Cannot create the data source", x);
 		}

+ 37 - 43
frameworks/Java/wicket/src/main/java/hellowicket/fortune/FortunePage.java

@@ -16,48 +16,42 @@ import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.ListView;
 
 /**
- * A page that loads all fortune cookies
+ * A page that loads all fortune cookies. This mimics the Servlet example
+ * exactly, without any further optimizations that one could do such as sorting
+ * in the database, or not sorting at all.
  */
-public class FortunePage extends WebPage
-{
-  public FortunePage() throws Exception
-  {
-    List<Fortune> fortunes = new ArrayList<>(10000);
-
-    Fortune newFortune = new Fortune(0, "Additional fortune added at request time.");
-    fortunes.add(newFortune);
-
-    DataSource dataSource = WicketApplication.get().getDataSource();
-    try (Connection connection = dataSource.getConnection())
-    {
-      try (PreparedStatement statement = connection.prepareStatement("SELECT * FROM Fortune",
-              ResultSet.TYPE_FORWARD_ONLY,
-              ResultSet.CONCUR_READ_ONLY))
-      {
-          try (ResultSet resultSet = statement.executeQuery())
-          {
-              while (resultSet.next())
-              {
-                  fortunes.add(new Fortune(
-                          resultSet.getInt("id"),
-                          resultSet.getString("message")));
-              }
-          }
-      }
-    }
-
-    Collections.sort(fortunes);
-
-    ListView<Fortune> listView = new ListView<Fortune>("fortunes", fortunes)
-    {
-      @Override
-      protected void populateItem(ListItem<Fortune> item)
-      {
-        Fortune fortune = item.getModelObject();
-        item.add(new Label("id", fortune.id));
-        item.add(new Label("message", fortune.message));
-      }
-    };
-    add(listView);
-  }
+public class FortunePage extends WebPage {
+	private static final long serialVersionUID = 1L;
+
+	public FortunePage() throws Exception {
+		List<Fortune> fortunes = new ArrayList<>(10000);
+
+		DataSource dataSource = WicketApplication.get().getDataSource();
+		try ( //
+				Connection connection = dataSource.getConnection();
+				PreparedStatement statement = connection.prepareStatement("SELECT id, message FROM Fortune",
+						ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+				ResultSet resultSet = statement.executeQuery();) {
+
+			while (resultSet.next()) {
+				fortunes.add(new Fortune(resultSet.getInt("id"), resultSet.getString("message")));
+			}
+		}
+
+		fortunes.add(new Fortune(0, "Additional fortune added at request time."));
+
+		Collections.sort(fortunes);
+
+		ListView<Fortune> listView = new ListView<Fortune>("fortunes", fortunes) {
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			protected void populateItem(ListItem<Fortune> item) {
+				Fortune fortune = item.getModelObject();
+				item.add(new Label("id", fortune.id));
+				item.add(new Label("message", fortune.message));
+			}
+		};
+		add(listView);
+	}
 }