Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldTrackSecondaryUnitIdsAsWell() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldTrackSecondaryUnitIdsAsWell()
        {
            // GIVEN
            NeoStores neoStores = NeoStoresRule.builder().build();
            HighIdTransactionApplier tracker = new HighIdTransactionApplier(neoStores);

            NodeRecord node = (new NodeRecord(5)).initialize(true, 123, true, 456, 0);

            node.SecondaryUnitId       = 6;
            node.RequiresSecondaryUnit = true;

            RelationshipRecord relationship = (new RelationshipRecord(10)).initialize(true, 1, 2, 3, 4, 5, 6, 7, 8, true, true);

            relationship.SecondaryUnitId       = 12;
            relationship.RequiresSecondaryUnit = true;

            RelationshipGroupRecord relationshipGroup = (new RelationshipGroupRecord(8)).initialize(true, 0, 1, 2, 3, 4, 5);

            relationshipGroup.SecondaryUnitId       = 20;
            relationshipGroup.RequiresSecondaryUnit = true;

            // WHEN
            tracker.VisitNodeCommand(new NodeCommand(new NodeRecord(node.Id), node));
            tracker.VisitRelationshipCommand(new RelationshipCommand(new RelationshipRecord(relationship.Id), relationship));
            tracker.VisitRelationshipGroupCommand(new RelationshipGroupCommand(new RelationshipGroupRecord(relationshipGroup.Id), relationshipGroup));
            tracker.Close();

            // THEN
            assertEquals(node.SecondaryUnitId + 1, neoStores.NodeStore.HighId);
            assertEquals(relationship.SecondaryUnitId + 1, neoStores.RelationshipStore.HighId);
            assertEquals(relationshipGroup.SecondaryUnitId + 1, neoStores.RelationshipGroupStore.HighId);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldUpdateHighIdsOnExternalTransaction() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldUpdateHighIdsOnExternalTransaction()
        {
            // GIVEN
            NeoStores neoStores = NeoStoresRule.builder().build();
            HighIdTransactionApplier tracker = new HighIdTransactionApplier(neoStores);

            // WHEN
            // Nodes
            tracker.VisitNodeCommand(Commands.CreateNode(10, 2, 3));
            tracker.VisitNodeCommand(Commands.CreateNode(20, 4, 5));

            // Relationships
            tracker.VisitRelationshipCommand(Commands.CreateRelationship(4, 10, 20, 0));
            tracker.VisitRelationshipCommand(Commands.CreateRelationship(45, 10, 20, 1));

            // Label tokens
            tracker.VisitLabelTokenCommand(Commands.CreateLabelToken(3, 0));
            tracker.VisitLabelTokenCommand(Commands.CreateLabelToken(5, 1));

            // Property tokens
            tracker.VisitPropertyKeyTokenCommand(Commands.CreatePropertyKeyToken(3, 0));
            tracker.VisitPropertyKeyTokenCommand(Commands.CreatePropertyKeyToken(5, 1));

            // Relationship type tokens
            tracker.VisitRelationshipTypeTokenCommand(Commands.CreateRelationshipTypeToken(3, 0));
            tracker.VisitRelationshipTypeTokenCommand(Commands.CreateRelationshipTypeToken(5, 1));

            // Relationship groups
            tracker.VisitRelationshipGroupCommand(Commands.CreateRelationshipGroup(10, 1));
            tracker.VisitRelationshipGroupCommand(Commands.CreateRelationshipGroup(20, 2));

            // Schema rules
            tracker.VisitSchemaRuleCommand(Commands.CreateIndexRule(EMPTY.ProviderDescriptor, 10, SchemaDescriptorFactory.forLabel(0, 1)));
            tracker.VisitSchemaRuleCommand(Commands.CreateIndexRule(EMPTY.ProviderDescriptor, 20, SchemaDescriptorFactory.forLabel(1, 2)));

            // Properties
            tracker.VisitPropertyCommand(Commands.CreateProperty(10, PropertyType.STRING, 0, 6, 7));
            tracker.VisitPropertyCommand(Commands.CreateProperty(20, PropertyType.ARRAY, 1, 8, 9));

            tracker.Close();

            // THEN
            assertEquals("NodeStore", 20 + 1, neoStores.NodeStore.HighId);
            assertEquals("DynamicNodeLabelStore", 5 + 1, neoStores.NodeStore.DynamicLabelStore.HighId);
            assertEquals("RelationshipStore", 45 + 1, neoStores.RelationshipStore.HighId);
            assertEquals("RelationshipTypeStore", 5 + 1, neoStores.RelationshipTypeTokenStore.HighId);
            assertEquals("RelationshipType NameStore", 1 + 1, neoStores.RelationshipTypeTokenStore.NameStore.HighId);
            assertEquals("PropertyKeyStore", 5 + 1, neoStores.PropertyKeyTokenStore.HighId);
            assertEquals("PropertyKey NameStore", 1 + 1, neoStores.PropertyKeyTokenStore.NameStore.HighId);
            assertEquals("LabelStore", 5 + 1, neoStores.LabelTokenStore.HighId);
            assertEquals("Label NameStore", 1 + 1, neoStores.LabelTokenStore.NameStore.HighId);
            assertEquals("PropertyStore", 20 + 1, neoStores.PropertyStore.HighId);
            assertEquals("PropertyStore DynamicStringStore", 7 + 1, neoStores.PropertyStore.StringStore.HighId);
            assertEquals("PropertyStore DynamicArrayStore", 9 + 1, neoStores.PropertyStore.ArrayStore.HighId);
            assertEquals("SchemaStore", 20 + 1, neoStores.SchemaStore.HighId);
        }