Package liquibase.servicelocator

Examples of liquibase.servicelocator.ServiceLocator


  @Test
  public void replacesServiceLocator() throws Exception {
    SpringApplication application = new SpringApplication(Conf.class);
    application.setWebEnvironment(false);
    application.run();
    ServiceLocator instance = ServiceLocator.getInstance();
    Field field = ReflectionUtils.findField(ServiceLocator.class, "classResolver");
    field.setAccessible(true);
    Object resolver = field.get(instance);
    assertThat(resolver, instanceOf(SpringPackageScanClassResolver.class));
  }
View Full Code Here


            .getChangeLog());
        Assert.state(resource.exists(), "Cannot find changelog location: "
            + resource + " (please add changelog or check your Liquibase "
            + "configuration)");
      }
      ServiceLocator serviceLocator = ServiceLocator.getInstance();
      serviceLocator.addPackageToScan(CommonsLoggingLiquibaseLogger.class
          .getPackage().getName());
    }
View Full Code Here

            throw new RuntimeException("Failed to validate database", e);
        }
    }

    private Liquibase getLiquibase(Connection connection) throws Exception {
        ServiceLocator sl = ServiceLocator.getInstance();

        if (!System.getProperties().containsKey("liquibase.scan.packages")) {
            if (sl.getPackages().remove("liquibase.core")) {
                sl.addPackageToScan("liquibase.core.xml");
            }

            if (sl.getPackages().remove("liquibase.parser")) {
                sl.addPackageToScan("liquibase.parser.core.xml");
            }

            if (sl.getPackages().remove("liquibase.serializer")) {
                sl.addPackageToScan("liquibase.serializer.core.xml");
            }

            sl.getPackages().remove("liquibase.ext");
            sl.getPackages().remove("liquibase.sdk");
        }

        LogFactory.setInstance(new LogWrapper());
        Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
        return new Liquibase(CHANGELOG, new ClassLoaderResourceAccessor(getClass().getClassLoader()), database);
View Full Code Here

TOP

Related Classes of liquibase.servicelocator.ServiceLocator

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.