//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void verifyAcquisitionFailure(java.util.concurrent.Future<bool> lockAcquisition) throws InterruptedException private void VerifyAcquisitionFailure(Future <bool> lockAcquisition) { try { lockAcquisition.get(); fail("Lock acquisition should fail."); } catch (ExecutionException e) { assertThat(Exceptions.rootCause(e), instanceOf(typeof(LockAcquisitionTimeoutException))); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteOutThePropertyRecordBeforeReferencingItFromANodeRecord() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteOutThePropertyRecordBeforeReferencingItFromANodeRecord() { Race race = new Race(); long[] latestNodeId = new long[1]; AtomicLong writes = new AtomicLong(); AtomicLong reads = new AtomicLong(); long endTime = currentTimeMillis() + SECONDS.toMillis(2); race.WithEndCondition(() => (writes.get() > 100 && reads.get() > 10_000) || currentTimeMillis() > endTime); race.AddContestant(() => { using (Transaction tx = Db.beginTx()) { Node node = Db.createNode(); latestNodeId[0] = node.Id; node.setProperty("largeProperty", LONG_STRING_VALUE); tx.success(); } writes.incrementAndGet(); }); race.AddContestant(() => { try { using (Transaction tx = Db.GraphDatabaseAPI.beginTx()) { Node node = Db.GraphDatabaseAPI.getNodeById(latestNodeId[0]); foreach (string propertyKey in node.PropertyKeys) { node.getProperty(propertyKey); } tx.success(); } } catch (NotFoundException e) { if (Exceptions.contains(e, typeof(InvalidRecordException))) { throw e; } } reads.incrementAndGet(); }); race.Go(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPropagateIOExceptions() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPropagateIOExceptions() { // Given TransactionFailureException exceptionThrown = null; File storeDir = TestDirectory.storeDir(); LimitedFileSystemGraphDatabase db = new LimitedFileSystemGraphDatabase(storeDir); using (Transaction tx = Db.beginTx()) { Db.createNode(); tx.Success(); } long logVersion = Db.DependencyResolver.resolveDependency(typeof(LogVersionRepository)).CurrentLogVersion; Db.runOutOfDiskSpaceNao(); // When try { using (Transaction tx = Db.beginTx()) { Db.createNode(); tx.Success(); } } catch (TransactionFailureException e) { exceptionThrown = e; } finally { assertNotNull("Expected tx finish to throw TransactionFailureException when filesystem is full.", exceptionThrown); assertTrue(Exceptions.contains(exceptionThrown, typeof(IOException))); } Db.somehowGainMoreDiskSpace(); // to help shutting down the db Db.shutdown(); PageCache pageCache = PageCacheRule.getPageCache(Db.FileSystem); File neoStore = TestDirectory.databaseLayout().metadataStore(); assertEquals(logVersion, MetaDataStore.getRecord(pageCache, neoStore, MetaDataStore.Position.LOG_VERSION)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteOutThePropertyRecordBeforeReferencingItFromARelationshipRecord() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteOutThePropertyRecordBeforeReferencingItFromARelationshipRecord() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long node1Id; long node1Id; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long node2Id; long node2Id; using (Transaction tx = Db.beginTx()) { Node node1 = Db.createNode(); node1Id = node1.Id; Node node2 = Db.createNode(); node2Id = node2.Id; tx.Success(); } Race race = new Race(); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long[] latestRelationshipId = new long[1]; long[] latestRelationshipId = new long[1]; AtomicLong writes = new AtomicLong(); AtomicLong reads = new AtomicLong(); long endTime = currentTimeMillis() + SECONDS.toMillis(2); race.WithEndCondition(() => (writes.get() > 100 && reads.get() > 10_000) || currentTimeMillis() > endTime); race.AddContestant(() => { using (Transaction tx = Db.beginTx()) { Node node1 = Db.GraphDatabaseAPI.getNodeById(node1Id); Node node2 = Db.GraphDatabaseAPI.getNodeById(node2Id); Relationship rel = node1.createRelationshipTo(node2, _friend); latestRelationshipId[0] = rel.Id; rel.setProperty("largeProperty", LONG_STRING_VALUE); tx.Success(); } writes.incrementAndGet(); }); race.AddContestant(() => { try { using (Transaction tx = Db.GraphDatabaseAPI.beginTx()) { Relationship rel = Db.GraphDatabaseAPI.getRelationshipById(latestRelationshipId[0]); foreach (string propertyKey in rel.PropertyKeys) { rel.getProperty(propertyKey); } tx.Success(); } } catch (NotFoundException e) { if (Exceptions.contains(e, typeof(InvalidRecordException))) { throw e; } } reads.incrementAndGet(); }); race.Go(); }
protected internal static System.IndexOutOfRangeException WithInvalidOrdinalMessage(ChannelBuffer buffer, sbyte statusOrdinal, System.IndexOutOfRangeException e) { int maxBytesToPrint = 1024 * 40; return(Exceptions.withMessage(e, format("%s | read invalid ordinal %d. First %db of this channel buffer is:%n%s", e.Message, statusOrdinal, maxBytesToPrint, BeginningOfBufferAsHexString(buffer, maxBytesToPrint)))); }