< prev index next >

jdk/test/java/net/httpclient/RequestBodyTest.java

Print this page
rev 17249 : 8180887: move FileUtils to top level testlibrary
Reviewed-by: duke
   1 /*
   2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test @bug 8087112
  26  * @modules jdk.incubator.httpclient
  27  *          java.logging
  28  *          jdk.httpserver
  29  * @library /lib/testlibrary/
  30  * @compile ../../../com/sun/net/httpserver/LogFilter.java
  31  * @compile ../../../com/sun/net/httpserver/FileServerHandler.java
  32  * @build LightWeightHttpServer
  33  * @build jdk.testlibrary.SimpleSSLContext
  34  * @run testng/othervm RequestBodyTest
  35  */
  36 
  37 import java.io.*;
  38 import java.net.URI;
  39 import jdk.incubator.http.HttpClient;
  40 import jdk.incubator.http.HttpRequest;
  41 import jdk.incubator.http.HttpResponse;
  42 import java.nio.charset.Charset;
  43 import java.nio.charset.StandardCharsets;
  44 import java.nio.file.Files;
  45 import java.nio.file.Path;
  46 import java.nio.file.Paths;
  47 import java.util.ArrayList;
  48 import java.util.Arrays;
  49 import java.util.List;
  50 import java.util.Optional;
  51 import java.util.concurrent.ExecutorService;
  52 import java.util.concurrent.Executors;
  53 import java.util.function.Supplier;
  54 import javax.net.ssl.SSLContext;
  55 import jdk.testlibrary.FileUtils;
  56 import static java.nio.charset.StandardCharsets.*;
  57 import static java.nio.file.StandardOpenOption.*;
  58 import static jdk.incubator.http.HttpRequest.BodyProcessor.*;
  59 import static jdk.incubator.http.HttpResponse.BodyHandler.*;
  60 
  61 import org.testng.annotations.AfterTest;
  62 import org.testng.annotations.BeforeTest;
  63 import org.testng.annotations.DataProvider;
  64 import org.testng.annotations.Test;
  65 import static org.testng.Assert.*;
  66 
  67 public class RequestBodyTest {
  68 
  69     static final String fileroot = System.getProperty("test.src") + "/docs";
  70     static final String midSizedFilename = "/files/notsobigfile.txt";
  71     static final String smallFilename = "/files/smallfile.txt";
  72 
  73     HttpClient client;
  74     ExecutorService exec = Executors.newCachedThreadPool();
  75     String httpURI;


   1 /*
   2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test @bug 8087112
  26  * @modules jdk.incubator.httpclient
  27  *          java.logging
  28  *          jdk.httpserver
  29  * @library /lib/testlibrary/ /test/lib
  30  * @compile ../../../com/sun/net/httpserver/LogFilter.java
  31  * @compile ../../../com/sun/net/httpserver/FileServerHandler.java
  32  * @build LightWeightHttpServer
  33  * @build jdk.testlibrary.SimpleSSLContext
  34  * @run testng/othervm RequestBodyTest
  35  */
  36 
  37 import java.io.*;
  38 import java.net.URI;
  39 import jdk.incubator.http.HttpClient;
  40 import jdk.incubator.http.HttpRequest;
  41 import jdk.incubator.http.HttpResponse;
  42 import java.nio.charset.Charset;
  43 import java.nio.charset.StandardCharsets;
  44 import java.nio.file.Files;
  45 import java.nio.file.Path;
  46 import java.nio.file.Paths;
  47 import java.util.ArrayList;
  48 import java.util.Arrays;
  49 import java.util.List;
  50 import java.util.Optional;
  51 import java.util.concurrent.ExecutorService;
  52 import java.util.concurrent.Executors;
  53 import java.util.function.Supplier;
  54 import javax.net.ssl.SSLContext;
  55 import jdk.test.lib.util.FileUtils;
  56 import static java.nio.charset.StandardCharsets.*;
  57 import static java.nio.file.StandardOpenOption.*;
  58 import static jdk.incubator.http.HttpRequest.BodyProcessor.*;
  59 import static jdk.incubator.http.HttpResponse.BodyHandler.*;
  60 
  61 import org.testng.annotations.AfterTest;
  62 import org.testng.annotations.BeforeTest;
  63 import org.testng.annotations.DataProvider;
  64 import org.testng.annotations.Test;
  65 import static org.testng.Assert.*;
  66 
  67 public class RequestBodyTest {
  68 
  69     static final String fileroot = System.getProperty("test.src") + "/docs";
  70     static final String midSizedFilename = "/files/notsobigfile.txt";
  71     static final String smallFilename = "/files/smallfile.txt";
  72 
  73     HttpClient client;
  74     ExecutorService exec = Executors.newCachedThreadPool();
  75     String httpURI;


< prev index next >