From 9a22dd820ab43c0068a09683acf6dba890626ab4 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Sat, 21 Jul 2018 15:55:43 +0200 Subject: [PATCH] Issue #2679 - h2spec compliance. Integrated h2spec execution in the Maven build. Signed-off-by: Simone Bordet --- jetty-http2/http2-server/pom.xml | 108 +++++++++++------- .../jetty/http2/server/H2SpecServer.java | 48 ++++++++ pom.xml | 5 + 3 files changed, 118 insertions(+), 43 deletions(-) create mode 100644 jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/H2SpecServer.java diff --git a/jetty-http2/http2-server/pom.xml b/jetty-http2/http2-server/pom.xml index 7313aa64f32..01532422e39 100644 --- a/jetty-http2/http2-server/pom.xml +++ b/jetty-http2/http2-server/pom.xml @@ -1,5 +1,6 @@ - + org.eclipse.jetty.http2 http2-parent @@ -10,55 +11,76 @@ http2-server Jetty :: HTTP2 :: Server - + ${project.groupId}.server + + com.github.madgnome + h2spec-maven-plugin + + org.eclipse.jetty.http2.server.H2SpecServer + ${skipTests} + + + 5.1 - closed: Sends a DATA frame + + + + + h2spec + test + + h2spec + + + + - - - org.eclipse.jetty.http2 - http2-common - ${project.version} - - - org.eclipse.jetty - jetty-server - ${project.version} - - - org.eclipse.jetty.alpn - alpn-api - ${alpn.api.version} - provided - - - org.eclipse.jetty - jetty-servlet - ${project.version} - test - - - org.eclipse.jetty - jetty-servlets - ${project.version} - test - - - org.eclipse.jetty - jetty-alpn-server - ${project.version} - test - - - org.eclipse.jetty.toolchain - jetty-test-helper - test - - + + + org.eclipse.jetty.http2 + http2-common + ${project.version} + + + org.eclipse.jetty + jetty-server + ${project.version} + + + org.eclipse.jetty.alpn + alpn-api + ${alpn.api.version} + provided + + + org.eclipse.jetty + jetty-servlet + ${project.version} + test + + + org.eclipse.jetty + jetty-servlets + ${project.version} + test + + + org.eclipse.jetty + jetty-alpn-server + ${project.version} + test + + + org.eclipse.jetty.toolchain + jetty-test-helper + test + + diff --git a/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/H2SpecServer.java b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/H2SpecServer.java new file mode 100644 index 00000000000..de99425b90b --- /dev/null +++ b/jetty-http2/http2-server/src/test/java/org/eclipse/jetty/http2/server/H2SpecServer.java @@ -0,0 +1,48 @@ +// +// ======================================================================== +// Copyright (c) 1995-2018 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.http2.server; + +import org.eclipse.jetty.server.HttpConfiguration; +import org.eclipse.jetty.server.HttpConnectionFactory; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; + +/** + * HTTP/2 server to run the 'h2spec' tool against. + */ +public class H2SpecServer +{ + public static void main(String[] args) throws Exception + { + int port = Integer.parseInt(args[0]); + + Server server = new Server(); + + HttpConfiguration http_config = new HttpConfiguration(); + http_config.setRequestHeaderSize(16 * 1024); + + HttpConnectionFactory http = new HttpConnectionFactory(http_config); + HTTP2CServerConnectionFactory h2c = new HTTP2CServerConnectionFactory(http_config); + ServerConnector connector = new ServerConnector(server, http, h2c); + connector.setPort(port); + server.addConnector(connector); + + server.start(); + } +} diff --git a/pom.xml b/pom.xml index 5e1d12d5c4c..8309d7aab73 100644 --- a/pom.xml +++ b/pom.xml @@ -887,6 +887,11 @@ buildnumber-maven-plugin 1.4 + + com.github.madgnome + h2spec-maven-plugin + 0.3 +