galenwarren commented on a change in pull request #15599:
URL: https://github.com/apache/flink/pull/15599#discussion_r781418333



##########
File path: 
flink-filesystems/flink-gs-fs-hadoop/src/test/java/org/apache/flink/fs/gs/utils/BlobUtilsTest.java
##########
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.fs.gs.utils;
+
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.fs.gs.GSFileSystemOptions;
+import org.apache.flink.fs.gs.storage.GSBlobIdentifier;
+
+import org.junit.Test;
+
+import java.net.URI;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+
+/** Test {@link BlobUtils}. */
+public class BlobUtilsTest {
+
+    @Test
+    public void shouldParseValidUri() {
+        GSBlobIdentifier blobIdentifier = 
BlobUtils.parseUri(URI.create("gs://bucket/foo/bar"));
+        assertEquals("bucket", blobIdentifier.bucketName);
+        assertEquals("foo/bar", blobIdentifier.objectName);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shouldFailToParseUriBadScheme() {
+        BlobUtils.parseUri(URI.create("s3://bucket/foo/bar"));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shouldFailToParseUriMissingBucketName() {
+        BlobUtils.parseUri(URI.create("gs:///foo/bar"));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shouldFailToParseUriMissingObjectName() {
+        BlobUtils.parseUri(URI.create("gs://bucket/"));
+    }
+
+    @Test
+    public void shouldUseTemporaryBucketNameIfSpecified() {
+        Configuration flinkConfig = new Configuration();
+        flinkConfig.setString("gs.writer.temporary.bucket.name", "temp");

Review comment:
       A question: For the "gs.writer.chunk.size" option, which is of 
`MemorySize` type, I can't figure out how a caller would set this property 
without `GSFileSystemOptions.WRITER_CHUNK_SIZE` being exposed publicly. There 
doesn't seem to be a `setMemorySize` method on the Flink `Configuration` object 
that would allow setting the property by it's (string) name.
   
   For now, I made `GSFileSystemOptions.WRITER_CHUNK_SIZE` public, and if that 
one is public, it would seem that 
`GSFileSystemOptions.WRITER_TEMPORARY_BUCKET_NAME` should be public too?
   
   But very possible I'm missing something, please point me in the right 
direction if this is wrong.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to