public async Task InitializeAsync() { _harness = await new MiniKuduClusterBuilder().BuildHarnessAsync(); var options = _harness.CreateClientBuilder().BuildOptions(); var securityContext = new SecurityContext(); var systemClock = new SystemClock(); var connectionFactory = new KuduConnectionFactory( options, securityContext, NullLoggerFactory.Instance); _testConnectionFactory = new TestConnectionFactory(connectionFactory); _client = new KuduClient( options, securityContext, _testConnectionFactory, systemClock, NullLoggerFactory.Instance); var builder = ClientTestUtil.GetBasicSchema() .SetTableName("chaos_test_table") .SetNumReplicas(3) .CreateBasicRangePartition(); _table = await _client.CreateTableAsync(builder); }
private IConnectionFactory GetConnectionFactory() { var connectionString = _storage.ConnectionString; var factory = new TestConnectionFactory(new SQLiteDataProvider(), "RoleStoreTest", connectionString); factory.CreateTables <LinqToDB.Identity.IdentityUser, LinqToDB.Identity.IdentityRole, string>(); return(factory); }
public TestConnectionFactory CreateContext(bool delete = false) { var factory = new TestConnectionFactory(new SqlServerDataProvider("*", SqlServerVersion.v2012), "Test", _fixture.ConnectionString); CreateTables(factory, _fixture.ConnectionString); return(factory); }
protected override TestConnectionFactory CreateTestContext() { var connectionString = _storage.ConnectionString; var factory = new TestConnectionFactory(new SQLiteDataProvider(), "InMemoryEFUserStoreTest", connectionString); CreateTables(factory, connectionString); return(factory); }
public UserStoreWithGenerics(TestConnectionFactory factory, string loginContext) : base(factory) { LoginContext = loginContext; factory.CreateTable <IdentityUserClaimWithIssuer>(); factory.CreateTable <IdentityUserRoleWithDate>(); factory.CreateTable <IdentityUserLoginWithContext>(); factory.CreateTable <IdentityUserTokenWithStuff>(); }
protected override TestConnectionFactory CreateTestContext() { var connectionString = _storage.ConnectionString; //"Data Source=:memory:;"; var factory = new TestConnectionFactory(new SQLiteDataProvider(ProviderName.SQLite), "InMemoryEFUserStoreTestWithGenerics", connectionString); CreateTables(factory, connectionString); return(factory); }
public TestConnectionFactory CreateContext() { //throw new NotImplementedException(); //var db = DbUtil.Create<TestDbContext>(_fixture.ConnectionString); //db.Database.EnsureCreated(); //return db; var factory = new TestConnectionFactory(new SqlServerDataProvider("*", SqlServerVersion.v2012, SqlServerProvider.SystemDataSqlClient), "Test", _fixture.ConnectionString); CreateTables(factory, _fixture.ConnectionString); return(factory); }
public async Task MultipleConnectionForEndPointWorks() { var factory = new TestConnectionFactory(); var pool = new ConnectionPoolingFactory(factory); var endpoint = new HttpEndPoint(HttpConnectionKind.Http, "127.0.0.1", 80, "", new Uri("http://localhost"), 2); var connection = await pool.ConnectAsync(endpoint); Assert.NotNull(connection); // No conneciton available, will wait for one to be created. var connection2 = await pool.ConnectAsync(endpoint); // return original to pool await connection.DisposeAsync(); await connection2.DisposeAsync(); }
public async Task TestBasicConnectionPooling() { var factory = new TestConnectionFactory(); var pool = new ConnectionPoolingFactory(factory); var endpoint = IPEndPoint.Parse("127.0.0.1:80"); var connection = await pool.ConnectAsync(endpoint); Assert.NotNull(connection); // No conneciton available, will wait for one to be created. var connectionTask = pool.ConnectAsync(endpoint); Assert.False(connectionTask.IsCompleted); // return original to pool await connection.DisposeAsync(); // Await should allow the connection again. var connection2 = await connectionTask; }
public DefaultPocoTest(ScratchDatabaseFixture fixture) { var services = new ServiceCollection(); var factory = new TestConnectionFactory(_dataProvider, nameof(DefaultPocoTest), fixture.ConnectionString); services .AddIdentity <IdentityUser, IdentityRole>() .AddLinqToDBStores(factory); services.AddTransient(_ => new IdentityDataConnection(_dataProvider, fixture.ConnectionString)); services.AddLogging(); var provider = services.BuildServiceProvider(); _builder = new ApplicationBuilder(provider); factory.CreateTables <IdentityUser, IdentityRole, string>(); }
public async Task HttpEndPointEqualsWorks() { var factory = new TestConnectionFactory(); var pool = new ConnectionPoolingFactory(factory); var endpoint1 = new HttpEndPoint(HttpConnectionKind.Http, "127.0.0.1", 80, "", new Uri("http://localhost"), 1); var endpoint2 = new HttpEndPoint(HttpConnectionKind.Http, "127.0.0.1", 80, "", new Uri("http://localhost"), 1); var connection = await pool.ConnectAsync(endpoint1); Assert.NotNull(connection); // No conneciton available, will wait for one to be created. var connectionTask = pool.ConnectAsync(endpoint2); Assert.False(connectionTask.IsCompleted); // return original to pool await connection.DisposeAsync(); // Await should allow the connection again. var connection2 = await connectionTask; }
public TestConnectionFactory CreateContext() { var factory = new TestConnectionFactory(new SqlServerDataProvider("*", SqlServerVersion.v2012), "UserStoreWithGenericsTest", _fixture.ConnectionString); CreateTables(factory, _fixture.ConnectionString); factory.CreateTable <IdentityUserClaimWithIssuer>(); factory.CreateTable <IdentityUserRoleWithDate>(); factory.CreateTable <IdentityUserLoginWithContext>(); factory.CreateTable <IdentityUserTokenWithStuff>(); factory.CreateTable <IdentityRoleClaimWithIssuer>(); return(factory); //var db = DbUtil.Create<ContextWithGenerics>(_fixture.ConnectionString); //db.Database.EnsureCreated(); //return db; }
protected override void AddRoleStore(IServiceCollection services, TestConnectionFactory context = null) { var store = new RoleStore <LinqToDB.Identity.IdentityRole>(context ?? CreateTestContext()); services.AddSingleton <IRoleStore <LinqToDB.Identity.IdentityRole> >(store); }
protected override void AddRoleStore(IServiceCollection services, TestConnectionFactory context = null) { services.AddSingleton <IRoleStore <TRole> >( new RoleStore <TKey, TRole>(CreateTestContext())); }
// public ApplicationDbContext CreateAppContext() // { //throw new NotImplementedException(); // //var db = DbUtil.Create<ApplicationDbContext>(_fixture.ConnectionString); // //db.Database.EnsureCreated(); // //return db; // } protected override void AddUserStore(IServiceCollection services, TestConnectionFactory context = null) { services.AddSingleton <IUserStore <IdentityUser> >( new UserStore <IdentityUser, IdentityRole>(context ?? CreateTestContext())); }
protected override void AddRoleStore(IServiceCollection services, TestConnectionFactory context = null) { services.AddSingleton <IRoleStore <MyIdentityRole> >( new RoleStoreWithGenerics(context ?? CreateTestContext(), "TestContext")); }
protected override void AddUserStore(IServiceCollection services, TestConnectionFactory context = null) { _store = new UserStoreWithGenerics(context ?? CreateTestContext(), "TestContext"); services.AddSingleton <IUserStore <IdentityUserWithGenerics> >(_store); }
public RoleStoreWithGenerics(TestConnectionFactory factory, string loginContext) : base(factory) { _loginContext = loginContext; factory.CreateTable <IdentityRoleClaim <string> >(); factory.CreateTable <IdentityUserRoleWithDate>(); }
protected override void AddRoleStore(IServiceCollection services, TestConnectionFactory context = null) { services.AddSingleton <IRoleStore <GuidRole> >(new ApplicationRoleStore(context ?? CreateTestContext())); }
public CustomPocoTest(ScratchDatabaseFixture fixture) { _fixture = fixture; _factory = new TestConnectionFactory(_dataProvider, nameof(CustomPocoTest), _fixture.ConnectionString); }