From 169c63d511d2f657520c0c301da6ba984fb3b253 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 7 Dec 2012 09:29:57 +0100 Subject: Fix some quality flaws --- .../java/org/sonar/core/plugins/DefaultPluginMetadata.java | 3 ++- .../main/java/org/sonar/core/plugins/PluginClassloaders.java | 3 ++- sonar-core/src/main/java/org/sonar/core/purge/PurgeDao.java | 3 ++- .../persistence/dialect/PostgreSQLSequenceGeneratorTest.java | 12 +++++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) (limited to 'sonar-core/src') diff --git a/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java b/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java index c0c00ae9be3..f08e78de9a4 100644 --- a/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java +++ b/sonar-core/src/main/java/org/sonar/core/plugins/DefaultPluginMetadata.java @@ -188,7 +188,8 @@ public class DefaultPluginMetadata implements PluginMetadata, Comparable result = Lists.newArrayList(); result.addAll(mapper.selectPurgeableSnapshotsWithEvents(resourceId)); result.addAll(mapper.selectPurgeableSnapshotsWithoutEvents(resourceId)); - Collections.sort(result);// sort by date + // sort by date + Collections.sort(result); return result; } finally { MyBatis.closeQuietly(session); diff --git a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSQLSequenceGeneratorTest.java b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSQLSequenceGeneratorTest.java index 70502a7f5a1..fd7d34270f9 100644 --- a/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSQLSequenceGeneratorTest.java +++ b/sonar-core/src/test/java/org/sonar/core/persistence/dialect/PostgreSQLSequenceGeneratorTest.java @@ -24,8 +24,7 @@ import org.junit.Test; import java.util.Properties; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import static org.fest.assertions.Assertions.assertThat; public class PostgreSQLSequenceGeneratorTest { @@ -37,7 +36,14 @@ public class PostgreSQLSequenceGeneratorTest { PostgreSQLSequenceGenerator generator = new PostgreSQLSequenceGenerator(); generator.configure(null, props, new PostgreSql.PostgreSQLWithDecimalDialect()); - assertThat(generator.getSequenceName(), is("my_table_id_seq")); + assertThat(generator.getSequenceName()).isEqualTo("my_table_id_seq"); } + @Test + public void should_not_fail_if_table_name_can_not_be_loaded() { + Properties props = new Properties(); + PostgreSQLSequenceGenerator generator = new PostgreSQLSequenceGenerator(); + generator.configure(null, props, new PostgreSql.PostgreSQLWithDecimalDialect()); + assertThat(generator.getSequenceName()).isNotEmpty(); + } } -- cgit v1.2.3