Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPopulateIndexWithUniquePointsThatCollideOnSpaceFillingCurve() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldPopulateIndexWithUniquePointsThatCollideOnSpaceFillingCurve()
        {
            Config        config   = Config.defaults(stringMap(default_schema_provider.name(), _schemaIndex.providerName()));
            BatchInserter inserter = NewBatchInserter(config);
            Pair <PointValue, PointValue> collidingPoints = SpatialIndexValueTestUtil.pointsWithSameValueOnSpaceFillingCurve(config);

            inserter.createNode(MapUtil.map("prop", collidingPoints.First()), TestLabels.LABEL_ONE);
            inserter.createNode(MapUtil.map("prop", collidingPoints.Other()), TestLabels.LABEL_ONE);
            inserter.CreateDeferredConstraint(TestLabels.LABEL_ONE).assertPropertyIsUnique("prop").create();
            inserter.Shutdown();

            GraphDatabaseService db = GraphDatabaseService(config);

            try
            {
                AwaitIndexesOnline(db);
                using (Transaction tx = Db.beginTx())
                {
                    AssertSingleCorrectHit(db, collidingPoints.First());
                    AssertSingleCorrectHit(db, collidingPoints.Other());
                    tx.Success();
                }
            }
            finally
            {
                Db.shutdown();
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldThrowWhenPopulatingWithNonUniquePoints() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldThrowWhenPopulatingWithNonUniquePoints()
        {
            Config        config   = Config.defaults(stringMap(default_schema_provider.name(), _schemaIndex.providerName()));
            BatchInserter inserter = NewBatchInserter(config);
            PointValue    point    = Values.pointValue(CoordinateReferenceSystem.WGS84, 0.0, 0.0);

            inserter.createNode(MapUtil.map("prop", point), TestLabels.LABEL_ONE);
            inserter.createNode(MapUtil.map("prop", point), TestLabels.LABEL_ONE);
            inserter.CreateDeferredConstraint(TestLabels.LABEL_ONE).assertPropertyIsUnique("prop").create();
            inserter.Shutdown();

            GraphDatabaseService db = GraphDatabaseService(config);

            try
            {
                using (Transaction tx = Db.beginTx())
                {
                    IEnumerator <IndexDefinition> indexes = Db.schema().Indexes.GetEnumerator();
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    assertTrue(indexes.hasNext());
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    IndexDefinition index = indexes.next();
                    Org.Neo4j.Graphdb.schema.Schema_IndexState indexState = Db.schema().getIndexState(index);
                    assertEquals(Org.Neo4j.Graphdb.schema.Schema_IndexState.Failed, indexState);
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    assertFalse(indexes.hasNext());
                    tx.Success();
                }
            }
            finally
            {
                Db.shutdown();
            }
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldInsertDifferentTypesOfThings() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldInsertDifferentTypesOfThings()
        {
            // GIVEN
            BatchInserter inserter = BatchInserters.Inserter(Directory.databaseDir(), FileSystemRule.get(), stringMap(GraphDatabaseSettings.log_queries.name(), "true", GraphDatabaseSettings.record_format.name(), RecordFormat, GraphDatabaseSettings.log_queries_filename.name(), Directory.file("query.log").AbsolutePath));
            long          node1Id;
            long          node2Id;
            long          relationshipId;

            try
            {
                // WHEN
                node1Id = inserter.createNode(SomeProperties(1), Enum.GetValues(typeof(Labels)));
                node2Id = node1Id + 10;
                inserter.createNode(node2Id, SomeProperties(2), Enum.GetValues(typeof(Labels)));
                relationshipId = inserter.CreateRelationship(node1Id, node2Id, MyRelTypes.TEST, SomeProperties(3));
                inserter.CreateDeferredSchemaIndex(Labels.One).on("key").create();
                inserter.CreateDeferredConstraint(Labels.Two).assertPropertyIsUnique("key").create();
            }
            finally
            {
                inserter.Shutdown();
            }

            // THEN
            GraphDatabaseService db = (new EnterpriseGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(Directory.databaseDir()).setConfig(OnlineBackupSettings.online_backup_enabled, Settings.FALSE).newGraphDatabase();

            try
            {
                using (Transaction tx = Db.beginTx())
                {
                    Node node1 = Db.getNodeById(node1Id);
                    Node node2 = Db.getNodeById(node2Id);
                    assertEquals(SomeProperties(1), node1.AllProperties);
                    assertEquals(SomeProperties(2), node2.AllProperties);
                    assertEquals(relationshipId, single(node1.Relationships).Id);
                    assertEquals(relationshipId, single(node2.Relationships).Id);
                    assertEquals(SomeProperties(3), single(node1.Relationships).AllProperties);
                    tx.Success();
                }
            }
            finally
            {
                Db.shutdown();
            }
        }
Пример #4
0
 public override ConstraintCreator CreateDeferredConstraint(Label label)
 {
     return(@delegate.CreateDeferredConstraint(label));
 }