Skip to content

Commit 6901f5d

Browse files
Add tests
Supress a style issue
1 parent 87ec68a commit 6901f5d

7 files changed

Lines changed: 692 additions & 18 deletions

File tree

hadoop-tools/hadoop-gcp/pom.xml

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,13 @@
361361
</excludeFilterFile>
362362
<effort>Max</effort>
363363
</configuration>
364+
</plugin>
365+
<plugin>
366+
<groupId>org.apache.maven.plugins</groupId>
367+
<artifactId>maven-checkstyle-plugin</artifactId>
368+
<configuration>
369+
<suppressionsLocation>src/config/checkstyle-suppressions.xml</suppressionsLocation>
370+
</configuration>
364371
</plugin>
365372
<plugin>
366373
<groupId>org.apache.maven.plugins</groupId>
@@ -413,6 +420,24 @@
413420
</plugins>
414421
</build>
415422

423+
<dependencyManagement>
424+
<dependencies>
425+
<dependency>
426+
<!--
427+
We're using a specific Protobuf version to ensure compatibility with the
428+
Google Cloud Storage (GCS) client. The GCS client often relies on
429+
particular Long-Term Support (LTS) versions of Protobuf. When we upgrade
430+
the GCS client, we'll likely need to update Protobuf too. To prevent
431+
dependency conflicts, Protobuf will be shaded within the GCS connector's
432+
fat JAR.
433+
-->
434+
<groupId>com.google.protobuf</groupId>
435+
<artifactId>protobuf-java</artifactId>
436+
<version>3.25.5</version>
437+
</dependency>
438+
</dependencies>
439+
</dependencyManagement>
440+
416441
<dependencies>
417442
<dependency>
418443
<groupId>org.apache.hadoop</groupId>
@@ -427,14 +452,13 @@
427452
<groupId>javax.enterprise</groupId>
428453
<artifactId>cdi-api</artifactId>
429454
</exclusion>
455+
<!-- Exclude protobuf-java 2.5.0 -->
456+
<exclusion>
457+
<groupId>com.google.protobuf</groupId>
458+
<artifactId>protobuf-java</artifactId>
459+
</exclusion>
430460
</exclusions>
431461
</dependency>
432-
<dependency>
433-
<groupId>org.apache.hadoop</groupId>
434-
<artifactId>hadoop-common</artifactId>
435-
<scope>test</scope>
436-
<type>test-jar</type>
437-
</dependency>
438462
<dependency>
439463
<groupId>org.assertj</groupId>
440464
<artifactId>assertj-core</artifactId>
@@ -458,21 +482,22 @@
458482
<dependency>
459483
<groupId>com.google.cloud</groupId>
460484
<artifactId>google-cloud-storage</artifactId>
485+
</dependency>
486+
<dependency>
487+
<groupId>org.junit.jupiter</groupId>
488+
<artifactId>junit-jupiter-api</artifactId>
489+
<scope>test</scope>
461490
</dependency>
462491
<dependency>
463-
<groupId>com.google.protobuf</groupId>
464-
<artifactId>protobuf-java</artifactId>
465-
<!--
466-
We're using a specific Protobuf version to ensure compatibility with the
467-
Google Cloud Storage (GCS) client. The GCS client often relies on
468-
particular Long-Term Support (LTS) versions of Protobuf. When we upgrade
469-
the GCS client, we'll likely need to update Protobuf too. To prevent
470-
dependency conflicts, Protobuf will be shaded within the GCS connector's
471-
fat JAR.
472-
-->
473-
<version>3.25.3</version>
492+
<groupId>org.junit.jupiter</groupId>
493+
<artifactId>junit-jupiter-engine</artifactId>
494+
<scope>test</scope>
495+
</dependency>
496+
<dependency>
497+
<groupId>org.junit.jupiter</groupId>
498+
<artifactId>junit-jupiter-params</artifactId>
499+
<scope>test</scope>
474500
</dependency>
475-
476501
</dependencies>
477502
</project>
478503

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE suppressions PUBLIC
3+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.0//EN"
4+
"https://checkstyle.org/dtds/suppressions_1_0.dtd">
5+
6+
7+
<!--
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
-->
20+
21+
<suppressions>
22+
<suppress checks="ParameterNumber"
23+
files="org[\\/]apache[\\/]hadoop[\\/]fs[\\/]gs[\\/]GoogleCloudStorageItemInfo.java"/>
24+
<suppress checks="ParameterNumber"
25+
files="org[\\/]apache[\\/]hadoop[\\/]fs[\\/]gs[\\/]TestStorageResourceId.java"/>
26+
</suppressions>

hadoop-tools/hadoop-gcp/src/main/java/org/apache/hadoop/fs/gs/StorageResourceId.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ static StorageResourceId fromStringPath(String path) {
262262
* Parses {@link StorageResourceId} from specified string and generationId.
263263
*/
264264
static StorageResourceId fromStringPath(String path, long generationId) {
265+
checkArgument(path != null, "path must not be null");
266+
265267
Matcher matcher = GCS_PATH_PATTERN.matcher(path);
266268
checkArgument(matcher.matches(), "'%s' is not a valid GCS object name.", path);
267269

0 commit comments

Comments
 (0)