jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timur Alperovich <notificati...@github.com>
Subject Re: [jclouds/jclouds] DLO - Lower Level Provider API changes (#1105)
Date Fri, 07 Jul 2017 21:03:57 GMT
timuralp commented on this pull request.

Here are the ones I spotted. If you can configure your editor to remove trailing white space,
please clean them up. If you can't that's fine. Maybe that will get cleaned up before merging.

> +      // configure the blobstore to use multipart uploading of the file
+      for (int partNumber = 0; partNumber < 3; partNumber++) {
+         String objName = String.format("%s/%s/%s", objectName, "dlo", partNumber);
+         String data = String.format("%s%s", "data", partNumber);
+         ByteSource payload = ByteSource.wrap(data.getBytes(Charsets.UTF_8));
+         Blob blob = blobStore.blobBuilder(objName)
+               .payload(payload)
+               .build();
+         String etag = blobStore.putBlob(defaultContainerName, blob);
+         assertNotNull(etag);
+         total_size += data.length();
+      }
+      
+      getApi().getDynamicLargeObjectApi(regionId, defaultContainerName).putManifest(objectName,
+            ImmutableMap.of("myfoo", "Bar"));
+     

There is trailing white space on this line. I don't know if there is a way to get github to
highlight it.

> +      SwiftObject object1s = getApi().getObjectApi(regionId, containerName).get(name);
+      assertThat(object1s.getETag()).isEqualTo(etag1s);
+      assertThat(object1s.getPayload().getContentMetadata().getContentLength()).isEqualTo(Long.valueOf(1024L
* 1024L));
+   }
+
+   protected void deleteAllObjectsInContainerDLO(String regionId, final String containerName)
{
+       ObjectList objects = getApi().getObjectApi(regionId, containerName).list(new ListContainerOptions());
+      if (objects == null) {
+         return;
+      }
+      List<String> pathsToDelete = Lists.transform(objects, new Function<SwiftObject,
String>() {
+         public String apply(SwiftObject input) {
+            return containerName + "/" + input.getName();
+         }
+      });
+      

Trailing white space here and line 134.

> +   @SuppressWarnings("deprecation")
+   @Test
+   public void uploadLargeFile() throws Exception {
+      MockWebServer server = mockOpenStackServer();
+      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
+      server.enqueue(new MockResponse().setBody("").addHeader(ETAG, "89d903bc35dede724fd52c51437ff5fd"));
+      server.enqueue(new MockResponse().setBody("").addHeader(ETAG, "d41d8cd98f00b204e9800998ecf8427e"));
+      server.enqueue(addCommonHeaders(new MockResponse().addHeader("X-Object-Manifest", "myContainer/myObject")));
+
+      try {
+         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
+         assertEquals(api.getObjectApi("DFW", containerName).put(objectName.concat("1"),
Payloads.newPayload("data1")),
+               "89d903bc35dede724fd52c51437ff5fd");
+         assertEquals(api.getDynamicLargeObjectApi("DFW", containerName).putManifest(objectName,
+               ImmutableMap.of("MyFoo", "Bar"), ImmutableMap.of("MyFoo", "Bar")), "d41d8cd98f00b204e9800998ecf8427e");
+      

Trailing white space here.

> +      MockWebServer server = mockOpenStackServer();
+      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
+      server.enqueue(new MockResponse().setBody("").addHeader(ETAG, "89d903bc35dede724fd52c51437ff5fd"));
+      server.enqueue(new MockResponse().setBody("").addHeader(ETAG, "d41d8cd98f00b204e9800998ecf8427e"));
+      server.enqueue(addCommonHeaders(new MockResponse().addHeader("X-Object-Manifest", "myContainer/myObject")));
+
+      try {
+         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
+         assertEquals(api.getObjectApi("DFW", containerName).put(objectName.concat("1"),
Payloads.newPayload("data1")),
+               "89d903bc35dede724fd52c51437ff5fd");
+         assertEquals(api.getDynamicLargeObjectApi("DFW", containerName).putManifest(objectName,
+               ImmutableMap.of("MyFoo", "Bar"), ImmutableMap.of("MyFoo", "Bar")), "d41d8cd98f00b204e9800998ecf8427e");
+      
+         assertEquals(server.getRequestCount(), 3);
+         assertAuthentication(server);
+         

Trailing white space.

> +
+      try {
+         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
+         assertEquals(api.getObjectApi("DFW", containerName).put(objectName.concat("1"),
Payloads.newPayload("data1")),
+               "89d903bc35dede724fd52c51437ff5fd");
+         assertEquals(api.getDynamicLargeObjectApi("DFW", containerName).putManifest(objectName,
+               ImmutableMap.of("MyFoo", "Bar"), ImmutableMap.of("MyFoo", "Bar")), "d41d8cd98f00b204e9800998ecf8427e");
+      
+         assertEquals(server.getRequestCount(), 3);
+         assertAuthentication(server);
+         
+         RecordedRequest uploadRequest = server.takeRequest();
+         assertEquals(uploadRequest.getRequestLine(),
+               "PUT /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/myContainer/myObjectTest1
HTTP/1.1");
+         assertEquals(new String(uploadRequest.getBody()), "data1");
+         

Trailing white space.

> @@ -67,4 +68,9 @@ ObjectApi getObjectApi(@EndpointParam(parser = RegionToEndpoint.class)
String re
    @Path("/{containerName}")
    StaticLargeObjectApi getStaticLargeObjectApi(@EndpointParam(parser = RegionToEndpoint.class)
String region,
          @PathParam("containerName") String containerName);
+   

Trailing white space.

> +    * @param headers
+    *           Binds the map to headers, without prefixing/escaping the header
+    *           name/key.
+    *
+    * @return {@link SwiftObject#getEtag()} of the object, which is the MD5
+    *         checksum of the concatenated ETag values of the {@code segments}.
+    */
+   @Deprecated
+   @Named("dynamicLargeObject:putManifest")
+   @PUT
+   @ResponseParser(ETagHeader.class)
+   @Headers(keys = "X-Object-Manifest", values = "{containerName}/{objectName}/")
+   String putManifest(@PathParam("objectName") String objectName,
+         @BinderParam(BindObjectMetadataToHeaders.class) Map<String, String> metadata,
+         @BinderParam(BindToHeaders.class) Map<String, String> headers);
+   

Trailing white space.

> +      RegionScopedBlobStoreContext ctx = RegionScopedBlobStoreContext.class.cast(view);
+      BlobStore blobStore = ctx.getBlobStore();
+      String defaultContainerName = getContainerName();
+      // configure the blobstore to use multipart uploading of the file
+      for (int partNumber = 0; partNumber < 3; partNumber++) {
+         String objName = String.format("%s/%s/%s", objectName, "dlo", partNumber);
+         String data = String.format("%s%s", "data", partNumber);
+         ByteSource payload = ByteSource.wrap(data.getBytes(Charsets.UTF_8));
+         Blob blob = blobStore.blobBuilder(objName)
+               .payload(payload)
+               .build();
+         String etag = blobStore.putBlob(defaultContainerName, blob);
+         assertNotNull(etag);
+         total_size += data.length();
+      }
+      

Trailing white space.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1105#pullrequestreview-48715778
Mime
View raw message