Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCollectUnlimitedNumberOfBadEntriesIfToldTo()
        public virtual void ShouldCollectUnlimitedNumberOfBadEntriesIfToldTo()
        {
            // GIVEN
            using (BadCollector collector = new BadCollector(NULL_OUTPUT_STREAM, UNLIMITED_TOLERANCE, COLLECT_ALL))
            {
                // WHEN
                int count = 10_000;
                for (int i = 0; i < count; i++)
                {
                    collector.CollectDuplicateNode(i, i, "group");
                }

                // THEN
                assertEquals(count, collector.BadEntries());
            }
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void skipBadEntriesLogging()
        public virtual void SkipBadEntriesLogging()
        {
            MemoryStream outputStream = new MemoryStream();

            using (BadCollector badCollector = new BadCollector(outputStream, 100, COLLECT_ALL, 10, true, NO_MONITOR))
            {
                CollectBadRelationship(badCollector);
                for (int i = 0; i < 2; i++)
                {
                    badCollector.CollectDuplicateNode(i, i, "group");
                }
                CollectBadRelationship(badCollector);
                badCollector.CollectExtraColumns("a,b,c", 1, "a");
                assertEquals("Output stream should not have any reported entries", 0, outputStream.size());
            }
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowExceptionIfBadRelationshipsTipsUsOverTheToleranceEdge() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldThrowExceptionIfBadRelationshipsTipsUsOverTheToleranceEdge()
        {
            // given
            int tolerance = 1;

            using (BadCollector badCollector = new BadCollector(BadOutputFile(), tolerance, BadCollector.COLLECT_ALL))
            {
                // when
                badCollector.CollectDuplicateNode(1, 1, "group");
                try
                {
                    CollectBadRelationship(badCollector);
                    fail("Should have thrown an InputException");
                }
                catch (InputException)
                {
                    // then expect to end up here
                }
            }
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotCollectBadNodesIfWeShouldOnlyBeCollectingRelationships() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotCollectBadNodesIfWeShouldOnlyBeCollectingRelationships()
        {
            // given
            int tolerance = 1;

            using (BadCollector badCollector = new BadCollector(BadOutputFile(), tolerance, BadCollector.BAD_RELATIONSHIPS))
            {
                // when
                CollectBadRelationship(badCollector);
                try
                {
                    badCollector.CollectDuplicateNode(1, 1, "group");
                }
                catch (InputException)
                {
                    // then expect to end up here
                    assertEquals(1, badCollector.BadEntries());
                }
            }
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldApplyBackPressure() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldApplyBackPressure()
        {
            // given
            int backPressureThreshold = 10;
            BlockableMonitor monitor  = new BlockableMonitor();

            using (OtherThreadExecutor <Void> t2 = new OtherThreadExecutor <Void>("T2", null), BadCollector badCollector = new BadCollector(NULL_OUTPUT_STREAM, UNLIMITED_TOLERANCE, COLLECT_ALL, backPressureThreshold, false, monitor))
            {
                for (int i = 0; i < backPressureThreshold; i++)
                {
                    badCollector.CollectDuplicateNode(i, i, "group");
                }

                // when
                Future <object> enqueue = t2.ExecuteDontWait(command(() => badCollector.collectDuplicateNode(999, 999, "group")));
                t2.WaitUntilWaiting(waitDetails => waitDetails.isAt(typeof(BadCollector), "collect"));
                monitor.Unblock();

                // then
                enqueue.get();
            }
        }