[
https://issues.apache.org/jira/browse/NIFI-5537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16611108#comment-16611108
]
ASF GitHub Bot commented on NIFI-5537:
--------------------------------------
Github user MikeThomsen commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2956#discussion_r216785691
--- Diff:
nifi-nar-bundles/nifi-neo4j-bundle/nifi-neo4j-processors/src/test/java/org/apache/nifi/processors/neo4j/ITNeo4JCyperExecutor.java
---
@@ -0,0 +1,218 @@
+/*
+ * 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.nifi.processors.neo4j;
+
+import org.apache.nifi.util.MockFlowFile;
+import org.apache.nifi.util.TestRunner;
+import org.apache.nifi.util.TestRunners;
+import org.neo4j.driver.v1.AuthTokens;
+import org.neo4j.driver.v1.Driver;
+import org.neo4j.driver.v1.GraphDatabase;
+import org.neo4j.driver.v1.Session;
+import org.neo4j.driver.v1.StatementResult;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Neo4J Cypher integration tests. Please set the neo4j url, user and
password according to your setup.
+ * The steps to setup neo4j are
+ * <ol>
+ * <li> Install Neo4J</li>
+ * <code>brew install neo4j</code>
+ * <li>Setup neo4j</li>
+ * <code>neo4j start</code>
+ * <li>Log into cypher shell using default username/password -
neo4j/neo4j</li>
+ * <code>cypher-shell</code>
+ * <li>Changel password to admin</li>
+ * <code>CALL dbms.changePassword('admin')</code>
+ * <li> Restart neo4j</li>
+ * <code>neo4j restart</code>
+ * <li>Log into cypher shell using new password (admin)</li>
+ * <code>cypher-shell</code>
+ * </ol>
+ */
+public class ITNeo4JCyperExecutor {
+ protected TestRunner runner;
+ protected Driver driver;
+ protected String neo4jUrl = "bolt://localhost:7687";
+ protected String user = "neo4j";
+ protected String password = "admin";
+
+ @Before
+ public void setUp() throws Exception {
+ runner = TestRunners.newTestRunner(Neo4JCypherExecutor.class);
+ runner.setProperty(AbstractNeo4JCypherExecutor.CONNECTION_URL,
neo4jUrl);
+ runner.setProperty(AbstractNeo4JCypherExecutor.USERNAME, user);
+ runner.setProperty(AbstractNeo4JCypherExecutor.PASSWORD, password);
+ runner.setProperty(AbstractNeo4JCypherExecutor.QUERY, "match (n)
return n");
+ driver = GraphDatabase.driver(neo4jUrl, AuthTokens.basic(user,
password));
+ executeSession("match (n) detach delete n");
+
+ StatementResult result = executeSession("match (n) return n");
+
+ assertEquals("nodes should be equal", 0, result.list().size());
+ }
+
+ protected StatementResult executeSession(String statement) {
+ try (Session session = driver.session()) {
+ return session.run(statement);
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ runner = null;
+ if (driver != null)
--- End diff --
Curly brackets.
> Create Neo4J cypher execution processor
> ---------------------------------------
>
> Key: NIFI-5537
> URL: https://issues.apache.org/jira/browse/NIFI-5537
> Project: Apache NiFi
> Issue Type: New Feature
> Components: Extensions
> Affects Versions: 1.7.1
> Environment: All
> Reporter: Mans Singh
> Assignee: Mans Singh
> Priority: Minor
> Labels: graph, neo4j, node, relationship
> Fix For: 1.8.0
>
>
> Create Nifi Neo4J cypher queries processor
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)