Tabnine Logo
BaseBlobSignerLiveTest.getContainerName
Code IndexAdd Tabnine to your IDE (free)

How to use
getContainerName
method
in
org.jclouds.blobstore.integration.internal.BaseBlobSignerLiveTest

Best Java code snippets using org.jclouds.blobstore.integration.internal.BaseBlobSignerLiveTest.getContainerName (Showing top 13 results out of 315)

origin: jclouds/legacy-jclouds

@Test
public void testSignGetUrl() throws Exception {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   view.getBlobStore().putBlob(container, blob);
   assertConsistencyAwareContainerSize(container, 1);
   HttpRequest request = view.getSigner().signGetBlob(container, name);
   assertEquals(request.getFilters().size(), 0);
   assertEquals(Strings2.toString(view.utils().http().invoke(request).getPayload()), text);
 } finally {
   returnContainer(container);
 }
}
origin: jclouds/legacy-jclouds

@Test
public void testSignPutUrl() throws Exception {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   HttpRequest request = view.getSigner().signPutBlob(container, blob);
   assertEquals(request.getFilters().size(), 0);
   Strings2.toString(view.utils().http().invoke(request).getPayload());
   assertConsistencyAwareContainerSize(container, 1);
 } finally {
   returnContainer(container);
 }
}
origin: jclouds/legacy-jclouds

@Test
public void testSignGetUrlOptions() throws Exception {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   view.getBlobStore().putBlob(container, blob);
   assertConsistencyAwareContainerSize(container, 1);
   HttpRequest request = view.getSigner().signGetBlob(container, name, range(0, 1));
   assertEquals(request.getFilters().size(), 0);
   assertEquals(Strings2.toString(view.utils().http().invoke(request).getPayload()), "fo");
 } finally {
   returnContainer(container);
 }
}
origin: apache/jclouds

@Test
public void testSignPutUrl() throws Exception {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("image/png").build();
 String container = getContainerName();
 try {
   HttpRequest request = view.getSigner().signPutBlob(container, blob);
   assertEquals(request.getFilters().size(), 0);
   Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().openStream());
   blob = view.getBlobStore().getBlob(container, name);
   assertThat(blob.getMetadata().getContentMetadata().getContentType()).isEqualTo("image/png");
 } finally {
   returnContainer(container);
 }
}
origin: apache/jclouds

@Test
public void testSignPutUrlWithTime() throws Exception {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   HttpRequest request = view.getSigner().signPutBlob(container, blob, getSignedUrlTimeout());
   assertEquals(request.getFilters().size(), 0);
   // Strip Expect: 100-continue to make actual responses visible, since
   // Java 7+ will throw a ProtocolException instead of setting the response code:
   // http://www.docjar.com/html/api/sun/net/www/protocol/http/HttpURLConnection.java.html#1021
   request = request.toBuilder().removeHeader(EXPECT).build();
   Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().openStream());
 } finally {
   returnContainer(container);
 }
}
origin: apache/jclouds

@Test
public void testSignGetUrl() throws Exception {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   view.getBlobStore().putBlob(container, blob);
   assertConsistencyAwareContainerSize(container, 1);
   HttpRequest request = view.getSigner().signGetBlob(container, name);
   assertEquals(request.getFilters().size(), 0);
   assertEquals(Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().openStream()), text);
 } finally {
   returnContainer(container);
 }
}
origin: apache/jclouds

@Test
public void testSignGetUrlOptions() throws Exception {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   view.getBlobStore().putBlob(container, blob);
   assertConsistencyAwareContainerSize(container, 1);
   HttpRequest request = view.getSigner().signGetBlob(container, name, range(0, 1));
   assertEquals(request.getFilters().size(), 0);
   assertEquals(Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().openStream()), "fo");
 } finally {
   returnContainer(container);
 }
}
origin: apache/jclouds

@Test
public void testSignGetUrlWithTime() throws InterruptedException, IOException {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   view.getBlobStore().putBlob(container, blob);
   assertConsistencyAwareContainerSize(container, 1);
   HttpRequest request = view.getSigner().signGetBlob(container, name, getSignedUrlTimeout());
   assertEquals(request.getFilters().size(), 0);
   assertEquals(Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().openStream()), text);
 } finally {
   returnContainer(container);
 }
}
origin: apache/jclouds

public void testSignPutUrlWithTime(final long timeout) throws InterruptedException, IOException {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   HttpRequest request = view.getSigner().signPutBlob(container, blob, 0);
   assertEquals(request.getFilters().size(), 0);
   // Strip Expect: 100-continue to make actual responses visible, since
   // Java 7+ will throw a ProtocolException instead of setting the response code:
   // http://www.docjar.com/html/api/sun/net/www/protocol/http/HttpURLConnection.java.html#1021
   request = request.toBuilder().removeHeader(EXPECT).build();
   try {
    Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().openStream());
    fail("Temporary URL did not expire as expected");
   } catch (AuthorizationException expected) {
   }
 } finally {
   returnContainer(container);
 }
}
origin: jclouds/legacy-jclouds

@Test
public void testSignGetUrlWithTime() throws InterruptedException, IOException {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   view.getBlobStore().putBlob(container, blob);
   assertConsistencyAwareContainerSize(container, 1);
   HttpRequest request = view.getSigner().signGetBlob(container, name, 3 /* seconds */);
      assertEquals(request.getFilters().size(), 0);
   assertEquals(Strings2.toString(view.utils().http().invoke(request).getPayload()), text);
   TimeUnit.SECONDS.sleep(4);
   try {
    Strings2.toString(view.utils().http().invoke(request).getPayload());
    fail("Temporary URL did not expire as expected");
   } catch (AuthorizationException expected) {
   }
 } catch (UnsupportedOperationException ignore) {
   throw new SkipException("signGetUrl with a time limit is not supported on " + provider);
 } finally {
   returnContainer(container);
 }
}
origin: jclouds/legacy-jclouds

  @Test
  public void testSignRemoveUrl() throws Exception {
   String name = "hello";
   String text = "fooooooooooooooooooooooo";

   Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
   String container = getContainerName();
   try {
     view.getBlobStore().putBlob(container, blob);
     assertConsistencyAwareContainerSize(container, 1);
     HttpRequest request = view.getSigner().signRemoveBlob(container, name);
     assertEquals(request.getFilters().size(), 0);
     view.utils().http().invoke(request);
     assert !view.getBlobStore().blobExists(container, name);
   } finally {
     returnContainer(container);
   }
  }
}
origin: apache/jclouds

public void testSignGetUrlWithTime(final long timeout) throws InterruptedException, IOException {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   view.getBlobStore().putBlob(container, blob);
   assertConsistencyAwareContainerSize(container, 1);
   HttpRequest request = view.getSigner().signGetBlob(container, name, timeout);
   assertEquals(request.getFilters().size(), 0);
   try {
    Strings2.toStringAndClose(view.utils().http().invoke(request).getPayload().openStream());
    fail("Temporary URL did not expire as expected");
   } catch (AuthorizationException expected) {
   }
 } finally {
   returnContainer(container);
 }
}
origin: jclouds/legacy-jclouds

@Test
public void testSignPutUrlWithTime() throws Exception {
 String name = "hello";
 String text = "fooooooooooooooooooooooo";
 Blob blob = view.getBlobStore().blobBuilder(name).payload(text).contentType("text/plain").build();
 String container = getContainerName();
 try {
   HttpRequest request = view.getSigner().signPutBlob(container, blob, 3 /* seconds */);
   assertEquals(request.getFilters().size(), 0);
   Strings2.toString(view.utils().http().invoke(request).getPayload());
   assertConsistencyAwareContainerSize(container, 1);
   view.getBlobStore().removeBlob(container, name);
   assertConsistencyAwareContainerSize(container, 0);
   TimeUnit.SECONDS.sleep(4);
   try {
    Strings2.toString(view.utils().http().invoke(request).getPayload());
    fail("Temporary URL did not expire as expected");
   } catch (AuthorizationException expected) {
   }
 } catch (UnsupportedOperationException ignore) {
   throw new SkipException("signPutUrl with a time limit is not supported on " + provider);
 } finally {
   returnContainer(container);
 }
}
org.jclouds.blobstore.integration.internalBaseBlobSignerLiveTestgetContainerName

Popular methods of BaseBlobSignerLiveTest

  • testSignPutUrlWithTime
  • testSignGetUrlWithTime
  • assertConsistencyAwareContainerSize
  • returnContainer
  • setupProperties
  • testSignPutUrlWithTimeExpired
  • getSignedUrlTimeout
  • testSignGetUrl
  • testSignGetUrlOptions
  • testSignGetUrlWithTimeExpired
  • testSignPutUrl
  • testSignPutUrl

Popular in Java

  • Making http post requests using okhttp
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getExternalFilesDir (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JFileChooser (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now