Skip to content

Commit 325cbf5

Browse files
committed
Fix progress ticket for test
1 parent bdee216 commit 325cbf5

2 files changed

Lines changed: 11 additions & 173 deletions

File tree

modules/Neo4jPlugin/src/main/java/org/gephi/plugins/neo4j/importer/Neo4jDatabaseImporter.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,15 @@ public class Neo4jDatabaseImporter implements WizardImporter, LongTask {
9595
public boolean execute(ContainerLoader containerLoader) {
9696
this.container = containerLoader;
9797
this.report = new Report();
98-
this.progressTicket.setDisplayName("Neo4j import");
99-
this.progressTicket.switchToIndeterminate();
100-
this.progressTicket.start();
98+
if (this.progressTicket != null) {
99+
this.progressTicket.setDisplayName("Neo4j import");
100+
this.progressTicket.switchToIndeterminate();
101+
this.progressTicket.start();
102+
}
101103

102104
try {
103105
// Create the neo4j driver
104-
this.progressTicket.progress("Connecting to neo4j...");
106+
if (this.progressTicket != null) this.progressTicket.progress("Connecting to neo4j...");
105107
if (this.driver != null) this.driver.close();
106108
this.driver = GraphDatabase.driver(
107109
url != null ? url : "neo4j://localhost",
@@ -125,7 +127,7 @@ public boolean execute(ContainerLoader containerLoader) {
125127
this.getReport().logIssue(new Issue(e, Issue.Level.CRITICAL));
126128
} finally {
127129
if (this.driver != null) this.driver.close();
128-
this.progressTicket.finish();
130+
if (this.progressTicket != null) this.progressTicket.finish();
129131
}
130132

131133
return !cancel;
@@ -138,7 +140,7 @@ private void doImportByNodeAndEdgeTypes(List<String> labels, List<String> relati
138140
Value parameters = parameters("labels", labels, "relationshipTypes", relationshipTypes);
139141

140142
// Import nodes
141-
this.progressTicket.progress("Importing nodes...");
143+
if (this.progressTicket != null) this.progressTicket.progress("Importing nodes...");
142144
long nbNodesImported = Flowable.using(
143145
() -> this.driver.rxSession(this.DBName != null ? SessionConfig.forDatabase(this.DBName) : SessionConfig.defaultConfig()),
144146
session -> session.readTransaction(tx -> {
@@ -155,7 +157,7 @@ private void doImportByNodeAndEdgeTypes(List<String> labels, List<String> relati
155157
this.getReport().log(String.format("%s nodes imported", nbNodesImported));
156158

157159
// Import edges
158-
this.progressTicket.progress("Importing edges...");
160+
if (this.progressTicket != null) this.progressTicket.progress("Importing edges...");
159161
long nbEdgesImported = Flowable.using(
160162
() -> this.driver.rxSession(this.DBName != null ? SessionConfig.forDatabase(this.DBName) : SessionConfig.defaultConfig()),
161163
session -> session.readTransaction(tx -> {
@@ -178,7 +180,7 @@ private void doImportByNodeAndEdgeTypes(List<String> labels, List<String> relati
178180
*/
179181
private void doImportByNodeAndEdgeQueries() {
180182
// Import nodes
181-
this.progressTicket.progress("Importing nodes...");
183+
if (this.progressTicket != null) this.progressTicket.progress("Importing nodes...");
182184
long nbNodesImported = Flowable.using(
183185
() -> this.driver.rxSession(this.DBName != null ? SessionConfig.forDatabase(this.DBName) : SessionConfig.defaultConfig()),
184186
session -> session.readTransaction(tx -> {
@@ -204,7 +206,7 @@ private void doImportByNodeAndEdgeQueries() {
204206
this.getReport().log(String.format("%s nodes imported", nbNodesImported));
205207

206208
// Import edges
207-
this.progressTicket.progress("Importing edges...");
209+
if (this.progressTicket != null) this.progressTicket.progress("Importing edges...");
208210
long nbEdgesImported = Flowable.using(
209211
() -> this.driver.rxSession(this.DBName != null ? SessionConfig.forDatabase(this.DBName) : SessionConfig.defaultConfig()),
210212
session -> session.readTransaction(tx -> {

modules/Neo4jPlugin/src/test/java/org/gephi/plugins/neo4j/importer/Neo4JDatabaseImporterTest.java

Lines changed: 0 additions & 164 deletions
This file was deleted.

0 commit comments

Comments
 (0)