并行运行时Liquibase更新引发错误

时间:2019-05-21 06:47:17

标签: spring-data-jpa liquibase liquibase-sql

我正在尝试为我的DDL实体生成JPA脚本,并且效果很好。 我正在为该错误添加单元测试

Caused by: liquibase.exception.ServiceNotFoundException: Could not find unique implementation of liquibase.executor.Executor.  Found 0 implementations
at liquibase.servicelocator.ServiceLocator.findClass(ServiceLocator.java:185)
at liquibase.servicelocator.ServiceLocator.newInstance(ServiceLocator.java:211)
... 21 more

我的testng测试看起来像这样

    @DataProvider(parallel = true)
    public Object[][] listToArrays() {

    File f=new File(PropertyReader.getInstance().getProperty("path");
    File[] files=f.listFiles();

    List<MetaData> list =prepare(files);


        Object[][] array = new Object[list.size()][1];
        for (int i = 0; i < list.size(); i++) {
        array[i][0] = list.get(i);
         }
    return array;
    }

    @Test(dataProvider = "listToArrays")
    public void test(MetaData s) throws ScriptGenerationException, 
    UnsupportedEncodingException, LiquibaseException, IOException {

        String[] rdbmsTypes=new String[] 
                            {"MSSQL","POSTGRES","ORACLE","MYSQL"};

        for (String rdbmsType : rdbmsTypes) {

                FileSystemResourceAccessor fsOpener = new FileSystemResourceAccessor();
    CommandLineResourceAccessor clOpener = new CommandLineResourceAccessor(this.getClass().getClassLoader());
    CompositeResourceAccessor fileOpener = new CompositeResourceAccessor(new ResourceAccessor[] { fsOpener, clOpener });

    Database database = CommandLineUtils.createDatabaseObject(fileOpener, this.url, this.username, this.password, this.driver, 
            this.defaultCatalogName, this.defaultSchemaName, Boolean.parseBoolean(this.outputDefaultCatalog),
            Boolean.parseBoolean(this.outputDefaultSchema), this.databaseClass, 
            this.driverPropertiesFile, this.propertyProviderClass, this.liquibaseCatalogName, 
            this.liquibaseSchemaName, this.databaseChangeLogTableName, this.databaseChangeLogLockTableName);


    Liquibase liquibase=new Liquibase(d, null, database);

    Writer w=getOutputWriter();

    liquibase.update(new Contexts(this.contexts), new LabelExpression(this.labels), w);

    w.close();

        }

    }

可能是什么原因造成的?

注意:我仅在离线模式下使用Liquibase

0 个答案:

没有答案
相关问题