-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor JanusGraphHasStep strategy and fix documentation misspell CTR
Follow up to #3724 Signed-off-by: Oleksandr Porunov <[email protected]>
- Loading branch information
Showing
5 changed files
with
78 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
65 changes: 65 additions & 0 deletions
65
janusgraph-core/src/test/java/org/janusgraph/util/datastructures/ExceptionUtilTest.java
This file contains 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,65 @@ | ||
// Copyright 2023 JanusGraph Authors | ||
// | ||
// Licensed 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.janusgraph.util.datastructures; | ||
|
||
import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalInterruptedException; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertFalse; | ||
import static org.junit.jupiter.api.Assertions.assertSame; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class ExceptionUtilTest { | ||
|
||
@Test | ||
public void isCausedBy_WhenExceptionHasNoCause_ReturnsFalse() { | ||
Throwable exception = new RuntimeException("Test exception"); | ||
boolean result = ExceptionUtil.isCausedBy(exception, NullPointerException.class); | ||
assertFalse(result); | ||
} | ||
|
||
@Test | ||
public void isCausedBy_WhenExceptionCauseMatches_ReturnsTrue() { | ||
NullPointerException cause = new NullPointerException("Test cause"); | ||
Throwable exception = new RuntimeException("Test exception", cause); | ||
boolean result = ExceptionUtil.isCausedBy(exception, NullPointerException.class); | ||
assertTrue(result); | ||
} | ||
|
||
@Test | ||
public void isCausedBy_WhenExceptionCauseDoesNotMatch_ReturnsFalse() { | ||
IllegalArgumentException cause = new IllegalArgumentException("Test cause"); | ||
Throwable exception = new RuntimeException("Test exception", cause); | ||
boolean result = ExceptionUtil.isCausedBy(exception, NullPointerException.class); | ||
assertFalse(result); | ||
} | ||
|
||
@Test | ||
public void convertIfInterrupted_WhenRuntimeExceptionNotCausedByInterruptedException_ReturnsSameException() { | ||
RuntimeException exception = new RuntimeException("Test exception"); | ||
RuntimeException result = ExceptionUtil.convertIfInterrupted(exception); | ||
assertSame(exception, result); | ||
} | ||
|
||
@Test | ||
public void convertIfInterrupted_WhenRuntimeExceptionCausedByInterruptedException_ReturnsTraversalInterruptedException() { | ||
InterruptedException cause = new InterruptedException("Test cause"); | ||
RuntimeException exception = new RuntimeException("Test exception", cause); | ||
RuntimeException result = ExceptionUtil.convertIfInterrupted(exception); | ||
assertTrue(result instanceof TraversalInterruptedException); | ||
assertEquals(exception, result.getCause()); | ||
} | ||
} |
dac1ea1
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.
Benchmark
org.janusgraph.JanusGraphSpeedBenchmark.basicAddAndDelete
20859.96076811083
ms/op20132.68260361965
ms/op1.04
org.janusgraph.GraphCentricQueryBenchmark.getVertices
1816.142567769631
ms/op1617.8956294193085
ms/op1.12
org.janusgraph.MgmtOlapJobBenchmark.runClearIndex
222.5595572521739
ms/op222.76279991304347
ms/op1.00
org.janusgraph.MgmtOlapJobBenchmark.runReindex
599.0068900644444
ms/op541.8996275500001
ms/op1.11
org.janusgraph.JanusGraphSpeedBenchmark.basicCount
367.1732681465175
ms/op368.0788711730627
ms/op1.00
org.janusgraph.CQLMultiQueryHasStepBenchmark.getVerticesFilteredByHasStepWithNonHasStepAfterOut
190952.99126051553
ms/oporg.janusgraph.CQLMultiQueryBenchmark.getElementsWithUsingEmitRepeatSteps
38612.53095589334
ms/oporg.janusgraph.CQLMultiQueryBenchmark.getAllElementsTraversedFromOuterVertex
21968.607111862624
ms/oporg.janusgraph.CQLMultiQueryBenchmark.getVerticesWithDoubleUnion
833.576925271878
ms/oporg.janusgraph.CQLMultiQueryHasStepBenchmark.getVerticesFilteredByHasStep
193639.64074360297
ms/oporg.janusgraph.CQLMultiQueryBenchmark.getNames
23488.29916608722
ms/op19643.66567439762
ms/op1.20
org.janusgraph.CQLMultiQueryBenchmark.getVerticesFilteredByAndStep
846.9237343292218
ms/oporg.janusgraph.CQLMultiQueryBenchmark.getVerticesFromMultiNestedRepeatStepStartingFromSingleVertex
30740.772159917142
ms/oporg.janusgraph.CQLMultiQueryBenchmark.getVerticesWithCoalesceUsage
772.593280929701
ms/oporg.janusgraph.CQLMultiQueryHasStepBenchmark.getAllPropertiesOfVerticesFilteredByHasStep
237453.85455990594
ms/oporg.janusgraph.CQLMultiQueryHasStepBenchmark.getVerticesFilteredByHasStepInParentStep
197248.65034425672
ms/oporg.janusgraph.CQLMultiQueryBenchmark.getIdToOutVerticesProjection
458.0167254749214
ms/oporg.janusgraph.CQLMultiQueryBenchmark.getNeighborNames
21903.664964059444
ms/op19824.388658859913
ms/op1.10
org.janusgraph.CQLMultiQueryBenchmark.getElementsWithUsingRepeatUntilSteps
21460.03266763694
ms/oporg.janusgraph.CQLMultiQueryBenchmark.getAdjacentVerticesLocalCounts
22674.777950415715
ms/oporg.janusgraph.CQLMultiQueryHasStepBenchmark.getSpecificPropertiesOfVerticesFilteredByHasStep
313493.00170404284
ms/opThis comment was automatically generated by workflow using github-action-benchmark.