当前位置: 首页>>代码示例>>Java>>正文


Java EmbeddedDatabase.shutdown方法代码示例

本文整理汇总了Java中org.springframework.jdbc.datasource.embedded.EmbeddedDatabase.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Java EmbeddedDatabase.shutdown方法的具体用法?Java EmbeddedDatabase.shutdown怎么用?Java EmbeddedDatabase.shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.jdbc.datasource.embedded.EmbeddedDatabase的用法示例。


在下文中一共展示了EmbeddedDatabase.shutdown方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入方法依赖的package包/类
public static void main(final String[] args) throws SQLException {
    LOGGER.info("===========================================================");
    // r�cup�ration du contexte via les annotations � partir d'un package
    ApplicationContext context = new AnnotationConfigApplicationContext(ApplicationConfiguration.class);
    LOGGER.info("===========================================================");
    // notre contexte est charg�
    LOGGER.info("context is loaded : {}", context);

    LOGGER.info("-----------------------------------------------------------");

    EmbeddedDatabase dataSource = context.getBean(EmbeddedDatabase.class);

    LOGGER.info("Datasource : {}, connection : {}", dataSource, dataSource.getConnection().isClosed());


    // fermeture de la base embarqu�e
    dataSource.shutdown();
}
 
开发者ID:Eulbobo,项目名称:java-samples,代码行数:19,代码来源:Application.java

示例2: noTable

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入方法依赖的package包/类
@Test
public void noTable() throws ClassNotFoundException, SQLException, JAXBException, IOException {
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase embeddedDatabase = builder.setType(EmbeddedDatabaseType.H2).build();

    Metadata meta = extractor.extract(embeddedDatabase.getConnection());

    assertThat(countTables(meta)).isZero();
    assertThat(countColumns(meta)).isZero();
    assertThat(countPrimaryKeys(meta)).isZero();
    assertThat(countImportedKeys(meta)).isZero();
    assertThat(countIndexes(meta)).isZero();
    assertThat(countEnums(meta)).isZero();

    embeddedDatabase.shutdown();
}
 
开发者ID:jaxio,项目名称:celerio,代码行数:17,代码来源:MetaDataExtractorTest.java

示例3: outputIsSameAsInput

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入方法依赖的package包/类
@Test
public void outputIsSameAsInput() throws ClassNotFoundException, SQLException, XmlMappingException, IOException {
    EmbeddedDatabase embeddedDatabase = createMinimalEmbeddedDatabase(ALL_RELATIONS_SCRIPT);

    Metadata meta = extractor.extract(embeddedDatabase.getConnection());


    assertThat(countTables(meta)).isEqualTo(18);
    assertThat(countColumns(meta)).isEqualTo(49);
    assertThat(countPrimaryKeys(meta)).isEqualTo(18);
    assertThat(countIndexes(meta)).isEqualTo(21);
    assertThat(countEnums(meta)).isEqualTo(3);

    File tempFile = File.createTempFile(getClass().getName(), ".xml");
    tempFile.deleteOnExit();
    loader.write(meta, tempFile);

    Metadata loadedMeta = loader.load(tempFile);
    assertThat(countTables(meta)).isEqualTo(countTables(loadedMeta));
    assertThat(countColumns(meta)).isEqualTo(countColumns(loadedMeta));
    assertThat(countPrimaryKeys(meta)).isEqualTo(countPrimaryKeys(loadedMeta));
    assertThat(countIndexes(meta)).isEqualTo(countIndexes(loadedMeta));
    assertThat(countEnums(meta)).isEqualTo(countEnums(loadedMeta));

    embeddedDatabase.shutdown();
}
 
开发者ID:jaxio,项目名称:celerio,代码行数:27,代码来源:MetaDataExtractorTest.java

示例4: testConfigurationHotReloading

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入方法依赖的package包/类
@Test
public void testConfigurationHotReloading() throws Exception {
    //given
    EmbeddedDatabase database = new EmbeddedDatabaseBuilder().setName("test").addScript("database.sql").build();
    System.setProperty("sp", "foo");
    HotReloadableConfig config = new HotReloadableConfig();

    //when
    propertiesInjector.injectProperties(config);

    //then
    assertThat(config.getSystemProperty()).isEqualTo("foo");
    assertThat(config.getName()).isEqualTo("Foo");

    // Properties changes should be reloaded
    System.setProperty("sp","bar");
    new JdbcTemplate(database).update("update ApplicationProperties set value = ? where key = ?", "Bar", "name");
    sleep(2 * 1000);
    assertThat(config.getSystemProperty()).isEqualTo("bar");
    assertThat(config.getName()).isEqualTo("Bar");
    database.shutdown();
}
 
开发者ID:j-easy,项目名称:easy-props,代码行数:23,代码来源:PropertiesInjectorImplTest.java

示例5: minimal

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入方法依赖的package包/类
@Test
public void minimal() throws ClassNotFoundException, SQLException, JAXBException, IOException {
    EmbeddedDatabase embeddedDatabase = createMinimalEmbeddedDatabase(MINIMAL_SCRIPT);
    Metadata meta = extractor.extract(embeddedDatabase.getConnection());

    assertThat(countTables(meta)).isEqualTo(6);
    assertThat(countColumns(meta)).isEqualTo(29);
    assertThat(countPrimaryKeys(meta)).isEqualTo(9);
    assertThat(countImportedKeys(meta)).isEqualTo(4);
    assertThat(countIndexes(meta)).isEqualTo(13);
    assertThat(countEnums(meta)).isZero();

    embeddedDatabase.shutdown();
}
 
开发者ID:jaxio,项目名称:celerio,代码行数:15,代码来源:MetaDataExtractorTest.java

示例6: shutdownCreatedDatabases

import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase; //导入方法依赖的package包/类
@After
public void shutdownCreatedDatabases() {
	for(EmbeddedDatabase db : this.createdDatabases) {
		db.shutdown();
	}
}
 
开发者ID:andreptb,项目名称:fitnesse-jdbc-slim,代码行数:7,代码来源:JdbcFixtureTestCase.java


注:本文中的org.springframework.jdbc.datasource.embedded.EmbeddedDatabase.shutdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。