//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void calls_simplistic_procedure() public virtual void CallsSimplisticProcedure() { using (Driver driver = GraphDatabase.driver(GraphDb.boltURI(), Configuration()), Session session = driver.session()) { StatementResult result = session.run("CALL " + _procedureNamespace + ".theAnswer()"); assertThat(result.single().get("value").asLong()).isEqualTo(42L); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setup() public virtual void Setup() { _adminDriver = GraphDatabase.driver(Db.boltURI(), basic("neo4j", "neo4j")); using (Session session = _adminDriver.session(), Transaction tx = session.beginTransaction()) { tx.run("CALL dbms.changePassword('abc')").consume(); tx.success(); } _adminDriver.close(); _adminDriver = GraphDatabase.driver(Db.boltURI(), basic("neo4j", "abc")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mixingPeriodicCommitAndLoadCSVShouldWork() public virtual void MixingPeriodicCommitAndLoadCSVShouldWork() { for (int i = _lineCountInCSV - 1; i < _lineCountInCSV + 1; i++) // test with different periodic commit sizes { using (Driver driver = GraphDatabase.driver(GraphDb.boltURI(), Configuration()), Session session = driver.session()) { StatementResult result = session.run("USING PERIODIC COMMIT " + i + "\n" + "LOAD CSV FROM \"" + _url + "\" as row fieldterminator \" \"\n" + "MERGE (currentnode:Label1 {uuid:row[0]})\n" + "RETURN currentnode;"); int countOfNodes = 0; while (result.hasNext()) { Node node = result.next().get(0).asNode(); assertTrue(node.hasLabel("Label1")); assertEquals(countOfNodes.ToString(), node.get("uuid").asString()); countOfNodes++; } assertEquals(_lineCountInCSV, countOfNodes); session.reset(); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @BeforeClass public static void setUp() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public static void SetUp() { _driver = GraphDatabase.driver(Db.boltURI()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogQueriesViaBolt() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldLogQueriesViaBolt() { // *** GIVEN *** Socket socket = new Socket("localhost", Neo4j.boltURI().Port); DataInputStream dataIn = new DataInputStream(socket.InputStream); DataOutputStream dataOut = new DataOutputStream(socket.OutputStream); // Bolt handshake send(dataOut, new sbyte[] { ( sbyte )0x60, ( sbyte )0x60, unchecked (( sbyte )0xB0), ( sbyte )0x17, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); receive(dataIn, new sbyte[] { 0, 0, 0, 1 }); // This has been taken from: http://alpha.neohq.net/docs/server-manual/bolt-examples.html // Send INIT "MyClient/1.0" { "scheme": "basic", "principal": "neo4j", "credentials": "secret"} Send(dataOut, "00 40 B1 01 8C 4D 79 43 6C 69 65 6E 74 2F 31 2E\n" + "30 A3 86 73 63 68 65 6D 65 85 62 61 73 69 63 89\n" + "70 72 69 6E 63 69 70 61 6C 85 6E 65 6F 34 6A 8B\n" + "63 72 65 64 65 6E 74 69 61 6C 73 86 73 65 63 72\n" + "65 74 00 00"); // Receive SUCCESS {} ReceiveSuccess(dataIn); // *** WHEN *** for (int i = 0; i < 5; i++) { // Send RUN "RETURN 1 AS num" {} Send(dataOut, "00 13 b2 10 8f 52 45 54 55 52 4e 20 31 20 41 53 20 6e 75 6d a0 00 00"); // Receive SUCCESS { "fields": ["num"], "result_available_after": X } //non-deterministic so just ignore it here ReceiveSuccess(dataIn); //receive( dataIn, "00 0f b1 70 a1 86 66 69 65 6c 64 73 91 83 6e 75 6d 00 00" ); // Send PULL_ALL Send(dataOut, "00 02 B0 3F 00 00"); // Receive RECORD[1] Receive(dataIn, "00 04 b1 71 91 01 00 00"); // Receive SUCCESS { "type": "r", "result_consumed_after": Y } //non-deterministic so just ignore it here ReceiveSuccess(dataIn); } // *** THEN *** Path queriesLog = Neo4j.Config.get(GraphDatabaseSettings.log_queries_filename).toPath(); IList <string> lines = Files.readAllLines(queriesLog); assertThat(lines, hasSize(5)); foreach (string line in lines) { assertThat(line, containsString("INFO")); assertThat(line, containsString("bolt-session")); assertThat(line, containsString("MyClient/1.0")); assertThat(line, containsString("client/127.0.0.1:")); assertThat(line, containsString("server/127.0.0.1:" + Neo4j.boltURI().Port)); assertThat(line, containsString(" - RETURN 1 AS num - {}")); } // *** CLEAN UP *** // Send RESET Send(dataOut, "00 02 b0 0f 00 00"); // Receive SUCCESS {} Receive(dataIn, "00 03 b1 70 a0 00 00"); socket.close(); }