Ejemplo n.º 1
0
 public void SetUp()
 {
     Connection = new HanaConnection(IntegrationTestOptions.Hana.ConnectionString);
     Processor  = new HanaProcessor(Connection, new HanaGenerator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions(), new HanaDbFactory());
     Connection.Open();
     Processor.BeginTransaction();
 }
Ejemplo n.º 2
0
        public HanaTestTable(string tableName, HanaProcessor processor, string schemaName, params string[] columnDefinitions)
        {
            _schemaName = schemaName;

            Name = quoter.QuoteTableName(tableName);
            Init(processor, columnDefinitions);
        }
Ejemplo n.º 3
0
 public ScopedConnection()
 {
     Connection = new HanaConnection(IntegrationTestOptions.Hana.ConnectionString);
     Processor  = new HanaProcessor(Connection, new HanaGenerator(), new TextWriterAnnouncer(TestContext.Out), new ProcessorOptions(), new HanaDbFactory());
     Connection.Open();
     Processor.BeginTransaction();
 }
Ejemplo n.º 4
0
        private void Init(HanaProcessor processor, IEnumerable <string> columnDefinitions)
        {
            Connection  = (HanaConnection)processor.Connection;
            Transaction = (HanaTransaction)processor.Transaction;

            NameWithSchema = string.IsNullOrEmpty(_schemaName) ? Name : string.Format("\"{0}\".{1}", _schemaName, Name);
            Create(columnDefinitions);
        }
Ejemplo n.º 5
0
        private void Init(HanaProcessor processor, IEnumerable <string> columnDefinitions)
        {
            NameWithSchema = quoter.QuoteTableName(Name, _schemaName);

            Connection  = (HanaConnection)processor.Connection;
            Transaction = (HanaTransaction)processor.Transaction;

            Create(columnDefinitions);
        }
Ejemplo n.º 6
0
        public HanaTestSequence(HanaProcessor processor, string schemaName, string sequenceName)
        {
            _schemaName = schemaName;
            Name        = _quoter.QuoteSequenceName(sequenceName, null);

            Connection     = (HanaConnection)processor.Connection;
            Transaction    = (HanaTransaction)processor.Transaction;
            NameWithSchema = _quoter.QuoteSequenceName(sequenceName, schemaName);
            Create();
        }
Ejemplo n.º 7
0
        public HanaTestSequence(HanaProcessor processor, string schemaName, string sequenceName)
        {
            _schemaName = schemaName;
            Name        = quoter.QuoteSequenceName(sequenceName);

            Connection     = (HanaConnection)processor.Connection;
            Transaction    = (HanaTransaction)processor.Transaction;
            NameWithSchema = string.IsNullOrEmpty(_schemaName) ? Name : string.Format("\"{0}\".{1}", _schemaName, Name);
            Create();
        }
Ejemplo n.º 8
0
 public void SetUp()
 {
     if (!IntegrationTestOptions.Hana.IsEnabled)
     {
         Assert.Ignore();
     }
     Connection = new HanaConnection(IntegrationTestOptions.Hana.ConnectionString);
     Processor  = new HanaProcessor(Connection, new HanaGenerator(), new TextWriterAnnouncer(TestContext.Out), new ProcessorOptions(), new HanaDbFactory());
     Connection.Open();
     Processor.BeginTransaction();
 }
Ejemplo n.º 9
0
        private void Init(HanaProcessor processor, IEnumerable <string> columnDefinitions)
        {
            NameWithSchema = _quoter.QuoteTableName(Name, _schemaName);

            Connection  = (HanaConnection)processor.Connection;
            Transaction = (HanaTransaction)processor.Transaction;

            if (Connection.State != ConnectionState.Open)
            {
                Connection.Open();
            }

            Create(columnDefinitions);
        }
        public void CallingProcessWithPerformDbOperationExpressionWhenInPreviewOnlyModeWillNotMakeDbChanges()
        {
            var output = new StringWriter();

            var connection = new HanaConnection(IntegrationTestOptions.Hana.ConnectionString);

            var processor = new HanaProcessor(
                connection,
                new HanaGenerator(),
                new TextWriterAnnouncer(output),
                new ProcessorOptions {
                PreviewOnly = true
            },
                new HanaDbFactory());

            bool tableExists;

            try
            {
                var expression =
                    new PerformDBOperationExpression
                {
                    Operation = (con, trans) =>
                    {
                        var command = con.CreateCommand();
                        command.CommandText = "CREATE TABLE ProcessTestTable (test int NULL) ";
                        command.Transaction = trans;

                        command.ExecuteNonQuery();
                    }
                };

                processor.Process(expression);

                tableExists = processor.TableExists("", "ProcessTestTable");
            }
            finally
            {
                processor.RollbackTransaction();
            }

            tableExists.ShouldBeFalse();

            var fmOutput = output.ToString();

            Assert.That(fmOutput, Is.StringContaining("/* Performing DB Operation */"));
        }
 public void SetUp()
 {
     ServiceScope = ServiceProvider.CreateScope();
     Processor    = ServiceScope.ServiceProvider.GetRequiredService <HanaProcessor>();
 }
Ejemplo n.º 12
0
 public HanaTestTable(HanaProcessor processor, string schemaName, params string[] columnDefinitions)
 {
     _schemaName = schemaName;
     Name        = "\"Table" + Guid.NewGuid().ToString("N") + "\"";
     Init(processor, columnDefinitions);
 }