You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by fl...@apache.org on 2021/10/06 12:07:02 UTC
[tinkerpop] 01/01: Only execute transactions tests if transactions
are supported
This is an automated email from the ASF dual-hosted git repository.
florianhockmann pushed a commit to branch TINKERPOP-2556
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit cd47e44e952ba77e7bf035e3d529f19b15a518bb
Author: Florian Hockmann <fh...@florian-hockmann.de>
AuthorDate: Wed Oct 6 13:35:14 2021 +0200
Only execute transactions tests if transactions are supported
---
.../GraphTraversalModificationTests.cs | 18 ++-
gremlin-dotnet/test/pom.xml | 137 +++++++++++++++++++++
2 files changed, 153 insertions(+), 2 deletions(-)
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalModificationTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalModificationTests.cs
index 341cde0..2ce0573 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalModificationTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/GraphTraversalModificationTests.cs
@@ -33,7 +33,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
{
private readonly IRemoteConnection _connection = new RemoteConnectionFactory().CreateRemoteConnection("g");
- [Fact]
+ [IgnoreIfTransactionsNotSupportedFact]
public async Task ShouldSupportRemoteTransactionsCommit()
{
var g = AnonymousTraversalSource.Traversal().WithRemote(_connection);
@@ -55,7 +55,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
g.V().Count().Next();
}
- [Fact]
+ [IgnoreIfTransactionsNotSupportedFact]
public async Task ShouldSupportRemoteTransactionsRollback()
{
var g = AnonymousTraversalSource.Traversal().WithRemote(_connection);
@@ -88,4 +88,18 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
g.V().Drop().Iterate();
}
}
+
+ public sealed class IgnoreIfTransactionsNotSupportedFact : FactAttribute
+ {
+ public IgnoreIfTransactionsNotSupportedFact()
+ {
+ if (!TransactionsSupported)
+ {
+ Skip = "Transactions not supported";
+ }
+ }
+
+ private static bool TransactionsSupported =>
+ Convert.ToBoolean(Environment.GetEnvironmentVariable("TEST_TRANSACTIONS"));
+ }
}
\ No newline at end of file
diff --git a/gremlin-dotnet/test/pom.xml b/gremlin-dotnet/test/pom.xml
index d110391..2294643 100644
--- a/gremlin-dotnet/test/pom.xml
+++ b/gremlin-dotnet/test/pom.xml
@@ -96,6 +96,16 @@ limitations under the License.
<extensions>true</extensions>
<configuration>
<skip>${skipTests}</skip>
+ <!--
+ transaction testing is disabled unless the -DincludeNeo4j flag enables the include-neo4j
+ maven profile which is a standard profile we use to add neo4j to testing explicitly - for
+ npm we set this TEST_TRANSACTIONS environment variable that can be accessed in tests to
+ determine if we skip transaction oriented tests or not. without neo4j we can't test tx()
+ so this is disabled by default and enabled in the include-neo4j profile below
+ -->
+ <environmentVariables>
+ <TEST_TRANSACTIONS>false</TEST_TRANSACTIONS>
+ </environmentVariables>
</configuration>
</plugin>
<plugin>
@@ -113,6 +123,11 @@ limitations under the License.
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.tinkerpop</groupId>
+ <artifactId>neo4j-gremlin</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
@@ -206,5 +221,127 @@ limitations under the License.
</plugins>
</build>
</profile>
+ <!--
+ This profile will include neo4j for purposes of transactional testing within Gremlin Server.
+ Tests that require neo4j specifically will be "ignored" if this profile is not turned on.
+ -->
+ <profile>
+ <id>include-neo4j</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <property>
+ <name>includeNeo4j</name>
+ </property>
+ </activation>
+ <properties>
+ <packaging.type>dotnet-integration-test</packaging.type>
+ </properties>
+ <build>
+ <plugins>
+ <!-- with neo4j present we can enable transaction testing -->
+ <plugin>
+ <groupId>org.eobjects.build</groupId>
+ <artifactId>dotnet-maven-plugin</artifactId>
+ <configuration>
+ <environmentVariables combine.children="override">
+ <TEST_TRANSACTIONS>true</TEST_TRANSACTIONS>
+ </environmentVariables>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.gmavenplus</groupId>
+ <artifactId>gmavenplus-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.neo4j</groupId>
+ <artifactId>neo4j-tinkerpop-api-impl</artifactId>
+ <version>0.9-3.4.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.neo4j</groupId>
+ <artifactId>neo4j-kernel</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-text</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.github.ben-manes.caffeine</groupId>
+ <artifactId>caffeine</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-reflect</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-nop</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>io.dropwizard.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.11.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-reflect</artifactId>
+ <version>2.11.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ <version>5.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ <version>4.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.neo4j</groupId>
+ <artifactId>neo4j-kernel</artifactId>
+ <version>3.4.11</version>
+ <exclusions>
+ <exclusion>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-all</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file