Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void stringWithMaximumLengthShouldBeAllowed()
        internal virtual void StringWithMaximumLengthShouldBeAllowed()
        {
            string   longestString = RandomStringUtils.randomAscii(IndexWriter.MAX_TERM_LENGTH);
            Document document      = documentRepresentingProperties(( long )123, longestString);

            assertEquals(longestString, document.getField(string.key(0)).stringValue());
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void readArrayAndStringPropertiesWithDifferentBlockSizes()
        public virtual void ReadArrayAndStringPropertiesWithDifferentBlockSizes()
        {
            string stringValue = RandomStringUtils.randomAlphanumeric(10000);

            sbyte[] arrayValue = RandomStringUtils.randomAlphanumeric(10000).Bytes;

            GraphDatabaseService db = (new TestGraphDatabaseFactory()).setFileSystem(Fs.get()).newImpermanentDatabaseBuilder().setConfig(GraphDatabaseSettings.string_block_size, "1024").setConfig(GraphDatabaseSettings.array_block_size, "2048").newGraphDatabase();

            try
            {
                long nodeId;
                using (Transaction tx = Db.beginTx())
                {
                    Node node = Db.createNode();
                    nodeId = node.Id;
                    node.SetProperty("string", stringValue);
                    node.SetProperty("array", arrayValue);
                    tx.Success();
                }

                using (Transaction tx = Db.beginTx())
                {
                    Node node = Db.getNodeById(nodeId);
                    assertEquals(stringValue, node.GetProperty("string"));
                    assertArrayEquals(arrayValue, ( sbyte[] )node.GetProperty("array"));
                    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 void shortStringIsValidValue()
        internal virtual void ShortStringIsValidValue()
        {
            INSTANCE.validate(RandomStringUtils.randomAlphabetic(5));
            INSTANCE.validate(RandomStringUtils.randomAlphabetic(10));
            INSTANCE.validate(RandomStringUtils.randomAlphabetic(250));
            INSTANCE.validate(RandomStringUtils.randomAlphabetic(450));
            INSTANCE.validate(RandomStringUtils.randomAlphabetic(MAX_TERM_LENGTH));
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void createDropRelationshipLongStringProperty()
        public virtual void CreateDropRelationshipLongStringProperty()
        {
            Label  markerLabel     = Label.label("marker");
            string testPropertyKey = "testProperty";
            string propertyValue   = RandomStringUtils.randomAscii(255);

            using (Transaction tx = Db.beginTx())
            {
                Node         start        = Db.createNode(markerLabel);
                Node         end          = Db.createNode(markerLabel);
                Relationship relationship = start.CreateRelationshipTo(end, withName("type"));
                relationship.SetProperty(testPropertyKey, propertyValue);
                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                Relationship relationship = Db.getRelationshipById(0);
                assertEquals(propertyValue, relationship.GetProperty(testPropertyKey));
                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                Relationship relationship = Db.getRelationshipById(0);
                relationship.RemoveProperty(testPropertyKey);
                tx.Success();
            }

            using (Transaction tx = Db.beginTx())
            {
                Relationship relationship = Db.getRelationshipById(0);
                assertFalse(relationship.HasProperty(testPropertyKey));
                tx.Success();
            }
        }
Пример #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void stringOverExceedLimitNotAllowed()
        internal virtual void StringOverExceedLimitNotAllowed()
        {
            int length = MAX_TERM_LENGTH * 2;

            System.ArgumentException iae = assertThrows(typeof(System.ArgumentException), () => INSTANCE.validate(RandomStringUtils.randomAlphabetic(length)));
            assertThat(iae.Message, containsString("Property value size is too large for index. Please see index documentation for limitations."));
        }