//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void startAndAwaitCompletionOf(DeleteDuplicateNodesStep step) throws InterruptedException private static void StartAndAwaitCompletionOf(DeleteDuplicateNodesStep step) { step.start(0); step.Receive(0, null); step.awaitCompleted(); }
public virtual void ShouldDeleteEverythingAboutTheDuplicatedNodes() { // given NeoStores neoStores = _neoStoresRule.builder().build(); Ids[] ids = new Ids[9]; DataImporter.Monitor monitor = new DataImporter.Monitor(); ids[0] = CreateNode(monitor, neoStores, 10, 10); // node with many properties and many labels ids[1] = CreateNode(monitor, neoStores, 10, 1); // node with many properties and few labels ids[2] = CreateNode(monitor, neoStores, 10, 0); // node with many properties and no labels ids[3] = CreateNode(monitor, neoStores, 1, 10); // node with few properties and many labels ids[4] = CreateNode(monitor, neoStores, 1, 1); // node with few properties and few labels ids[5] = CreateNode(monitor, neoStores, 1, 0); // node with few properties and no labels ids[6] = CreateNode(monitor, neoStores, 0, 10); // node with no properties and many labels ids[7] = CreateNode(monitor, neoStores, 0, 1); // node with no properties and few labels ids[8] = CreateNode(monitor, neoStores, 0, 0); // node with no properties and no labels // when long[] duplicateNodeIds = RandomNodes(ids); SimpleStageControl control = new SimpleStageControl(); using (DeleteDuplicateNodesStep step = new DeleteDuplicateNodesStep(control, Configuration.DEFAULT, PrimitiveLongCollections.iterator(duplicateNodeIds), neoStores.NodeStore, neoStores.PropertyStore, monitor)) { control.Steps(step); StartAndAwaitCompletionOf(step); } control.AssertHealthy(); // then int expectedNodes = 0; int expectedProperties = 0; foreach (Ids entity in ids) { bool expectedToBeInUse = !ArrayUtils.contains(duplicateNodeIds, entity.Node.Id); int stride = expectedToBeInUse ? 1 : 0; expectedNodes += stride; // Verify node record assertEquals(expectedToBeInUse, neoStores.NodeStore.isInUse(entity.Node.Id)); // Verify label records foreach (DynamicRecord labelRecord in entity.Node.DynamicLabelRecords) { assertEquals(expectedToBeInUse, neoStores.NodeStore.DynamicLabelStore.isInUse(labelRecord.Id)); } // Verify property records foreach (PropertyRecord propertyRecord in entity.Properties) { assertEquals(expectedToBeInUse, neoStores.PropertyStore.isInUse(propertyRecord.Id)); foreach (PropertyBlock property in propertyRecord) { // Verify property dynamic value records foreach (DynamicRecord valueRecord in property.ValueRecords) { AbstractDynamicStore valueStore; switch (property.Type) { case STRING: valueStore = neoStores.PropertyStore.StringStore; break; case ARRAY: valueStore = neoStores.PropertyStore.ArrayStore; break; default: throw new System.ArgumentException(propertyRecord + " " + property); } assertEquals(expectedToBeInUse, valueStore.IsInUse(valueRecord.Id)); } expectedProperties += stride; } } } assertEquals(expectedNodes, monitor.NodesImported()); assertEquals(expectedProperties, monitor.PropertiesImported()); }