Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldParseRelationshipGroupInconsistencies() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldParseRelationshipGroupInconsistencies()
        {
            // Given
            ReportInconsistencies inconsistencies = new ReportInconsistencies();
            string text = "ERROR: The first outgoing relationship is not the first in its chain.\n" +
                          "\tRelationshipGroup[1337,type=1,out=2,in=-1,loop=-1,prev=-1,next=3,used=true,owner=4,secondaryUnitId=-1]\n" +
                          "ERROR: The first outgoing relationship is not the first in its chain.\n" +
                          "\tRelationshipGroup[4242,type=1,out=2,in=-1,loop=-1,prev=-1,next=3,used=true,owner=4,secondaryUnitId=-1]\n";

            // When
            InconsistencyReportReader reader = new InconsistencyReportReader(inconsistencies);

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

            // Then
            assertTrue(inconsistencies.ContainsRelationshipGroupId(1337));
            assertTrue(inconsistencies.ContainsRelationshipGroupId(4242));
        }
Example #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));
        }