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


Java LiquibaseException类代码示例

本文整理汇总了Java中liquibase.exception.LiquibaseException的典型用法代码示例。如果您正苦于以下问题:Java LiquibaseException类的具体用法?Java LiquibaseException怎么用?Java LiquibaseException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setup

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
/**
 * Setup of test data: set attributes, purge and initialize test datbase 
 */
@Before
public void setup() throws SQLException, LiquibaseException {
	// Init jdbcTemplate
	this.jdbcTemplate = new JdbcTemplate(datasource);
	
	// Set test db properties
	DriverManagerDataSource ds = (DriverManagerDataSource)datasource;
	this.paasTestDbUrl = ds.getUrl();
	this.paasTestDbUser = ds.getUsername();
	this.paasTestDbPassword = ds.getPassword();

	// purge test database
	liquibaseWrapper.purgeDatabase(paasTestDbUrl, paasTestDbUser, paasTestDbPassword);
	
	// init database state
	liquibaseWrapper.applyChangeLog(paasTestDbUrl, paasTestDbUser, paasTestDbPassword, basicInitialChangeLofFile);
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:21,代码来源:CheckVariousRefactoringCommandsIT.java

示例2: afterPropertiesSet

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws LiquibaseException {
    if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT)) {
        taskExecutor.execute(() -> {
            try {
                log.warn("Starting Liquibase asynchronously, your database might not be ready at startup!");
                initDb();
            } catch (LiquibaseException e) {
                log.error("Liquibase could not start correctly, your database is NOT ready: {}", e.getMessage(), e);
            }
        });
    } else {
        log.debug("Starting Liquibase synchronously");
        initDb();
    }
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:17,代码来源:AsyncSpringLiquibase.java

示例3: afterPropertiesSet

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void afterPropertiesSet() throws Exception {
    if (getDataSource() == null && getSchemas() == null) {
        super.afterPropertiesSet();
    } else {
        if (getDataSource() == null && getSchemas() != null) {
            throw new LiquibaseException("When schemas are defined you should also define a base dataSource");
        }

        if (getDataSource() != null) {
            log.info("Schema based multitenancy enabled");
            if (CollectionUtils.isEmpty(getSchemas())) {
                log.warn("Schemas not defined, using defaultSchema only");
                setSchemas(new ArrayList<>());
                getSchemas().add(getDefaultSchema());
            }

            runOnAllSchemasXm();
        }
    }
}
 
开发者ID:xm-online,项目名称:xm-commons,代码行数:25,代码来源:XmMultiTenantSpringLiquibase.java

示例4: runOnAllSchemasXm

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
private void runOnAllSchemasXm() throws LiquibaseException {

        for (String schema : getSchemas()) {
            if (schema.equals("default")) {
                schema = null;
            }

            log.info("Initializing Liquibase for schema {}", schema);
            try {
                SpringLiquibase liquibase = getXmSpringLiquibase(getDataSource());
                liquibase.setDefaultSchema(schema);
                liquibase.afterPropertiesSet();
                log.info("Liquibase run for schema {}", schema);
            } catch (Exception e) {
                log.error("Failed to initialize Liquibase for schema {}", schema, e);
            }
        }

    }
 
开发者ID:xm-online,项目名称:xm-commons,代码行数:20,代码来源:XmMultiTenantSpringLiquibase.java

示例5: create

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
/**
 * Create database schema for tenant.
 *
 * @param tenant - the tenant
 */
public void create(Tenant tenant) {
    StopWatch stopWatch = createStarted();
    log.info("START - SETUP:CreateTenant:schema tenantKey={}", tenant.getTenantKey());
    DatabaseUtil.createSchema(dataSource, tenant.getTenantKey());
    log.info("STOP - SETUP:CreateTenant:schema tenantKey={}, time={}ms", tenant.getTenantKey(),
        stopWatch.getTime());
    try {
        stopWatch.reset();
        stopWatch.start();
        log.info("START - SETUP:CreateTenant:liquibase tenantKey={}", tenant.getTenantKey());
        SpringLiquibase liquibase = new SpringLiquibase();
        liquibase.setResourceLoader(resourceLoader);
        liquibase.setDataSource(dataSource);
        liquibase.setChangeLog(CHANGE_LOG_PATH);
        liquibase.setContexts(liquibaseProperties.getContexts());
        liquibase.setDefaultSchema(tenant.getTenantKey());
        liquibase.setDropFirst(liquibaseProperties.isDropFirst());
        liquibase.setShouldRun(true);
        liquibase.afterPropertiesSet();
        log.info("STOP - SETUP:CreateTenant:liquibase tenantKey={}, time={}ms", tenant.getTenantKey(),
            stopWatch.getTime());
    } catch (LiquibaseException e) {
        throw new RuntimeException("Can not migrate database for creation tenant " + tenant.getTenantKey(), e);
    }
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:31,代码来源:TenantDatabaseService.java

示例6: initDatabaseSchema

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
private void initDatabaseSchema() throws SQLException, LiquibaseException {

        if (config.hasKey("database.changelog")) {

            ResourceAccessor resourceAccessor = new FileSystemResourceAccessor();

            Database database = DatabaseFactory.getInstance().openDatabase(
                    config.getString("database.url"),
                    config.getString("database.user"),
                    config.getString("database.password"),
                    null, resourceAccessor);

            Liquibase liquibase = new Liquibase(
                    config.getString("database.changelog"), resourceAccessor, database);

            liquibase.clearCheckSums();

            liquibase.update(new Contexts());
        }
    }
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:21,代码来源:DataManager.java

示例7: afterPropertiesSet

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws LiquibaseException {
    if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT, Constants.SPRING_PROFILE_HEROKU)) {
        taskExecutor.execute(() -> {
            try {
                log.warn("Starting Liquibase asynchronously, your database might not be ready at startup!");
                initDb();
            } catch (LiquibaseException e) {
                log.error("Liquibase could not start correctly, your database is NOT ready: {}", e.getMessage(), e);
            }
        });
    } else {
        log.debug("Starting Liquibase synchronously");
        initDb();
    }
}
 
开发者ID:ugouku,项目名称:shoucang,代码行数:17,代码来源:AsyncSpringLiquibase.java

示例8: afterPropertiesSet

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws LiquibaseException {
    if (!env.acceptsProfiles(Constants.SPRING_PROFILE_NO_LIQUIBASE)) {
        if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT, Constants.SPRING_PROFILE_HEROKU)) {
            taskExecutor.execute(() -> {
                try {
                    log.warn("Starting Liquibase asynchronously, your database might not be ready at startup!");
                    initDb();
                } catch (LiquibaseException e) {
                    log.error("Liquibase could not start correctly, your database is NOT ready: {}", e.getMessage(), e);
                }
            });
        } else {
            log.debug("Starting Liquibase synchronously");
            initDb();
        }
    } else {
        log.debug("Liquibase is disabled");
    }
}
 
开发者ID:klask-io,项目名称:klask-io,代码行数:21,代码来源:AsyncSpringLiquibase.java

示例9: setUpClass

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws ParserConfigurationException, IOException, SAXException, SQLException, LiquibaseException {
    ApplicationConfig config = ConfigurationBuilder.createBuilder().loadXMLConfiguration().getConfiguration();

    HikariConfig hikariConfig = new HikariConfig();
    hikariConfig.setJdbcUrl("jdbc:" + config.getDbUrl() + "/" + config.getDbName());
    hikariConfig.setUsername(config.getDbUser());
    hikariConfig.setPassword(config.getDbPassword());
    hikariConfig.setMaximumPoolSize(config.getThreadLimit());
    if(config.isDbIgnoreSSLWarn()) {
        hikariConfig.addDataSourceProperty("useSSL", false);
    }

    dataSource = new HikariDataSource(hikariConfig);

    Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(dataSource.getConnection()));

    Liquibase liquibase = new Liquibase("db/changelog/db.changelog-master.yaml", new ClassLoaderResourceAccessor(), database);

    liquibase.update(new Contexts(), new LabelExpression());
}
 
开发者ID:XIVStats,项目名称:XIVStats-Gatherer-Java,代码行数:22,代码来源:GathererControllerIT.java

示例10: afterPropertiesSet

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws LiquibaseException {
    if (!env.acceptsProfiles(Constants.SPRING_PROFILE_NO_LIQUIBASE)) {
        if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT, Constants.SPRING_PROFILE_HEROKU)) {
            taskExecutor.execute(() -> {
                try {
                    logger.warn("Starting Liquibase asynchronously, your database might not be ready at startup!");
                    initDb();
                } catch (LiquibaseException e) {
                    logger.error("Liquibase could not start correctly, your database is NOT ready: {}", e.getMessage(), e);
                }
            });
        } else {
            logger.debug("Starting Liquibase synchronously");
            initDb();
        }
    } else {
        logger.debug("Liquibase is disabled");
    }
}
 
开发者ID:stormpath,项目名称:generator-jhipster-stormpath,代码行数:21,代码来源:AsyncSpringLiquibase.java

示例11: afterPropertiesSet

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws LiquibaseException {
    if (!env.acceptsProfiles(SPRING_PROFILE_NO_LIQUIBASE)) {
        if (env.acceptsProfiles(SPRING_PROFILE_DEVELOPMENT, SPRING_PROFILE_HEROKU)) {
            taskExecutor.execute(() -> {
                try {
                    logger.warn(STARTING_ASYNC_MESSAGE);
                    initDb();
                } catch (LiquibaseException e) {
                    logger.error(EXCEPTION_MESSAGE, e.getMessage(), e);
                }
            });
        } else {
            logger.debug(STARTING_SYNC_MESSAGE);
            initDb();
        }
    } else {
        logger.debug(DISABLED_MESSAGE);
    }
}
 
开发者ID:jhipster,项目名称:jhipster,代码行数:21,代码来源:AsyncSpringLiquibase.java

示例12: applyChangelog

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
@Override
public void applyChangelog( Map<String, Object> parameters )
    throws SQLException, LiquibaseException
{
    Liquibase liquibase = null;
    try
    {
        liquibase = newConnectedLiquibase();
        for( Map.Entry<String, Object> entry : parameters.entrySet() )
        {
            liquibase.getChangeLogParameters().set( entry.getKey(), entry.getValue() );
        }
        liquibase.update( config.get().contexts().get() );
    }
    finally
    {
        if( liquibase != null )
        {
            liquibase.getDatabase().close();
        }
    }
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:23,代码来源:LiquibaseService.java

示例13: createTables

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
private void createTables(String changelog) {
    
    Connection holdingConnection;
    try {
        ResourceAccessor resourceAccessor = new FileSystemResourceAccessor();
        
        holdingConnection = getConnectionImpl(USER_NAME, getPostgresPassword());
        JdbcConnection conn = new JdbcConnection(holdingConnection);
        
        PostgresDatabase database = new PostgresDatabase();
        database.setDefaultSchemaName("public");
        database.setConnection(conn);
        
        liquibase = new Liquibase(changelog, resourceAccessor, database);
        liquibase.dropAll();
        liquibase.update("test");
        
        conn.close();
        
    } catch (SQLException | LiquibaseException ex) {
        LOG.error("Error during createTable step", ex);
        throw new RuntimeException("Error during createTable step", ex);
    }
    
}
 
开发者ID:mbarre,项目名称:schemacrawler-additional-lints,代码行数:26,代码来源:PostgreSqlDatabase.java

示例14: afterPropertiesSet

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
@Override
    public void afterPropertiesSet() throws LiquibaseException {
//        if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT, Constants.SPRING_PROFILE_HEROKU)) {
//            taskExecutor.execute(() -> {
//                try {
//                    log.warn("Starting Liquibase asynchronously, your database might not be ready at startup!");
//                    initDb();
//                } catch (LiquibaseException e) {
//                    log.error("Liquibase could not start correctly, your database is NOT ready: {}", e.getMessage(), e);
//                }
//            });
//        } else {
            log.debug("Starting Liquibase synchronously");
            initDb();
//        }
    }
 
开发者ID:TransparencyInternationalEU,项目名称:lobbycal,代码行数:17,代码来源:AsyncSpringLiquibase.java

示例15: forceUpdate

import liquibase.exception.LiquibaseException; //导入依赖的package包/类
public void forceUpdate() throws LiquibaseException {
    ConfigurationProperty shouldRunProperty =
        LiquibaseConfiguration.getInstance().getProperty(GlobalConfiguration.class, GlobalConfiguration.SHOULD_RUN);

    if (!shouldRunProperty.getValue(Boolean.class)) {
        // don't override the global configuraiton... 
        // LiquibaseConfiguration.getInstance().getConfiguration(GlobalConfiguration.class).setValue(GlobalConfiguration.SHOULD_RUN, true);
        log.warn("Can't override GlobalConfiguraiton when forcing liquibase to run");
        return;
    }
    if (!shouldRun) {
        log.info("Liquibase forcing 'shouldRun' " + "property on Spring Liquibase Bean: " + getBeanName());
        shouldRun = true;
    }
    super.afterPropertiesSet();
}
 
开发者ID:jhaood,项目名称:github-job-keywords,代码行数:17,代码来源:LiquibaseActuator.java


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