Package org.springframework.jdbc.datasource.embedded

Examples of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory$EmbeddedDataSourceProxy


    @Inject
    private TextEncryptor textEncryptor;

    @Bean(destroyMethod="shutdown")
    public DataSource dataSource() {
      EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
      factory.setDatabaseName("greenhouse");
      factory.setDatabaseType(EmbeddedDatabaseType.H2);
      return populateDatabase(factory.getDatabase());   
    }
View Full Code Here


public class GreenhouseDatabaseInstallerTest {

  @Test
  public void runUpgrader() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    EmbeddedDatabase db = factory.getDatabase();
    System.setProperty("security.encryptPassword", "foo");
    System.setProperty("security.encryptSalt", new String(Hex.encode(KeyGenerators.secureRandom().generateKey())));
    DatabaseUpgrader installer = new DatabaseUpgrader(db, new StandardEnvironment(), Encryptors.noOpText());
    installer.run();
    installer.run();
View Full Code Here

    populator.addScript(new ClassPathResource(script, relativeTo));
    return this;
  }
 
  public EmbeddedDatabase getDatabase() {
    EmbeddedDatabaseFactory databaseFactory = new EmbeddedDatabaseFactory();
    databaseFactory.setDatabaseName("greenhouse");
    databaseFactory.setDatabaseType(EmbeddedDatabaseType.H2);
    databaseFactory.setDatabasePopulator(populator);   
    return databaseFactory.getDatabase();
  }
View Full Code Here

    DatabasePopulatorUtils.execute(populator, dataSource());
  }

  @Bean
  public DataSource dataSource() {
    return new EmbeddedDatabaseFactory().getDatabase();
  }
View Full Code Here

  }

  @Override
  protected JpaUsersConnectionRepository createUsersConnectionRepository() {

    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    if (testMySqlCompatiblity) {
      factory.setDatabaseConfigurer(new DataSourceTestConfig.MySqlCompatibleH2DatabaseConfigurer());
    } else {
      factory.setDatabaseType(EmbeddedDatabaseType.H2);
    }

    factory.setDatabasePopulator(resourceDatabasePopulator);
    database = factory.getDatabase();

    return new JpaUsersConnectionRepository(dataAccessor,
        connectionFactoryRegistry, Encryptors.noOpText());

  }
View Full Code Here

    return resourceDatabasePopulator;
  }

  @Bean
  EmbeddedDatabase dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    if (testMySqlCompatiblity) {
      factory.setDatabaseConfigurer(new MySqlCompatibleH2DatabaseConfigurer());
    } else {
      factory.setDatabaseType(EmbeddedDatabaseType.H2);
    }

    factory.setDatabasePopulator(resourceDatabasePopulator());
    return factory.getDatabase();
  }
View Full Code Here

  private ConnectionRepository connectionRepository;

  @Before
  public void setUp() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    if (testMySqlCompatiblity) {
      factory.setDatabaseConfigurer(new MySqlCompatibleH2DatabaseConfigurer())
    } else {
      factory.setDatabaseType(EmbeddedDatabaseType.H2);     
    }
    ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
    populator.addScript(new ClassPathResource(getSchemaSql(), getClass()));
    factory.setDatabasePopulator(populator);
    database = factory.getDatabase();
    dataAccessor = new JdbcTemplate(database);
    connectionFactoryRegistry = new ConnectionFactoryRegistry();
    connectionFactory = new TestFacebookConnectionFactory();
    connectionFactoryRegistry.addConnectionFactory(connectionFactory);
    usersConnectionRepository = new JdbcUsersConnectionRepository(database, connectionFactoryRegistry, Encryptors.noOpText());
View Full Code Here

@EnableTransactionManagement
public class MainConfig {

  @Bean(destroyMethod = "shutdown")
  public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("spring-social-showcase");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
  }
View Full Code Here

@PropertySource("classpath:application.properties")
public class MainConfig {

  @Bean(destroyMethod = "shutdown")
  public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("spring-social-quickstart");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
  }
View Full Code Here

@EnableTransactionManagement
public class MainConfig {

  @Bean(destroyMethod = "shutdown")
  public DataSource dataSource() {
    EmbeddedDatabaseFactory factory = new EmbeddedDatabaseFactory();
    factory.setDatabaseName("spring-social-showcase");
    factory.setDatabaseType(EmbeddedDatabaseType.H2);
    factory.setDatabasePopulator(databasePopulator());
    return factory.getDatabase();
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseFactory$EmbeddedDataSourceProxy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.