public void CreateStreamsTestingDatabase() { var sqlServerLocator = GetSqlServerLocator(); var configuration = SqlServerDatabaseDefinition.BuildDatabaseConfigurationUsingDefaultsAsNecessary("Streams", @"D:\SQL\"); var createDatabaseOp = new CreateDatabaseOp(configuration, ExistingDatabaseStrategy.Throw); var protocol = new SqlOperationsProtocol(sqlServerLocator); protocol.Execute(createDatabaseOp); }
public static void CreateDatabase_ExistingDatabaseTest() { var sqlServerLocatorCopy = GetSqlServerLocator(); var sqlServerLocator = sqlServerLocatorCopy.DeepCloneWithDatabaseName("Monkey"); var protocol = new SqlOperationsProtocol(sqlServerLocator); var configuration = SqlServerDatabaseDefinition.BuildDatabaseConfigurationUsingDefaultsAsNecessary(sqlServerLocator.DatabaseName, @"D:\SQL\"); var createDatabaseOpThrow = new CreateDatabaseOp(configuration, ExistingDatabaseStrategy.Throw); var createDatabaseOpSkip = new CreateDatabaseOp(configuration, ExistingDatabaseStrategy.Skip); protocol.Execute(createDatabaseOpThrow); protocol.Execute(createDatabaseOpSkip); var ex = Record.Exception(() => protocol.Execute(createDatabaseOpThrow)); }
public void CreateStreamExampleDatabaseAndScripts() { var sqlServerLocator = new SqlServerLocator("localhost", "StreamExample3", "sa", "<password>", "SQLDEV2017"); var configuration = SqlServerDatabaseDefinition.BuildDatabaseConfigurationUsingDefaultsAsNecessary(sqlServerLocator.DatabaseName, @"D:\SQL\"); var createDatabaseOp = new CreateDatabaseOp(configuration, ExistingDatabaseStrategy.Throw); var protocol = new SqlOperationsProtocol(sqlServerLocator); protocol.Execute(createDatabaseOp); var resourceLocatorProtocol = new SingleResourceLocatorProtocols(sqlServerLocator); var configurationTypeRepresentation = typeof(NullJsonSerializationConfiguration).ToRepresentation(); SerializerRepresentation defaultSerializerRepresentation = new SerializerRepresentation( SerializationKind.Json, configurationTypeRepresentation); var defaultSerializationFormat = SerializationFormat.String; var stream = new SqlStream( "Example", TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(3), defaultSerializerRepresentation, defaultSerializationFormat, new JsonSerializerFactory(), resourceLocatorProtocol); stream.Execute(new StandardCreateStreamOp(stream.StreamRepresentation, ExistingStreamStrategy.Skip)); this.testOutputHelper.WriteLine("Created database."); /* * var path = "D:/Temp/Example"; * var connectionString = sqlServerLocator.BuildConnectionString(TimeSpan.FromSeconds(20)); * Scripter.ScriptDatabaseToFilePath(connectionString, path, this.testOutputHelper.WriteLine, false); */ }