當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。