Search in sources :

Example 6 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project janusgraph by JanusGraph.

the class JanusGraphStepStrategyTest method doTest.

@ParameterizedTest
@MethodSource("generateTestParameters")
public void doTest(Traversal original, Traversal optimized, Collection<TraversalStrategy> otherStrategies) {
    final TraversalStrategies strategies = new DefaultTraversalStrategies();
    strategies.addStrategies(JanusGraphStepStrategy.instance());
    for (final TraversalStrategy strategy : otherStrategies) {
        strategies.addStrategies(strategy);
    }
    original.asAdmin().setStrategies(strategies);
    original.asAdmin().applyStrategies();
    assertEquals(optimized, original);
}
Also used : TraversalStrategies(org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies) DefaultTraversalStrategies(org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies) TraversalStrategy(org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy) DefaultTraversalStrategies(org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 7 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project janusgraph by JanusGraph.

the class JanusGraphMultiQueryStepTest method testReset.

@ParameterizedTest
@MethodSource("generateTestParameters")
public void testReset(Traversal.Admin traversal, boolean limitBatchSize, Collection<MultiQueriable> clients) {
    JanusGraphMultiQueryStep originalStep = new JanusGraphMultiQueryStep(traversal, limitBatchSize);
    clients.forEach(originalStep::attachClient);
    originalStep.reset();
    assertEquals(limitBatchSize, originalStep.isLimitBatchSize());
    assertEquals(originalStep.getClientSteps().size(), clients.size());
    assertTrue(clients.containsAll(originalStep.getClientSteps()));
    assertTrue(originalStep.getClientSteps().containsAll(clients));
}
Also used : JanusGraphMultiQueryStep(org.janusgraph.graphdb.tinkerpop.optimize.step.JanusGraphMultiQueryStep) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 8 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project janusgraph by JanusGraph.

the class JanusGraphMultiQueryStepTest method testClone.

@ParameterizedTest
@MethodSource("generateTestParameters")
public void testClone(Traversal.Admin traversal, boolean limitBatchSize, Collection<MultiQueriable> clients) {
    JanusGraphMultiQueryStep originalStep = new JanusGraphMultiQueryStep(traversal, limitBatchSize);
    clients.forEach(originalStep::attachClient);
    JanusGraphMultiQueryStep clone = originalStep.clone();
    assertEquals(limitBatchSize, clone.isLimitBatchSize());
    assertEquals(originalStep.getClientSteps().size(), clone.getClientSteps().size());
    assertTrue(clone.getClientSteps().containsAll(originalStep.getClientSteps()));
    assertTrue(originalStep.getClientSteps().containsAll(clone.getClientSteps()));
}
Also used : JanusGraphMultiQueryStep(org.janusgraph.graphdb.tinkerpop.optimize.step.JanusGraphMultiQueryStep) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 9 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project janusgraph by JanusGraph.

the class JanusGraphTest method testSupportOfDataTypes.

@ParameterizedTest
@MethodSource("generateParametersTestSupportOfDataTypes")
public <T> void testSupportOfDataTypes(Class<T> classes, T data, Equals<T> a) {
    clopen(option(CUSTOM_ATTRIBUTE_CLASS, "attribute10"), SpecialInt.class.getCanonicalName(), option(CUSTOM_SERIALIZER_CLASS, "attribute10"), SpecialIntSerializer.class.getCanonicalName());
    PropertyKey num = makeKey("propertyKey", classes);
    finishSchema();
    clopen();
    num = tx.getPropertyKey("propertyKey");
    JanusGraphVertex v = tx.addVertex();
    v.property(VertexProperty.Cardinality.single, n(num), data);
    // ######## VERIFICATION ##########
    assertTrue(a.verifyValue(v.value("propertyKey")));
    clopen();
    v = getV(tx, v);
    // ######## CHECK AFTER REOPEN ##########
    assertTrue(a.verifyValue(v.value("propertyKey")));
}
Also used : SpecialIntSerializer(org.janusgraph.graphdb.serializer.SpecialIntSerializer) SpecialInt(org.janusgraph.graphdb.serializer.SpecialInt) JanusGraphVertex(org.janusgraph.core.JanusGraphVertex) PropertyKey(org.janusgraph.core.PropertyKey) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 10 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project janusgraph by JanusGraph.

the class GeoshapeGraphBinarySerializerTest method shouldSerializeViaIoRegistry.

@ParameterizedTest
@MethodSource("geoshapeProvider")
public void shouldSerializeViaIoRegistry(Geoshape geoshape) throws IOException {
    final GraphBinaryMessageSerializerV1 serializer = new GraphBinaryMessageSerializerV1();
    final Map<String, Object> config = new HashMap<>();
    config.put(TOKEN_IO_REGISTRIES, Collections.singletonList(JanusGraphIoRegistry.class.getName()));
    serializer.configure(config, Collections.emptyMap());
    assertSymmetricGeoshapeSerializationInResponseMessage(serializer, geoshape);
}
Also used : HashMap(java.util.HashMap) GraphBinaryMessageSerializerV1(org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

MethodSource (org.junit.jupiter.params.provider.MethodSource)1376 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1361 Transaction (org.neo4j.graphdb.Transaction)103 Stream (java.util.stream.Stream)70 Test (org.junit.jupiter.api.Test)67 ArrayList (java.util.ArrayList)63 InterruptAfter (io.aeron.test.InterruptAfter)60 List (java.util.List)60 SelfSignedCertificate (io.netty.handler.ssl.util.SelfSignedCertificate)58 IOException (java.io.IOException)58 ArrowableSingleShape (net.sf.latexdraw.model.api.shape.ArrowableSingleShape)55 TimeUnit (java.util.concurrent.TimeUnit)54 CountDownLatch (java.util.concurrent.CountDownLatch)53 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)52 lombok.val (lombok.val)52 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)51 Arguments (org.junit.jupiter.params.provider.Arguments)47 AfterEach (org.junit.jupiter.api.AfterEach)46 SSLEngine (javax.net.ssl.SSLEngine)44 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)43