use of org.sonar.api.utils.MessageException in project sonarqube by SonarSource.
the class LoadReportAnalysisMetadataHolderStepTest method execute_sets_branch_even_if_MessageException_is_thrown_because_projectKey_in_report_is_different_from_componentKey_in_CE_task.
@Test
public void execute_sets_branch_even_if_MessageException_is_thrown_because_projectKey_in_report_is_different_from_componentKey_in_CE_task() {
ComponentDto otherProject = db.components().insertPublicProject();
reportReader.setMetadata(ScannerReport.Metadata.newBuilder().setProjectKey(otherProject.getDbKey()).build());
try {
underTest.execute(new TestComputationStepContext());
} catch (MessageException e) {
assertThat(analysisMetadataHolder.getBranch()).isNotNull();
}
}
use of org.sonar.api.utils.MessageException in project sonarqube by SonarSource.
the class OracleTest method test_driver_versions.
@Test
public void test_driver_versions() throws Exception {
DatabaseMetaData metadata = newMetadata(11, 2, "18.3.0.0.0");
underTest.init(metadata);
metadata = newMetadata(11, 2, "12.2.0.1.0");
underTest.init(metadata);
// no error
metadata = newMetadata(11, 2, "12.1.0.2.0");
underTest.init(metadata);
// no error
metadata = newMetadata(11, 2, "12.1.0.1.0");
underTest.init(metadata);
// no error
metadata = newMetadata(11, 2, "12.0.2");
underTest.init(metadata);
// no error
metadata = newMetadata(11, 2, "11.1.0.2");
try {
underTest.init(metadata);
fail();
} catch (MessageException e) {
assertThat(e).hasMessage("Unsupported Oracle driver version: 11.1.0.2. Minimal supported version is 12.1.");
}
}
use of org.sonar.api.utils.MessageException in project sonarqube by SonarSource.
the class LoadPeriodsStepTest method verifyFailWithInvalidValueMessageException.
private void verifyFailWithInvalidValueMessageException(String propertyValue, String debugLog, String... otherDebugLogs) {
try {
underTest.execute(new TestComputationStepContext());
fail("a Message Exception should have been thrown");
} catch (MessageException e) {
verifyInvalidValueMessage(e, propertyValue);
verifyDebugLogs(debugLog, otherDebugLogs);
}
}
use of org.sonar.api.utils.MessageException in project sonarqube by SonarSource.
the class DatabaseCheckerTest method requires_oracle_driver_11_2.
@Test
public void requires_oracle_driver_11_2() throws Exception {
Database db = mockDb(new Oracle(), 11, 2, "11.2.0.0.1");
new DatabaseChecker(db).start();
// no error
db = mockDb(new Oracle(), 11, 2, "11.3.1");
new DatabaseChecker(db).start();
// no error
db = mockDb(new Oracle(), 11, 2, "12.0.2");
new DatabaseChecker(db).start();
// no error
db = mockDb(new Oracle(), 11, 2, "11.1.0.2");
try {
new DatabaseChecker(db).start();
fail();
} catch (MessageException e) {
assertThat(e).hasMessage("Unsupported Oracle driver version: 11.1.0.2. Minimal supported version is 11.2.");
}
}
use of org.sonar.api.utils.MessageException in project sonarqube by SonarSource.
the class DatabaseCheckerTest method requires_oracle_11g_or_greater.
@Test
public void requires_oracle_11g_or_greater() throws Exception {
// oracle 11.0 is ok
Database db = mockDb(new Oracle(), 11, 0, "11.2.0.0.1");
new DatabaseChecker(db).start();
// oracle 11.1 is ok
db = mockDb(new Oracle(), 11, 1, "11.2.0.0.1");
new DatabaseChecker(db).start();
// oracle 11.2 is ok
db = mockDb(new Oracle(), 11, 2, "11.2.0.0.1");
new DatabaseChecker(db).start();
// oracle 12 is ok
db = mockDb(new Oracle(), 12, 0, "11.2.0.0.1");
new DatabaseChecker(db).start();
// oracle 10 is not supported
db = mockDb(new Oracle(), 10, 2, "11.2.0.0.1");
try {
new DatabaseChecker(db).start();
fail();
} catch (MessageException e) {
assertThat(e).hasMessage("Unsupported oracle version: 10.2. Minimal supported version is 11.0.");
}
}
Aggregations