Package com.google.appengine.tck.blobstore.support

Examples of com.google.appengine.tck.blobstore.support.FileUploader


    @Test
    @RunAsClient
    @InSequence(10)
    public void testUploadedFileHasCorrectContent_upload(@ArquillianResource URL url) throws Exception {
        FileUploader fileUploader = new FileUploader();
        String uploadUrl = fileUploader.getUploadUrl(new URL(url, "getUploadUrl"));
        fileUploader.uploadFile(uploadUrl, "file", FILENAME, CONTENT_TYPE, UPLOADED_CONTENT);
    }
View Full Code Here


    @Test
    @RunAsClient
    @InSequence(40)
    public void testSubmitMultipartFormWithoutFile_upload(@ArquillianResource URL url) throws Exception {
        FileUploader fileUploader = new FileUploader();
        String uploadUrl = fileUploader.getUploadUrl(new URL(url, "getUploadUrl"), FileUploader.Method.POST);
        fileUploader.uploadWithoutFile(uploadUrl, "file");
    }
View Full Code Here

    @Test
    @RunAsClient
    @InSequence(60)
    public void testMaxPerBlob(@ArquillianResource URL url) throws Exception {
        FileUploader fileUploader = new FileUploader();
        // 5 is smaller then content's length
        String uploadUrl = fileUploader.getUploadUrl(new URL(url, "getUploadUrl"), Collections.singletonMap("max_per_blob", "5"));
        fileUploader.uploadFile(uploadUrl, "file", getRandomName(), CONTENT_TYPE, UPLOADED_CONTENT, 413);
    }
View Full Code Here

    @Test
    @RunAsClient
    @InSequence(70)
    public void testMaxAll(@ArquillianResource URL url) throws Exception {
        FileUploader fileUploader = new FileUploader();
        // 5 is smaller then content's length
        String uploadUrl = fileUploader.getUploadUrl(new URL(url, "getUploadUrl"), Collections.singletonMap("max_all", "5"));
        fileUploader.uploadFile(uploadUrl, "file", getRandomName(), CONTENT_TYPE, UPLOADED_CONTENT, 413);
    }
View Full Code Here

    @Test
    @RunAsClient
    @InSequence(80)
    public void testBucketName(@ArquillianResource URL url) throws Exception {
        FileUploader fileUploader = new FileUploader();
        String uploadUrl = fileUploader.getUploadUrl(new URL(url, "getUploadUrl"), Collections.singletonMap("bucket_name", "TheBucket"));
        String blobKey = fileUploader.uploadFile(uploadUrl, "file", getRandomName(), CONTENT_TYPE, UPLOADED_CONTENT);
        Assert.assertTrue(String.format("Received blobKey '%s'", blobKey), blobKey.contains("gs")); // TODO -- better way?
    }
View Full Code Here

    @RunAsClient
    @InSequence(90)
    public void testGcs(@ArquillianResource URL url) throws Exception {
      String filename = String.format("abc%s.txt", System.currentTimeMillis());

        FileUploader fileUploader = new FileUploader();
        Map<String, String> params = new HashMap<>();
        params.put("bucket_name", "GcsBucket");
        params.put("successPath", "gcsHandler?uploadedFilename=" + filename + "&uploadedContentType=" + CONTENT_TYPE);
        String uploadUrl = fileUploader.getUploadUrl(new URL(url, "getUploadUrl"), params);
        String result = fileUploader.uploadFile(uploadUrl, "file", filename, CONTENT_TYPE, "GcsTest".getBytes());
        Assert.assertEquals("GcsTest_123", result);
    }
View Full Code Here

@RunWith(Arquillian.class)
public class BlobstoreServeTest extends SimpleBlobstoreTestBase {
    @Test
    @RunAsClient
    public void testUploadedFileHasCorrectContent_upload(@ArquillianResource URL url) throws Exception {
        FileUploader fileUploader = new FileUploader();
        String uploadUrl = fileUploader.getUploadUrl(new URL(url, "getUploadUrl"));
        final String blobKey = fileUploader.uploadFile(uploadUrl, "file", FILENAME, CONTENT_TYPE, UPLOADED_CONTENT);

        final String content = new String(UPLOADED_CONTENT);
        final URI uri = new URL(url, "blobserviceserve?blobKey=" + blobKey).toURI();
        try (CloseableHttpClient client = HttpClients.createDefault()) {
            doTest(client, uri, null, null, content);
View Full Code Here

TOP

Related Classes of com.google.appengine.tck.blobstore.support.FileUploader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.