-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-10503. Bump jgrapht to 1.4.0 #6364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ecdbbc1
HDDS-10503. Upgrade jgrapht dependency.
ivanzlenko a26ee39
HDDS-10503. Fix license text.
ivanzlenko 5a56681
HDDS-10503. Use @EnumSource instead of @MethodSource
ivanzlenko 8f465c1
HDDS-10503. Remove redundant imports
ivanzlenko db3e9e1
HDDS-10503. Downgrade jgrapht version to the latest which supports ja…
ivanzlenko eb31ad8
fix dependency
adoroszlai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
84 changes: 84 additions & 0 deletions
84
...ds/rocksdb-checkpoint-differ/src/test/java/org/apache/ozone/graph/TestPrintableGraph.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| /* | ||
| * 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.ozone.graph; | ||
|
|
||
| import com.google.common.graph.MutableGraph; | ||
| import org.apache.ozone.rocksdiff.CompactionNode; | ||
| import org.junit.jupiter.api.extension.ExtendWith; | ||
| import org.junit.jupiter.api.io.TempDir; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.EnumSource; | ||
| import org.mockito.Mock; | ||
| import org.mockito.junit.jupiter.MockitoExtension; | ||
|
|
||
| import java.io.IOException; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
| import java.util.Set; | ||
| import java.util.stream.Collectors; | ||
| import java.util.stream.Stream; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
| import static org.mockito.Mockito.when; | ||
|
|
||
| /** | ||
| * This class is used for testing the PrintableGraph class. | ||
| * It contains methods to test the generation and printing of graphs with different types. | ||
| */ | ||
| @ExtendWith(MockitoExtension.class) | ||
| public class TestPrintableGraph { | ||
| @TempDir | ||
| private Path dir; | ||
|
|
||
| @Mock | ||
| private MutableGraph<CompactionNode> mutableGraph; | ||
|
|
||
| @ParameterizedTest | ||
| @EnumSource(PrintableGraph.GraphType.class) | ||
| void testPrintNoGraphMessage(PrintableGraph.GraphType graphType) { | ||
| PrintableGraph graph = new PrintableGraph(mutableGraph, graphType); | ||
| try { | ||
| graph.generateImage(dir.resolve(graphType.name()).toString()); | ||
| } catch (IOException e) { | ||
| assertEquals("Graph is empty.", e.getMessage()); | ||
| } | ||
| } | ||
|
|
||
| @ParameterizedTest | ||
| @EnumSource(PrintableGraph.GraphType.class) | ||
| void testPrintActualGraph(PrintableGraph.GraphType graphType) throws IOException { | ||
| Set<CompactionNode> nodes = Stream.of( | ||
| new CompactionNode("fileName1", | ||
| 100, 100, "startKey1", "endKey1", "columnFamily1"), | ||
| new CompactionNode("fileName2", | ||
| 200, 200, "startKey2", "endKey2", null), | ||
| new CompactionNode("fileName3", | ||
| 300, 300, null, "endKey3", "columnFamily3"), | ||
| new CompactionNode("fileName4", | ||
| 400, 400, "startKey4", null, "columnFamily4") | ||
| ).collect(Collectors.toSet()); | ||
| when(mutableGraph.nodes()).thenReturn(nodes); | ||
|
|
||
| PrintableGraph graph = new PrintableGraph(mutableGraph, graphType); | ||
| graph.generateImage(dir.resolve(graphType.name()).toString()); | ||
|
|
||
| assertTrue(Files.exists(dir.resolve(graphType.name())), "Graph hasn't been generated"); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
License header is needed in all files. Example:
ozone/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigFileAppender.java
Lines 1 to 17 in 131eec0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we need more informative output in rat.sh and mark build failed :)
~/projects/opensource/ozone hadoop-hdds/rocksdb-checkpoint-differ/target/rat.txt: !????? /home/izlenko/projects/opensource/ozone/hadoop-hdds/rocksdb-checkpoint-differ/src/test/java/org/apache/ozone/graph/TestPrintableGraph.java izlenko:~/projects/openI've totally missed that.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
I don't see any problem there, the check failed: https://github.com/ivanzlenko/ozone/actions/runs/8233075581/job/22511818434
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whole output from console.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rat.shexits with error code.BUILD SUCCESSis printed only becausehadoop-hddsandhadoop-ozoneare checked separately, the latter is successful. This will be improved in #6358, which changes the build to run a single Maven command for the whole project.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!