//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void timeoutOnAcquiringExclusiveLock() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TimeoutOnAcquiringExclusiveLock() { ExpectedException.expect(new RootCauseMatcher <>(typeof(LockAcquisitionTimeoutException), "The transaction has been terminated. " + "Retry your operation in a new transaction, and you should see a successful result. " + "Unable to acquire lock within configured timeout (dbms.lock.acquisition.timeout). " + "Unable to acquire lock for resource: NODE with id: 0 within 2000 millis.")); using (Transaction ignored = _database.beginTx()) { ResourceIterator <Node> nodes = _database.findNodes(_marker); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: Node node = nodes.next(); node.SetProperty(TEST_PROPERTY_NAME, "b"); Future <Void> propertySetFuture = _secondTransactionExecutor.executeDontWait(state => { using (Transaction transaction1 = _database.beginTx()) { node.SetProperty(TEST_PROPERTY_NAME, "b"); transaction1.success(); } return(null); }); _secondTransactionExecutor.waitUntilWaiting(ExclusiveLockWaitingPredicate()); _clockExecutor.execute((OtherThreadExecutor.WorkerCommand <Void, Void>)state => { _fakeClock.forward(3, TimeUnit.SECONDS); return(null); }); propertySetFuture.get(); fail("Should throw termination exception."); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void pageCacheMetrics() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void PageCacheMetrics() { Label testLabel = Label.label("testLabel"); using (Transaction transaction = _database.beginTx()) { Node node = _database.createNode(testLabel); node.SetProperty("property", "value"); transaction.Success(); } using (Transaction ignored = _database.beginTx()) { ResourceIterator <Node> nodes = _database.findNodes(testLabel); assertEquals(1, nodes.Count()); } AssertMetrics("Metrics report should include page cache pins", PC_PINS, greaterThan(0L)); AssertMetrics("Metrics report should include page cache unpins", PC_UNPINS, greaterThan(0L)); AssertMetrics("Metrics report should include page cache evictions", PC_EVICTIONS, greaterThanOrEqualTo(0L)); AssertMetrics("Metrics report should include page cache page faults", PC_PAGE_FAULTS, greaterThan(0L)); AssertMetrics("Metrics report should include page cache hits", PC_HITS, greaterThan(0L)); AssertMetrics("Metrics report should include page cache flushes", PC_FLUSHES, greaterThanOrEqualTo(0L)); AssertMetrics("Metrics report should include page cache exceptions", PC_EVICTION_EXCEPTIONS, equalTo(0L)); assertEventually("Metrics report should include page cache hit ratio", () => readDoubleValue(metricsCsv(_metricsDirectory, PC_HIT_RATIO)), lessThanOrEqualTo(1.0), 5, SECONDS); assertEventually("Metrics report should include page cache usage ratio", () => readDoubleValue(metricsCsv(_metricsDirectory, PC_USAGE_RATIO)), lessThanOrEqualTo(1.0), 5, SECONDS); }
private Node CreateNodeWithProperty(Label label, string key, object value) { Node node = _db.createNode(label); node.SetProperty(key, value); return(node); }
private void CreateNonUniqueNodes() { using (Transaction tx = _db.beginTx()) { Node originNode = _db.createNode(LABEL); originNode.SetProperty(KEY, _point1); Node centerNode = _db.createNode(LABEL); centerNode.SetProperty(KEY, _point1); tx.Success(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void readOwnChangesWithoutIndex() public virtual void ReadOwnChangesWithoutIndex() { // WHEN using (Transaction tx = _db.beginTx()) { Node node = _db.createNode(_label); node.SetProperty(PROPERTY_KEY, VALUE_1); AssertNodeWith(_label, PROPERTY_KEY, VALUE_1); tx.Success(); } AssertInTxNodeWith(_label, PROPERTY_KEY, VALUE_1); }
private Pair <long, long> CreateUniqueNodes() { Pair <long, long> nodeIds; using (Transaction tx = _db.beginTx()) { Node originNode = _db.createNode(LABEL); originNode.SetProperty(KEY, _point1); Node centerNode = _db.createNode(LABEL); centerNode.SetProperty(KEY, _point2); nodeIds = Pair.of(originNode.Id, centerNode.Id); tx.Success(); } return(nodeIds); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(timeout = TEST_TIMEOUT) public void removeNodeChangeNodeProperty() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void RemoveNodeChangeNodeProperty() { // GIVEN //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.test.Barrier_Control barrier = new org.neo4j.test.Barrier_Control(); Org.Neo4j.Test.Barrier_Control barrier = new Org.Neo4j.Test.Barrier_Control(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long nodeId; long nodeId; using (Transaction tx = _db.beginTx()) { Node node = _db.createNode(); nodeId = node.Id; node.SetProperty(PROPERTY_KEY, VALUE_1); tx.Success(); } // WHEN Future <Void> future = T2.execute(state => { using (Transaction tx = _db.beginTx()) { _db.getNodeById(nodeId).delete(); tx.Success(); barrier.Reached(); } return(null); }); try { using (Transaction tx = _db.beginTx()) { barrier.Await(); _db.getNodeById(nodeId).setProperty(PROPERTY_KEY, VALUE_2); tx.Success(); barrier.Release(); } } catch (TransactionFailureException e) { // Node was already deleted, fine. assertThat(e.InnerException, instanceOf(typeof(InvalidRecordException))); } future.get(); using (Transaction tx = _db.beginTx()) { try { _db.getNodeById(nodeId); assertEquals(VALUE_2, _db.getNodeById(nodeId).getProperty(PROPERTY_KEY, VALUE_2)); } catch (NotFoundException) { // Fine, its gone } tx.Success(); } }