[ 
https://issues.apache.org/jira/browse/BEAM-9577?focusedWorklogId=433398&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-433398
 ]

ASF GitHub Bot logged work on BEAM-9577:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/May/20 22:19
            Start Date: 14/May/20 22:19
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on a change in pull request #11708:
URL: https://github.com/apache/beam/pull/11708#discussion_r425462707



##########
File path: 
sdks/java/core/src/test/java/org/apache/beam/sdk/io/ClassLoaderFileSystemTest.java
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.beam.sdk.io;
+
+import static java.nio.channels.Channels.newInputStream;
+import static org.junit.Assert.assertArrayEquals;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.channels.ReadableByteChannel;
+import org.apache.beam.sdk.options.PipelineOptionsFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class ClassLoaderFileSystemTest {
+
+  private static final String SOME_CLASS =
+      "classpath://org/apache/beam/sdk/io/ClassLoaderFilesystem.class";
+
+  @Test
+  public void testOpen() throws IOException {
+    ClassLoaderFileSystem filesystem = new ClassLoaderFileSystem();
+    ReadableByteChannel channel = 
filesystem.open(filesystem.matchNewResource(SOME_CLASS, false));
+    checkIsClass(channel);
+  }
+
+  @Test
+  public void testRegistrar() throws IOException {
+    ReadableByteChannel channel = 
FileSystems.open(FileSystems.matchNewResource(SOME_CLASS, false));
+    checkIsClass(channel);
+  }
+
+  public void checkIsClass(ReadableByteChannel channel) throws IOException {
+    FileSystems.setDefaultPipelineOptions(PipelineOptionsFactory.create());
+    InputStream inputStream = newInputStream(channel);
+    byte[] magic = new byte[4];
+    inputStream.read(magic);
+    assertArrayEquals(magic, new byte[] {(byte) 0xCA, (byte) 0xFE, (byte) 
0xBA, (byte) 0xBE});

Review comment:
       It's used on the Python side.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 433398)
    Time Spent: 21.5h  (was: 21h 20m)

> Update artifact staging and retrieval protocols to be dependency aware.
> -----------------------------------------------------------------------
>
>                 Key: BEAM-9577
>                 URL: https://issues.apache.org/jira/browse/BEAM-9577
>             Project: Beam
>          Issue Type: Improvement
>          Components: beam-model
>            Reporter: Robert Bradshaw
>            Assignee: Robert Bradshaw
>            Priority: Major
>          Time Spent: 21.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to