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


Java SchemaInitializer类代码示例

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


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

示例1: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  install(new JpaPersistModule("main"));
  H2DBTestServer server = H2DBTestServer.startDefault();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(DBInitializer.class).asEagerSingleton();
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));

  bind(new TypeLiteral<TckRepository<FreeResourcesLimitImpl>>() {})
      .toInstance(new JpaTckRepository<>(FreeResourcesLimitImpl.class));
  bind(new TypeLiteral<TckRepository<AccountImpl>>() {})
      .toInstance(new JpaTckRepository<>(AccountImpl.class));

  bind(FreeResourcesLimitDao.class).to(JpaFreeResourcesLimitDao.class);
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ResourceTckModule.java

示例2: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  install(new JpaPersistModule("main"));
  H2DBTestServer server = H2DBTestServer.startDefault();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(DBInitializer.class).asEagerSingleton();
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));

  bind(new TypeLiteral<AbstractPermissionsDomain<MemberImpl>>() {}).to(OrganizationDomain.class);

  bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {})
      .to(JpaOrganizationImplTckRepository.class);
  bind(new TypeLiteral<TckRepository<UserImpl>>() {})
      .toInstance(new JpaTckRepository<>(UserImpl.class));
  bind(new TypeLiteral<TckRepository<MemberImpl>>() {})
      .toInstance(new JpaTckRepository<>(MemberImpl.class));
  bind(new TypeLiteral<TckRepository<OrganizationDistributedResourcesImpl>>() {})
      .toInstance(new JpaTckRepository<>(OrganizationDistributedResourcesImpl.class));

  bind(OrganizationDao.class).to(JpaOrganizationDao.class);
  bind(MemberDao.class).to(JpaMemberDao.class);

  bind(OrganizationDistributedResourcesDao.class)
      .to(JpaOrganizationDistributedResourcesDao.class);
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:OrganizationJpaTckModule.java

示例3: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  H2DBTestServer server = H2DBTestServer.startDefault();
  install(
      new PersistTestModuleBuilder()
          .setDriver(Driver.class)
          .runningOn(server)
          .addEntityClass(AccountImpl.class)
          .setExceptionHandler(H2ExceptionHandler.class)
          .build());
  bind(DBInitializer.class).asEagerSingleton();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));

  bind(new TypeLiteral<TckRepository<AccountImpl>>() {})
      .toInstance(new JpaTckRepository<>(AccountImpl.class));

  bind(AccountDao.class).to(JpaAccountDao.class);
}
 
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:AccountJpaTckModule.java

示例4: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  H2DBTestServer server = H2DBTestServer.startDefault();
  install(
      new PersistTestModuleBuilder()
          .setDriver(Driver.class)
          .runningOn(server)
          .addEntityClasses(SshPairImpl.class, UserImpl.class, AccountImpl.class)
          .setExceptionHandler(H2ExceptionHandler.class)
          .build());
  bind(DBInitializer.class).asEagerSingleton();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));

  bind(SshDao.class).to(JpaSshDao.class);
  bind(new TypeLiteral<TckRepository<SshPairImpl>>() {})
      .toInstance(new JpaTckRepository<>(SshPairImpl.class));
  bind(new TypeLiteral<TckRepository<UserImpl>>() {})
      .toInstance(new JpaTckRepository<>(UserImpl.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:SshTckModule.java

示例5: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  H2DBTestServer server = H2DBTestServer.startDefault();
  install(
      new PersistTestModuleBuilder()
          .setDriver(Driver.class)
          .runningOn(server)
          .addEntityClasses(InstallerImpl.class, InstallerServerConfigImpl.class)
          .setExceptionHandler(H2ExceptionHandler.class)
          .build());
  bind(DBInitializer.class).asEagerSingleton();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server.getDataSource()));

  bind(new TypeLiteral<TckRepository<InstallerImpl>>() {}).to(InstallerJpaTckRepository.class);

  bind(InstallerDao.class).to(JpaInstallerDao.class);
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:JpaTckModule.java

示例6: initializesSchemaWhenDatabaseIsEmpty

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Test
public void initializesSchemaWhenDatabaseIsEmpty() throws Exception {
  createScript("1.0/1__init.sql", "CREATE TABLE test (id INT, text TEXT, PRIMARY KEY (id));");
  createScript(
      "1.0/2__add_data.sql",
      "INSERT INTO test VALUES(1, 'test1');"
          + "INSERT INTO test VALUES(2, 'test2');"
          + "INSERT INTO test VALUES(3, 'test3');");
  createScript("2.0/1__add_more_data.sql", "INSERT INTO test VALUES(4, 'test4');");
  createScript(
      "2.0/postgresql/1__add_more_data.sql", "INSERT INTO test VALUES(4, 'postgresql-data');");

  final SchemaInitializer initializer = FlywayInitializerBuilder.from(dataSource).build();
  initializer.init();

  assertEquals(
      queryEntities(),
      Sets.newHashSet(
          new TestEntity(1, "test1"),
          new TestEntity(2, "test2"),
          new TestEntity(3, "test3"),
          new TestEntity(4, "test4")));

  // second init must do nothing, so there are no conflicts
  initializer.init();
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:FlywaySchemaInitializerTest.java

示例7: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  H2DBTestServer server = H2DBTestServer.startDefault();
  install(
      new PersistTestModuleBuilder()
          .setDriver(Driver.class)
          .runningOn(server)
          .addEntityClasses(
              OrganizationImpl.class,
              AccountImpl.class,
              WorkspaceImpl.class,
              WorkspaceConfigImpl.class,
              ProjectConfigImpl.class,
              EnvironmentImpl.class,
              ExtendedMachineImpl.class,
              CommandImpl.class,
              SourceStorageImpl.class,
              ServerConf2Impl.class,
              SnapshotImpl.class,
              InviteImpl.class)
          .addEntityClass(
              "org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute")
          .setExceptionHandler(H2ExceptionHandler.class)
          .build());
  bind(DBInitializer.class).asEagerSingleton();
  bind(SchemaInitializer.class)
      .toInstance(
          new FlywaySchemaInitializer(server.getDataSource(), "che-schema", "codenvy-schema"));
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));

  bind(new TypeLiteral<TckRepository<InviteImpl>>() {})
      .toInstance(new JpaTckRepository<>(InviteImpl.class));
  bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {})
      .toInstance(new JpaTckRepository<>(OrganizationImpl.class));
  bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {})
      .toInstance(new JpaTckRepository<>(WorkspaceImpl.class));

  bind(InviteDao.class).to(JpaInviteDao.class);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:40,代码来源:InviteJpaTckModule.java

示例8: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  install(new InitModule(PostConstruct.class));
  install(new JpaPersistModule("test"));
  bind(SchemaInitializer.class)
      .toInstance(
          new FlywaySchemaInitializer(inMemoryDefault(), "che-schema", "codenvy-schema"));
  bind(DBInitializer.class).asEagerSingleton();
  bindConstant().annotatedWith(Names.named("codenvy.admin.name")).to(NAME);
  bindConstant().annotatedWith(Names.named("codenvy.admin.initial_password")).to(PASSWORD);
  bindConstant().annotatedWith(Names.named("codenvy.admin.email")).to(EMAIL);
  bind(PermissionsManager.class).toInstance(permissionsManager);
  bind(UserManager.class).toInstance(mock(UserManager.class));
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:15,代码来源:AdminUserCreatorTest.java

示例9: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  final Map<String, String> properties = new HashMap<>();
  properties.put(TRANSACTION_TYPE, PersistenceUnitTransactionType.RESOURCE_LOCAL.name());

  final String dbUrl = System.getProperty("jdbc.url");
  final String dbUser = System.getProperty("jdbc.user");
  final String dbPassword = System.getProperty("jdbc.password");

  waitConnectionIsEstablished(dbUrl, dbUser, dbPassword);

  properties.put(JDBC_URL, dbUrl);
  properties.put(JDBC_USER, dbUser);
  properties.put(JDBC_PASSWORD, dbPassword);
  properties.put(JDBC_DRIVER, System.getProperty("jdbc.driver"));

  JpaPersistModule main = new JpaPersistModule("main");
  main.properties(properties);
  install(main);
  final PGSimpleDataSource dataSource = new PGSimpleDataSource();
  dataSource.setUser(dbUser);
  dataSource.setPassword(dbPassword);
  dataSource.setUrl(dbUrl);
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(dataSource, "che-schema", "codenvy-schema"));
  bind(DBInitializer.class).asEagerSingleton();
  bind(TckResourcesCleaner.class).to(JpaCleaner.class);

  bind(new TypeLiteral<TckRepository<InviteImpl>>() {})
      .toInstance(new JpaTckRepository<>(InviteImpl.class));
  bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {})
      .toInstance(new JpaTckRepository<>(OrganizationImpl.class));
  bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {})
      .toInstance(new JpaTckRepository<>(WorkspaceImpl.class));

  bind(InviteDao.class).to(JpaInviteDao.class);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:38,代码来源:JpaIntegrationTckModule.java

示例10: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  H2DBTestServer server = H2DBTestServer.startDefault();
  install(
      new PersistTestModuleBuilder()
          .setDriver(Driver.class)
          .runningOn(server)
          .addEntityClasses(
              UserImpl.class,
              AccountImpl.class,
              AbstractPermissions.class,
              SystemPermissionsImpl.class)
          .setExceptionHandler(H2ExceptionHandler.class)
          .build());
  bind(DBInitializer.class).asEagerSingleton();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
  // Creates empty multibinder to avoid error during container starting
  Multibinder.newSetBinder(
      binder(), String.class, Names.named(SystemDomain.SYSTEM_DOMAIN_ACTIONS));

  bind(new TypeLiteral<AbstractPermissionsDomain<SystemPermissionsImpl>>() {})
      .to(TestDomain.class);
  bind(new TypeLiteral<PermissionsDao<SystemPermissionsImpl>>() {})
      .to(JpaSystemPermissionsDao.class);

  bind(new TypeLiteral<TckRepository<SystemPermissionsImpl>>() {})
      .toInstance(new JpaTckRepository<>(SystemPermissionsImpl.class));
  bind(new TypeLiteral<TckRepository<UserImpl>>() {})
      .toInstance(new JpaTckRepository<>(UserImpl.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:SystemPermissionsTckModule.java

示例11: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  H2DBTestServer server = H2DBTestServer.startDefault();
  install(
      new PersistTestModuleBuilder()
          .setDriver(Driver.class)
          .runningOn(server)
          .addEntityClasses(
              UserImpl.class, ProfileImpl.class, PreferenceEntity.class, AccountImpl.class)
          .setExceptionHandler(H2ExceptionHandler.class)
          .build());
  bind(DBInitializer.class).asEagerSingleton();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server.getDataSource()));

  bind(new TypeLiteral<TckRepository<UserImpl>>() {}).to(UserJpaTckRepository.class);
  bind(new TypeLiteral<TckRepository<ProfileImpl>>() {})
      .toInstance(new JpaTckRepository<>(ProfileImpl.class));
  bind(new TypeLiteral<TckRepository<Pair<String, Map<String, String>>>>() {})
      .to(PreferenceJpaTckRepository.class);

  bind(UserDao.class).to(JpaUserDao.class);
  bind(ProfileDao.class).to(JpaProfileDao.class);
  bind(PreferenceDao.class).to(JpaPreferenceDao.class);
  // SHA-512 encryptor is faster than PBKDF2 so it is better for testing
  bind(PasswordEncryptor.class).to(SHA512PasswordEncryptor.class).in(Singleton.class);
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:JpaTckModule.java

示例12: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  H2DBTestServer server = H2DBTestServer.startDefault();
  install(
      new PersistTestModuleBuilder()
          .setDriver(Driver.class)
          .runningOn(server)
          .addEntityClasses(
              AccountImpl.class,
              WorkspaceImpl.class,
              WorkspaceConfigImpl.class,
              ProjectConfigImpl.class,
              EnvironmentImpl.class,
              RecipeImpl.class,
              MachineConfigImpl.class,
              SourceStorageImpl.class,
              ServerConfigImpl.class,
              StackImpl.class,
              CommandImpl.class,
              RecipeImpl.class,
              VolumeImpl.class)
          .addEntityClass(
              "org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute")
          .setExceptionHandler(H2ExceptionHandler.class)
          .build());
  bind(DBInitializer.class).asEagerSingleton();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));

  bind(new TypeLiteral<TckRepository<AccountImpl>>() {})
      .toInstance(new JpaTckRepository<>(AccountImpl.class));
  bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {}).toInstance(new WorkspaceRepository());
  bind(new TypeLiteral<TckRepository<StackImpl>>() {}).toInstance(new StackRepository());

  bind(WorkspaceDao.class).to(JpaWorkspaceDao.class);
  bind(StackDao.class).to(JpaStackDao.class);
}
 
开发者ID:eclipse,项目名称:che,代码行数:39,代码来源:WorkspaceTckModule.java

示例13: DBInitializer

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Inject
public DBInitializer(SchemaInitializer schemaInitializer, JpaInitializer jpaInitializer)
    throws SchemaInitializationException {
  // schema must be initialized before any other component that may interact with database
  initProperties = ImmutableMap.copyOf(schemaInitializer.init());

  // jpa initialization goes next
  jpaInitializer.init();
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:DBInitializer.java

示例14: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  H2DBTestServer server = H2DBTestServer.startDefault();
  install(
      new PersistTestModuleBuilder()
          .setDriver(Driver.class)
          .runningOn(server)
          .addEntityClasses(
              AccountImpl.class,
              UserImpl.class,
              WorkspaceImpl.class,
              WorkspaceConfigImpl.class,
              ProjectConfigImpl.class,
              EnvironmentImpl.class,
              StackPermissionsImpl.class,
              WorkerImpl.class,
              MachineConfigImpl.class,
              SourceStorageImpl.class,
              ServerConfigImpl.class,
              StackImpl.class,
              CommandImpl.class,
              RecipeImpl.class,
              VolumeImpl.class)
          .addEntityClass(
              "org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute")
          .setExceptionHandler(H2ExceptionHandler.class)
          .build());
  bind(DBInitializer.class).asEagerSingleton();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));

  bind(new TypeLiteral<TckRepository<AccountImpl>>() {})
      .toInstance(new JpaTckRepository<>(AccountImpl.class));
  bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {}).toInstance(new WorkspaceRepository());
  bind(new TypeLiteral<TckRepository<StackImpl>>() {}).toInstance(new StackRepository());
  bind(new TypeLiteral<TckRepository<UserImpl>>() {})
      .toInstance(new JpaTckRepository<>(UserImpl.class));
  bind(new TypeLiteral<TckRepository<WorkerImpl>>() {})
      .toInstance(new JpaTckRepository<>(WorkerImpl.class));
  bind(new TypeLiteral<TckRepository<StackPermissionsImpl>>() {})
      .toInstance(new JpaTckRepository<>(StackPermissionsImpl.class));

  bind(new TypeLiteral<PermissionsDao<StackPermissionsImpl>>() {})
      .to(JpaStackPermissionsDao.class);

  bind(new TypeLiteral<AbstractPermissionsDomain<WorkerImpl>>() {})
      .to(WorkerDaoTest.TestDomain.class);
  bind(new TypeLiteral<AbstractPermissionsDomain<StackPermissionsImpl>>() {})
      .to(StackPermissionsDaoTest.TestDomain.class);

  bind(WorkerDao.class).to(JpaWorkerDao.class);
  bind(WorkspaceDao.class).to(JpaWorkspaceDao.class);
  bind(StackDao.class).to(JpaStackDao.class);
}
 
开发者ID:eclipse,项目名称:che,代码行数:56,代码来源:WorkspaceTckModule.java

示例15: configure

import org.eclipse.che.core.db.schema.SchemaInitializer; //导入依赖的package包/类
@Override
protected void configure() {
  H2DBTestServer server = H2DBTestServer.startDefault();
  install(
      new PersistTestModuleBuilder()
          .setDriver(Driver.class)
          .runningOn(server)
          .addEntityClasses(
              AccountImpl.class,
              UserImpl.class,
              WorkspaceImpl.class,
              WorkspaceConfigImpl.class,
              ProjectConfigImpl.class,
              EnvironmentImpl.class,
              StackPermissionsImpl.class,
              WorkerImpl.class,
              MachineConfigImpl.class,
              SourceStorageImpl.class,
              ServerConfigImpl.class,
              StackImpl.class,
              CommandImpl.class,
              RecipeImpl.class,
              VolumeImpl.class)
          .addEntityClass(
              "org.eclipse.che.api.workspace.server.model.impl.ProjectConfigImpl$Attribute")
          .setExceptionHandler(H2ExceptionHandler.class)
          .build());

  bind(new TypeLiteral<AbstractPermissionsDomain<StackPermissionsImpl>>() {})
      .to(StackPermissionsDaoTest.TestDomain.class);
  bind(new TypeLiteral<PermissionsDao<StackPermissionsImpl>>() {})
      .to(JpaStackPermissionsDao.class);
  bind(new TypeLiteral<TckRepository<StackPermissionsImpl>>() {})
      .toInstance(new JpaTckRepository<>(StackPermissionsImpl.class));
  bind(new TypeLiteral<TckRepository<StackImpl>>() {})
      .toInstance(new JpaTckRepository<>(StackImpl.class));

  bind(new TypeLiteral<AbstractPermissionsDomain<WorkerImpl>>() {})
      .to(WorkerDaoTest.TestDomain.class);

  bind(WorkerDao.class).to(JpaWorkerDao.class);
  bind(new TypeLiteral<TckRepository<WorkerImpl>>() {})
      .toInstance(new JpaTckRepository<>(WorkerImpl.class));
  bind(new TypeLiteral<TckRepository<UserImpl>>() {})
      .toInstance(new JpaTckRepository<>(UserImpl.class));
  bind(new TypeLiteral<TckRepository<AccountImpl>>() {})
      .toInstance(new JpaTckRepository<>(AccountImpl.class));

  bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {})
      .toInstance(new JpaTckRepository<>(WorkspaceImpl.class));

  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(DBInitializer.class).asEagerSingleton();
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));
}
 
开发者ID:eclipse,项目名称:che,代码行数:57,代码来源:JpaTckModule.java


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