Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void failToCreatePointOnOldDatabase()
        internal virtual void FailToCreatePointOnOldDatabase()
        {
            File storeDir = _testDirectory.storeDir();
            GraphDatabaseService        nonUpgradedStore = startNonUpgradableDatabaseWithFormat(storeDir, StandardV3_2.NAME);
            TransactionFailureException exception        = assertThrows(typeof(TransactionFailureException), () =>
            {
                using (Transaction transaction = nonUpgradedStore.BeginTx())
                {
                    Node node = nonUpgradedStore.CreateNode();
                    node.setProperty("a", pointValue(Cartesian, 1.0, 2.0));
                    transaction.success();
                }
            });

            assertEquals("Current record format does not support POINT_PROPERTIES. Please upgrade your store to the format that support requested capability.", Exceptions.rootCause(exception).Message);
            nonUpgradedStore.Shutdown();

            GraphDatabaseService restartedOldFormatDatabase = startNonUpgradableDatabaseWithFormat(storeDir, StandardV3_2.NAME);

            using (Transaction transaction = restartedOldFormatDatabase.BeginTx())
            {
                Node node = restartedOldFormatDatabase.CreateNode();
                node.SetProperty("c", "d");
                transaction.success();
            }
            restartedOldFormatDatabase.Shutdown();
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void changedConstraintsShouldResultInTransientFailure()
        public virtual void ChangedConstraintsShouldResultInTransientFailure()
        {
            // Given
            ThreadStart constraintCreation = () =>
            {
                using (Org.Neo4j.Graphdb.Transaction tx = Db.beginTx())
                {
                    CreateConstraintInRunningTx(db, KEY, PROP);
                    tx.Success();
                }
            };

            // When
            try
            {
                using (Org.Neo4j.Graphdb.Transaction tx = Db.beginTx())
                {
                    Executors.newSingleThreadExecutor().submit(constraintCreation).get();
                    Db.createNode();
                    tx.Success();
                }
                fail("Exception expected");
            }
            catch (Exception e)
            {
                // Then
                assertThat(e, instanceOf(typeof(TransientTransactionFailureException)));
                assertThat(e.InnerException, instanceOf(typeof(TransactionFailureException)));
                TransactionFailureException cause = ( TransactionFailureException )e.InnerException;
                assertEquals(Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.ConstraintsChanged, cause.Status());
            }
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void failToCreateDateArrayOnOldDatabase()
        internal virtual void FailToCreateDateArrayOnOldDatabase()
        {
            File storeDir = _testDirectory.storeDir();
            GraphDatabaseService        nonUpgradedStore = startNonUpgradableDatabaseWithFormat(storeDir, StandardV3_2.NAME);
            LocalDate                   date             = DateValue.date(1991, 5, 3).asObjectCopy();
            TransactionFailureException failureException = assertThrows(typeof(TransactionFailureException), () =>
            {
                using (Transaction transaction = nonUpgradedStore.BeginTx())
                {
                    Node node = nonUpgradedStore.CreateNode();
                    node.setProperty("a", new LocalDate[] { date, date });
                    transaction.success();
                }
            });

            assertEquals("Current record format does not support TEMPORAL_PROPERTIES. Please upgrade your store " + "to the format that support requested capability.", Exceptions.rootCause(failureException).Message);
            nonUpgradedStore.Shutdown();

            GraphDatabaseService restartedOldFormatDatabase = startNonUpgradableDatabaseWithFormat(storeDir, StandardV3_2.NAME);

            using (Transaction transaction = restartedOldFormatDatabase.BeginTx())
            {
                Node node = restartedOldFormatDatabase.CreateNode();
                node.SetProperty("c", "d");
                transaction.success();
            }
            restartedOldFormatDatabase.Shutdown();
        }