Mercurial > stress-tester
changeset 724:4e3b671d6cdf
HeadersGenerator
author | Devel 1 |
---|---|
date | Fri, 01 Dec 2017 13:18:12 +0100 |
parents | 62de3e39e249 |
children | 75cf7ccbbff2 |
files | stress-tester/src/test/java/com/passus/st/HeadersGenerator.java stress-tester/src/test/resources/headers.txt |
diffstat | 2 files changed, 124 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stress-tester/src/test/java/com/passus/st/HeadersGenerator.java Fri Dec 01 13:18:12 2017 +0100 @@ -0,0 +1,42 @@ +package com.passus.st; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Iterator; +import org.testng.annotations.Test; + +/** + * + * @author mikolaj.podbielski + */ +public class HeadersGenerator { + + static Path PATH = Paths.get("src/test/resources/headers.txt"); + + public static void main(String[] args) throws Exception { + printHttpHeaders(); + System.out.println("================"); + printNcHttpDataUtils(); + } + + static String id(String s) { + return s.toUpperCase().replace('-', '_'); + } + + @Test + public static void printHttpHeaders() throws Exception { + Files.lines(PATH).forEach((l) -> System.out.format( + "public static final ByteStringImpl %s = createNew(\"%s\");\n\n", id(l), l)); + } + + @Test + public static void printNcHttpDataUtils() throws Exception { + int i = 0; + Iterator<String> it = Files.lines(PATH).iterator(); + while (it.hasNext()) { + String l = it.next(); + System.out.format("codeToHeader.put((byte) %d, HttpHeaders.%s);\n", ++i, id(l)); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stress-tester/src/test/resources/headers.txt Fri Dec 01 13:18:12 2017 +0100 @@ -0,0 +1,82 @@ +Accept +Accept-Charset +Accept-Encoding +Accept-Language +Accept-Ranges +Access-Control-Allow-Credentials +Access-Control-Allow-Headers +Access-Control-Allow-Methods +Access-Control-Allow-Origin +Access-Control-Expose-Headers +Access-Control-Max-Age +Access-Control-Request-Headers +Access-Control-Request-Method +Age +Allow +Authorization +Cache-Control +Connection +Content-Disposition +Content-Encoding +Content-Language +Content-Length +Content-Location +Content-Range +Content-Security-Policy +Content-Security-Policy-Report-Only +Content-Type +Cookie +Cookie2 +DNT +Date +ETag +Expect +Expires +Forwarded +From +Host +If-Match +If-Modified-Since +If-None-Match +If-Range +If-Unmodified-Since +Keep-Alive +Large-Allocation +Last-Modified +Location +Origin +P3P +Pragma +Proxy-Authenticate +Proxy-Authorization +Proxy-Connection +Public-Key-Pins +Public-Key-Pins-Report-Only +Range +Referer +Referrer-Policy +Retry-After +Server +Set-Cookie +Set-Cookie2 +SourceMap +Strict-Transport-Security +TE +Timing-Allow-Origin +Tk +Trailer +Transfer-Encoding +Upgrade-Insecure-Requests +User-Agent +Vary +Via +WWW-Authenticate +Warning +X-Content-Type-Options +X-DNS-Prefetch-Control +X-Forwarded-For +X-Forwarded-Host +X-Forwarded-Proto +X-Frame-Options +X-Requested-With +X-XSS-Protection \ No newline at end of file