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

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

Best Java code snippets using org.jclouds.blobstore.integration.internal.BaseBlobSignerLiveTest.returnContainer (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.internalBaseBlobSignerLiveTestreturnContainer

Popular methods of BaseBlobSignerLiveTest

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

Popular in Java

  • Making http post requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • runOnUiThread (Activity)
  • putExtra (Intent)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Top 12 Jupyter Notebook extensions
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