Beispiel #1
0
        private static string ConstructHelpfulDiagnosticsMessage(Org.Neo4j.Kernel.impl.locking.Locks_Client client, Locks lockManager, ResourceType resourceType, long resourceId, LockType type)
        {
            StringWriter stringWriter = new StringWriter();

            stringWriter.append(format("%s tried to apply local %s lock on %s(%s) after acquired on master. Currently these locks exist:%n", client, type, resourceType, resourceId));

            lockManager.Accept(new DumpLocksVisitor(FormattedLog.withUTCTimeZone().toWriter(stringWriter)));
            return(stringWriter.ToString());
        }
Beispiel #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReadBasicEntities() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReadBasicEntities()
        {
            // GIVEN
            MemoryStream @out = new MemoryStream(1_000);
            FormattedLog log  = FormattedLog.toOutputStream(@out);
            InconsistencyMessageLogger logger = new InconsistencyMessageLogger(log);
            long nodeId              = 5;
            long indexNodeId         = 7;
            long nodeNotInTheIndexId = 17;
            long indexId             = 99;
            long relationshipGroupId = 10;
            long relationshipId      = 15;
            long propertyId          = 20;

            logger.Error(RecordType.NODE, new NodeRecord(nodeId), "Some error", "something");
            logger.Error(RecordType.RELATIONSHIP, new RelationshipRecord(relationshipId), "Some error", "something");
            logger.Error(RecordType.RELATIONSHIP_GROUP, new RelationshipGroupRecord(relationshipGroupId), "Some error", "something");
            logger.Error(RecordType.PROPERTY, new PropertyRecord(propertyId), "Some error", "something");
            logger.Error(RecordType.INDEX, new IndexEntry(IndexDescriptorFactory.forSchema(SchemaDescriptorFactory.forLabel(1, 1)).withId(indexNodeId), idTokenNameLookup, 0), "Some index error", "Something wrong with index");
            logger.Error(RecordType.NODE, new NodeRecord(nodeNotInTheIndexId), "Some index error", IndexDescriptorFactory.forSchema(forLabel(1, 2), new IndexProviderDescriptor("key", "version")).withId(indexId).ToString());
            string text = @out.ToString();

            // WHEN
            ReportInconsistencies     inconsistencies = new ReportInconsistencies();
            InconsistencyReportReader reader          = new InconsistencyReportReader(inconsistencies);

            reader.Read(new StreamReader(new StringReader(text)));

            // THEN
            assertTrue(inconsistencies.ContainsNodeId(nodeId));
            // assertTrue( inconsistencies.containsNodeId( indexNodeId ) );
            assertTrue(inconsistencies.ContainsNodeId(nodeNotInTheIndexId));
            assertTrue(inconsistencies.ContainsRelationshipId(relationshipId));
            assertTrue(inconsistencies.ContainsRelationshipGroupId(relationshipGroupId));
            assertTrue(inconsistencies.ContainsPropertyId(propertyId));
            assertTrue(inconsistencies.ContainsSchemaIndexId(indexId));
        }