org.sonar.db.dialect.Dialect.supportsMigration()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中org.sonar.db.dialect.Dialect.supportsMigration()方法的一些代码示例,展示了Dialect.supportsMigration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dialect.supportsMigration()方法的具体详情如下:
包路径:org.sonar.db.dialect.Dialect
类名称:Dialect
方法名:supportsMigration

Dialect.supportsMigration介绍

[英]Indicates whether DB migration can be perform on the DB vendor implementation associated with the current dialect.
[中]指示是否可以在与当前方言关联的DB供应商实现上执行DB迁移。

代码示例

代码示例来源:origin: SonarSource/sonarqube

@Test
public void verify_example() throws Exception {
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(RUNNING);
 when(migrationState.getStartedAt()).thenReturn(DateUtils.parseDateTime("2015-02-23T18:54:23+0100"));
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(getClass().getResource("example-migrate_db.json"));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void verify_example() throws Exception {
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(RUNNING);
 when(migrationState.getStartedAt()).thenReturn(DateUtils.parseDateTime("2015-02-23T18:54:23+0100"));
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(getClass().getResource("example-migrate_db.json"));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void state_from_database_migration_and_msg_includes_error_when_dbmigration_status_is_FAILED(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(FAILED);
 when(migrationState.getStartedAt()).thenReturn(SOME_DATE);
 when(migrationState.getError()).thenReturn(new UnsupportedOperationException(SOME_THROWABLE_MSG));
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_MIGRATION_FAILED, failedMsg(SOME_THROWABLE_MSG), SOME_DATE));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void state_from_database_migration_and_msg_has_default_msg_when_dbmigration_status_is_SUCCEEDED(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(SUCCEEDED);
 when(migrationState.getStartedAt()).thenReturn(SOME_DATE);
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_MIGRATION_SUCCEEDED, MESSAGE_STATUS_SUCCEEDED, SOME_DATE));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void state_from_database_migration_and_msg_has_default_msg_when_dbmigration_status_is_FAILED(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(FAILED);
 when(migrationState.getStartedAt()).thenReturn(SOME_DATE);
 when(migrationState.getError()).thenReturn(null); // no failure throwable caught
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_MIGRATION_FAILED, failedMsg(DEFAULT_ERROR_MSG), SOME_DATE));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void state_from_database_migration_when_dbmigration_status_is_RUNNING(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(RUNNING);
 when(migrationState.getStartedAt()).thenReturn(SOME_DATE);
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_MIGRATION_RUNNING, MESSAGE_STATUS_RUNNING, SOME_DATE));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void state_from_database_migration_and_msg_includes_error_when_dbmigration_status_is_FAILED(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(FAILED);
 when(migrationState.getStartedAt()).thenReturn(SOME_DATE);
 when(migrationState.getError()).thenReturn(new UnsupportedOperationException(SOME_THROWABLE_MSG));
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_MIGRATION_FAILED, failedMsg(SOME_THROWABLE_MSG), SOME_DATE));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void start_migration_and_return_state_from_databasemigration_when_dbmigration_status_is_NONE(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(NONE);
 when(migrationState.getStartedAt()).thenReturn(SOME_DATE);
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_MIGRATION_REQUIRED, MESSAGE_MIGRATION_REQUIRED));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void state_from_database_migration_when_dbmigration_status_is_RUNNING(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(RUNNING);
 when(migrationState.getStartedAt()).thenReturn(SOME_DATE);
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_MIGRATION_RUNNING, MESSAGE_STATUS_RUNNING, SOME_DATE));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void state_from_database_migration_and_msg_has_default_msg_when_dbmigration_status_is_SUCCEEDED(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(SUCCEEDED);
 when(migrationState.getStartedAt()).thenReturn(SOME_DATE);
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_MIGRATION_SUCCEEDED, MESSAGE_STATUS_SUCCEEDED, SOME_DATE));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void start_migration_and_return_state_from_databasemigration_when_dbmigration_status_is_NONE(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(NONE);
 when(migrationState.getStartedAt()).thenReturn(SOME_DATE);
 underTest.handle(request, response);
 verify(databaseMigration).startIt();
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_MIGRATION_RUNNING, MESSAGE_STATUS_RUNNING, SOME_DATE));
}

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void state_from_database_migration_and_msg_has_default_msg_when_dbmigration_status_is_FAILED(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(true);
 when(migrationState.getStatus()).thenReturn(FAILED);
 when(migrationState.getStartedAt()).thenReturn(SOME_DATE);
 when(migrationState.getError()).thenReturn(null); // no failure throwable caught
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_MIGRATION_FAILED, failedMsg(DEFAULT_ERROR_MSG), SOME_DATE));
}

代码示例来源:origin: SonarSource/sonarqube

if (status == DatabaseVersion.Status.UP_TO_DATE || status == DatabaseVersion.Status.REQUIRES_DOWNGRADE) {
 write(json, databaseMigrationState);
} else if (!database.getDialect().supportsMigration()) {
 writeNotSupportedResponse(json);
} else {

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void state_is_NONE_with_specific_msg_when_db_requires_upgrade_but_dialect_does_not_support_migration(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(false);
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_NOT_SUPPORTED, MESSAGE_NO_MIGRATION_ON_EMBEDDED_DATABASE));
}

代码示例来源:origin: SonarSource/sonarqube

if (status == DatabaseVersion.Status.UP_TO_DATE || status == DatabaseVersion.Status.REQUIRES_DOWNGRADE) {
 write(json, migrationState);
} else if (!database.getDialect().supportsMigration()) {
 writeNotSupportedResponse(json);
} else {

代码示例来源:origin: SonarSource/sonarqube

@Test
@UseDataProvider("statusRequiringDbMigration")
public void state_is_NONE_with_specific_msg_when_db_requires_upgrade_but_dialect_does_not_support_migration(DatabaseVersion.Status status) throws Exception {
 when(databaseVersion.getStatus()).thenReturn(status);
 when(dialect.supportsMigration()).thenReturn(false);
 underTest.handle(request, response);
 assertJson(response.outputAsString()).isSimilarTo(expectedResponse(STATUS_NOT_SUPPORTED, MESSAGE_NO_MIGRATION_ON_EMBEDDED_DATABASE));
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-server

if (status == DatabaseVersion.Status.UP_TO_DATE || status == DatabaseVersion.Status.REQUIRES_DOWNGRADE) {
 write(json, databaseMigrationState);
} else if (!database.getDialect().supportsMigration()) {
 writeNotSupportedResponse(json);
} else {

代码示例来源:origin: org.sonarsource.sonarqube/sonar-server

if (status == DatabaseVersion.Status.UP_TO_DATE || status == DatabaseVersion.Status.REQUIRES_DOWNGRADE) {
 write(json, migrationState);
} else if (!database.getDialect().supportsMigration()) {
 writeNotSupportedResponse(json);
} else {

相关文章