summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--archetypes/sonar-basic-plugin/pom.xml2
-rw-r--r--archetypes/sonar-gwt-plugin/pom.xml2
-rw-r--r--plugins/sonar-checkstyle-plugin/pom.xml2
-rw-r--r--plugins/sonar-cobertura-plugin/pom.xml2
-rw-r--r--plugins/sonar-core-gwt/pom.xml2
-rw-r--r--plugins/sonar-core-plugin/pom.xml2
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java3
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/MavenInitializer.java4
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java220
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/AsynchronousMeasuresSensor.java58
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualMeasureDecorator.java71
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb68
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/EnglishLanguagePack.java (renamed from plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CustomMeasuresWidget.java)25
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java87
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ManualMeasureDecoratorTest.java52
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/FrenchPlugin.jarbin1058 -> 0 bytes
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/org/sonar/i18n/test_fr.properties4
-rwxr-xr-xplugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin.jarbin0 -> 1113 bytes
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/META-INF/MANIFEST.MF (renamed from plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/META-INF/MANIFEST.MF)0
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/org/sonar/i18n/test.properties (renamed from plugins/sonar-core-plugin/src/test/resources/StandardPlugin/org/sonar/i18n/test.properties)1
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/org/sonar/i18n/test/fakerule.html2
-rwxr-xr-xplugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin.jarbin0 -> 1130 bytes
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/META-INF/MANIFEST.MF (renamed from plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/META-INF/MANIFEST.MF)0
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr.properties4
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr/fakerule.html2
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin.jar (renamed from plugins/sonar-core-plugin/src/test/resources/QuebecPlugin.jar)bin1051 -> 1051 bytes
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/META-INF/MANIFEST.MF (renamed from plugins/sonar-core-plugin/src/test/resources/StandardPlugin/META-INF/MANIFEST.MF)0
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties (renamed from plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties)0
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/StandardPlugin.jarbin1068 -> 0 bytes
-rw-r--r--plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/ManualMeasureDecoratorTest/testCopyManualMeasures.xml11
-rw-r--r--plugins/sonar-cpd-plugin/pom.xml2
-rw-r--r--plugins/sonar-dbcleaner-plugin/pom.xml2
-rw-r--r--plugins/sonar-design-plugin/pom.xml2
-rwxr-xr-xplugins/sonar-design-plugin/src/main/resources/org/sonar/i18n/design.properties4
-rw-r--r--plugins/sonar-findbugs-plugin/pom.xml20
-rw-r--r--plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsConfiguration.java14
-rw-r--r--plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsConstants.java7
-rw-r--r--plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java35
-rw-r--r--plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsMavenInitializer.java54
-rw-r--r--plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsPlugin.java6
-rw-r--r--plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsConfigurationTest.java16
-rw-r--r--plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsMavenInitializerTest.java64
-rw-r--r--plugins/sonar-findbugs-plugin/src/test/resources/org/sonar/plugins/findbugs/FindbugsMavenInitializerTest/pom.xml22
-rw-r--r--plugins/sonar-googleanalytics-plugin/pom.xml2
-rwxr-xr-xplugins/sonar-i18n-en-plugin/pom.xml57
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/java/org/sonar/plugins/i18n/en/EnglishPack.java37
-rwxr-xr-x[-rw-r--r--]plugins/sonar-i18n-en-plugin/src/main/java/org/sonar/plugins/i18n/en/EnglishPackPlugin.java (renamed from plugins/sonar-design-plugin/src/test/java/org/sonar/plugins/design/batch/MavenDependenciesSensorTest.java)59
-rwxr-xr-xplugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties (renamed from plugins/sonar-core-plugin/src/main/resources/org/sonar/i18n/core.properties)373
-rwxr-xr-xplugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/design.properties4
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava.properties29
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/ArchitecturalConstraint.html11
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/AvoidBreakOutsideSwitch.html18
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/AvoidContinueStatement.html16
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/CallToDeprecatedMethod.html2
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/ClassCyclomaticComplexity.html14
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/EmptyFile.html7
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/MaximumInheritanceDepth.html9
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/MethodCyclomaticComplexity.html14
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/NoSonar.html5
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UndocumentedApi.html8
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UnusedPrivateMethod.html13
-rw-r--r--plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UnusedProtectedMethod.html11
-rw-r--r--plugins/sonar-pmd-plugin/pom.xml2
-rw-r--r--plugins/sonar-squid-java-plugin/pom.xml2
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java29
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java25
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java18
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/ArchitectureCheck.java20
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/CallToDeprecatedMethodCheck.java4
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedPrivateMethodCheck.java12
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedProtectedMethodCheck.java12
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java12
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java10
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/EmptyFileCheck.java3
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java12
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/NoSonarCheck.java5
-rw-r--r--plugins/sonar-surefire-plugin/pom.xml2
-rw-r--r--pom.xml177
-rw-r--r--samples/checkstyle-extensions-plugin/pom.xml1
-rw-r--r--samples/gwt-plugin/pom.xml2
-rw-r--r--samples/pmd-extensions-plugin/pom.xml1
-rw-r--r--samples/pom.xml2
-rw-r--r--samples/standard-plugin/pom.xml1
-rw-r--r--sonar-application/pom.xml8
-rw-r--r--sonar-batch-bootstrapper/pom.xml2
-rw-r--r--sonar-batch-maven-compat/pom.xml2
-rw-r--r--sonar-batch/pom.xml2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java2
-rw-r--r--sonar-channel/pom.xml2
-rw-r--r--sonar-check-api/pom.xml2
-rw-r--r--sonar-colorizer/pom.xml2
-rw-r--r--sonar-core-maven-plugin/pom.xml2
-rw-r--r--sonar-core/pom.xml2
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresDao.java196
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresService.java130
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/dao/DaoFacade.java9
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/entity/ManualMeasure.java94
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/entity/Review.java67
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java2
-rw-r--r--sonar-core/src/main/resources/META-INF/persistence.xml3
-rw-r--r--sonar-core/src/test/java/org/sonar/jpa/dao/AsyncMeasuresDaoTest.java165
-rw-r--r--sonar-core/src/test/java/org/sonar/jpa/dao/AsyncMeasuresServiceTest.java153
-rw-r--r--sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java2
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/sharedFixture.xml23
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasure-result.xml22
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasure.xml26
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasureSnapshots-result.xml11
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasureSnapshots.xml11
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetAsyncMeasureSnapshotsFromSnapshotId.xml26
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetLastAsyncMeasureSnapshot.xml12
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextAsyncMeasureSnapshot.xml11
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextAsyncMeasureSnapshotsUntilDate.xml50
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextSnapshotsUntilDate.xml35
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetPreviousAsyncMeasureSnapshots.xml18
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetPreviousSnapshot.xml24
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addFutureSnapshot-result.xml28
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addFutureSnapshot.xml24
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addInvisibleMeasure-result.xml28
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addInvisibleMeasure.xml24
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignAPastMeasureToNextSnapshotsWithDifferentMetric-result.xml37
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignAPastMeasureToNextSnapshotsWithDifferentMetric.xml33
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresToLastSnapshot-result.xml42
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresToLastSnapshot.xml36
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresWhenNoPreviousSnapshot-result.xml45
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresWhenNoPreviousSnapshot.xml43
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasureToFutureSnapshotsWithDifferentMetric-result.xml59
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasureToFutureSnapshotsWithDifferentMetric.xml49
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasuresWhenNoPreviousSnapshot-result.xml24
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasuresWhenNoPreviousSnapshot.xml24
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasureToFutureSnapshots-result.xml44
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasureToFutureSnapshots.xml36
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasuresToLastSnapshot-result.xml43
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasuresToLastSnapshot.xml42
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignPastMeasuresToPastSnapshot-result.xml47
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignPastMeasuresToPastSnapshot.xml42
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteLastMeasure-result.xml30
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteLastMeasure.xml32
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteMeasure-result.xml41
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteMeasure.xml39
-rw-r--r--sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/sharedFixture.xml13
-rw-r--r--sonar-deprecated/pom.xml2
-rw-r--r--sonar-duplications/pom.xml2
-rw-r--r--sonar-graph/pom.xml2
-rw-r--r--sonar-gwt-api/pom.xml2
-rw-r--r--sonar-java-api/pom.xml11
-rw-r--r--sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java22
-rw-r--r--sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java27
-rw-r--r--sonar-markdown/pom.xml2
-rw-r--r--sonar-maven-plugin/pom.xml2
-rw-r--r--sonar-maven3-plugin/pom.xml2
-rw-r--r--sonar-plugin-api/pom.xml2
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/database/model/AsyncMeasureSnapshot.java172
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java13
-rw-r--r--sonar-server/pom.xml8
-rw-r--r--sonar-server/src/main/java/org/sonar/server/platform/Platform.java2
-rw-r--r--sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java13
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/api_controller.rb103
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/events_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/api/manual_measures_controller.rb117
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/metrics_controller.rb11
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb71
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb11
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb11
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/filter_column.rb42
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/manual_measure.rb44
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb96
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/project.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb46
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb36
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb18
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/_criterion.html.erb18
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_list.html.erb34
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_treemap.html.erb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb14
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/_tabs.html.erb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/manage.html.erb32
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb84
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/search_path.html.erb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb87
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb16
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_source.html.erb40
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_violations.html.erb24
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb14
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb18
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb24
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.html.erb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/sessions/new.html.erb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/config/routes.rb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/048_create_async_measure_snapshots_table.rb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/210_drop_parameters_table.rb (renamed from sonar-server/src/main/webapp/WEB-INF/app/models/async_measure_snapshot.rb)34
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/211_create_manual_measures.rb40
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/212_move_async_measures.rb55
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/213_drop_async_measures_table.rb33
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb20
-rw-r--r--sonar-server/src/test/java/org/sonar/server/database/JndiDatabaseConnectorTest.java9
-rw-r--r--sonar-squid/pom.xml2
-rw-r--r--sonar-testing-harness/pom.xml2
-rw-r--r--sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl22
-rw-r--r--sonar-ws-client/pom.xml2
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/Connector.java2
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java49
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java16
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/AbstractQuery.java30
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/Query.java2
217 files changed, 2490 insertions, 3174 deletions
diff --git a/archetypes/sonar-basic-plugin/pom.xml b/archetypes/sonar-basic-plugin/pom.xml
index e2f6290e489..018641def44 100644
--- a/archetypes/sonar-basic-plugin/pom.xml
+++ b/archetypes/sonar-basic-plugin/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
diff --git a/archetypes/sonar-gwt-plugin/pom.xml b/archetypes/sonar-gwt-plugin/pom.xml
index 3b0ee706535..aab1fa370a2 100644
--- a/archetypes/sonar-gwt-plugin/pom.xml
+++ b/archetypes/sonar-gwt-plugin/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
diff --git a/plugins/sonar-checkstyle-plugin/pom.xml b/plugins/sonar-checkstyle-plugin/pom.xml
index cbe6c1d4d4c..d0ca868630e 100644
--- a/plugins/sonar-checkstyle-plugin/pom.xml
+++ b/plugins/sonar-checkstyle-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<groupId>org.codehaus.sonar.plugins</groupId>
diff --git a/plugins/sonar-cobertura-plugin/pom.xml b/plugins/sonar-cobertura-plugin/pom.xml
index 41bdcc1b8fa..1dbd6f6ccc3 100644
--- a/plugins/sonar-cobertura-plugin/pom.xml
+++ b/plugins/sonar-cobertura-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<groupId>org.codehaus.sonar.plugins</groupId>
diff --git a/plugins/sonar-core-gwt/pom.xml b/plugins/sonar-core-gwt/pom.xml
index 64afa66588f..4f6a84d051b 100644
--- a/plugins/sonar-core-gwt/pom.xml
+++ b/plugins/sonar-core-gwt/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>sonar-core-gwt</artifactId>
diff --git a/plugins/sonar-core-plugin/pom.xml b/plugins/sonar-core-plugin/pom.xml
index 90d99466f0c..00b03525dc8 100644
--- a/plugins/sonar-core-plugin/pom.xml
+++ b/plugins/sonar-core-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<groupId>org.codehaus.sonar.plugins</groupId>
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
index 76c1bdf43dc..807e8834852 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
@@ -183,7 +183,6 @@ public class CorePlugin extends SonarPlugin {
extensions.add(RulesWidget.class);
extensions.add(SizeWidget.class);
extensions.add(EventsWidget.class);
- extensions.add(CustomMeasuresWidget.class);
// chart
extensions.add(XradarChart.class);
@@ -197,7 +196,6 @@ public class CorePlugin extends SonarPlugin {
extensions.add(ProfileSensor.class);
extensions.add(ProfileEventsSensor.class);
extensions.add(ProjectLinksSensor.class);
- extensions.add(AsynchronousMeasuresSensor.class);
extensions.add(UnitTestDecorator.class);
extensions.add(VersionEventsSensor.class);
extensions.add(CheckAlertThresholds.class);
@@ -216,6 +214,7 @@ public class CorePlugin extends SonarPlugin {
extensions.add(FilesDecorator.class);
extensions.add(CloseReviewsDecorator.class);
extensions.add(ReferenceAnalysis.class);
+ extensions.add(ManualMeasureDecorator.class);
// time machine
extensions.add(TendencyDecorator.class);
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/MavenInitializer.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/MavenInitializer.java
index a76799deba1..f64458e17e8 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/MavenInitializer.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/batch/MavenInitializer.java
@@ -44,12 +44,12 @@ public class MavenInitializer extends Initializer {
if (StringUtils.isBlank(conf.getString(JavaUtils.JAVA_SOURCE_PROPERTY))) {
String version = MavenUtils.getJavaSourceVersion(pom);
conf.setProperty(JavaUtils.JAVA_SOURCE_PROPERTY, version);
- Logs.INFO.info("Java source version: {}", version);
+ Logs.INFO.info("Java source version: {}", JavaUtils.getSourceVersion(project));
}
if (StringUtils.isBlank(conf.getString(JavaUtils.JAVA_TARGET_PROPERTY))) {
String version = MavenUtils.getJavaVersion(pom);
conf.setProperty(JavaUtils.JAVA_TARGET_PROPERTY, version);
- Logs.INFO.info("Java target version: {}", version);
+ Logs.INFO.info("Java target version: {}", JavaUtils.getTargetVersion(project));
}
/*
* See http://jira.codehaus.org/browse/SONAR-2151
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java
index 8438b706622..66cd05dc970 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java
@@ -19,10 +19,25 @@
*/
package org.sonar.plugins.core.i18n;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.Set;
+
import org.apache.commons.collections.EnumerationUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.BatchExtension;
@@ -33,12 +48,9 @@ import org.sonar.api.platform.PluginRepository;
import org.sonar.api.utils.Logs;
import org.sonar.api.utils.SonarException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.text.MessageFormat;
-import java.util.*;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
public final class I18nManager implements I18n, ServerExtension, BatchExtension {
@@ -50,6 +62,7 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension
private Map<String, String> keys = Maps.newHashMap();
private Properties unknownKeys = new Properties();
private BundleClassLoader bundleClassLoader = new BundleClassLoader();
+ private List<Locale> registeredLocales = Lists.newArrayList();
public I18nManager(PluginRepository pluginRepository, LanguagePack[] languagePacks) {
this.pluginRepository = pluginRepository;
@@ -60,40 +73,64 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension
this(pluginRepository, new LanguagePack[0]);
}
-
public void start() {
doStart(InstalledPlugin.create(pluginRepository));
}
- void doStart(List<InstalledPlugin> installedPlugins) {
+ protected void doStart(List<InstalledPlugin> installedPlugins) {
Logs.INFO.info("Loading i18n bundles");
Set<URI> alreadyLoadedResources = Sets.newHashSet();
+ LanguagePack englishPack = findEnglishPack();
+
for (InstalledPlugin plugin : installedPlugins) {
+ // look first in the classloader of the English I18n Plugin of the Sonar platform
+ searchAndStoreBundleNames(plugin.key, englishPack.getClass().getClassLoader(), alreadyLoadedResources);
+ // then look in the classloader of the plugin
searchAndStoreBundleNames(plugin.key, plugin.classloader, alreadyLoadedResources);
}
+
+ for (LanguagePack pack : languagePacks) {
+ if ( !pack.equals(englishPack)) {
+ addLanguagePack(pack);
+ }
+ }
+ }
+
+ protected LanguagePack findEnglishPack() {
+ LanguagePack englishPack = null;
for (LanguagePack pack : languagePacks) {
- addLanguagePack(pack);
+ if (pack.getLocales().contains(Locale.ENGLISH)) {
+ englishPack = pack;
+ break;
+ }
}
+ if (englishPack == null) {
+ throw new SonarException("The I18n English Pack was not found.");
+ }
+ return englishPack;
}
- private void addLanguagePack(LanguagePack languagePack) {
+ protected void addLanguagePack(LanguagePack languagePack) {
LOG.debug("Search for bundles in language pack : {}", languagePack);
for (String pluginKey : languagePack.getPluginKeys()) {
String bundleBaseName = buildBundleBaseName(pluginKey);
for (Locale locale : languagePack.getLocales()) {
- String bundlePropertiesFile = new StringBuilder(bundleBaseName).append('_').append(locale.toString()).append(".properties").toString();
+ String bundlePropertiesFile = new StringBuilder(bundleBaseName).append('_').append(locale.toString()).append(".properties")
+ .toString();
ClassLoader classloader = languagePack.getClass().getClassLoader();
- LOG.info("Adding locale {} for bundleName : {} from classloader : {}", new Object[]{locale, bundleBaseName, classloader});
+ LOG.info("Adding locale {} for bundleName : {} from classloader : {}", new Object[] { locale, bundleBaseName, classloader });
bundleClassLoader.addResource(bundlePropertiesFile, classloader);
+ registeredLocales.add(locale);
}
}
}
- private String buildBundleBaseName(String pluginKey) {
+ protected String buildBundleBaseName(String pluginKey) {
return packagePathToSearchIn + "/" + pluginKey;
}
- private void searchAndStoreBundleNames(String pluginKey, ClassLoader classloader, Set<URI> alreadyLoadedResources) {
+ @SuppressWarnings("unchecked")
+ protected void searchAndStoreBundleNames(String pluginKey, ClassLoader classloader, Set<URI> alreadyLoadedResources) {
String bundleBaseName = buildBundleBaseName(pluginKey);
String bundleDefaultPropertiesFile = bundleBaseName + ".properties";
try {
@@ -106,7 +143,7 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension
}
URL propertiesUrl = resources.get(0);
- if (!alreadyLoadedResources.contains(propertiesUrl.toURI())) {
+ if ( !alreadyLoadedResources.contains(propertiesUrl.toURI())) {
LOG.debug("Found the ResourceBundle base file : {} from classloader : {}", propertiesUrl, classloader);
LOG.debug("Add bundleName : {} from classloader : {}", bundleBaseName, classloader);
bundleClassLoader.addResource(bundleDefaultPropertiesFile, classloader);
@@ -121,8 +158,8 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension
while (keysToAdd.hasMoreElements()) {
String key = keysToAdd.nextElement();
if (keys.containsKey(key)) {
- LOG.warn("DUPLICATE KEY : Key '{}' defined in bundle '{}' is already defined in bundle '{}'. It is ignored.", new Object[]{
- key, bundleBaseName, keys.get(key)});
+ LOG.warn("DUPLICATE KEY : Key '{}' defined in bundle '{}' is already defined in bundle '{}'. It is ignored.", new Object[] {
+ key, bundleBaseName, keys.get(key) });
} else {
keys.put(key, bundleBaseName);
}
@@ -139,40 +176,127 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension
}
public String message(final Locale locale, final String key, final String defaultText, final Object... objects) {
- String result = defaultText;
+ String translatedMessage = defaultText;
try {
- String bundleBaseName = keys.get(key);
- if (bundleBaseName == null) {
- LOG.warn("UNKNOWN KEY : Key '{}' not found in any bundle. Default value '{}' is returned.", key, defaultText);
- unknownKeys.put(key, defaultText);
+ if (isKeyForRuleDescription(key)) {
+ // Rule descriptions are in HTML files, not in regular bundles
+ translatedMessage = findRuleDescription(locale, key, defaultText);
} else {
- try {
- ResourceBundle bundle = ResourceBundle.getBundle(bundleBaseName, locale, bundleClassLoader);
-
- String value = bundle.getString(key);
- if ("".equals(value)) {
- LOG.warn("VOID KEY : Key '{}' (from bundle '{}') returns a void value. Default value '{}' is returned.", new Object[]{key,
- bundleBaseName, defaultText});
- } else {
- result = value;
+ translatedMessage = findStandardMessage(locale, key, defaultText, objects);
+ }
+ } catch (MissingResourceException e) {
+ LOG.warn(e.getMessage());
+ if (translatedMessage == null) {
+ // when no translation has been found, the key is returned
+ return key;
+ }
+ } catch (Exception e) {
+ LOG.error("Exception when retrieving I18n string: ", e);
+ if (translatedMessage == null) {
+ // when no translation has been found, the key is returned
+ return key;
+ }
+ }
+ return translatedMessage;
+ }
+
+ protected boolean isKeyForRuleDescription(String key) {
+ return StringUtils.startsWith(key, "rule.") && StringUtils.endsWith(key, ".description");
+ }
+
+ protected String findRuleDescription(final Locale locale, final String ruleDescriptionKey, final String defaultText) throws IOException {
+ String translation = defaultText;
+ String ruleNameKey = ruleDescriptionKey.replace(".description", ".name");
+
+ String bundleBaseName = keys.get(ruleNameKey);
+ if (bundleBaseName == null) {
+ handleMissingBundle(ruleNameKey, defaultText, bundleBaseName);
+ } else {
+ Locale localeToUse = defineLocaleToUse(locale);
+ String htmlFilePath = computeHtmlFilePath(bundleBaseName, ruleDescriptionKey, localeToUse);
+ ClassLoader classLoader = bundleClassLoader.getClassLoaderForBundle(bundleBaseName, localeToUse);
+ InputStream stream = classLoader.getResourceAsStream(htmlFilePath);
+ if (stream == null) {
+ throw new MissingResourceException("MISSING RULE DESCRIPTION : file '" + htmlFilePath
+ + "' not found in any bundle. Default value is returned.", bundleBaseName, ruleDescriptionKey);
+ }
+ translation = IOUtils.toString(stream, "UTF-8");
+ }
+
+ return translation;
+ }
+
+ protected Locale defineLocaleToUse(final Locale locale) {
+ Locale localeToUse = locale;
+ if ( !registeredLocales.contains(locale)) {
+ localeToUse = Locale.ENGLISH;
+ }
+ return localeToUse;
+ }
+
+ protected String extractRuleName(String ruleDescriptionKey) {
+ int firstDotIndex = ruleDescriptionKey.indexOf(".");
+ int secondDotIndex = ruleDescriptionKey.indexOf(".", firstDotIndex + 1);
+ int thirdDotIndex = ruleDescriptionKey.indexOf(".", secondDotIndex + 1);
+ return ruleDescriptionKey.substring(secondDotIndex + 1, thirdDotIndex);
+ }
+
+ protected String computeHtmlFilePath(String bundleBaseName, String ruleDescriptionKey, Locale locale) {
+ String ruleName = extractRuleName(ruleDescriptionKey);
+ if (Locale.ENGLISH.equals(locale)) {
+ return bundleBaseName + "/" + ruleName + ".html";
+ } else {
+ return bundleBaseName + "_" + locale.toString() + "/" + ruleName + ".html";
+ }
+ }
+
+ protected String findStandardMessage(final Locale locale, final String key, final String defaultText, final Object... objects) {
+ String translation = defaultText;
+
+ String bundleBaseName = keys.get(key);
+ if (bundleBaseName == null) {
+ handleMissingBundle(key, defaultText, bundleBaseName);
+ } else {
+ try {
+ ResourceBundle bundle = ResourceBundle.getBundle(bundleBaseName, locale, bundleClassLoader);
+
+ String value = bundle.getString(key);
+ if ("".equals(value)) {
+ if (translation == null) {
+ throw new MissingResourceException("VOID KEY : Key '" + key + "' (from bundle '" + bundleBaseName + "') returns a void value.",
+ bundleBaseName, key);
}
- } catch (MissingResourceException e) {
- LOG.warn("BUNDLE NOT LOADED : Failed loading bundle {} from classloader {}. Default value '{}' is returned.", new Object[]{
- bundleBaseName, bundleClassLoader, defaultText});
+ LOG.warn("VOID KEY : Key '{}' (from bundle '{}') returns a void value. Default value '{}' is returned.", new Object[] { key,
+ bundleBaseName, defaultText });
+ } else {
+ translation = value;
+ }
+ } catch (MissingResourceException e) {
+ if (translation == null) {
+ throw e;
}
+ LOG.warn("BUNDLE NOT LOADED : Failed loading bundle {} from classloader {}. Default value '{}' is returned.", new Object[] {
+ bundleBaseName, bundleClassLoader, defaultText });
}
- } catch (Exception e) {
- LOG.error("Exception when retrieving I18n string.", e);
}
if (objects.length > 0) {
- LOG.debug("Translation : {}, {}, {}, {}", new String[]{locale.toString(), key, defaultText, Arrays.deepToString(objects)});
- return MessageFormat.format(result, objects);
+ LOG.debug("Translation : {}, {}, {}, {}", new String[] { locale.toString(), key, defaultText, Arrays.deepToString(objects) });
+ return MessageFormat.format(translation, objects);
} else {
- return result;
+ return translation;
}
}
+ protected void handleMissingBundle(final String key, final String defaultText, String bundleBaseName) {
+ if (defaultText == null) {
+ throw new MissingResourceException("UNKNOWN KEY : Key '" + key
+ + "' not found in any bundle, and no default value provided. The key is returned.", bundleBaseName, key);
+ }
+ LOG.warn("UNKNOWN KEY : Key '{}' not found in any bundle. Default value '{}' is returned.", key, defaultText);
+ unknownKeys.put(key, defaultText);
+ }
+
/**
* @return the unknownKeys
*/
@@ -180,18 +304,28 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension
return unknownKeys;
}
-
private static class BundleClassLoader extends URLClassLoader {
+
private Map<String, ClassLoader> resources = Maps.newHashMap();
public BundleClassLoader() {
- super(new URL[]{}, null);
+ super(new URL[] {}, null);
}
public void addResource(String resourceName, ClassLoader classloader) {
resources.put(resourceName, classloader);
}
+ public ClassLoader getClassLoaderForBundle(String bundleBaseName, Locale locale) {
+ StringBuilder resourceName = new StringBuilder(bundleBaseName);
+ if (locale != null && !locale.equals(Locale.ENGLISH)) {
+ resourceName.append("_");
+ resourceName.append(locale);
+ }
+ resourceName.append(".properties");
+ return resources.get(resourceName.toString());
+ }
+
@Override
public URL findResource(String name) {
if (resources.containsKey(name)) {
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/AsynchronousMeasuresSensor.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/AsynchronousMeasuresSensor.java
deleted file mode 100644
index 3a23449aec9..00000000000
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/AsynchronousMeasuresSensor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.core.sensors;
-
-import org.sonar.api.batch.Phase;
-import org.sonar.api.batch.Sensor;
-import org.sonar.api.batch.SensorContext;
-import org.sonar.core.NotDryRun;
-import org.sonar.jpa.dao.AsyncMeasuresService;
-import org.sonar.api.database.model.Snapshot;
-import org.sonar.api.resources.Project;
-import org.sonar.api.resources.ResourceUtils;
-
-@NotDryRun
-@Phase(name = Phase.Name.PRE)
-public class AsynchronousMeasuresSensor implements Sensor {
-
- private AsyncMeasuresService reviewsService;
- private Snapshot snapshot;
-
- public AsynchronousMeasuresSensor(AsyncMeasuresService reviewsService, Snapshot snapshot) {
- this.reviewsService = reviewsService;
- this.snapshot = snapshot;
- }
-
- public boolean shouldExecuteOnProject(Project project) {
- return true;
- }
-
- public void analyse(Project project, SensorContext context) {
- if (!ResourceUtils.isRootProject(project)) {
- return;
- }
- reviewsService.refresh(snapshot);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName();
- }
-}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualMeasureDecorator.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualMeasureDecorator.java
new file mode 100644
index 00000000000..91935f4c6f7
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ManualMeasureDecorator.java
@@ -0,0 +1,71 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.plugins.core.sensors;
+
+import org.sonar.api.batch.Decorator;
+import org.sonar.api.batch.DecoratorContext;
+import org.sonar.api.batch.Phase;
+import org.sonar.api.database.DatabaseSession;
+import org.sonar.api.measures.Measure;
+import org.sonar.api.measures.MetricFinder;
+import org.sonar.api.resources.Project;
+import org.sonar.api.resources.Resource;
+import org.sonar.jpa.entity.ManualMeasure;
+
+import java.util.List;
+
+@Phase(name = Phase.Name.PRE)
+public class ManualMeasureDecorator implements Decorator {
+
+ private DatabaseSession session;
+ private MetricFinder metricFinder;
+
+ public ManualMeasureDecorator(DatabaseSession session, MetricFinder metricFinder) {
+ this.session = session;
+ this.metricFinder = metricFinder;
+ }
+
+ public boolean shouldExecuteOnProject(Project project) {
+ return true;
+ }
+
+ public void decorate(Resource resource, DecoratorContext context) {
+ if (resource.getId() != null) {
+ List<ManualMeasure> manualMeasures = session.getResults(ManualMeasure.class, "resourceId", resource.getId());
+ for (ManualMeasure manualMeasure : manualMeasures) {
+ context.saveMeasure(copy(manualMeasure));
+ }
+ }
+ }
+
+ private Measure copy(ManualMeasure manualMeasure) {
+ Measure measure = new Measure(metricFinder.findById(manualMeasure.getMetricId()));
+ measure.setValue(manualMeasure.getValue(), 5);
+ measure.setData(manualMeasure.getTextValue());
+ measure.setDescription(manualMeasure.getDescription());
+ measure.setUrl(manualMeasure.getUrl());
+ return measure;
+ }
+
+ @Override
+ public String toString() {
+ return getClass().getSimpleName();
+ }
+}
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb
deleted file mode 100644
index d53de7b202d..00000000000
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/custom_measures.html.erb
+++ /dev/null
@@ -1,68 +0,0 @@
- <%
- measures = @snapshot.async_measures.select{ |m|
- m.metric and m.metric.enabled==true and m.metric.user_managed?
- }.sort{ |m1,m2|
- m1.metric.name <=> m2.metric.name
- }
- %>
- <% if is_admin?(@snapshot) || measures.size>0 %>
- <script type="text/javascript">
- function selectReviewMetric(){
- $$('.review_description_update').each(function(element) {
- element.hide();
- });
- review = $('review_metric_id').value;
- $('review_description_'+review).show();
- $('review_value_'+review).show();
- }
-
- function selectEventCateg(){
- $$('#event_cat_desc .comments').each(function(elt) {
- elt.hide();
- });
- selected_categ = $('event_category').value;
- if (selected_categ!=null && selected_categ!='') {
- $('event_cat_desc_'+selected_categ).show();
- }
- }
- </script>
- <%
- measures.each do |m|
- html_name_id = "review_name_#{m.metric.short_name}"
- html_value_id = "review_value_#{m.metric.short_name}"
- html_date_id = "review_date_#{m.metric.short_name}"
- %>
- <div class="dashbox">
- <h3 id='<%= html_name_id %>'><%= m.metric.short_name %></h3>
- <p><span id='<%= html_value_id %>' class="big">
- <%= format_measure(m, :suffix => '', :url => m.url) -%>
- </span></p>
- <% if m.measure_date %>
- <p><span id='<%= html_date_id %>'><%= l(m.measure_date.to_date) %></span>
- <% if m.review? && is_admin?(@snapshot) %>
- <%= link_to 'delete',
- {:controller => 'project', :action => 'delete_review', :id => m.id, :sid => @snapshot.id}, :method => 'delete', :confirm => 'Delete this measure ?',
- :class => 'action', :id => "delete_review_#{m.metric_key}" %>
- <% end %>
- </p>
- <% end %>
- <% unless m.description.blank? %>
- <p><%= m.description %></p>
- <% end %>
- </div>
- <% end %>
- <% if is_admin?(@snapshot) %>
- <div id="add_review_form">
- <p>
- <% if @review %>
- <%= render :partial => 'dashboard_edit_review' %>
- <% else %>
- <%= link_to_remote 'Add a measure',
- {:url => {:controller => 'project', :action => 'edit_review', :sid => @snapshot.id}, :update => 'add_review_form'},
- {:class => 'action', :id => 'add_review'} %>
- <% end %>
- </p>
- </div>
- <% end %>
- <div class="clear"></div>
- <% end %>
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CustomMeasuresWidget.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/EnglishLanguagePack.java
index 5bb3525a3fd..0660fd60527 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/CustomMeasuresWidget.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/EnglishLanguagePack.java
@@ -17,24 +17,23 @@
* License along with Sonar; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.plugins.core.widgets;
+package org.sonar.plugins.core.i18n;
-import org.sonar.api.web.AbstractRubyTemplate;
-import org.sonar.api.web.Description;
-import org.sonar.api.web.RubyRailsWidget;
+import org.sonar.api.i18n.LanguagePack;
-@Description("Displays manual measures entered on the project.")
-public class CustomMeasuresWidget extends AbstractRubyTemplate implements RubyRailsWidget {
- public String getId() {
- return "custom_measures";
- }
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+
+public class EnglishLanguagePack extends LanguagePack {
- public String getTitle() {
- return "Custom measures";
+ @Override
+ public List<String> getPluginKeys() {
+ return Arrays.asList("test");
}
@Override
- protected String getTemplatePath() {
- return "/org/sonar/plugins/core/widgets/custom_measures.html.erb";
+ public List<Locale> getLocales() {
+ return Arrays.asList(Locale.ENGLISH);
}
} \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java
index 380f65efe3d..bf66390c9e6 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java
@@ -19,12 +19,12 @@
*/
package org.sonar.plugins.core.i18n;
-import com.google.common.collect.Lists;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.api.i18n.LanguagePack;
-import org.sonar.api.platform.PluginRepository;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
import java.net.URL;
import java.net.URLClassLoader;
@@ -32,12 +32,17 @@ import java.util.Arrays;
import java.util.List;
import java.util.Locale;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.api.i18n.LanguagePack;
+import org.sonar.api.platform.PluginRepository;
+
+import com.google.common.collect.Lists;
public class I18nManagerTest {
- public static String TEST_PLUGIN_CLASS_NAME = "org.sonar.plugins.core.i18n.StandardPlugin";
+ public static String ENGLISH_PACK_CLASS_NAME = "org.sonar.plugins.core.i18n.EnglishLanguagePack";
public static String FRENCH_PACK_CLASS_NAME = "org.sonar.plugins.core.i18n.FrenchLanguagePack";
public static String QUEBEC_PACK_CLASS_NAME = "org.sonar.plugins.core.i18n.QuebecLanguagePack";
@@ -46,19 +51,19 @@ public class I18nManagerTest {
@Before
public void createManager() throws Exception {
- List<InstalledPlugin> plugins = Lists.newArrayList(
- new InstalledPlugin("test", new TestClassLoader(getClass().getClassLoader().getResource("StandardPlugin.jar"))),
- new InstalledPlugin("fake1", getClass().getClassLoader()),
- new InstalledPlugin("fake2", getClass().getClassLoader())
- );
+ List<InstalledPlugin> plugins = Lists.newArrayList(new InstalledPlugin("test", getClass().getClassLoader()), new InstalledPlugin(
+ "fake1", getClass().getClassLoader()), new InstalledPlugin("fake2", getClass().getClassLoader()));
- TestClassLoader frenchPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("FrenchPlugin.jar"));
+ TestClassLoader englishPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("I18n/EnglishPlugin.jar"));
+ LanguagePack englishPack = (LanguagePack) englishPackClassLoader.loadClass(ENGLISH_PACK_CLASS_NAME).newInstance();
+
+ TestClassLoader frenchPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("I18n/FrenchPlugin.jar"));
LanguagePack frenchPack = (LanguagePack) frenchPackClassLoader.loadClass(FRENCH_PACK_CLASS_NAME).newInstance();
- TestClassLoader quebecPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("QuebecPlugin.jar"));
+ TestClassLoader quebecPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("I18n/QuebecPlugin.jar"));
LanguagePack quebecPack = (LanguagePack) quebecPackClassLoader.loadClass(QUEBEC_PACK_CLASS_NAME).newInstance();
- manager = new I18nManager(mock(PluginRepository.class), new LanguagePack[]{frenchPack, quebecPack});
+ manager = new I18nManager(mock(PluginRepository.class), new LanguagePack[] { frenchPack, quebecPack, englishPack });
manager.doStart(plugins);
}
@@ -98,15 +103,59 @@ public class I18nManagerTest {
Assert.assertEquals("Default value for Unknown", manager.getUnknownKeys().getProperty("unknown"));
}
+ @Test
+ public void shouldReturnKeyIfTranslationMissingAndNotDefaultProvided() throws Exception {
+ String result = manager.message(Locale.ENGLISH, "unknown.key", null);
+ assertEquals("unknown.key", result);
+ Assert.assertEquals(0, manager.getUnknownKeys().size());
+ }
+
+ @Test
+ public void testIsKeyForRuleDescription() throws Exception {
+ assertTrue(manager.isKeyForRuleDescription("rule.squid.ArchitecturalConstraint.description"));
+ assertFalse(manager.isKeyForRuleDescription("rule.squid.ArchitecturalConstraint.name"));
+ assertFalse(manager.isKeyForRuleDescription("another.key"));
+ }
+
+ @Test
+ public void testDefineLocaleToUse() throws Exception {
+ assertThat(manager.defineLocaleToUse(Locale.CANADA_FRENCH), is(Locale.CANADA_FRENCH));
+ // Locale not supported => get the English one
+ assertThat(manager.defineLocaleToUse(Locale.JAPAN), is(Locale.ENGLISH));
+ }
+
+ @Test
+ public void testExtractRuleName() throws Exception {
+ assertThat(manager.extractRuleName("rule.squid.ArchitecturalConstraint.description"), is("ArchitecturalConstraint"));
+ }
+
+ @Test
+ public void testComputeHtmlFilePath() throws Exception {
+ assertThat(manager.computeHtmlFilePath("org/sonar/i18n/test", "rule.test.fakerule.description", Locale.FRENCH),
+ is("org/sonar/i18n/test_fr/fakerule.html"));
+ assertThat(manager.computeHtmlFilePath("org/sonar/i18n/test", "rule.test.fakerule.description", Locale.ENGLISH),
+ is("org/sonar/i18n/test/fakerule.html"));
+ }
+
+ @Test
+ public void shouldReturnRuleDescriptionFromHTMLFile() throws Exception {
+ String result = manager.message(Locale.FRENCH, "rule.test.fakerule.description", "foo");
+ assertThat(result, is("<h1>Règle bidon</h1>\nC'est la description de la règle bidon."));
+ // Locale not supported => get the English translation
+ result = manager.message(Locale.JAPAN, "rule.test.fakerule.description", "foo");
+ assertThat(result, is("<h1>Fake Rule</h1>\nThis is the description of the fake rule."));
+ }
+
public static class TestClassLoader extends URLClassLoader {
+
public TestClassLoader(URL url) {
- super(new URL[]{url, classSource}, Thread.currentThread().getContextClassLoader());
+ super(new URL[] { url, classSource }, Thread.currentThread().getContextClassLoader());
}
protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
Class c = findLoadedClass(name);
if (c == null) {
- if (name.equals(TEST_PLUGIN_CLASS_NAME) || name.equals(QUEBEC_PACK_CLASS_NAME) || name.equals(FRENCH_PACK_CLASS_NAME)) {
+ if (name.equals(ENGLISH_PACK_CLASS_NAME) || name.equals(QUEBEC_PACK_CLASS_NAME) || name.equals(FRENCH_PACK_CLASS_NAME)) {
c = findClass(name);
} else {
return super.loadClass(name, resolve);
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ManualMeasureDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ManualMeasureDecoratorTest.java
new file mode 100644
index 00000000000..4ca1719de50
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ManualMeasureDecoratorTest.java
@@ -0,0 +1,52 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.plugins.core.sensors;
+
+import org.junit.Test;
+import org.sonar.api.batch.DecoratorContext;
+import org.sonar.api.measures.Metric;
+import org.sonar.api.resources.JavaFile;
+import org.sonar.api.test.IsMeasure;
+import org.sonar.core.components.DefaultMetricFinder;
+import org.sonar.jpa.test.AbstractDbUnitTestCase;
+
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+public class ManualMeasureDecoratorTest extends AbstractDbUnitTestCase {
+
+ private Metric reviewNote = new Metric.Builder("review_note", "Note", Metric.ValueType.FLOAT).create().setId(2);
+
+ @Test
+ public void testCopyManualMeasures() throws Exception {
+ setupData("testCopyManualMeasures");
+
+ JavaFile javaFile = new JavaFile("Foo.java");
+ javaFile.setId(40);
+
+ ManualMeasureDecorator decorator = new ManualMeasureDecorator(getSession(), new DefaultMetricFinder(getSessionFactory()));
+ DecoratorContext context = mock(DecoratorContext.class);
+ decorator.decorate(javaFile, context);
+
+ verify(context).saveMeasure(argThat(new IsMeasure(reviewNote, 6.0, "six")));
+ }
+
+}
diff --git a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin.jar b/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin.jar
deleted file mode 100644
index ab61bd88697..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin.jar
+++ /dev/null
Binary files differ
diff --git a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/org/sonar/i18n/test_fr.properties b/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/org/sonar/i18n/test_fr.properties
deleted file mode 100644
index cc8efa7afc3..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/org/sonar/i18n/test_fr.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-it=Il
-is=fait
-cold=froid
-
diff --git a/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin.jar b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin.jar
new file mode 100755
index 00000000000..14d66ce530d
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin.jar
Binary files differ
diff --git a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/META-INF/MANIFEST.MF b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/META-INF/MANIFEST.MF
index a45029d3531..a45029d3531 100644
--- a/plugins/sonar-core-plugin/src/test/resources/FrenchPlugin/META-INF/MANIFEST.MF
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/META-INF/MANIFEST.MF
diff --git a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin/org/sonar/i18n/test.properties b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/org/sonar/i18n/test.properties
index 88aabfe61a2..7aba645661f 100644
--- a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin/org/sonar/i18n/test.properties
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/org/sonar/i18n/test.properties
@@ -2,3 +2,4 @@ it=It
is=is
cold=cold
only.english=Ketchup
+rule.test.fakerule.name=Fake Rule \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/org/sonar/i18n/test/fakerule.html b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/org/sonar/i18n/test/fakerule.html
new file mode 100644
index 00000000000..7e7d84dea8b
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/EnglishPlugin/org/sonar/i18n/test/fakerule.html
@@ -0,0 +1,2 @@
+<h1>Fake Rule</h1>
+This is the description of the fake rule. \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin.jar b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin.jar
new file mode 100755
index 00000000000..383c767d26d
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin.jar
Binary files differ
diff --git a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/META-INF/MANIFEST.MF b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/META-INF/MANIFEST.MF
index a45029d3531..a45029d3531 100644
--- a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/META-INF/MANIFEST.MF
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/META-INF/MANIFEST.MF
diff --git a/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr.properties b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr.properties
new file mode 100644
index 00000000000..a1d8766e962
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr.properties
@@ -0,0 +1,4 @@
+it=Il
+is=fait
+cold=froid
+rule.test.fakerule.name=R\u00e8gle bidon
diff --git a/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr/fakerule.html b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr/fakerule.html
new file mode 100644
index 00000000000..94c0d0869f8
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/FrenchPlugin/org/sonar/i18n/test_fr/fakerule.html
@@ -0,0 +1,2 @@
+<h1>Règle bidon</h1>
+C'est la description de la règle bidon. \ No newline at end of file
diff --git a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin.jar b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin.jar
index 101df34ba6d..101df34ba6d 100644
--- a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin.jar
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin.jar
Binary files differ
diff --git a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin/META-INF/MANIFEST.MF b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/META-INF/MANIFEST.MF
index a45029d3531..a45029d3531 100644
--- a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin/META-INF/MANIFEST.MF
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/META-INF/MANIFEST.MF
diff --git a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties
index 38b5b84ccdf..38b5b84ccdf 100644
--- a/plugins/sonar-core-plugin/src/test/resources/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties
+++ b/plugins/sonar-core-plugin/src/test/resources/I18n/QuebecPlugin/org/sonar/i18n/test_fr_CA.properties
diff --git a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin.jar b/plugins/sonar-core-plugin/src/test/resources/StandardPlugin.jar
deleted file mode 100644
index 73deac7e8b6..00000000000
--- a/plugins/sonar-core-plugin/src/test/resources/StandardPlugin.jar
+++ /dev/null
Binary files differ
diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/ManualMeasureDecoratorTest/testCopyManualMeasures.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/ManualMeasureDecoratorTest/testCopyManualMeasures.xml
new file mode 100644
index 00000000000..78f114c5c0a
--- /dev/null
+++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/sensors/ManualMeasureDecoratorTest/testCopyManualMeasures.xml
@@ -0,0 +1,11 @@
+<dataset>
+ <metrics id="1" NAME="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name=""
+ enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+ <metrics id="2" NAME="review_note" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name=""
+ enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
+
+
+ <manual_measures id="1" metric_id="2" resource_id="30" value="3.14" text_value="pi" created_at="[null]" updated_at="[null]" description="this is pi" url="http://pi"/>
+ <manual_measures id="2" metric_id="2" resource_id="40" value="6" text_value="six" created_at="[null]" updated_at="[null]" description="this is six" url="http://six"/>
+
+</dataset> \ No newline at end of file
diff --git a/plugins/sonar-cpd-plugin/pom.xml b/plugins/sonar-cpd-plugin/pom.xml
index 52ef485c16b..a8c4bb671d8 100644
--- a/plugins/sonar-cpd-plugin/pom.xml
+++ b/plugins/sonar-cpd-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<groupId>org.codehaus.sonar.plugins</groupId>
diff --git a/plugins/sonar-dbcleaner-plugin/pom.xml b/plugins/sonar-dbcleaner-plugin/pom.xml
index c5db0e57695..ef0a699e63f 100644
--- a/plugins/sonar-dbcleaner-plugin/pom.xml
+++ b/plugins/sonar-dbcleaner-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<groupId>org.codehaus.sonar.plugins</groupId>
diff --git a/plugins/sonar-design-plugin/pom.xml b/plugins/sonar-design-plugin/pom.xml
index b5196b3122e..8ed7317cfd5 100644
--- a/plugins/sonar-design-plugin/pom.xml
+++ b/plugins/sonar-design-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<groupId>org.codehaus.sonar.plugins</groupId>
diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/i18n/design.properties b/plugins/sonar-design-plugin/src/main/resources/org/sonar/i18n/design.properties
deleted file mode 100755
index c3af9b66e32..00000000000
--- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/i18n/design.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-view.org.sonar.plugins.design.ui.page.DesignPage.title=Design
-view.org.sonar.plugins.design.ui.libraries.LibrariesPage.title=Libraries
-view.org.sonar.plugins.design.ui.dependencies.DependenciesTab.title=Dependencies
-view.org.sonar.plugins.design.ui.lcom4.Lcom4Tab.title=LCOM4
diff --git a/plugins/sonar-findbugs-plugin/pom.xml b/plugins/sonar-findbugs-plugin/pom.xml
index 3faccc2a4fd..7687def4980 100644
--- a/plugins/sonar-findbugs-plugin/pom.xml
+++ b/plugins/sonar-findbugs-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<groupId>org.codehaus.sonar.plugins</groupId>
@@ -69,21 +69,19 @@
</exclusions>
</dependency>
- <!-- unit tests -->
- <dependency>
- <groupId>org.codehaus.sonar</groupId>
- <artifactId>sonar-testing-harness</artifactId>
- <scope>test</scope>
- </dependency>
-
<!-- TODO http://jira.codehaus.org/browse/SONAR-2011
- We need following dependency, otherwise we will receive
- java.lang.NoClassDefFoundError: org/apache/maven/project/MavenProject
- during call mock(org.sonar.api.resources.Project.class)
+ We need following dependency, otherwise we will receive compilation error
-->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- unit tests -->
+ <dependency>
+ <groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar-testing-harness</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsConfiguration.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsConfiguration.java
index 4674bf2e7c4..21057ea4663 100644
--- a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsConfiguration.java
+++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsConfiguration.java
@@ -33,6 +33,8 @@ import org.sonar.plugins.findbugs.xml.FindBugsFilter;
import org.sonar.plugins.findbugs.xml.Match;
import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
/**
* @since 2.4
@@ -98,6 +100,18 @@ public class FindbugsConfiguration implements BatchExtension {
return project.getFileSystem().writeToWorkingDirectory(findBugsFilter.toXml(), "findbugs-exclude.xml");
}
+ public List<File> getExcludesFilters() {
+ List<File> result = new ArrayList<File>();
+ String[] filters = project.getConfiguration().getStringArray(FindbugsConstants.EXCLUDES_FILTERS_PROPERTY);
+ for (String excludesFilterPath : filters) {
+ excludesFilterPath = StringUtils.trim(excludesFilterPath);
+ if (StringUtils.isNotBlank(excludesFilterPath)) {
+ result.add(project.getFileSystem().resolvePath(excludesFilterPath));
+ }
+ }
+ return result;
+ }
+
public String getEffort() {
return StringUtils.lowerCase(project.getConfiguration().getString(CoreProperties.FINDBUGS_EFFORT_PROPERTY,
CoreProperties.FINDBUGS_EFFORT_DEFAULT_VALUE));
diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsConstants.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsConstants.java
index fc1491b9d56..0467f5a3dc6 100644
--- a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsConstants.java
+++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsConstants.java
@@ -33,7 +33,12 @@ public final class FindbugsConstants {
*/
public static final String GENERATE_XML_KEY = "sonar.findbugs.generateXml";
public static final boolean GENERATE_XML_DEFAULT_VALUE = true; // TODO should be false - see SONAR-1880
-
+
+ /**
+ * @since 2.10
+ */
+ public static final String EXCLUDES_FILTERS_PROPERTY = "sonar.findbugs.excludesFilters";
+
private FindbugsConstants() {
}
}
diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java
index e1e8fd2a482..c545b63243c 100644
--- a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java
+++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsExecutor.java
@@ -19,19 +19,6 @@
*/
package org.sonar.plugins.findbugs;
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.lang.reflect.Field;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.TimeUnit;
-
import com.google.common.collect.Lists;
import edu.umd.cs.findbugs.*;
import edu.umd.cs.findbugs.config.UserPreferences;
@@ -46,6 +33,19 @@ import org.sonar.api.utils.Logs;
import org.sonar.api.utils.SonarException;
import org.sonar.api.utils.TimeProfiler;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
/**
* @since 2.4
*/
@@ -96,6 +96,14 @@ public class FindbugsExecutor implements BatchExtension {
engine.addFilter(configuration.saveIncludeConfigXml().getAbsolutePath(), true);
engine.addFilter(configuration.saveExcludeConfigXml().getAbsolutePath(), false);
+ for (File filterFile : configuration.getExcludesFilters()) {
+ if (filterFile.isFile()) {
+ engine.addFilter(filterFile.getAbsolutePath(), false);
+ } else {
+ LOG.warn("FindBugs filter-file not found: {}", filterFile);
+ }
+ }
+
engine.setDetectorFactoryCollection(detectorFactory);
engine.setAnalysisFeatureSettings(FindBugs.DEFAULT_EFFORT);
@@ -167,4 +175,5 @@ public class FindbugsExecutor implements BatchExtension {
throw new SonarException(e);
}
}
+
}
diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsMavenInitializer.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsMavenInitializer.java
new file mode 100644
index 00000000000..26d1e5b7547
--- /dev/null
+++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsMavenInitializer.java
@@ -0,0 +1,54 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.plugins.findbugs;
+
+import org.apache.commons.configuration.Configuration;
+import org.sonar.api.batch.Initializer;
+import org.sonar.api.batch.SupportedEnvironment;
+import org.sonar.api.batch.maven.MavenPlugin;
+import org.sonar.api.batch.maven.MavenUtils;
+import org.sonar.api.resources.Project;
+
+/**
+ * Configures Sonar FindBugs Plugin according to configuration of findbugs-maven-plugin.
+ * Supports only "excludeFilterFile".
+ *
+ * @since 2.10
+ */
+@SupportedEnvironment("maven")
+public class FindbugsMavenInitializer extends Initializer {
+
+ private static final String FINDBUGS_GROUP_ID = MavenUtils.GROUP_ID_CODEHAUS_MOJO;
+ private static final String FINDBUGS_ARTIFACT_ID = "findbugs-maven-plugin";
+
+ @Override
+ public void execute(Project project) {
+ Configuration conf = project.getConfiguration();
+ if (!conf.containsKey(FindbugsConstants.EXCLUDES_FILTERS_PROPERTY)) {
+ conf.setProperty(FindbugsConstants.EXCLUDES_FILTERS_PROPERTY, getExcludesFiltersFromPluginConfiguration(project));
+ }
+ }
+
+ private static String getExcludesFiltersFromPluginConfiguration(Project project) {
+ MavenPlugin mavenPlugin = MavenPlugin.getPlugin(project.getPom(), FINDBUGS_GROUP_ID, FINDBUGS_ARTIFACT_ID);
+ return mavenPlugin != null ? mavenPlugin.getParameter("excludeFilterFile") : null;
+ }
+
+}
diff --git a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsPlugin.java b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsPlugin.java
index c234f6b9059..bb9777ba15b 100644
--- a/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsPlugin.java
+++ b/plugins/sonar-findbugs-plugin/src/main/java/org/sonar/plugins/findbugs/FindbugsPlugin.java
@@ -38,6 +38,11 @@ import java.util.List;
name = "Timeout",
description = "Specifies the amount of time, in milliseconds, that FindBugs may run before it is assumed to be hung and is terminated. " +
"The default is 600,000 milliseconds, which is ten minutes.",
+ project = true, module = true, global = true),
+ @Property(
+ key = FindbugsConstants.EXCLUDES_FILTERS_PROPERTY,
+ name = "Excludes Filters",
+ description = "Paths to findbugs filter-files with exclusions (comma-separated).",
project = true, module = true, global = true) })
public class FindbugsPlugin extends SonarPlugin {
@@ -50,6 +55,7 @@ public class FindbugsPlugin extends SonarPlugin {
list.add(FindbugsProfileExporter.class);
list.add(FindbugsProfileImporter.class);
list.add(SonarWayWithFindbugsProfile.class);
+ list.add(FindbugsMavenInitializer.class);
return list;
}
}
diff --git a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsConfigurationTest.java b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsConfigurationTest.java
index ef4b16df8d0..c85fbb38291 100644
--- a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsConfigurationTest.java
+++ b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsConfigurationTest.java
@@ -24,8 +24,8 @@ import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import java.io.File;
-
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -34,6 +34,8 @@ import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.resources.Project;
import org.sonar.api.test.SimpleProjectFileSystem;
+import java.io.File;
+
public class FindbugsConfigurationTest {
@Rule
@@ -62,4 +64,14 @@ public class FindbugsConfigurationTest {
assertThat(findbugsExcludeFile.exists(), is(true));
}
+ @Test
+ public void shouldReturnExcludesFilters() {
+ Configuration projectConfiguration = new BaseConfiguration();
+ when(project.getConfiguration()).thenReturn(projectConfiguration);
+ FindbugsConfiguration conf = new FindbugsConfiguration(project, RulesProfile.create(), new FindbugsProfileExporter(), null);
+
+ assertThat(conf.getExcludesFilters().size(), is(0));
+ projectConfiguration.setProperty(FindbugsConstants.EXCLUDES_FILTERS_PROPERTY, " foo.xml , bar.xml,");
+ assertThat(conf.getExcludesFilters().size(), is(2));
+ }
}
diff --git a/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsMavenInitializerTest.java b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsMavenInitializerTest.java
new file mode 100644
index 00000000000..c49dcb36982
--- /dev/null
+++ b/plugins/sonar-findbugs-plugin/src/test/java/org/sonar/plugins/findbugs/FindbugsMavenInitializerTest.java
@@ -0,0 +1,64 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.plugins.findbugs;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.apache.commons.configuration.Configuration;
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.api.resources.Project;
+import org.sonar.api.test.MavenTestUtils;
+
+public class FindbugsMavenInitializerTest {
+
+ private Project project;
+ private FindbugsMavenInitializer initializer;
+
+ @Before
+ public void setUp() {
+ project = mock(Project.class);
+ initializer = new FindbugsMavenInitializer();
+ }
+
+ @Test
+ public void doNotSetExcludesFiltersIfAlreadyConfigured() {
+ Configuration configuration = mock(Configuration.class);
+ when(configuration.containsKey(FindbugsConstants.EXCLUDES_FILTERS_PROPERTY)).thenReturn(true);
+ when(project.getConfiguration()).thenReturn(configuration);
+ initializer.execute(project);
+ verify(configuration, never()).setProperty(eq(FindbugsConstants.EXCLUDES_FILTERS_PROPERTY), anyString());
+ }
+
+ @Test
+ public void shouldGetExcludesFiltersFromPom() {
+ Project project = MavenTestUtils.loadProjectFromPom(getClass(), "pom.xml");
+ initializer.execute(project);
+ assertThat(project.getConfiguration().getString(FindbugsConstants.EXCLUDES_FILTERS_PROPERTY), is("foo.xml"));
+ }
+
+}
diff --git a/plugins/sonar-findbugs-plugin/src/test/resources/org/sonar/plugins/findbugs/FindbugsMavenInitializerTest/pom.xml b/plugins/sonar-findbugs-plugin/src/test/resources/org/sonar/plugins/findbugs/FindbugsMavenInitializerTest/pom.xml
new file mode 100644
index 00000000000..6cf12342a42
--- /dev/null
+++ b/plugins/sonar-findbugs-plugin/src/test/resources/org/sonar/plugins/findbugs/FindbugsMavenInitializerTest/pom.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>fake.group</groupId>
+ <artifactId>fake.artifactId</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>findbugs-maven-plugin</artifactId>
+ <configuration>
+ <excludeFilterFile>foo.xml</excludeFilterFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/plugins/sonar-googleanalytics-plugin/pom.xml b/plugins/sonar-googleanalytics-plugin/pom.xml
index f7040049957..0847913abb7 100644
--- a/plugins/sonar-googleanalytics-plugin/pom.xml
+++ b/plugins/sonar-googleanalytics-plugin/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
diff --git a/plugins/sonar-i18n-en-plugin/pom.xml b/plugins/sonar-i18n-en-plugin/pom.xml
new file mode 100755
index 00000000000..57e98d1efba
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar</artifactId>
+ <version>2.10-SNAPSHOT</version>
+ <relativePath>../..</relativePath>
+ </parent>
+ <groupId>org.codehaus.sonar.plugins</groupId>
+ <artifactId>sonar-i18n-en-plugin</artifactId>
+ <packaging>sonar-plugin</packaging>
+ <name>Sonar :: Plugins :: I18n English Pack</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar-plugin-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>native2ascii-maven-plugin</artifactId>
+ <version>1.0-alpha-1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>native2ascii</goal>
+ </goals>
+ <!-- specific configurations -->
+ <configuration>
+ <encoding>UTF8</encoding>
+ <src>${basedir}/src/main/resources</src>
+ <dest>${project.build.outputDirectory}</dest>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar-packaging-maven-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <pluginKey>i18nen</pluginKey>
+ <pluginName>I18n English Pack</pluginName>
+ <pluginClass>org.sonar.plugins.i18n.en.EnglishPackPlugin</pluginClass>
+ <pluginDescription>
+ <![CDATA[Language pack for English.]]></pluginDescription>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/java/org/sonar/plugins/i18n/en/EnglishPack.java b/plugins/sonar-i18n-en-plugin/src/main/java/org/sonar/plugins/i18n/en/EnglishPack.java
new file mode 100644
index 00000000000..62213736882
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/java/org/sonar/plugins/i18n/en/EnglishPack.java
@@ -0,0 +1,37 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.plugins.i18n.en;
+
+import org.sonar.api.i18n.LanguagePack;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+
+public class EnglishPack extends LanguagePack {
+
+ public List<String> getPluginKeys() {
+ return Arrays.asList("core", "design", "squidjava");
+ }
+
+ public List<Locale> getLocales() {
+ return Arrays.asList(Locale.ENGLISH);
+ }
+}
diff --git a/plugins/sonar-design-plugin/src/test/java/org/sonar/plugins/design/batch/MavenDependenciesSensorTest.java b/plugins/sonar-i18n-en-plugin/src/main/java/org/sonar/plugins/i18n/en/EnglishPackPlugin.java
index 8c74a45b1bc..e78ad34f7fc 100644..100755
--- a/plugins/sonar-design-plugin/src/test/java/org/sonar/plugins/design/batch/MavenDependenciesSensorTest.java
+++ b/plugins/sonar-i18n-en-plugin/src/main/java/org/sonar/plugins/i18n/en/EnglishPackPlugin.java
@@ -1,27 +1,32 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.design.batch;
-
-import org.junit.Ignore;
-
-@Ignore
-public class MavenDependenciesSensorTest {
-
-}
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.plugins.i18n.en;
+
+import org.sonar.api.SonarPlugin;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class EnglishPackPlugin extends SonarPlugin {
+
+ public List getExtensions() {
+ return Arrays.asList(EnglishPack.class);
+ }
+}
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/i18n/core.properties b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties
index 7f77fa47862..ecfe127b689 100755
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/i18n/core.properties
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties
@@ -1,36 +1,3 @@
-app.view.layouts.layout.login=Log in
-app.view.layouts.layout.logout=Log out
-app.view.layouts.layout.configuration=Configuration
-app.view.layouts.layout.filters=Filters
-app.view.layouts.layout.reviews=Reviews
-app.view.layouts.layout.dependencies=Dependencies
-app.view.layouts.layout.components=Components
-app.view.layouts.layout.violations_drilldown=Violations drilldown
-app.view.layouts.layout.time_machine=Time machine
-app.view.layouts.layout.settings=Settings
-app.view.layouts.layout.project_roles=Project roles
-app.view.layouts.layout.quality_profiles=Quality profiles
-app.view.layouts.layout.event_categories=Event categories
-app.view.layouts.layout.manual_metrics=Manual metrics
-app.view.layouts.layout.default_filters=Default filters
-app.view.layouts.layout.default_dashboards=Default dashboards
-app.view.layouts.layout.my_profile=My profile
-app.view.layouts.layout.security=Security
-app.view.layouts.layout.users=Users
-app.view.layouts.layout.groups=Groups
-app.view.layouts.layout.global_roles=Global roles
-app.view.layouts.layout.system=System
-app.view.layouts.layout.backup=Backup
-app.view.layouts.layout.system_info=System Info
-app.view.layouts.layout.update_center=Update Center
-
-app.view.components.treemap_settings.size=Size
-app.view.components.treemap_settings.color=Color
-app.view.filters.treemap.size=Size
-app.view.filters.treemap.color=Color
-
-view.org.sonar.plugins.core.clouds.GwtClouds.title=Clouds
-view.org.sonar.plugins.core.hotspots.GwtHotspots.title=Hotspots
view.coverage.title=Coverage
view.org.sonar.plugins.core.duplicationsviewer.DuplicationsViewer.title=Duplications
view.source.title=Source
@@ -49,13 +16,251 @@ view.size.methods_suffix=\ methods
view.size.accessors_suffix=\ accessors
view.size.paragraphs_suffix=\ paragraphs
-general_columns.links=Links
-general_columns.build_time=Build time
-general_columns.language=Language
-general_columns.version=Version
-general_columns.date=Build date
-general_columns.key=Key
-general_columns.name=Name
+
+#------------------------------------------------------------------------------
+#
+# GENERIC WORDS, sorted alphabetically
+#
+#------------------------------------------------------------------------------
+
+add_verb=Add
+and=And
+assign=Assign
+author=Author
+ascending=Ascending
+blocker=Blocker
+build_date=Build date
+cancel=Cancel
+change_verb=Change
+class=Class
+classes=Classes
+color=Color
+criteria=Criteria
+critical=Critical
+date=Date
+days=Days
+delete=Delete
+descending=Descending
+directory=Directory
+directories=Directories
+display=Display
+edit=Edit
+file=File
+files=Files
+info=Info
+key=Key
+language=Language
+library=Library
+links=Links
+login=Login
+major=Major
+max=Max
+min=Min
+minor=Minor
+name=Name
+none=None
+operations=Operations
+order=Order
+package=Package
+packages=Packages
+password=Password
+path=Path
+project=Project
+projects=Projects
+reset_verb=Reset
+search_verb=Search
+shared=Shared
+view=View
+views=Views
+raw=Raw
+reassign=Reassign
+reopen=Reopen
+reopened=Reopened
+resolve=Resolve
+result=Result
+rule=Rule
+review_verb=Review
+select_verb=Select
+severity=Severity
+size=Size
+sub_project=Sub-project
+sub_projects=Sub-projects
+sub_view=Sub-view
+sub_views=Sub-views
+table=Table
+treemap=Treemap
+unfollow=Unfollow
+unit_test=Unit test
+unit_tests=Unit tests
+value=Value
+variarion=Variation
+violations=Violations
+version=Version
+
+
+#------------------------------------------------------------------------------
+#
+# GENERIC EXPRESSIONS, sorted alphabetically
+#
+#------------------------------------------------------------------------------
+
+add_comment=Add comment
+added_over_x_days=Added over {0} days
+added_since=Added since {0}
+added_since_previous_analysis=Added since previous analysis
+added_since_previous_analysis_detailed=Added since previous analysis ({0})
+added_since_version=Added since version {0}
+alerts_feed=Alerts feed
+all_violations=All violations
+assigned_to=Assigned to
+delta_since_previous_analysis=&Delta; since previous analysis
+delta_over_x_days=&Delta; over {0} days
+delta_since=&Delta; since {0}
+delta_since_version=&Delta; since version {0}
+equals=Equals
+false_positive=False-Positive
+false_positives_only=False-Positives only
+full_source=Full source
+greater_or_equals=Greater or equals
+greater_than=Greater than
+less_or_equals=Less or equals
+less_than=Less than
+move_left=Move left
+move_right=Move right
+new_violations=New violations
+new_window=New window
+no_results=No results
+page_size=Page size
+remove_column=Remove this column
+results_not_display_due_to_security=Due to security settings, some results are not being displayed.
+save_and_close=Save & Close
+save_and_preview=Save & Preview
+select_a_metric=Select a metric
+time_changes=Time changes
+
+
+#------------------------------------------------------------------------------
+#
+# LAYOUT
+#
+#------------------------------------------------------------------------------
+
+layout.home=Home
+layout.login=Log in
+layout.logout=Log out
+layout.configuration=Configuration
+layout.print=Print
+layout.permalink=Permalink
+layout.sonar.slogan=Embrace Quality
+layout.powered_by=Powered by
+layout.plugins=Plugins
+layout.documentation=Documentation
+layout.ask_a_questions=Ask a question
+layout.bug_feature_request=Bug/feature request
+
+sidebar.project_system=System
+sidebar.security=Security
+sidebar.system=System
+
+
+#------------------------------------------------------------------------------
+#
+# PAGES, sorted alphabetically
+#
+#------------------------------------------------------------------------------
+
+backup.page=Backup
+clouds.page=Clouds
+components.page=Components
+coverage.page=Coverage
+default_dashboards.page=Default dashboards
+default_filters.page=Default filters
+dependencies.page=Dependencies
+event_categories.page=Event categories
+filters.page=Filters
+filters.size=Size
+filters.color=Color
+global_roles.page=Global roles
+manual_metrics.page=Manual metrics
+my_profile.page=My profile
+project_roles.page=Project roles
+project_settings.page=Settings
+quality_profiles.page=Quality profiles
+reviews.page=Reviews
+settings.page=Settings
+source.page=Source
+system_info.page=System Info
+timemachine.page=Time Machine
+user_groups.page=Groups
+users.page=Users
+violations.page=Violations
+violations_drilldown.page=Violations drilldown
+update_center.page=Update Center
+
+org.sonar.plugins.core.hotspots.GwtHotspots.page=Hotspots
+org.sonar.plugins.core.duplicationsviewer.DuplicationsViewer.page=Duplications
+
+
+#------------------------------------------------------------------------------
+#
+# SESSION
+#
+#------------------------------------------------------------------------------
+
+sessions.remember_me=Remember me on this computer
+sessions.log_in=Log in
+
+
+#------------------------------------------------------------------------------
+#
+# FILTERS
+#
+#------------------------------------------------------------------------------
+
+filters.add_filter=Add filter
+filters.edit_filter=Edit filter
+filters.manage_filters=Manage filters
+filters.search_for=Search for
+filters.advanced_search=Advanced search
+filters.default_period=Default period
+filters.when_no_language_no_filter_apply=When no language is selected, no filter will apply
+filters.favourite_only=Favourites only
+filters.resource_key_like=Resource key like
+filters.use_star_to_match=Use the character * to match zero or more characters.
+filters.resource_name_like=Resource name like
+filters.do_you_want_to_delete=Do you want to delete this filter ?
+filters.during_last=During last
+filters.prior_to_last=Prior to last
+filters.search_by_name=Search by name
+filters.display_as=Display as
+filters.add_column=Add column
+filters.default_sorted_column=Default sorted column
+filters.treemap_not_supported_for_period_selection=Treemap does not support yet the selection of a period.
+filters.my_filters=My filters
+filters.no_filters=No filters
+filters.do_you_want_to_stop_following=Do you want to stop following this filter ?
+filters.shared_filters=Shared filters
+filters.shared_filters_description=These filters are shared by administrators and can be followed without copying them.
+
+
+#------------------------------------------------------------------------------
+#
+# REVIEWS
+#
+#------------------------------------------------------------------------------
+
+reviews.do_you_want_to_reopen=Do you want to reopen this review?
+reviews.do_you_want_to_resolve=Do you want to resolve this review?
+reviews.flag_as_false_positive=Flag as false-positive
+reviews.unflag_as_false_positive=Unflag as false-positive
+reviews.do_you_want_to_delete_comment=Do you want to delete this comment?
+
+
+#------------------------------------------------------------------------------
+#
+# METRIC DOMAINS
+#
+#------------------------------------------------------------------------------
domain.Size=Size
domain.Tests=Tests
@@ -68,59 +273,66 @@ domain.Design=Design
domain.SCM=SCM
domain.Management=Management
-metric.lines.name=Lines
-metric.lines.description=Lines
-metric.generated_lines.name=Generated Lines
-metric.generated_lines.description=Number of generated lines
+#------------------------------------------------------------------------------
+#
+# METRICS
+#
+#------------------------------------------------------------------------------
-metric.ncloc.name=Lines of code
-metric.ncloc.description=Non Commenting Lines of Code
+metric.accessors.name=Accessors
+metric.accessors.description=Accessors
-metric.generated_ncloc.name=Generated lines of code
-metric.generated_ncloc.description=Generated non Commenting Lines of Code
+metric.alert_status.name=Alert
+metric.alert_status.description=Alert
metric.classes.name=Classes
metric.classes.description=Classes
-metric.files.name=Files
-metric.files.description=Number of files
+metric.comment_blank_lines.name=Blank comments
+metric.comment_blank_lines.description=Comments that do not contain comments
+
+metric.comment_lines.name=Comment lines
+metric.comment_lines.description=Number of comment lines
+
+metric.comment_lines_density.name=Comments (%)
+metric.comment_lines_density.description=Comments balanced by ncloc + comment lines
+
+metric.commented_out_code_lines.name=Commented LOCs
+metric.commented_out_code_lines.description=Commented lines of code
+
+metric.complexity.name=Complexity
+metric.complexity.description=Cyclomatic complexity
metric.directories.name=Directories
metric.directories.description=Directories
-metric.packages.name=Packages
-metric.packages.description=Packages
+metric.files.name=Files
+metric.files.description=Number of files
metric.functions.name=Methods
metric.functions.description=Methods
-metric.accessors.name=Accessors
-metric.accessors.description=Accessors
-
-metric.paragraphs.name=Paragraphs
-metric.paragraphs.description=Number of paragraphs
+metric.generated_lines.name=Generated Lines
+metric.generated_lines.description=Number of generated lines
-metric.statements.name=Statements
-metric.statements.description=Number of statements
+metric.generated_ncloc.name=Generated lines of code
+metric.generated_ncloc.description=Generated non Commenting Lines of Code
-metric.public_api.name=Public API
-metric.public_api.description=Public API
+metric.lines.name=Lines
+metric.lines.description=Lines
-#--------------------------------------------------------------------------------------------------------------------
-#
-# DOCUMENTATION
-#
-#--------------------------------------------------------------------------------------------------------------------
+metric.ncloc.name=Lines of code
+metric.ncloc.description=Non Commenting Lines of Code
-metric.comment_lines.name=Comment lines
-metric.comment_lines.description=Number of comment lines
+metric.packages.name=Packages
+metric.packages.description=Packages
-metric.comment_lines_density.name=Comments (%)
-metric.comment_lines_density.description=Comments balanced by ncloc + comment lines
+metric.paragraphs.name=Paragraphs
+metric.paragraphs.description=Number of paragraphs
-metric.comment_blank_lines.name=Blank comments
-metric.comment_blank_lines.description=Comments that do not contain comments
+metric.public_api.name=Public API
+metric.public_api.description=Public API
metric.public_documented_api_density.name=Public documented API (%)
metric.public_documented_api_density.description=Public documented classes and methods balanced by ncloc
@@ -128,17 +340,10 @@ metric.public_documented_api_density.description=Public documented classes and m
metric.public_undocumented_api.name=Public undocumented API
metric.public_undocumented_api.description=Public undocumented classes, methods and variables
-metric.commented_out_code_lines.name=Commented LOCs
-metric.commented_out_code_lines.description=Commented lines of code
+metric.statements.name=Statements
+metric.statements.description=Number of statements
-#--------------------------------------------------------------------------------------------------------------------
-#
-# COMPLEXITY
-#
-#--------------------------------------------------------------------------------------------------------------------
-metric.complexity.name=Complexity
-metric.complexity.description=Cyclomatic complexity
metric.class_complexity.name=Complexity /class
metric.class_complexity.description=Complexity average by class
@@ -425,12 +630,8 @@ metric.revisions_by_line.description=Revisions by line
metric.last_commit_datetimes_by_line.name=Last commit dates by line
metric.last_commit_datetimes_by_line.description=Last commit dates by line
-metric.alert_status.name=Alert
-metric.alert_status.description=Alert
-
metric.profile.name=Profile
metric.profile.description=Selected quality profile
metric.profile_version.name=Profile version
-metric.profile_version.description=Selected quality profile version
-
+metric.profile_version.description=Selected quality profile version \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/design.properties b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/design.properties
new file mode 100755
index 00000000000..e6356b6e141
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/design.properties
@@ -0,0 +1,4 @@
+org.sonar.plugins.design.ui.page.DesignPage.page=Design
+org.sonar.plugins.design.ui.libraries.LibrariesPage.page=Libraries
+org.sonar.plugins.design.ui.dependencies.DependenciesTab.page=Dependencies
+org.sonar.plugins.design.ui.lcom4.Lcom4Tab.page=LCOM4
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava.properties b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava.properties
new file mode 100644
index 00000000000..f26cabba546
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava.properties
@@ -0,0 +1,29 @@
+rule.squid.ArchitecturalConstraint.name=Architectural constraint
+rule.squid.ArchitecturalConstraint.param.fromClasses=Optional. If this property is not defined, all classes should adhere to this constraint. Ex : **.web.**
+rule.squid.ArchitecturalConstraint.param.toClasses=Mandatory. Ex : java.util.Vector, java.util.Hashtable, java.util.Enumeration
+
+rule.squid.AvoidBreakOutsideSwitch.name=Avoid using 'break' branching statement outside a 'switch' statement
+
+rule.squid.AvoidContinueStatement.name=Avoid using 'continue' branching statement
+
+rule.squid.CallToDeprecatedMethod.name=Avoid use of deprecated method
+
+rule.squid.ClassCyclomaticComplexity.name=Avoid too complex class
+rule.squid.ClassCyclomaticComplexity.param.max=Maximum complexity allowed.
+
+rule.squid.EmptyFile.name=Empty file
+
+rule.squid.MaximumInheritanceDepth.name=Avoid too deep inheritance tree
+rule.squid.MaximumInheritanceDepth.param.max=Maximum depth of the inheritance tree.
+
+rule.squid.MethodCyclomaticComplexity.name=Avoid too complex method
+rule.squid.MethodCyclomaticComplexity.param.max=Maximum complexity allowed.
+
+rule.squid.NoSonar.name=Avoid use of //NOSONAR marker
+
+rule.squid.UndocumentedApi.name=Undocumented API
+rule.squid.UndocumentedApi.param.forClasses=Optional. If this property is not defined, all classes should adhere to this constraint. Ex : **.api.**
+
+rule.squid.UnusedPrivateMethod.name=Unused private method
+
+rule.squid.UnusedProtectedMethod.name=Unused protected method
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/ArchitecturalConstraint.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/ArchitecturalConstraint.html
new file mode 100644
index 00000000000..2af771f2944
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/ArchitecturalConstraint.html
@@ -0,0 +1,11 @@
+<p>A source code comply to an architectural model when it fully
+ adheres to a set of architectural constraints. A constraint allows to
+ deny references between classes by pattern.</p>
+<p>You can for instance use this rule to :</p>
+<ul>
+ <li>forbid access to **.web.** from **.dao.** classes</li>
+ <li>forbid access to java.util.Vector, java.util.Hashtable and
+ java.util.Enumeration from any classes</li>
+ <li>forbid access to java.sql.** from **.ui.** and **.web.**
+ classes</li>
+</ul> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/AvoidBreakOutsideSwitch.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/AvoidBreakOutsideSwitch.html
new file mode 100644
index 00000000000..d691586270a
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/AvoidBreakOutsideSwitch.html
@@ -0,0 +1,18 @@
+<p>The use of the 'break' branching statement increases the
+ essential complexity of the source code and so prevents any refactoring
+ of this source code to replace all well structured control structures
+ with a single statement.</p>
+<p>For instance, with the following java program fragment, it's not
+ possible to apply the 'extract method' refactoring pattern :</p>
+<pre>
+mylabel : for (int i = 0 ; i< 3; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ doSomething();
+ if (checkSomething()) {
+ break mylabel;
+ }
+ }
+}
+</pre>
+<p>The use of the 'break' branching statement is only authorized
+ inside a 'switch' statement.</p> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/AvoidContinueStatement.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/AvoidContinueStatement.html
new file mode 100644
index 00000000000..d52b67eba23
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/AvoidContinueStatement.html
@@ -0,0 +1,16 @@
+<p>The use of the 'continue' branching statement increase the
+ essential complexity of the source code and so prevent any refactoring
+ of this source code to replace all well structured control structures
+ with a single statement.</p>
+<p>For instance, in the following java program fragment, it's not
+ possible to apply the 'extract method' refactoring pattern :</p>
+<pre>
+mylabel : for(int i = 0 ; i< 3; i++) {
+ for (int j = 0; j < 4 ; j++) {
+ doSomething();
+ if (checkSomething()) {
+ continue mylabel;
+ }
+ }
+}
+</pre> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/CallToDeprecatedMethod.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/CallToDeprecatedMethod.html
new file mode 100644
index 00000000000..146b8f3b13d
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/CallToDeprecatedMethod.html
@@ -0,0 +1,2 @@
+<p>Once deprecated, a method should no longer be used as it means
+ that the method might be removed sooner or later.</p> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/ClassCyclomaticComplexity.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/ClassCyclomaticComplexity.html
new file mode 100644
index 00000000000..a2837927eeb
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/ClassCyclomaticComplexity.html
@@ -0,0 +1,14 @@
+<p>The Cyclomatic Complexity is measured by the number of (&&, ||)
+ operators and (if, while, do, for, ?:, catch, switch, case, return,
+ throw) statements in the body of a class plus one for each constructor,
+ method (but not getter/setter), static initializer, or instance
+ initializer in the class. The last return stament in method, if exists,
+ is not taken into account.</p>
+<p>
+ Even when the Cyclomatic Complexity of a class is very high, this
+ complexity might be well distributed among all methods. Nevertheless,
+ most of the time, a very complex class is a class which breaks the <a
+ href='http://en.wikipedia.org/wiki/Single_responsibility_principle'>Single
+ Responsibility Principle</a> and which should be re-factored to be split
+ in several classes.
+</p> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/EmptyFile.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/EmptyFile.html
new file mode 100644
index 00000000000..9b3a8772360
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/EmptyFile.html
@@ -0,0 +1,7 @@
+<p>Detect empty files, which do not have any lines of code.</p>
+<p>Example:</p>
+<pre>
+//package org.foo;
+//
+//public class Bar {}
+</pre> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/MaximumInheritanceDepth.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/MaximumInheritanceDepth.html
new file mode 100644
index 00000000000..61fc1884394
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/MaximumInheritanceDepth.html
@@ -0,0 +1,9 @@
+<p>Inheritance is certainly one of the most valuable concept of
+ object-oriented programming. It's a way to compartmentalize and reuse
+ code by creating collections of attributes and behaviors called classes
+ which can be based on previously created classes. But abusing of this
+ concept by creating a deep inheritance tree can lead to very complex
+ and unmaintainable source code.</p>
+<p>Most of the time a too deep inheritance tree is due to bad object
+ oriented design which has led to systematically use 'inheritance' when
+ 'composition' would suit better.</p> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/MethodCyclomaticComplexity.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/MethodCyclomaticComplexity.html
new file mode 100644
index 00000000000..d50d8825d7a
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/MethodCyclomaticComplexity.html
@@ -0,0 +1,14 @@
+<p>The Cyclomatic Complexity is measured by the number of
+ (&amp;&amp;, ||) operators and (if, while, do, for, ?:, catch, switch,
+ case, return, throw) statements in the body of a class plus one for
+ each constructor, method (but not getter/setter), static initializer,
+ or instance initializer in the class. The last return stament in
+ method, if exists, is not taken into account.</p>
+<p>
+ Even when the Cyclomatic Complexity of a class is very high, this
+ complexity might be well distributed among all methods. Nevertheless,
+ most of the time, a very complex class is a class which breaks the <a
+ href="http://en.wikipedia.org/wiki/Single_responsibility_principle">Single
+ Responsibility Principle</a> and which should be re-factored to be split
+ in several classes.
+</p> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/NoSonar.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/NoSonar.html
new file mode 100644
index 00000000000..c56106d83c1
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/NoSonar.html
@@ -0,0 +1,5 @@
+<p>Any violation to quality rule can be deactivated with the
+ //NOSONAR marker. This marker is pretty useful to exclude
+ false-positive results but sometimes it can abusively be used to hide
+ real quality flaws.</p>
+<p>This rule allows to track and/or forbid use of this marker</p> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UndocumentedApi.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UndocumentedApi.html
new file mode 100644
index 00000000000..9745f9eab3d
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UndocumentedApi.html
@@ -0,0 +1,8 @@
+<p>Check that each public class, interface, method and constructor
+ has a Javadoc comment. The following public methods/constructors are
+ not concerned by this rule :</p>
+<ul>
+ <li>Getter / Setter</li>
+ <li>Method with @Override annotation</li>
+ <li>Empty constructor</li>
+</ul> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UnusedPrivateMethod.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UnusedPrivateMethod.html
new file mode 100644
index 00000000000..fd3901a49fa
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UnusedPrivateMethod.html
@@ -0,0 +1,13 @@
+<p>Private methods that are never executed are dead code. Dead code
+ means unnecessary, inoperative code that should be removed. This helps
+ in maintenance by decreasing the maintained code size, making it easier
+ to understand the program and preventing bugs from being introduced.</p>
+<p>In the following two cases, private methods are not considered as
+ dead code by Sonar :</p>
+<ul>
+ <li>Private empty constructors that are intentionally used to
+ prevent any direct instantiation of a class.</li>
+ <li>Private methods : readObject(...), writeObject(...),
+ writeReplace(...), readResolve(...) which can contractually be used
+ when implementing the Serializable interface.</li>
+</ul> \ No newline at end of file
diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UnusedProtectedMethod.html b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UnusedProtectedMethod.html
new file mode 100644
index 00000000000..ec8ed1032fd
--- /dev/null
+++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/squidjava/UnusedProtectedMethod.html
@@ -0,0 +1,11 @@
+<p>Protected methods that are never used by any classes in the same
+ project are strongly suspected to be dead code. Dead code means
+ unnecessary, inoperative code that should be removed. This helps in
+ maintenance by decreasing the maintained code size, making it easier to
+ understand the program and preventing bugs from being introduced.</p>
+<p>In the following case, unused protected methods are not
+ considered as dead code by Sonar :</p>
+<ul>
+ <li>Protected methods which override a method from a parent class.</li>
+ <li>Protected methods of an abstract class.</li>
+</ul> \ No newline at end of file
diff --git a/plugins/sonar-pmd-plugin/pom.xml b/plugins/sonar-pmd-plugin/pom.xml
index 5c9760c52e9..84d7233f91b 100644
--- a/plugins/sonar-pmd-plugin/pom.xml
+++ b/plugins/sonar-pmd-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<groupId>org.codehaus.sonar.plugins</groupId>
diff --git a/plugins/sonar-squid-java-plugin/pom.xml b/plugins/sonar-squid-java-plugin/pom.xml
index 58f2625b325..c86514ec2d9 100644
--- a/plugins/sonar-squid-java-plugin/pom.xml
+++ b/plugins/sonar-squid-java-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
<groupId>org.codehaus.sonar.plugins</groupId>
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java
index 73f853bebe3..474dfe6526b 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/BreakCheck.java
@@ -20,36 +20,19 @@
package org.sonar.java.ast.check;
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
-import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import java.util.Arrays;
+import java.util.List;
+
import org.sonar.check.Priority;
import org.sonar.check.Rule;
import org.sonar.java.ast.visitor.AstUtils;
import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
-import java.util.Arrays;
-import java.util.List;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
-@Rule(
- key = "AvoidBreakOutsideSwitch",
- name = "Avoid using 'break' branching statement outside a 'switch' statement",
- priority = Priority.MAJOR,
- description = "<p>The use of the 'break' branching statement increases the essential complexity of the source code and "
- + "so prevents any refactoring of this source code to replace all well structured control structures with a single statement.</p>"
- + "<p>For instance, with the following java program fragment, it's not possible to apply "
- + "the 'extract method' refactoring pattern :</p>"
- + "<pre>"
- + "mylabel : for (int i = 0 ; i< 3; i++) {\n"
- + " for (int j = 0; j < 4 ; j++) {\n"
- + " doSomething();\n"
- + " if (checkSomething()) {\n"
- + " break mylabel;\n"
- + " }\n"
- + " }\n"
- + "}\n"
- + "</pre>"
- + "<p>The use of the 'break' branching statement is only authorized inside a 'switch' statement.</p>")
+@Rule(key = "AvoidBreakOutsideSwitch", priority = Priority.MAJOR)
public class BreakCheck extends JavaAstCheck {
@Override
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java
index 773eef025f6..162d208fc27 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/ContinueCheck.java
@@ -20,32 +20,19 @@
package org.sonar.java.ast.check;
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
-import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import java.util.Arrays;
+import java.util.List;
+
import org.sonar.check.Priority;
import org.sonar.check.Rule;
import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceCode;
import org.sonar.squid.api.SourceFile;
-import java.util.Arrays;
-import java.util.List;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import com.puppycrawl.tools.checkstyle.api.TokenTypes;
-@Rule(key = "AvoidContinueStatement", name = "Avoid using 'continue' branching statement",
- priority = Priority.MAJOR, description = "<p>The use of the 'continue' branching statement increase the essential complexity "
- + "of the source code and so prevent any refactoring of this source code to replace all well structured control structures "
- + "with a single statement.</p><p>For instance, in the following java program fragment, it's not possible to apply "
- + "the 'extract method' refactoring pattern :</p>"
- + "<pre>"
- + "mylabel : for(int i = 0 ; i< 3; i++) {\n"
- + " for (int j = 0; j < 4 ; j++) {\n"
- + " doSomething();\n"
- + " if (checkSomething()) {\n"
- + " continue mylabel;\n"
- + " }\n"
- + " }\n"
- + "}\n"
- + "</pre>")
+@Rule(key = "AvoidContinueStatement", priority = Priority.MAJOR)
public class ContinueCheck extends JavaAstCheck {
@Override
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java
index c87626b8b19..d359d49316a 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/ast/check/UndocumentedApiCheck.java
@@ -20,7 +20,8 @@
package org.sonar.java.ast.check;
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
+import java.util.List;
+
import org.apache.commons.lang.StringUtils;
import org.sonar.api.utils.WildcardPattern;
import org.sonar.check.Priority;
@@ -28,17 +29,18 @@ import org.sonar.check.Rule;
import org.sonar.check.RuleProperty;
import org.sonar.java.PatternUtils;
import org.sonar.java.ast.visitor.PublicApiVisitor;
-import org.sonar.squid.api.*;
+import org.sonar.squid.api.CheckMessage;
+import org.sonar.squid.api.SourceClass;
+import org.sonar.squid.api.SourceCode;
+import org.sonar.squid.api.SourceFile;
+import org.sonar.squid.api.SourceMethod;
-import java.util.List;
+import com.puppycrawl.tools.checkstyle.api.DetailAST;
-@Rule(key = "UndocumentedApi", name = "Undocumented API", priority = Priority.MAJOR,
- description = "<p>Check that each public class, interface, method and constructor has a Javadoc comment. "
- + "The following public methods/constructors are not concerned by this rule :</p>" + "<ul><li>Getter / Setter</li>"
- + "<li>Method with @Override annotation</li>" + "<li>Empty constructor</li></ul>")
+@Rule(key = "UndocumentedApi", priority = Priority.MAJOR)
public class UndocumentedApiCheck extends JavaAstCheck {
- @RuleProperty(description = "Optional. If this property is not defined, all classes should adhere to this constraint. Ex : **.api.**")
+ @RuleProperty
private String forClasses = "";
private WildcardPattern[] patterns;
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/ArchitectureCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/ArchitectureCheck.java
index b272f1ef58b..24d58e6dd9a 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/ArchitectureCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/ArchitectureCheck.java
@@ -19,7 +19,8 @@
*/
package org.sonar.java.bytecode.check;
-import com.google.common.collect.Maps;
+import java.util.Map;
+
import org.apache.commons.lang.StringUtils;
import org.sonar.api.utils.WildcardPattern;
import org.sonar.check.Cardinality;
@@ -34,22 +35,15 @@ import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
import org.sonar.squid.api.SourceMethod;
-import java.util.Map;
+import com.google.common.collect.Maps;
-@Rule(key = "ArchitecturalConstraint", name = "Architectural constraint", cardinality = Cardinality.MULTIPLE,
- priority = Priority.MAJOR,
- description = "<p>A source code comply to an architectural model when it fully adheres to a set of architectural constraints. " +
- "A constraint allows to deny references between classes by pattern.</p>" +
- "<p>You can for instance use this rule to :</p>" +
- "<ul><li>forbid access to **.web.** from **.dao.** classes</li>" +
- "<li>forbid access to java.util.Vector, java.util.Hashtable and java.util.Enumeration from any classes</li>" +
- "<li>forbid access to java.sql.** from **.ui.** and **.web.** classes</li></ul>")
+@Rule(key = "ArchitecturalConstraint", cardinality = Cardinality.MULTIPLE, priority = Priority.MAJOR)
public class ArchitectureCheck extends BytecodeCheck {
- @RuleProperty(description = "Optional. If this property is not defined, all classes should adhere to this constraint. Ex : **.web.**")
+ @RuleProperty
private String fromClasses = "";
- @RuleProperty(description = "Mandatory. Ex : java.util.Vector, java.util.Hashtable, java.util.Enumeration")
+ @RuleProperty
private String toClasses = "";
private WildcardPattern[] fromPatterns;
@@ -98,7 +92,7 @@ public class ArchitectureCheck extends BytecodeCheck {
public void visitEdge(AsmEdge edge) {
if (asmClass != null && edge != null) {
String internalNameTargetClass = edge.getTargetAsmClass().getInternalName();
- if (!internalNames.containsKey(internalNameTargetClass)) {
+ if ( !internalNames.containsKey(internalNameTargetClass)) {
if (WildcardPattern.match(getToPatterns(), internalNameTargetClass)) {
int sourceLineNumber = getSourceLineNumber(edge);
logMessage(asmClass.getInternalName(), internalNameTargetClass, sourceLineNumber);
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/CallToDeprecatedMethodCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/CallToDeprecatedMethodCheck.java
index 9dc17a1b4f9..4ed21642c5d 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/CallToDeprecatedMethodCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/CallToDeprecatedMethodCheck.java
@@ -27,9 +27,7 @@ import org.sonar.java.bytecode.asm.AsmMethod;
import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
-@Rule(key = "CallToDeprecatedMethod", name = "Avoid use of deprecated method", priority = Priority.MINOR,
- description = "<p>Once deprecated, a method should no longer be used as it means that "
- + "the method might be removed sooner or later.</p>")
+@Rule(key = "CallToDeprecatedMethod", priority = Priority.MINOR)
public class CallToDeprecatedMethodCheck extends BytecodeCheck {
private AsmClass asmClass;
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedPrivateMethodCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedPrivateMethodCheck.java
index 6f4216d8b4d..5b2d9337a26 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedPrivateMethodCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedPrivateMethodCheck.java
@@ -27,15 +27,7 @@ import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
import org.sonar.squid.api.SourceMethod;
-@Rule(key = "UnusedPrivateMethod", name = "Unused private method",
- priority = Priority.MAJOR, description = "<p>Private methods that are never executed are dead code. " +
- "Dead code means unnecessary, inoperative code that should be removed. " +
- "This helps in maintenance by decreasing the maintained code size, " +
- "making it easier to understand the program and preventing bugs from being introduced.</p>" +
- "<p>In the following two cases, private methods are not considered as dead code by Sonar :</p>" +
- "<ul><li>Private empty constructors that are intentionally used to prevent any direct instantiation of a class.</li>" +
- "<li>Private methods : readObject(...), writeObject(...), writeReplace(...), readResolve(...) " +
- "which can contractually be used when implementing the Serializable interface.</li></ul>")
+@Rule(key = "UnusedPrivateMethod", priority = Priority.MAJOR)
public class UnusedPrivateMethodCheck extends BytecodeCheck {
private AsmClass asmClass;
@@ -47,7 +39,7 @@ public class UnusedPrivateMethodCheck extends BytecodeCheck {
@Override
public void visitMethod(AsmMethod asmMethod) {
- if (!asmMethod.isUsed() && asmMethod.isPrivate() && !asmMethod.isDefaultConstructor() && !SerializableContract.methodMatch(asmMethod)) {
+ if ( !asmMethod.isUsed() && asmMethod.isPrivate() && !asmMethod.isDefaultConstructor() && !SerializableContract.methodMatch(asmMethod)) {
CheckMessage message = new CheckMessage(this, "Private method '" + asmMethod.getName() + "(...)' is never used.");
SourceMethod sourceMethod = getSourceMethod(asmMethod);
if (sourceMethod != null) {
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedProtectedMethodCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedProtectedMethodCheck.java
index ea933b15184..a167205ae3b 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedProtectedMethodCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/bytecode/check/UnusedProtectedMethodCheck.java
@@ -27,15 +27,7 @@ import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
import org.sonar.squid.api.SourceMethod;
-@Rule(key = "UnusedProtectedMethod", name = "Unused protected method",
- priority = Priority.MAJOR, description = "<p>Protected methods that are never used by any classes " +
- "in the same project are strongly suspected to be dead code. "
- + "Dead code means unnecessary, inoperative code that should be removed. "
- + "This helps in maintenance by decreasing the maintained code size, "
- + "making it easier to understand the program and preventing bugs from being introduced.</p>"
- + "<p>In the following case, unused protected methods are not considered as dead code by Sonar :</p>"
- + "<ul><li>Protected methods which override a method from a parent class.</li></ul>"
- + "<ul><li>Protected methods of an abstract class.</li></ul>")
+@Rule(key = "UnusedProtectedMethod", priority = Priority.MAJOR)
public class UnusedProtectedMethodCheck extends BytecodeCheck {
private AsmClass asmClass;
@@ -47,7 +39,7 @@ public class UnusedProtectedMethodCheck extends BytecodeCheck {
@Override
public void visitMethod(AsmMethod asmMethod) {
- if (!asmMethod.isUsed() && asmMethod.isProtected() && !asmClass.isAbstract() && !SerializableContract.methodMatch(asmMethod)
+ if ( !asmMethod.isUsed() && asmMethod.isProtected() && !asmClass.isAbstract() && !SerializableContract.methodMatch(asmMethod)
&& !asmMethod.isInherited()) {
CheckMessage message = new CheckMessage(this, "Protected method '" + asmMethod.getName() + "(...)' is never used.");
SourceMethod sourceMethod = getSourceMethod(asmMethod);
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java
index 1f360273b95..94d2c6b261c 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/ClassComplexityCheck.java
@@ -28,20 +28,12 @@ import org.sonar.squid.api.SourceClass;
import org.sonar.squid.api.SourceFile;
import org.sonar.squid.measures.Metric;
-@Rule(key = "ClassCyclomaticComplexity", name = "Avoid too complex class",
- priority = Priority.MAJOR, description = "<p>The Cyclomatic Complexity is measured by the number of (&&, ||) operators "
- + "and (if, while, do, for, ?:, catch, switch, case, return, throw) statements in the body of a class plus one for "
- + "each constructor, method (but not getter/setter), static initializer, or instance initializer in the class. "
- + "The last return stament in method, if exists, is not taken into account.</p>"
- + "<p>Even when the Cyclomatic Complexity of a class is very high, this complexity might be well distributed among all methods. "
- + "Nevertheless, most of the time, a very complex class is a class which breaks the "
- + "<a href='http://en.wikipedia.org/wiki/Single_responsibility_principle'>Single Responsibility Principle</a> "
- + "and which should be re-factored to be split in several classes.</p>")
+@Rule(key = "ClassCyclomaticComplexity", priority = Priority.MAJOR)
public class ClassComplexityCheck extends SquidCheck {
public static final int DEFAULT_MAX = 200;
- @RuleProperty(description = "Maximum complexity allowed.", defaultValue = "" + DEFAULT_MAX)
+ @RuleProperty(defaultValue = "" + DEFAULT_MAX)
private Integer max = DEFAULT_MAX;
@Override
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java
index 9599cd0453b..846c4289a01 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/DITCheck.java
@@ -28,18 +28,12 @@ import org.sonar.squid.api.SourceClass;
import org.sonar.squid.api.SourceFile;
import org.sonar.squid.measures.Metric;
-@Rule(key = "MaximumInheritanceDepth", name = "Avoid too deep inheritance tree",
- priority = Priority.MAJOR, description = "<p>Inheritance is certainly one of the most valuable concept of object-oriented "
- + "programming. It's a way to compartmentalize and reuse code by creating collections of attributes and behaviors called "
- + "classes which can be based on previously created classes. But abusing of this concept by creating a deep inheritance tree "
- + "can lead to very complex and unmaintainable source code.</p>"
- + "<p>Most of the time a too deep inheritance tree is due to bad object oriented design which has led to systematically use "
- + "'inheritance' when 'composition' would suit better.</p>")
+@Rule(key = "MaximumInheritanceDepth", priority = Priority.MAJOR)
public class DITCheck extends SquidCheck {
public static final int DEFAULT_MAX = 5;
- @RuleProperty(description = "Maximum depth of the inheritance tree.", defaultValue = "" + DEFAULT_MAX)
+ @RuleProperty(defaultValue = "" + DEFAULT_MAX)
private Integer max = DEFAULT_MAX;
@Override
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/EmptyFileCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/EmptyFileCheck.java
index 9377f080c6a..1d46406943c 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/EmptyFileCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/EmptyFileCheck.java
@@ -26,8 +26,7 @@ import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
import org.sonar.squid.measures.Metric;
-@Rule(key = "EmptyFile", name = "Empty file", priority = Priority.MAJOR,
- description = "Detect empty files, which do not have any lines of code. Example: <pre>\n//package org.foo;\n//\n//public class Bar {}\n</pre>")
+@Rule(key = "EmptyFile", priority = Priority.MAJOR)
public final class EmptyFileCheck extends SquidCheck {
@Override
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java
index 0cbeb094367..69ada4e82ec 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/MethodComplexityCheck.java
@@ -28,20 +28,12 @@ import org.sonar.squid.api.SourceFile;
import org.sonar.squid.api.SourceMethod;
import org.sonar.squid.measures.Metric;
-@Rule(key = "MethodCyclomaticComplexity", name = "Avoid too complex method",
- priority = Priority.MAJOR, description = "<p>The Cyclomatic Complexity is measured by the number of (&&, ||) operators "
- + "and (if, while, do, for, ?:, catch, switch, case, return, throw) statements in the body of a constructor, "
- + "method, static initializer, or instance initializer. "
- + "The minimun Cyclomatic Complexity of a method is 1 and the last return stament, if exists, is not taken into account. "
- + "The more complex is a method, the more possible different paths through the source code exist. "
- + "Generally 1-4 is considered good, 5-7 ok, 8-10 consider re-factoring, and 11+ re-factor now. "
- + "Indeed above 10, it's pretty difficult to be able to think about all possible paths when maintaining the source code, "
- + "so the risk of regression increases exponentially.</p>")
+@Rule(key = "MethodCyclomaticComplexity", priority = Priority.MAJOR)
public class MethodComplexityCheck extends SquidCheck {
public static final int DEFAULT_MAX = 10;
- @RuleProperty(description = "Maximum complexity allowed.", defaultValue = "" + DEFAULT_MAX)
+ @RuleProperty(defaultValue = "" + DEFAULT_MAX)
private Integer max = DEFAULT_MAX;
@Override
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/NoSonarCheck.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/NoSonarCheck.java
index 1b329314b61..a55423352ac 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/NoSonarCheck.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/java/squid/check/NoSonarCheck.java
@@ -25,10 +25,7 @@ import org.sonar.check.Rule;
import org.sonar.squid.api.CheckMessage;
import org.sonar.squid.api.SourceFile;
-@Rule(key = "NoSonar", name = "Avoid use of //NOSONAR marker", priority = Priority.INFO,
- description = "<p>Any violation to quality rule can be deactivated with the //NOSONAR marker. This marker is pretty useful to exclude "
- + "false-positive results but sometimes it can abusively be used to hide real quality flaws.</p>"
- + "<p>This rule allows to track and/or forbid use of this marker</p>")
+@Rule(key = "NoSonar", priority = Priority.INFO)
public class NoSonarCheck extends SquidCheck {
@Override
diff --git a/plugins/sonar-surefire-plugin/pom.xml b/plugins/sonar-surefire-plugin/pom.xml
index 255db196006..7cd6d707563 100644
--- a/plugins/sonar-surefire-plugin/pom.xml
+++ b/plugins/sonar-surefire-plugin/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>../..</relativePath>
</parent>
diff --git a/pom.xml b/pom.xml
index adafc53d399..670a1365265 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
<packaging>pom</packaging>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<name>Sonar</name>
<url>http://www.sonarsource.org</url>
@@ -48,6 +48,7 @@
<module>plugins/sonar-cpd-plugin</module>
<module>plugins/sonar-squid-java-plugin</module>
<module>plugins/sonar-design-plugin</module>
+ <module>plugins/sonar-i18n-en-plugin</module>
</modules>
<organization>
@@ -123,7 +124,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
- <version>1.6</version>
+ <version>1.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -170,18 +171,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
- <version>2.5</version>
+ <version>2.6</version>
</plugin>
<plugin>
- <!-- not thread safe -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
- <version>1.0</version>
+ <version>1.0.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
- <version>2.6</version>
+ <version>2.9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -232,7 +232,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
- <version>2.4.3</version>
+ <version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -252,7 +252,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.6</version>
+ <version>2.9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -268,7 +268,7 @@
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId>
- <version>1.0</version>
+ <version>1.1</version>
<extensions>true</extensions>
</plugin>
</plugins>
@@ -420,6 +420,37 @@
<javadocDir>${project.reporting.outputDirectory}/${project.version}/apidocs</javadocDir>
</configuration>
</plugin>
+ <!-- check copyright/license headers -->
+ <plugin>
+ <inherited>false</inherited>
+ <groupId>com.mycila.maven-license-plugin</groupId>
+ <artifactId>maven-license-plugin</artifactId>
+ <configuration>
+ <header>${project.basedir}/copyright.txt</header>
+ <failIfMissing>true</failIfMissing>
+ <strictCheck>true</strictCheck>
+ <aggregate>true</aggregate>
+ <includes>
+ <include>**/sonar-*/src/main/java/**</include>
+ <include>**/sonar-*/src/test/java/**</include>
+ </includes>
+ <excludes>
+ <exclude>tests/**</exclude>
+ </excludes>
+ <mapping>
+ <java>SLASHSTAR_STYLE</java>
+ </mapping>
+ </configuration>
+ <executions>
+ <execution>
+ <id>enforce-license-headers</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
@@ -935,7 +966,7 @@
<scm>
<connection>scm:git:git@github.com:SonarSource/sonar.git</connection>
<developerConnection>scm:git:git@github.com:SonarSource/sonar.git</developerConnection>
- <url>git@github.com:SonarSource/sonar.git</url>
+ <url>https://github.com/SonarSource/sonar</url>
</scm>
<ciManagement>
@@ -1067,42 +1098,102 @@
</execution>
</executions>
</plugin>
-
-
- <!-- check copyright/license headers -->
- <plugin>
- <inherited>false</inherited>
- <groupId>com.mycila.maven-license-plugin</groupId>
- <artifactId>maven-license-plugin</artifactId>
- <configuration>
- <header>${project.basedir}/copyright.txt</header>
- <failIfMissing>true</failIfMissing>
- <strictCheck>true</strictCheck>
- <aggregate>true</aggregate>
- <includes>
- <include>**/sonar-*/src/main/java/**</include>
- <include>**/sonar-*/src/test/java/**</include>
- </includes>
- <excludes>
- <exclude>tests/**</exclude>
- </excludes>
- <mapping>
- <java>SLASHSTAR_STYLE</java>
- </mapping>
- </configuration>
- <executions>
- <execution>
- <id>enforce-license-headers</id>
- <phase>validate</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
</profile>
+
+ <profile>
+ <id>m2e</id>
+ <activation>
+ <!-- This profile is active only when used from Eclipse m2e and is used only to store settings. -->
+ <property>
+ <name>m2e.version</name>
+ </property>
+ </activation>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar-packaging-maven-plugin</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>check-dependencies</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar-dev-maven-plugin</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>trim</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>unpack</goal>
+ <goal>copy-dependencies</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>native2ascii-maven-plugin</artifactId>
+ <versionRange>[1.0-alpha-1,)</versionRange>
+ <goals>
+ <goal>native2ascii</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore></ignore>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/samples/checkstyle-extensions-plugin/pom.xml b/samples/checkstyle-extensions-plugin/pom.xml
index 9f982f9fde7..74801b1c481 100644
--- a/samples/checkstyle-extensions-plugin/pom.xml
+++ b/samples/checkstyle-extensions-plugin/pom.xml
@@ -19,6 +19,7 @@
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>${sonar.buildVersion}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>checkstyle</groupId>
diff --git a/samples/gwt-plugin/pom.xml b/samples/gwt-plugin/pom.xml
index abecb620c56..5882e577e84 100644
--- a/samples/gwt-plugin/pom.xml
+++ b/samples/gwt-plugin/pom.xml
@@ -14,12 +14,12 @@
<sonar.buildVersion>2.8</sonar.buildVersion>
</properties>
-
<dependencies>
<dependency>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>${sonar.buildVersion}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.sonar</groupId>
diff --git a/samples/pmd-extensions-plugin/pom.xml b/samples/pmd-extensions-plugin/pom.xml
index 80641f168c4..c773e7dfd92 100644
--- a/samples/pmd-extensions-plugin/pom.xml
+++ b/samples/pmd-extensions-plugin/pom.xml
@@ -19,6 +19,7 @@
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>${sonar.buildVersion}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>pmd</groupId>
diff --git a/samples/pom.xml b/samples/pom.xml
index 7f04aa665af..3b0669ea853 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<groupId>org.codehaus.sonar.samples</groupId>
diff --git a/samples/standard-plugin/pom.xml b/samples/standard-plugin/pom.xml
index d1692b5dc57..65cf9311728 100644
--- a/samples/standard-plugin/pom.xml
+++ b/samples/standard-plugin/pom.xml
@@ -19,6 +19,7 @@
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-plugin-api</artifactId>
<version>${sonar.buildVersion}</version>
+ <scope>provided</scope>
</dependency>
<!-- unit tests -->
diff --git a/sonar-application/pom.xml b/sonar-application/pom.xml
index b7dd5aacc11..32072863f92 100644
--- a/sonar-application/pom.xml
+++ b/sonar-application/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-application</artifactId>
<packaging>jar</packaging>
@@ -203,6 +203,12 @@
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>org.codehaus.sonar.plugins</groupId>
+ <artifactId>sonar-i18n-en-plugin</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>org.sonatype.jsw-binaries</groupId>
<artifactId>jsw-binaries</artifactId>
<version>3.2.3.6</version>
diff --git a/sonar-batch-bootstrapper/pom.xml b/sonar-batch-bootstrapper/pom.xml
index ef366801ef6..814fe1186b3 100644
--- a/sonar-batch-bootstrapper/pom.xml
+++ b/sonar-batch-bootstrapper/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-batch-bootstrapper</artifactId>
diff --git a/sonar-batch-maven-compat/pom.xml b/sonar-batch-maven-compat/pom.xml
index 50802593eb6..fd414742311 100644
--- a/sonar-batch-maven-compat/pom.xml
+++ b/sonar-batch-maven-compat/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-batch-maven-compat</artifactId>
diff --git a/sonar-batch/pom.xml b/sonar-batch/pom.xml
index b807e134a7a..89a6cb4fbaa 100644
--- a/sonar-batch/pom.xml
+++ b/sonar-batch/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<groupId>org.codehaus.sonar</groupId>
diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java
index 532848bb4f2..c54b8d6d126 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/ProjectModule.java
@@ -82,8 +82,6 @@ public class ProjectModule extends Module {
addComponent(TimeMachineConfiguration.class);
addComponent(org.sonar.api.database.daos.MeasuresDao.class);
addComponent(ProfilesDao.class);
- addComponent(AsyncMeasuresDao.class);
- addComponent(AsyncMeasuresService.class);
addComponent(DefaultRulesManager.class);
addComponent(DefaultSensorContext.class);
addComponent(Languages.class);
diff --git a/sonar-channel/pom.xml b/sonar-channel/pom.xml
index 5bba487bdb3..8a1fc5925f7 100644
--- a/sonar-channel/pom.xml
+++ b/sonar-channel/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>sonar-channel</artifactId>
diff --git a/sonar-check-api/pom.xml b/sonar-check-api/pom.xml
index 49891d8bc09..5c130b264db 100644
--- a/sonar-check-api/pom.xml
+++ b/sonar-check-api/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>sonar-check-api</artifactId>
diff --git a/sonar-colorizer/pom.xml b/sonar-colorizer/pom.xml
index 68490c727c7..8e55317bc21 100644
--- a/sonar-colorizer/pom.xml
+++ b/sonar-colorizer/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>sonar-colorizer</artifactId>
diff --git a/sonar-core-maven-plugin/pom.xml b/sonar-core-maven-plugin/pom.xml
index 060c219884a..562d722195c 100644
--- a/sonar-core-maven-plugin/pom.xml
+++ b/sonar-core-maven-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<!-- do not change, it's used when deploying in sonar internal repository -->
diff --git a/sonar-core/pom.xml b/sonar-core/pom.xml
index 375e32d3514..a7de1503e90 100644
--- a/sonar-core/pom.xml
+++ b/sonar-core/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-core</artifactId>
<name>Sonar :: Core</name>
diff --git a/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresDao.java b/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresDao.java
deleted file mode 100644
index 5f09d281a97..00000000000
--- a/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresDao.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.jpa.dao;
-
-import org.sonar.api.database.DatabaseSession;
-import org.sonar.api.database.model.AsyncMeasureSnapshot;
-import org.sonar.api.database.model.MeasureModel;
-import org.sonar.api.database.model.ResourceModel;
-import org.sonar.api.database.model.Snapshot;
-
-import javax.persistence.NoResultException;
-import javax.persistence.Query;
-import java.util.Date;
-import java.util.List;
-
-public class AsyncMeasuresDao extends BaseDao {
-
- public AsyncMeasuresDao(DatabaseSession session) {
- super(session);
- }
-
- public MeasureModel getAsyncMeasure(Long asyncMeasureId) {
- return getSession().getEntityManager().find(MeasureModel.class, asyncMeasureId);
- }
-
- public void deleteAsyncMeasure(MeasureModel asyncMeasure) {
- deleteAsyncMeasureSnapshots(asyncMeasure.getId());
- getSession().remove(asyncMeasure);
- }
-
- public Snapshot getPreviousSnapshot(Snapshot s) {
- try {
- return (Snapshot) getSession().createQuery(
- "SELECT s FROM Snapshot s " +
- "WHERE s.createdAt<:date " +
- "AND s.scope=:scope " +
- "AND s.resourceId=:resourceId " +
- "ORDER BY s.createdAt DESC")
- .setParameter("date", s.getCreatedAt())
- .setParameter("scope", s.getScope())
- .setParameter("resourceId", s.getResourceId())
- .setMaxResults(1)
- .getSingleResult();
- } catch (NoResultException ex) {
- return null;
- }
- }
-
- public List<Snapshot> getNextSnapshotsUntilDate(MeasureModel measure, Date date) {
- Query query = getSession().createQuery(
- "SELECT s FROM Snapshot s " +
- "WHERE s.resourceId=:projectId " +
- "AND s.createdAt>=:beginDate " +
- (date != null ? "AND s.createdAt<:endDate " : "") +
- "AND s.scope=:scope " +
- "ORDER BY s.createdAt ASC ")
- .setParameter("projectId", measure.getProjectId())
- .setParameter("beginDate", measure.getMeasureDate())
- .setParameter("scope", ResourceModel.SCOPE_PROJECT);
- if (date != null) {
- query.setParameter("endDate", date);
- }
- return query.getResultList();
- }
-
- public AsyncMeasureSnapshot createAsyncMeasureSnapshot(Long asyncMeasureId, Integer snapshotId, Date AsyncMeasureDate, Date snapshotDate, Integer metricId, Integer projectId) {
- AsyncMeasureSnapshot asyncMeasureSnapshot = new AsyncMeasureSnapshot(asyncMeasureId, snapshotId, AsyncMeasureDate, snapshotDate, metricId, projectId);
- getSession().save(asyncMeasureSnapshot);
- return asyncMeasureSnapshot;
- }
-
- public void updateAsyncMeasureSnapshot(AsyncMeasureSnapshot asyncMeasureSnapshot, Snapshot snapshot) {
- if (snapshot != null) {
- asyncMeasureSnapshot.setSnapshotId(snapshot.getId());
- asyncMeasureSnapshot.setSnapshotDate(snapshot.getCreatedAt());
- } else {
- asyncMeasureSnapshot.setSnapshotId(null);
- asyncMeasureSnapshot.setSnapshotDate(null);
- }
- getSession().merge(asyncMeasureSnapshot);
- }
-
- public void removeSnapshotFromAsyncMeasureSnapshot(AsyncMeasureSnapshot asyncMeasureSnapshot) {
- asyncMeasureSnapshot.setSnapshotId(null);
- asyncMeasureSnapshot.setSnapshotDate(null);
- getSession().merge(asyncMeasureSnapshot);
- }
-
-
- public AsyncMeasureSnapshot getNextAsyncMeasureSnapshot(Integer projetcId, Integer metricId, Date date) {
- try {
- return (AsyncMeasureSnapshot) getSession().createQuery(
- "SELECT ams FROM AsyncMeasureSnapshot ams " +
- "WHERE ams.projectId=:projectId " +
- "AND ams.metricId=:metricId " +
- "AND ams.measureDate>:date " +
- "ORDER BY ams.measureDate ASC")
- .setParameter("projectId", projetcId)
- .setParameter("metricId", metricId)
- .setParameter("date", date)
- .setMaxResults(1)
- .getSingleResult();
- } catch (NoResultException ex) {
- return null;
- }
- }
-
- public List<AsyncMeasureSnapshot> getNextAsyncMeasureSnapshotsUntilDate(MeasureModel asyncMeasure, Date endDate) {
- Query query = getSession().createQuery(
- "SELECT ams FROM AsyncMeasureSnapshot ams " +
- "WHERE ams.projectId=:projectId " +
- "AND ams.metricId=:metricId " +
- (endDate != null ? "AND ams.measureDate<:endDate " : "") +
- "AND ams.snapshotDate>=:measureDate " +
- "ORDER BY ams.snapshotDate ASC ")
- .setParameter("projectId", asyncMeasure.getProjectId())
- .setParameter("metricId", asyncMeasure.getMetricId())
- .setParameter("measureDate", asyncMeasure.getMeasureDate());
- if (endDate != null) {
- query.setParameter("endDate", endDate);
- }
- return query.getResultList();
- }
-
- public List<AsyncMeasureSnapshot> getPreviousAsyncMeasureSnapshots(Integer projectId, Date beginDate, Date endDate) {
- Query query = getSession().createQuery(
- "SELECT ams FROM AsyncMeasureSnapshot ams " +
- "WHERE ams.projectId=:projectId " +
- "AND ams.measureDate<=:endDate " +
- (beginDate != null ? "AND ams.measureDate>:beginDate " : "") +
- "AND ams.snapshotId IS NULL " +
- "ORDER BY ams.measureDate ASC")
- .setParameter("projectId", projectId)
- .setParameter("endDate", endDate);
- if (beginDate != null) {
- query.setParameter("beginDate", beginDate);
- }
- return query.getResultList();
- }
-
- public List<AsyncMeasureSnapshot> getAsyncMeasureSnapshotsFromSnapshotId(Integer snapshotId, List<Integer> metricIdsToExclude) {
- Query query = getSession().createQuery(
- "SELECT ams FROM AsyncMeasureSnapshot ams " +
- "WHERE ams.snapshotId=:snapshotId " +
- (!metricIdsToExclude.isEmpty() ? "AND ams.metricId NOT IN (:metricIdsToExclude) " : "") +
- "ORDER BY ams.measureDate ASC")
- .setParameter("snapshotId", snapshotId);
- if (!metricIdsToExclude.isEmpty()) {
- query.setParameter("metricIdsToExclude", metricIdsToExclude);
- }
- return query.getResultList();
- }
-
- public AsyncMeasureSnapshot getLastAsyncMeasureSnapshot(Integer projetcId, Integer metricId, Date date) {
- try {
- return (AsyncMeasureSnapshot) getSession().createQuery(
- "SELECT ams FROM AsyncMeasureSnapshot ams " +
- "WHERE ams.projectId=:projectId " +
- "AND ams.metricId=:metricId " +
- "AND ams.measureDate<:date " +
- "ORDER BY ams.measureDate DESC")
- .setParameter("projectId", projetcId)
- .setParameter("metricId", metricId)
- .setParameter("date", date)
- .setMaxResults(1)
- .getSingleResult();
- } catch (NoResultException ex) {
- return null;
- }
- }
-
- public void deleteAsyncMeasureSnapshots(Long asyncMeasureId) {
- getSession().createQuery(
- "DELETE FROM AsyncMeasureSnapshot ams WHERE ams.measureId=:measureId")
- .setParameter("measureId", asyncMeasureId)
- .executeUpdate();
- }
-
-}
diff --git a/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresService.java b/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresService.java
deleted file mode 100644
index e985ee3c614..00000000000
--- a/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresService.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.jpa.dao;
-
-import org.sonar.api.database.DatabaseSession;
-import org.sonar.api.database.model.AsyncMeasureSnapshot;
-import org.sonar.api.database.model.MeasureModel;
-import org.sonar.api.database.model.Snapshot;
-
-import java.util.*;
-
-public class AsyncMeasuresService {
- private final DatabaseSession session;
-
- public AsyncMeasuresService(DatabaseSession session) {
- this.session = session;
- }
-
- public void refresh(Snapshot snapshot) {
- AsyncMeasuresDao dao = new AsyncMeasuresDao(session);
- Snapshot previousSnapshot = dao.getPreviousSnapshot(snapshot);
- Date datePreviousSnapshot = (previousSnapshot != null ? previousSnapshot.getCreatedAt() : null);
-
- List<AsyncMeasureSnapshot> previousAsyncMeasureSnapshots = dao.getPreviousAsyncMeasureSnapshots(
- snapshot.getResourceId(), datePreviousSnapshot, snapshot.getCreatedAt());
- if (previousSnapshot != null) {
- previousAsyncMeasureSnapshots.addAll(dao.getAsyncMeasureSnapshotsFromSnapshotId(
- previousSnapshot.getId(), getMetricIds(previousAsyncMeasureSnapshots)));
- }
-
- for (AsyncMeasureSnapshot asyncMeasureSnapshot : purge(previousAsyncMeasureSnapshots)) {
- if (asyncMeasureSnapshot.getSnapshotId() == null) {
- dao.updateAsyncMeasureSnapshot(asyncMeasureSnapshot, snapshot);
- } else {
- dao.createAsyncMeasureSnapshot(
- asyncMeasureSnapshot.getMeasureId(), snapshot.getId(), asyncMeasureSnapshot.getMeasureDate(),
- snapshot.getCreatedAt(), asyncMeasureSnapshot.getMetricId(), asyncMeasureSnapshot.getProjectId());
- }
- }
- session.commit();
- }
-
- public void registerMeasure(Long id) {
- AsyncMeasuresDao dao = new AsyncMeasuresDao(session);
- registerMeasure(dao.getAsyncMeasure(id), dao);
- }
-
- private List<Integer> getMetricIds(List<AsyncMeasureSnapshot> list) {
- List<Integer> ids = new ArrayList<Integer>();
- for (AsyncMeasureSnapshot ams : list) {
- ids.add(ams.getMetricId());
- }
- return ids;
- }
-
- private Collection<AsyncMeasureSnapshot> purge(List<AsyncMeasureSnapshot> list) {
- Map<Integer, AsyncMeasureSnapshot> measuresById = new LinkedHashMap<Integer, AsyncMeasureSnapshot>();
- for (AsyncMeasureSnapshot currentAsyncMeasureSnapshot : list) {
- AsyncMeasureSnapshot asyncMeasureSnapshotFromMap = measuresById.get(currentAsyncMeasureSnapshot.getMetricId());
- if (asyncMeasureSnapshotFromMap != null) {
- if (asyncMeasureSnapshotFromMap.getMeasureDate().before(currentAsyncMeasureSnapshot.getMeasureDate())) {
- measuresById.put(currentAsyncMeasureSnapshot.getMetricId(), currentAsyncMeasureSnapshot);
- }
- } else {
- measuresById.put(currentAsyncMeasureSnapshot.getMetricId(), currentAsyncMeasureSnapshot);
- }
- }
- return measuresById.values();
- }
-
-
- public void deleteMeasure(Long id) {
- AsyncMeasuresDao dao = new AsyncMeasuresDao(session);
- MeasureModel measure = dao.getAsyncMeasure(id);
- AsyncMeasureSnapshot pastAsyncMeasureSnapshot = dao.getLastAsyncMeasureSnapshot(measure.getProjectId(),
- measure.getMetricId(), measure.getMeasureDate());
- dao.deleteAsyncMeasure(measure);
- if (pastAsyncMeasureSnapshot != null) {
- MeasureModel pastAsyncMeasure = dao.getAsyncMeasure(pastAsyncMeasureSnapshot.getMeasureId());
- dao.deleteAsyncMeasureSnapshots(pastAsyncMeasureSnapshot.getMeasureId());
- registerMeasure(pastAsyncMeasure, dao);
- }
- session.commit();
- }
-
- private void registerMeasure(MeasureModel measure, AsyncMeasuresDao dao) {
- AsyncMeasureSnapshot nextAsyncMeasureSnapshot = dao.getNextAsyncMeasureSnapshot(
- measure.getProjectId(), measure.getMetricId(), measure.getMeasureDate());
- Date dateNextAsyncMeasure = (nextAsyncMeasureSnapshot != null) ? nextAsyncMeasureSnapshot.getMeasureDate() : null;
-
- List<AsyncMeasureSnapshot> nextAsyncMeasureSnapshots = dao.getNextAsyncMeasureSnapshotsUntilDate(
- measure, dateNextAsyncMeasure);
- if (!nextAsyncMeasureSnapshots.isEmpty()) {
- for (AsyncMeasureSnapshot asyncMeasureSnapshot : nextAsyncMeasureSnapshots) {
- dao.createAsyncMeasureSnapshot(measure.getId(), asyncMeasureSnapshot.getSnapshotId(), measure.getMeasureDate(),
- asyncMeasureSnapshot.getSnapshotDate(), measure.getMetricId(), measure.getProjectId());
- dao.removeSnapshotFromAsyncMeasureSnapshot(asyncMeasureSnapshot);
- }
- } else {
- List<Snapshot> nextSnapshotsUntilDate = dao.getNextSnapshotsUntilDate(measure, dateNextAsyncMeasure);
- if (!nextSnapshotsUntilDate.isEmpty()) {
- for (Snapshot nextSnapshot : nextSnapshotsUntilDate) {
- dao.createAsyncMeasureSnapshot(measure.getId(), nextSnapshot.getId(), measure.getMeasureDate(),
- nextSnapshot.getCreatedAt(), measure.getMetricId(), measure.getProjectId());
- }
- } else {
- dao.createAsyncMeasureSnapshot(measure.getId(), null, measure.getMeasureDate(),
- null, measure.getMetricId(), measure.getProjectId());
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/sonar-core/src/main/java/org/sonar/jpa/dao/DaoFacade.java b/sonar-core/src/main/java/org/sonar/jpa/dao/DaoFacade.java
index fad86b13ce3..462f8752a81 100644
--- a/sonar-core/src/main/java/org/sonar/jpa/dao/DaoFacade.java
+++ b/sonar-core/src/main/java/org/sonar/jpa/dao/DaoFacade.java
@@ -23,14 +23,12 @@ public class DaoFacade {
private final RulesDao rulesDao;
private final MeasuresDao measuresDao;
- private final AsyncMeasuresDao asyncMeasureDao;
private final ProfilesDao profilesDao;
- public DaoFacade(ProfilesDao profilesDao, RulesDao rulesDao, MeasuresDao measuresDao, AsyncMeasuresDao asyncMeasureDao) {
+ public DaoFacade(ProfilesDao profilesDao, RulesDao rulesDao, MeasuresDao measuresDao) {
super();
this.rulesDao = rulesDao;
this.measuresDao = measuresDao;
- this.asyncMeasureDao = asyncMeasureDao;
this.profilesDao = profilesDao;
}
@@ -45,9 +43,4 @@ public class DaoFacade {
public MeasuresDao getMeasuresDao() {
return measuresDao;
}
-
- public AsyncMeasuresDao getAsyncMeasureDao() {
- return asyncMeasureDao;
- }
-
}
diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/ManualMeasure.java b/sonar-core/src/main/java/org/sonar/jpa/entity/ManualMeasure.java
new file mode 100644
index 00000000000..3e3544df582
--- /dev/null
+++ b/sonar-core/src/main/java/org/sonar/jpa/entity/ManualMeasure.java
@@ -0,0 +1,94 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.jpa.entity;
+
+import javax.persistence.*;
+import java.util.Date;
+
+@Entity
+@Table(name = "manual_measures")
+public final class ManualMeasure {
+ private static final int MAX_TEXT_SIZE = 4000;
+
+ @Id
+ @Column(name = "id")
+ @GeneratedValue
+ private Long id;
+
+ @Column(name = "value", updatable = true, nullable = true, precision = 30, scale = 20)
+ private Double value = null;
+
+ @Column(name = "text_value", updatable = true, nullable = true, length = MAX_TEXT_SIZE)
+ private String textValue;
+
+ @Column(name = "metric_id", updatable = false, nullable = false)
+ private Integer metricId;
+
+ @Column(name = "resource_id", updatable = true, nullable = true)
+ private Integer resourceId;
+
+ @Column(name = "description", updatable = true, nullable = true, length = MAX_TEXT_SIZE)
+ private String description;
+
+ @Column(name = "url", updatable = true, nullable = true, length = MAX_TEXT_SIZE)
+ private String url;
+
+ @Column(name = "created_at", updatable = true, nullable = true)
+ private Date createdAt;
+
+ @Column(name = "updated_at", updatable = true, nullable = true)
+ private Date updatedAt;
+
+ public Long getId() {
+ return id;
+ }
+
+ public Double getValue() {
+ return value;
+ }
+
+ public String getTextValue() {
+ return textValue;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public Integer getMetricId() {
+ return metricId;
+ }
+
+ public Integer getResourceId() {
+ return resourceId;
+ }
+
+ public Date getCreatedAt() {
+ return createdAt;
+ }
+
+ public Date getUpdatedAt() {
+ return updatedAt;
+ }
+}
diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/Review.java b/sonar-core/src/main/java/org/sonar/jpa/entity/Review.java
new file mode 100644
index 00000000000..54984c4baf5
--- /dev/null
+++ b/sonar-core/src/main/java/org/sonar/jpa/entity/Review.java
@@ -0,0 +1,67 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.jpa.entity;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name = "reviews")
+public final class Review {
+
+ @Id
+ @Column(name = "id")
+ @GeneratedValue
+ private Long id;
+
+ @Column(name = "user_id")
+ private Integer userId;
+
+ @Column(name = "assignee_id")
+ private Integer assigneeId;
+
+ @Column(name = "title")
+ private String title;
+
+ /**
+ * @return id of review
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * @return id of user, who created this review
+ */
+ public Integer getUserId() {
+ return userId;
+ }
+
+ /**
+ * @return id of assigned user or null, if not assigned
+ */
+ public Integer getAssigneeId() {
+ return assigneeId;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+}
diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
index b0251fe3da3..0a9a08813a0 100644
--- a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
+++ b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
@@ -40,7 +40,7 @@ public class SchemaMigration {
- complete the Derby DDL file used for unit tests : sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
*/
- public static final int LAST_VERSION = 203;
+ public static final int LAST_VERSION = 213;
public final static String TABLE_NAME = "schema_migrations";
diff --git a/sonar-core/src/main/resources/META-INF/persistence.xml b/sonar-core/src/main/resources/META-INF/persistence.xml
index 276b3f21cd9..bd7a593133d 100644
--- a/sonar-core/src/main/resources/META-INF/persistence.xml
+++ b/sonar-core/src/main/resources/META-INF/persistence.xml
@@ -7,6 +7,7 @@
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>org.sonar.jpa.entity.SchemaMigration</class>
+ <class>org.sonar.jpa.entity.ManualMeasure</class>
<class>org.sonar.api.database.configuration.Property</class>
<class>org.sonar.api.qualitymodel.Model</class>
<class>org.sonar.api.qualitymodel.Characteristic</class>
@@ -29,11 +30,11 @@
<class>org.sonar.api.profiles.RulesProfile</class>
<class>org.sonar.api.rules.ActiveRule</class>
<class>org.sonar.api.rules.ActiveRuleParam</class>
- <class>org.sonar.api.database.model.AsyncMeasureSnapshot</class>
<class>org.sonar.api.batch.Event</class>
<class>org.sonar.api.profiles.Alert</class>
<class>org.sonar.api.rules.ActiveRuleChange</class>
<class>org.sonar.api.rules.ActiveRuleParamChange</class>
+ <class>org.sonar.jpa.entity.Review</class>
<properties>
<property name="hibernate.current_session_context_class" value="thread"/>
diff --git a/sonar-core/src/test/java/org/sonar/jpa/dao/AsyncMeasuresDaoTest.java b/sonar-core/src/test/java/org/sonar/jpa/dao/AsyncMeasuresDaoTest.java
deleted file mode 100644
index ea86260a583..00000000000
--- a/sonar-core/src/test/java/org/sonar/jpa/dao/AsyncMeasuresDaoTest.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.jpa.dao;
-
-import org.junit.Test;
-import org.sonar.api.database.model.AsyncMeasureSnapshot;
-import org.sonar.api.database.model.MeasureModel;
-import org.sonar.api.database.model.ResourceModel;
-import org.sonar.api.database.model.Snapshot;
-import org.sonar.jpa.test.AbstractDbUnitTestCase;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class AsyncMeasuresDaoTest extends AbstractDbUnitTestCase {
-
- private static final int PROJECT_ID = 1;
- private static final int METRIC_ID = 1;
-
- @Test
- public void testGetNextAsyncMeasureSnapshot() {
- setupData("sharedFixture", "testGetNextAsyncMeasureSnapshot");
-
- AsyncMeasuresDao asyncMeasuresDao = new AsyncMeasuresDao(getSession());
- AsyncMeasureSnapshot asyncMeasure = asyncMeasuresDao.getNextAsyncMeasureSnapshot(
- PROJECT_ID, METRIC_ID, stringToDate("2008-12-04 08:00:00.00"));
-
- assertThat(asyncMeasure.getId(), is(3));
- }
-
- @Test
- public void testGetNextSnapshotsUntilDate() {
- setupData("sharedFixture", "testGetNextSnapshotsUntilDate");
-
- AsyncMeasuresDao asyncMeasuresDao = new AsyncMeasuresDao(getSession());
- MeasureModel asyncMeasure = getSession().getEntityManager().find(MeasureModel.class, 1l);
- List<Snapshot> snapshotIds = asyncMeasuresDao.getNextSnapshotsUntilDate(
- asyncMeasure, stringToDate("2008-12-06 12:00:00.00"));
-
- assertThat(snapshotIds.size(), is(2));
- assertThat(snapshotIds.get(0).getId(), is(2));
- assertThat(snapshotIds.get(1).getId(), is(4));
- }
-
- @Test
- public void testGetPreviousSnapshot() {
- setupData("sharedFixture", "testGetPreviousSnapshot");
- AsyncMeasuresDao asyncMeasuresDao = new AsyncMeasuresDao(getSession());
- Snapshot s = new Snapshot();
- s.setCreatedAt(stringToDate("2008-12-04 08:00:00.00"));
- s.setScope(ResourceModel.SCOPE_PROJECT);
- ResourceModel resource1 = getSession().getEntity(ResourceModel.class, 1);
- ResourceModel resource2 = getSession().getEntity(ResourceModel.class, 2);
-
- s.setResource(resource1);
- assertThat(asyncMeasuresDao.getPreviousSnapshot(s).getId(), is(1));
-
- s.setResource(resource2);
- assertThat(asyncMeasuresDao.getPreviousSnapshot(s).getId(), is(5));
- }
-
- @Test
- public void testGetNextAsyncMeasureSnapshotsUntilDate() {
- setupData("sharedFixture", "testGetNextAsyncMeasureSnapshotsUntilDate");
-
- AsyncMeasuresDao asyncMeasuresDao = new AsyncMeasuresDao(getSession());
- MeasureModel asyncMeasure = getSession().getEntityManager().find(MeasureModel.class, 3l);
- List<AsyncMeasureSnapshot> asyncMeasureSnapshots = asyncMeasuresDao.getNextAsyncMeasureSnapshotsUntilDate(
- asyncMeasure, stringToDate("2008-12-06 08:00:00.00"));
-
- assertThat(asyncMeasureSnapshots.size(), is(2));
- assertThat(asyncMeasureSnapshots.get(0).getId(), is(2));
- assertThat(asyncMeasureSnapshots.get(1).getId(), is(3));
- }
-
- @Test
- public void testDeleteAsyncMeasure() {
- setupData("sharedFixture", "testDeleteAsyncMeasure");
-
- AsyncMeasuresDao asyncMeasuresDao = new AsyncMeasuresDao(getSession());
- MeasureModel asyncMeasure = getSession().getEntityManager().find(MeasureModel.class, 1l);
- asyncMeasuresDao.deleteAsyncMeasure(asyncMeasure);
-
- getSession().commit();
- checkTables("testDeleteAsyncMeasure", "project_measures", "async_measure_snapshots");
- }
-
- @Test
- public void testGetAsyncMeasureSnapshotsFromSnapshotId() {
- setupData("sharedFixture", "testGetAsyncMeasureSnapshotsFromSnapshotId");
-
- AsyncMeasuresDao asyncMeasuresDao = new AsyncMeasuresDao(getSession());
- Integer snapshotId = 1;
- List<AsyncMeasureSnapshot> asyncMeasureSnapshots = asyncMeasuresDao.getAsyncMeasureSnapshotsFromSnapshotId(
- snapshotId, Arrays.asList(1));
- assertThat(asyncMeasureSnapshots.size(), is(1));
- assertThat(asyncMeasureSnapshots.get(0).getId(), is(2));
- }
-
- @Test
- public void testGetLastAsyncMeasureSnapshot() {
- setupData("sharedFixture", "testGetLastAsyncMeasureSnapshot");
-
- AsyncMeasuresDao asyncMeasuresDao = new AsyncMeasuresDao(getSession());
- AsyncMeasureSnapshot asyncMeasureSnapshot = asyncMeasuresDao.getLastAsyncMeasureSnapshot(
- PROJECT_ID, METRIC_ID, stringToDate("2008-12-04 12:00:00.00"));
- assertThat(asyncMeasureSnapshot.getId(), is(2));
- }
-
- @Test
- public void testDeleteAsyncMeasureSnapshots() {
- setupData("sharedFixture", "testDeleteAsyncMeasureSnapshots");
-
- AsyncMeasuresDao asyncMeasuresDao = new AsyncMeasuresDao(getSession());
- asyncMeasuresDao.deleteAsyncMeasureSnapshots(1l);
-
- checkTables("testDeleteAsyncMeasureSnapshots", "async_measure_snapshots");
- }
-
- @Test
- public void testGetPreviousAsyncMeasureSnapshots() {
- setupData("sharedFixture", "testGetPreviousAsyncMeasureSnapshots");
-
- AsyncMeasuresDao asyncMeasuresDao = new AsyncMeasuresDao(getSession());
- List<AsyncMeasureSnapshot> asyncMeasureSnapshots = asyncMeasuresDao.getPreviousAsyncMeasureSnapshots(
- PROJECT_ID, stringToDate("2008-12-04 08:00:00.00"), stringToDate("2008-12-08 08:00:00.00"));
- assertThat(asyncMeasureSnapshots.size(), is(2));
- assertThat(asyncMeasureSnapshots.get(0).getId(), is(5));
- assertThat(asyncMeasureSnapshots.get(1).getId(), is(6));
- }
-
-
- private static Date stringToDate(String sDate) {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SS");
- try {
- return sdf.parse(sDate);
- } catch (ParseException e) {
- throw new RuntimeException("Bad date format.");
- }
- }
-
-}
diff --git a/sonar-core/src/test/java/org/sonar/jpa/dao/AsyncMeasuresServiceTest.java b/sonar-core/src/test/java/org/sonar/jpa/dao/AsyncMeasuresServiceTest.java
deleted file mode 100644
index 7b936b5ee9f..00000000000
--- a/sonar-core/src/test/java/org/sonar/jpa/dao/AsyncMeasuresServiceTest.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.jpa.dao;
-
-import org.junit.Test;
-import org.sonar.api.database.model.Snapshot;
-import org.sonar.jpa.test.AbstractDbUnitTestCase;
-
-public class AsyncMeasuresServiceTest extends AbstractDbUnitTestCase {
-
- @Test
- public void assignLatestMeasuresToLastSnapshot() {
- setupData("sharedFixture", "assignLatestMeasuresToLastSnapshot");
-
- AsyncMeasuresService asyncMeasuresService = new AsyncMeasuresService(getSession());
- Snapshot snapshot = getSession().getEntityManager().find(Snapshot.class, 2);
- asyncMeasuresService.refresh(snapshot);
-
- checkTables("assignLatestMeasuresToLastSnapshot", "async_measure_snapshots");
- }
-
- @Test
- public void assignNewMeasuresToLastSnapshot() {
- setupData("sharedFixture", "assignNewMeasuresToLastSnapshot");
-
- AsyncMeasuresService asyncMeasuresService = new AsyncMeasuresService(getSession());
- Snapshot snapshot = getSession().getEntityManager().find(Snapshot.class, 2);
- asyncMeasuresService.refresh(snapshot);
-
- checkTables("assignNewMeasuresToLastSnapshot", "async_measure_snapshots");
- }
-
- @Test
- public void assignMeasuresWhenNoPreviousSnapshot() {
- setupData("sharedFixture", "assignMeasuresWhenNoPreviousSnapshot");
-
- AsyncMeasuresService asyncMeasuresService = new AsyncMeasuresService(getSession());
- Snapshot snapshot = getSession().getEntityManager().find(Snapshot.class, 1);
- asyncMeasuresService.refresh(snapshot);
-
- checkTables("assignMeasuresWhenNoPreviousSnapshot", "async_measure_snapshots");
- }
-
- @Test
- public void assignLatestMeasuresWhenNoPreviousSnapshot() {
- setupData("sharedFixture", "assignLatestMeasuresWhenNoPreviousSnapshot");
-
- AsyncMeasuresService asyncMeasuresService = new AsyncMeasuresService(getSession());
- Snapshot snapshot = getSession().getEntityManager().find(Snapshot.class, 1);
- asyncMeasuresService.refresh(snapshot);
-
- checkTables("assignLatestMeasuresWhenNoPreviousSnapshot", "async_measure_snapshots");
- }
-
- @Test
- public void assignPastMeasuresToPastSnapshot() {
- setupData("sharedFixture", "assignPastMeasuresToPastSnapshot");
-
- AsyncMeasuresService asyncMeasuresService = new AsyncMeasuresService(getSession());
- Snapshot snapshot = getSession().getEntityManager().find(Snapshot.class, 3);
- asyncMeasuresService.refresh(snapshot);
-
- checkTables("assignPastMeasuresToPastSnapshot", "async_measure_snapshots");
- }
-
- @Test
- public void assignNewMeasureToFutureSnapshots() {
- setupData("sharedFixture", "assignNewMeasureToFutureSnapshots");
-
- AsyncMeasuresService asyncMeasuresService = new AsyncMeasuresService(getSession());
- asyncMeasuresService.registerMeasure(2l);
-
- checkTables("assignNewMeasureToFutureSnapshots", "async_measure_snapshots");
- }
-
- @Test
- public void assignMeasureToFutureSnapshotsWithDifferentMetric() {
- setupData("sharedFixture", "assignMeasureToFutureSnapshotsWithDifferentMetric");
-
- AsyncMeasuresService asyncMeasureService = new AsyncMeasuresService(getSession());
- asyncMeasureService.registerMeasure(3l);
-
- checkTables("assignMeasureToFutureSnapshotsWithDifferentMetric", "async_measure_snapshots");
- }
-
- @Test
- public void assignAPastMeasureToNextSnapshotsWithDifferentMetric() {
- setupData("sharedFixture", "assignAPastMeasureToNextSnapshotsWithDifferentMetric");
-
- AsyncMeasuresService asyncMeasureService = new AsyncMeasuresService(getSession());
- asyncMeasureService.registerMeasure(2l);
-
- checkTables("assignAPastMeasureToNextSnapshotsWithDifferentMetric", "async_measure_snapshots");
- }
-
- @Test
- public void addFutureSnapshot() {
- setupData("sharedFixture", "addFutureSnapshot");
-
- AsyncMeasuresService asyncMeasureService = new AsyncMeasuresService(getSession());
- asyncMeasureService.registerMeasure(2l);
-
- checkTables("addFutureSnapshot", "async_measure_snapshots");
- }
-
- @Test
- public void addInvisibleMeasure() {
- setupData("sharedFixture", "addInvisibleMeasure");
-
- AsyncMeasuresService asyncMeasureService = new AsyncMeasuresService(getSession());
- asyncMeasureService.registerMeasure(2l);
-
- checkTables("addInvisibleMeasure", "async_measure_snapshots");
- }
-
- @Test
- public void deleteMeasure() {
- setupData("sharedFixture", "deleteMeasure");
-
- AsyncMeasuresService asyncMeasureService = new AsyncMeasuresService(getSession());
- asyncMeasureService.deleteMeasure(2l);
-
- checkTables("deleteMeasure", "async_measure_snapshots");
- }
-
- @Test
- public void deleteLastMeasure() {
- setupData("sharedFixture", "deleteLastMeasure");
-
- AsyncMeasuresService asyncMeasureService = new AsyncMeasuresService(getSession());
- asyncMeasureService.deleteMeasure(1l);
-
- checkTables("deleteLastMeasure", "async_measure_snapshots");
- }
-
-}
diff --git a/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java b/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java
index 834657bb7f9..d8f23f16b50 100644
--- a/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java
+++ b/sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java
@@ -82,7 +82,7 @@ public abstract class AbstractDbUnitTestCase {
public DaoFacade getDao() {
if (dao == null) {
- dao = new DaoFacade(new ProfilesDao(session), new RulesDao(session), new MeasuresDao(session), new AsyncMeasuresDao(session));
+ dao = new DaoFacade(new ProfilesDao(session), new RulesDao(session), new MeasuresDao(session));
}
return dao;
}
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/sharedFixture.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/sharedFixture.xml
deleted file mode 100644
index c748a030e3a..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/sharedFixture.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<dataset>
-
- <metrics id="1" name="foo" val_type="INT" description="[null]" domain="[null]"
- short_name="" qualitative="false" user_managed="false"
- enabled="false" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
- <metrics id="2" name="bar" val_type="INT" description="[null]" domain="[null]"
- short_name="" qualitative="false" user_managed="false"
- enabled="false" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
- <metrics id="3" name="boo" val_type="INT" description="[null]" domain="[null]"
- short_name="" qualitative="false" user_managed="false"
- enabled="false" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
- <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="mygroup:myartifact" name="[null]"
- root_id="[null]"
- description="[null]"
- enabled="true" language="java" copy_resource_id="[null]"/>
-
- <projects long_name="[null]" id="2" scope="PRJ" qualifier="TRK" kee="mygroup2:myartifact" name="[null]"
- root_id="[null]"
- description="[null]"
- enabled="true" language="java" copy_resource_id="[null]"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasure-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasure-result.xml
deleted file mode 100644
index 1905e69d94e..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasure-result.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<dataset>
-
- <!--<project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" id="1" project_id="1" metric_id="1" value="1" measure_date="2008-12-03 08:00:00.00" rule_id="[null]"-->
- <!--snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>-->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="5"
- measure_date="2008-12-06 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"
- alert_status="[null]" description="[null]"/>
-
-
- <!--<async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"-->
- <!--snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>-->
- <!--<async_measure_snapshots id="2" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 08:00:00.00"-->
- <!--snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>-->
- <!--<async_measure_snapshots id="3" project_measure_id="1" snapshot_id="3" measure_date="2008-12-03 08:00:00.00"-->
- <!--snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>-->
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="4" measure_date="2008-12-06 08:00:00.00"
- snapshot_date="2008-12-06 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasure.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasure.xml
deleted file mode 100644
index a31a3a3103f..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasure.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<dataset>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-03 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"
- alert_status="[null]" description="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="5"
- measure_date="2008-12-06 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"
- alert_status="[null]" description="[null]"/>
-
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="1" snapshot_id="3" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="4" measure_date="2008-12-06 08:00:00.00"
- snapshot_date="2008-12-06 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasureSnapshots-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasureSnapshots-result.xml
deleted file mode 100644
index a9371f88cc4..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasureSnapshots-result.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<dataset>
-
- <!--<async_measure_snapshots id="1" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-03 08:00:00.00"-->
- <!--snapshot_date="[null]" metric_id="1" project_id="1"/>-->
- <!--<async_measure_snapshots id="2" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 08:00:00.00"-->
- <!--snapshot_date="[null]" metric_id="1" project_id="1"/>-->
- <!--<async_measure_snapshots id="3" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-03 08:00:00.00"-->
- <!--snapshot_date="[null]" metric_id="1" project_id="1"/>-->
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="[null]" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="[null]" metric_id="2" project_id="1"/>
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasureSnapshots.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasureSnapshots.xml
deleted file mode 100644
index cf0a5f96390..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testDeleteAsyncMeasureSnapshots.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<dataset>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="[null]" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="[null]" metric_id="2" project_id="1"/>
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetAsyncMeasureSnapshotsFromSnapshotId.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetAsyncMeasureSnapshotsFromSnapshotId.xml
deleted file mode 100644
index f83aff294c3..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetAsyncMeasureSnapshotsFromSnapshotId.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-03 18:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"
- description="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="2" value="2"
- measure_date="2008-12-04 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"
- description="[null]"/>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 18:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="1" measure_date="2008-12-04 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="2" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetLastAsyncMeasureSnapshot.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetLastAsyncMeasureSnapshot.xml
deleted file mode 100644
index c449c6eef14..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetLastAsyncMeasureSnapshot.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<dataset>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="1" snapshot_id="2" measure_date="2008-12-04 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="1" snapshot_id="3" measure_date="2008-12-05 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="4" measure_date="2008-12-06 08:00:00.00"
- snapshot_date="2008-12-06 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextAsyncMeasureSnapshot.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextAsyncMeasureSnapshot.xml
deleted file mode 100644
index baba9aad126..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextAsyncMeasureSnapshot.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<dataset>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="1" snapshot_id="2" measure_date="2008-12-04 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="1" snapshot_id="3" measure_date="2008-12-05 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="4" measure_date="2008-12-06 08:00:00.00"
- snapshot_date="2008-12-06 12:00:00.00" metric_id="1" project_id="1"/>
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextAsyncMeasureSnapshotsUntilDate.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextAsyncMeasureSnapshotsUntilDate.xml
deleted file mode 100644
index ff8b246f66b..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextAsyncMeasureSnapshotsUntilDate.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="4" scope="PRJ" qualifier="TRK" created_at="2008-12-06 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-03 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"
- description="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="5"
- measure_date="2008-12-06 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"
- description="[null]"/>
- <!-- measure inserted on snapshot 2 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="3" project_id="1" metric_id="1" value="2"
- measure_date="2008-12-04 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"
- description="[null]"/>
-
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="1" snapshot_id="3" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="4" measure_date="2008-12-06 08:00:00.00"
- snapshot_date="2008-12-06 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextSnapshotsUntilDate.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextSnapshotsUntilDate.xml
deleted file mode 100644
index 096f1983d3b..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetNextSnapshotsUntilDate.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="FIL" qualifier="CLA" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="3" root_project_id="[null]" root_snapshot_id="3" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="4" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="5" scope="FIL" qualifier="CLA" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="4" root_project_id="[null]" root_snapshot_id="4" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="6" scope="PRJ" qualifier="TRK" created_at="2008-12-06 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-04 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"
- description="[null]"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetPreviousAsyncMeasureSnapshots.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetPreviousAsyncMeasureSnapshots.xml
deleted file mode 100644
index a268b957d61..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetPreviousAsyncMeasureSnapshots.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<dataset>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="2" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="2" measure_date="2008-12-04 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="2" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="3" snapshot_id="3" measure_date="2008-12-05 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="4" snapshot_id="4" measure_date="2008-12-06 08:00:00.00"
- snapshot_date="2008-12-06 12:00:00.00" metric_id="1" project_id="1"/>
-
- <async_measure_snapshots id="5" project_measure_id="5" snapshot_id="[null]" measure_date="2008-12-07 08:00:00.00"
- snapshot_date="[null]" metric_id="2" project_id="1"/>
- <async_measure_snapshots id="6" project_measure_id="6" snapshot_id="[null]" measure_date="2008-12-08 08:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="7" project_measure_id="7" snapshot_id="[null]" measure_date="2008-12-09 08:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetPreviousSnapshot.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetPreviousSnapshot.xml
deleted file mode 100644
index 115b532c994..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresDaoTest/testGetPreviousSnapshot.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="DIR" qualifier="PAC" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="1" root_project_id="[null]" root_snapshot_id="1" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="4" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="5" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="2"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addFutureSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addFutureSnapshot-result.xml
deleted file mode 100644
index 7a12ccd2074..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addFutureSnapshot-result.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- Assigned to first sanspshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-02 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- New measure, after last snapshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="5"
- measure_date="2008-12-04 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-02 12:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
-
- <!-- No snapshot attached -->
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="[null]" measure_date="2008-12-04 12:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addFutureSnapshot.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addFutureSnapshot.xml
deleted file mode 100644
index 4c2bea917dd..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addFutureSnapshot.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- Assigned to first sanspshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-02 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- New measure, after last snapshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="5"
- measure_date="2008-12-04 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-02 12:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addInvisibleMeasure-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addInvisibleMeasure-result.xml
deleted file mode 100644
index f10b82f86cd..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addInvisibleMeasure-result.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- Assigned to first sanspshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-02 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- New measure, just before first measure -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="50"
- measure_date="2008-12-02 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-02 12:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
-
- <!-- No snapshot attached -->
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="[null]" measure_date="2008-12-02 08:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addInvisibleMeasure.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addInvisibleMeasure.xml
deleted file mode 100644
index bca00e33772..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/addInvisibleMeasure.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- Assigned to first sanspshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-02 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- New measure, just before first measure -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="50"
- measure_date="2008-12-02 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-02 12:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignAPastMeasureToNextSnapshotsWithDifferentMetric-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignAPastMeasureToNextSnapshotsWithDifferentMetric-result.xml
deleted file mode 100644
index 7d20af58577..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignAPastMeasureToNextSnapshotsWithDifferentMetric-result.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- Assigned to snapshot 3 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-05 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- Past measure inserted, have to be assigned only to snapshot 1 and 2 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="8"
- measure_date="2008-12-03 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="3" measure_date="2008-12-05 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="2" snapshot_id="2" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignAPastMeasureToNextSnapshotsWithDifferentMetric.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignAPastMeasureToNextSnapshotsWithDifferentMetric.xml
deleted file mode 100644
index 74d8837d110..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignAPastMeasureToNextSnapshotsWithDifferentMetric.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- Assigned to snapshot 3 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-05 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- Past measure inserted, have to be assigned only to snapshot 1 and 2 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="8"
- measure_date="2008-12-03 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="3" measure_date="2008-12-05 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresToLastSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresToLastSnapshot-result.xml
deleted file mode 100644
index d881a39193f..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresToLastSnapshot-result.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<dataset>
-
- <!-- Previous snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <!-- New snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-02 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="2"
- measure_date="2008-12-02 10:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="3" project_id="1" metric_id="2" value="5"
- measure_date="2008-12-03 10:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <!-- Previous async_measure_snapshots, attached to first snapshot -->
- <async_measure_snapshots id="1" project_measure_id="2" snapshot_id="1" measure_date="2008-12-02 10:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="3" snapshot_id="1" measure_date="2008-12-03 10:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="2" project_id="1"/>
-
- <!--async_measure_snapshots from previous snapshot created for last snapshot -->
- <async_measure_snapshots id="3" project_measure_id="2" snapshot_id="2" measure_date="2008-12-02 10:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="3" snapshot_id="2" measure_date="2008-12-03 10:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="2" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresToLastSnapshot.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresToLastSnapshot.xml
deleted file mode 100644
index 13c290cb14d..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresToLastSnapshot.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<dataset>
-
- <!-- Previous snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <!-- New snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-02 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="2"
- measure_date="2008-12-02 10:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="3" project_id="1" metric_id="2" value="5"
- measure_date="2008-12-03 10:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <!-- Previous async_measure_snapshots, attached to first snapshot -->
- <async_measure_snapshots id="1" project_measure_id="2" snapshot_id="1" measure_date="2008-12-02 10:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="3" snapshot_id="1" measure_date="2008-12-03 10:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="2" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresWhenNoPreviousSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresWhenNoPreviousSnapshot-result.xml
deleted file mode 100644
index 99475dfb9d1..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresWhenNoPreviousSnapshot-result.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<dataset>
-
- <!-- new snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="2"
- measure_date="2008-12-02 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!--latest-->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="5"
- measure_date="2008-12-03 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="3" project_id="1" metric_id="2" value="6"
- measure_date="2008-12-02 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!--latest-->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="4" project_id="1" metric_id="2" value="7"
- measure_date="2008-12-03 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-02 12:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <!-- attached -->
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="1" measure_date="2008-12-03 12:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="3" snapshot_id="[null]" measure_date="2008-12-02 12:00:00.00"
- snapshot_date="[null]" metric_id="2" project_id="1"/>
- <!-- attached -->
- <async_measure_snapshots id="4" project_measure_id="4" snapshot_id="1" measure_date="2008-12-03 12:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="2" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresWhenNoPreviousSnapshot.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresWhenNoPreviousSnapshot.xml
deleted file mode 100644
index 7ea8aa5fbaa..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignLatestMeasuresWhenNoPreviousSnapshot.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<dataset>
-
- <!-- new snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="2"
- measure_date="2008-12-02 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!--latest-->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="5"
- measure_date="2008-12-03 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="3" project_id="1" metric_id="2" value="6"
- measure_date="2008-12-02 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!--latest-->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="4" project_id="1" metric_id="2" value="7"
- measure_date="2008-12-03 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-02 12:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="[null]" measure_date="2008-12-03 12:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="3" snapshot_id="[null]" measure_date="2008-12-02 12:00:00.00"
- snapshot_date="[null]" metric_id="2" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="4" snapshot_id="[null]" measure_date="2008-12-03 12:00:00.00"
- snapshot_date="[null]" metric_id="2" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasureToFutureSnapshotsWithDifferentMetric-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasureToFutureSnapshotsWithDifferentMetric-result.xml
deleted file mode 100644
index d2b62cbf6d8..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasureToFutureSnapshotsWithDifferentMetric-result.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="4" scope="PRJ" qualifier="TRK" created_at="2008-12-06 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- Assigned to snapshot 1, 2 and 3 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-03 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- Assigned to snapshot 4 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="8"
- measure_date="2008-12-06 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- To be assigned only to snapshot 2 and 3 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="3" project_id="1" metric_id="1" value="8"
- measure_date="2008-12-04 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <!-- Now assigned to no snapshot -->
- <async_measure_snapshots id="2" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <!-- Now assigned to no snapshot -->
- <async_measure_snapshots id="3" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="4" measure_date="2008-12-06 08:00:00.00"
- snapshot_date="2008-12-06 12:00:00.00" metric_id="1" project_id="1"/>
-
- <!-- Now assigned to review 3 -->
- <async_measure_snapshots id="5" project_measure_id="3" snapshot_id="2" measure_date="2008-12-04 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <!-- Now assigned to review 3 -->
- <async_measure_snapshots id="6" project_measure_id="3" snapshot_id="3" measure_date="2008-12-04 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
-
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasureToFutureSnapshotsWithDifferentMetric.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasureToFutureSnapshotsWithDifferentMetric.xml
deleted file mode 100644
index 9d343211f29..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasureToFutureSnapshotsWithDifferentMetric.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="4" scope="PRJ" qualifier="TRK" created_at="2008-12-06 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- Assigned to snapshot 1, 2 and 3 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-03 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- Assigned to snapshot 4 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="8"
- measure_date="2008-12-06 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- To be assigned only to snapshot 2 and 3 -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="3" project_id="1" metric_id="1" value="8"
- measure_date="2008-12-04 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="1" snapshot_id="3" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="4" measure_date="2008-12-06 08:00:00.00"
- snapshot_date="2008-12-06 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasuresWhenNoPreviousSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasuresWhenNoPreviousSnapshot-result.xml
deleted file mode 100644
index f8df127f391..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasuresWhenNoPreviousSnapshot-result.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="2"
- measure_date="2008-12-03 14:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="2" value="5"
- measure_date="2008-12-03 15:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 14:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="1" measure_date="2008-12-03 15:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="2" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasuresWhenNoPreviousSnapshot.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasuresWhenNoPreviousSnapshot.xml
deleted file mode 100644
index 036b21882df..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignMeasuresWhenNoPreviousSnapshot.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="2"
- measure_date="2008-12-03 14:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="2" value="5"
- measure_date="2008-12-03 15:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-03 14:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="[null]" measure_date="2008-12-03 15:00:00.00"
- snapshot_date="[null]" metric_id="2" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasureToFutureSnapshots-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasureToFutureSnapshots-result.xml
deleted file mode 100644
index 36a166be735..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasureToFutureSnapshots-result.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="10"
- measure_date="2008-12-03 8:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- New measure -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="8"
- measure_date="2008-12-04 8:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 8:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
-
- <!-- Now assigned to no snapshot -->
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="[null]" measure_date="2008-12-03 8:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="3" snapshot_id="[null]" measure_date="2008-12-03 8:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
-
- <!-- Now assigned to snapshot 2 and 3 -->
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="2" measure_date="2008-12-04 8:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="5" project_measure_id="2" snapshot_id="3" measure_date="2008-12-04 8:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasureToFutureSnapshots.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasureToFutureSnapshots.xml
deleted file mode 100644
index 5478f7f10bc..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasureToFutureSnapshots.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="10"
- measure_date="2008-12-03 8:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- New measure -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="8"
- measure_date="2008-12-04 8:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 8:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="2" measure_date="2008-12-03 8:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="3" snapshot_id="3" measure_date="2008-12-03 8:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasuresToLastSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasuresToLastSnapshot-result.xml
deleted file mode 100644
index 977d0365d79..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasuresToLastSnapshot-result.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<dataset>
-
- <!-- Previous snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <!-- New snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- Assigned to first sanspshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-02 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <!-- Assigmed to no snapshot, because its new reviews -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="2"
- measure_date="2008-12-03 18:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="3" project_id="1" metric_id="2" value="5"
- measure_date="2008-12-04 10:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <!-- async_measure_snapshots attached to first snapshot -->
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-02 12:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
-
- <!-- async_measure_snapshots now attached to last snapshot -->
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="2" measure_date="2008-12-03 18:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="3" snapshot_id="2" measure_date="2008-12-04 10:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="2" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasuresToLastSnapshot.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasuresToLastSnapshot.xml
deleted file mode 100644
index c73190edccd..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignNewMeasuresToLastSnapshot.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<dataset>
-
- <!-- Previous snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <!-- New snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"/>
-
- <!-- Assigned to first sanspshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-02 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <!-- Assigmed to no snapshot, because its new reviews -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="2"
- measure_date="2008-12-03 18:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="3" project_id="1" metric_id="2" value="5"
- measure_date="2008-12-04 10:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <!-- async_measure_snapshots attached to first snapshot -->
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-02 12:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
-
- <!-- async_measure_snapshots attached to no snapshot -->
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="[null]" measure_date="2008-12-03 18:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="3" snapshot_id="[null]" measure_date="2008-12-04 10:00:00.00"
- snapshot_date="[null]" metric_id="2" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignPastMeasuresToPastSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignPastMeasuresToPastSnapshot-result.xml
deleted file mode 100644
index 04ea0cd38d6..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignPastMeasuresToPastSnapshot-result.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<dataset>
-
- <!-- First snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-02 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <!-- Last snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- New snapshot, inserted between last two -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
-
- <!-- reviews attached to first snapshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-01 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- reviews attached to last snapshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="5"
- measure_date="2008-12-04 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <!-- async_measure_snapshots attached to first snapshot -->
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-01 12:00:00.00"
- snapshot_date="2008-12-02 12:00:00.00" metric_id="1" project_id="1"/>
- <!-- async_measure_snapshots attached to last snapshot -->
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="2" measure_date="2008-12-04 12:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
-
-
- <!-- async_measure_snapshots created for the new snapshot -->
- <async_measure_snapshots id="3" project_measure_id="1" snapshot_id="3" measure_date="2008-12-01 12:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignPastMeasuresToPastSnapshot.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignPastMeasuresToPastSnapshot.xml
deleted file mode 100644
index 1916d0b87f4..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/assignPastMeasuresToPastSnapshot.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<dataset>
-
- <!-- First snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-02 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <!-- Last snapshot -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!-- New snapshot, inserted between last two -->
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
-
- <!-- reviews attached to first snapshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-01 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- reviews attached to last snapshot -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="5"
- measure_date="2008-12-04 12:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <!-- async_measure_snapshots attached to first snapshot -->
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="1" measure_date="2008-12-01 12:00:00.00"
- snapshot_date="2008-12-02 12:00:00.00" metric_id="1" project_id="1"/>
- <!-- async_measure_snapshots attached to last snapshot -->
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="2" measure_date="2008-12-04 12:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteLastMeasure-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteLastMeasure-result.xml
deleted file mode 100644
index bbfd4845003..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteLastMeasure-result.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <!--<project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" id="1" project_id="1" metric_id="1" value="12" measure_date="2008-12-03 10:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>-->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="8"
- measure_date="2008-12-04 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
-
- <!--<async_measure_snapshots id="1" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 10:00:00.00"-->
- <!--snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>-->
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="3" measure_date="2008-12-04 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteLastMeasure.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteLastMeasure.xml
deleted file mode 100644
index d0a260f60f1..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteLastMeasure.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="12"
- measure_date="2008-12-03 10:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="8"
- measure_date="2008-12-04 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 10:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="2" project_measure_id="2" snapshot_id="3" measure_date="2008-12-04 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteMeasure-result.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteMeasure-result.xml
deleted file mode 100644
index ed2be1cb346..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteMeasure-result.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-03 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- async measure to be deleted -->
- <!--<project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" id="2" project_id="1" metric_id="1" value="2" measure_date="2008-12-05 08:00:00.00" rule_id="[null]"-->
- <!--snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>-->
-
- <!-- old async measure snapshots -->
- <!--<async_measure_snapshots id="1" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-03 08:00:00.00"-->
- <!--snapshot_date="[null]" metric_id="1" project_id="1" />-->
-
- <!--<async_measure_snapshots id="2" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"-->
- <!--snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1" />-->
- <!--<async_measure_snapshots id="3" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 08:00:00.00"-->
- <!--snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1" />-->
- <!--<async_measure_snapshots id="4" project_measure_id="2" snapshot_id="3" measure_date="2008-12-05 08:00:00.00"-->
- <!--snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1" />-->
-
- <async_measure_snapshots id="5" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="6" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="7" project_measure_id="1" snapshot_id="3" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteMeasure.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteMeasure.xml
deleted file mode 100644
index 17b279547f2..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/deleteMeasure.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<dataset>
-
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="1" scope="PRJ" qualifier="TRK" created_at="2008-12-03 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="2" scope="PRJ" qualifier="TRK" created_at="2008-12-04 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
- <snapshots period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" depth="[null]" id="3" scope="PRJ" qualifier="TRK" created_at="2008-12-05 12:00:00.00" version="[null]"
- project_id="1"
- parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="true"
- path="[null]"/>
-
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="1" project_id="1" metric_id="1" value="1"
- measure_date="2008-12-03 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
- <!-- async measure to be deleted -->
- <project_measures characteristic_id="[null]" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]"
- rule_priority="[null]"
- alert_text="[null]" id="2" project_id="1" metric_id="1" value="2"
- measure_date="2008-12-05 08:00:00.00" rule_id="[null]"
- snapshot_id="[null]" rules_category_id="[null]" text_value="[null]" tendency="[null]"/>
-
- <!-- old async measure snapshots -->
- <async_measure_snapshots id="1" project_measure_id="1" snapshot_id="[null]" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="[null]" metric_id="1" project_id="1"/>
-
- <async_measure_snapshots id="2" project_measure_id="1" snapshot_id="1" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-03 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="3" project_measure_id="1" snapshot_id="2" measure_date="2008-12-03 08:00:00.00"
- snapshot_date="2008-12-04 12:00:00.00" metric_id="1" project_id="1"/>
- <async_measure_snapshots id="4" project_measure_id="2" snapshot_id="3" measure_date="2008-12-05 08:00:00.00"
- snapshot_date="2008-12-05 12:00:00.00" metric_id="1" project_id="1"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/sharedFixture.xml b/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/sharedFixture.xml
deleted file mode 100644
index d1a6b09be2f..00000000000
--- a/sonar-core/src/test/resources/org/sonar/jpa/dao/AsyncMeasuresServiceTest/sharedFixture.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<dataset>
-
- <metrics id="1" name="foo" val_type="INT" description="[null]" domain="[null]"
- short_name="" qualitative="false" user_managed="false" enabled="false" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
- <metrics id="2" name="bar" val_type="INT" description="[null]" domain="[null]"
- short_name="" qualitative="false" user_managed="false" enabled="false" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/>
-
- <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="mygroup:myartifact" name="[null]"
- root_id="[null]"
- description="[null]"
- enabled="true" language="java" copy_resource_id="[null]"/>
-
-</dataset> \ No newline at end of file
diff --git a/sonar-deprecated/pom.xml b/sonar-deprecated/pom.xml
index e76c9e7684a..3675c1cd81a 100644
--- a/sonar-deprecated/pom.xml
+++ b/sonar-deprecated/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-deprecated</artifactId>
<name>Sonar :: Deprecated</name>
diff --git a/sonar-duplications/pom.xml b/sonar-duplications/pom.xml
index 79e7971b910..3325290dfd6 100644
--- a/sonar-duplications/pom.xml
+++ b/sonar-duplications/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-duplications</artifactId>
<name>Sonar :: Duplications</name>
diff --git a/sonar-graph/pom.xml b/sonar-graph/pom.xml
index f64930cfe0a..31c82aba65f 100644
--- a/sonar-graph/pom.xml
+++ b/sonar-graph/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<groupId>org.codehaus.sonar</groupId>
diff --git a/sonar-gwt-api/pom.xml b/sonar-gwt-api/pom.xml
index 2ebbe5a59ed..659191e3ee8 100644
--- a/sonar-gwt-api/pom.xml
+++ b/sonar-gwt-api/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-gwt-api</artifactId>
<packaging>jar</packaging>
diff --git a/sonar-java-api/pom.xml b/sonar-java-api/pom.xml
index a61248af2e0..42ba5c7932d 100644
--- a/sonar-java-api/pom.xml
+++ b/sonar-java-api/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-java-api</artifactId>
<name>Sonar :: Java API</name>
@@ -16,13 +16,8 @@
<!-- unit tests -->
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
+ <groupId>org.codehaus.sonar</groupId>
+ <artifactId>sonar-testing-harness</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java b/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java
index b3cc844574b..03951cc9dac 100644
--- a/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java
+++ b/sonar-java-api/src/main/java/org/sonar/java/api/JavaUtils.java
@@ -47,10 +47,20 @@ public final class JavaUtils {
public static final String JAVA_SOURCE_PROPERTY = "sonar.java.source";
/**
+ * Default value for property {@link #JAVA_SOURCE_PROPERTY}.
+ */
+ public static final String JAVA_SOURCE_DEFAULT_VALUE = "1.5";
+
+ /**
* To determine value of this property use {@link #getTargetVersion(Project)}.
*/
public static final String JAVA_TARGET_PROPERTY = "sonar.java.target";
+ /**
+ * Default value for property {@link #JAVA_TARGET_PROPERTY}.
+ */
+ public static final String JAVA_TARGET_DEFAULT_VALUE = "1.5";
+
private JavaUtils() {
// only static methods
}
@@ -68,16 +78,12 @@ public final class JavaUtils {
}
public static String getSourceVersion(Project project) {
- if (project.getConfiguration() != null) {
- return project.getConfiguration().getString(JAVA_SOURCE_PROPERTY);
- }
- return null;
+ String version = project.getConfiguration() != null ? project.getConfiguration().getString(JAVA_SOURCE_PROPERTY) : null;
+ return StringUtils.isNotBlank(version) ? version : JAVA_SOURCE_DEFAULT_VALUE;
}
public static String getTargetVersion(Project project) {
- if (project.getConfiguration() != null) {
- return project.getConfiguration().getString(JAVA_TARGET_PROPERTY);
- }
- return null;
+ String version = project.getConfiguration() != null ? project.getConfiguration().getString(JAVA_TARGET_PROPERTY) : null;
+ return StringUtils.isNotBlank(version) ? version : JAVA_TARGET_DEFAULT_VALUE;
}
}
diff --git a/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java b/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java
index 5cf2aecc0ea..e55e76205b8 100644
--- a/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java
+++ b/sonar-java-api/src/test/java/org/sonar/java/api/JavaUtilsTest.java
@@ -19,11 +19,13 @@
*/
package org.sonar.java.api;
-import org.junit.Test;
-
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
+import org.apache.commons.configuration.BaseConfiguration;
+import org.junit.Test;
+import org.sonar.api.resources.Project;
+
public class JavaUtilsTest {
@Test
@@ -36,4 +38,25 @@ public class JavaUtilsTest {
assertThat(JavaUtils.abbreviatePackage("com.foo."), is("com.f"));
assertThat(JavaUtils.abbreviatePackage("com.foo..bar"), is("com.f.b"));
}
+
+ @Test
+ public void shouldReturnDefaultJavaVersion() {
+ BaseConfiguration configuration = new BaseConfiguration();
+ Project project = new Project("").setConfiguration(configuration);
+
+ assertThat(JavaUtils.getSourceVersion(project), is("1.5"));
+ assertThat(JavaUtils.getTargetVersion(project), is("1.5"));
+ }
+
+ @Test
+ public void shouldReturnSpecifiedJavaVersion() {
+ BaseConfiguration configuration = new BaseConfiguration();
+ Project project = new Project("").setConfiguration(configuration);
+ configuration.setProperty(JavaUtils.JAVA_SOURCE_PROPERTY, "1.4");
+ configuration.setProperty(JavaUtils.JAVA_TARGET_PROPERTY, "1.6");
+
+ assertThat(JavaUtils.getSourceVersion(project), is("1.4"));
+ assertThat(JavaUtils.getTargetVersion(project), is("1.6"));
+ }
+
}
diff --git a/sonar-markdown/pom.xml b/sonar-markdown/pom.xml
index f32a090f92d..49eb119a576 100644
--- a/sonar-markdown/pom.xml
+++ b/sonar-markdown/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>sonar-markdown</artifactId>
diff --git a/sonar-maven-plugin/pom.xml b/sonar-maven-plugin/pom.xml
index 4e1d196f189..141b9929000 100644
--- a/sonar-maven-plugin/pom.xml
+++ b/sonar-maven-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
diff --git a/sonar-maven3-plugin/pom.xml b/sonar-maven3-plugin/pom.xml
index f95465ff9ac..76e65d0fbd1 100644
--- a/sonar-maven3-plugin/pom.xml
+++ b/sonar-maven3-plugin/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-maven3-plugin</artifactId>
<packaging>maven-plugin</packaging>
diff --git a/sonar-plugin-api/pom.xml b/sonar-plugin-api/pom.xml
index b803fb9bd52..dfb994003a5 100644
--- a/sonar-plugin-api/pom.xml
+++ b/sonar-plugin-api/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-plugin-api</artifactId>
<packaging>jar</packaging>
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/AsyncMeasureSnapshot.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/AsyncMeasureSnapshot.java
deleted file mode 100644
index 2abee562b20..00000000000
--- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/AsyncMeasureSnapshot.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.api.database.model;
-
-import org.apache.commons.lang.builder.EqualsBuilder;
-import org.apache.commons.lang.builder.HashCodeBuilder;
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.sonar.api.database.BaseIdentifiable;
-
-import java.util.Date;
-import javax.persistence.*;
-
-/**
- * Class to map an aysync measure with hibernate model
- */
-@Entity
-@Table(name = "async_measure_snapshots")
-public class AsyncMeasureSnapshot extends BaseIdentifiable {
-
- @Column(name = "project_measure_id", updatable = true, nullable = true)
- private Long measureId;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "measure_date", updatable = true, nullable = true)
- private Date measureDate;
-
- @Column(name = "snapshot_id", updatable = true, nullable = true)
- private Integer snapshotId;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "snapshot_date", updatable = true, nullable = true)
- private Date snapshotDate;
-
- @Column(name = "metric_id", updatable = true, nullable = true)
- private Integer metricId;
-
- @Column(name = "project_id", updatable = true, nullable = true)
- private Integer projectId;
-
- /**
- * This is the constructor to use
- *
- * @param measureId
- * @param snapshotId the snapshot id to which the measure is attached
- * @param measureDate the date of the measure
- * @param snapshotDate the snapshot date
- * @param metricId the metric the measure is attached to
- * @param projectId the id of the project
- */
- public AsyncMeasureSnapshot(Long measureId, Integer snapshotId, Date measureDate, Date snapshotDate, Integer metricId, Integer projectId) {
- this.measureId = measureId;
- this.measureDate = measureDate;
- this.snapshotId = snapshotId;
- this.snapshotDate = snapshotDate;
- this.projectId = projectId;
- this.metricId = metricId;
- }
-
- /**
- * Default constructor
- */
- public AsyncMeasureSnapshot() {
- }
-
- public Long getMeasureId() {
- return measureId;
- }
-
- public void setMeasureId(Long measureId) {
- this.measureId = measureId;
- }
-
- public Integer getSnapshotId() {
- return snapshotId;
- }
-
- public void setSnapshotId(Integer snapshotId) {
- this.snapshotId = snapshotId;
- }
-
- public Date getMeasureDate() {
- return measureDate;
- }
-
- public void setMeasureDate(Date measureDate) {
- this.measureDate = measureDate;
- }
-
- public Date getSnapshotDate() {
- return snapshotDate;
- }
-
- public void setSnapshotDate(Date snapshotDate) {
- this.snapshotDate = snapshotDate;
- }
-
- public Integer getMetricId() {
- return metricId;
- }
-
- public void setMetricId(Integer metricId) {
- this.metricId = metricId;
- }
-
- public Integer getProjectId() {
- return projectId;
- }
-
- public void setProjectId(Integer projectId) {
- this.projectId = projectId;
- }
-
- public void setMeasure(MeasureModel measure) {
- setMeasureId(measure.getId());
- setMeasureDate(measure.getMeasureDate());
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof AsyncMeasureSnapshot)) {
- return false;
- }
- if (this == obj) {
- return true;
- }
- AsyncMeasureSnapshot other = (AsyncMeasureSnapshot) obj;
- return new EqualsBuilder()
- .append(measureId, other.getMeasureId())
- .append(measureDate, other.getMeasureDate())
- .append(snapshotId, other.getSnapshotId())
- .append(snapshotDate, other.getSnapshotDate())
- .isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder(17, 37)
- .append(measureId)
- .append(measureDate)
- .append(snapshotDate)
- .append(snapshotId)
- .toHashCode();
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this)
- .append("id", getId())
- .append("measureId", measureId)
- .append("measureDate", measureDate)
- .append("snapshotId", snapshotId)
- .append("snapshotDate", snapshotDate)
- .toString();
- }
-}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java
index bf89e3f8d6a..a88932b6ae3 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/resources/ProjectUtils.java
@@ -20,6 +20,7 @@
package org.sonar.api.resources;
import com.google.common.collect.Lists;
+import org.apache.commons.lang.StringUtils;
import java.util.Collection;
import java.util.List;
@@ -41,10 +42,8 @@ public final class ProjectUtils {
*/
@Deprecated
public static String getJavaVersion(Project project) {
- if (project.getConfiguration() != null) {
- return project.getConfiguration().getString("sonar.java.target");
- }
- return null;
+ String version = project.getConfiguration() != null ? project.getConfiguration().getString("sonar.java.target") : null;
+ return StringUtils.isNotBlank(version) ? version : "1.5";
}
/**
@@ -52,10 +51,8 @@ public final class ProjectUtils {
*/
@Deprecated
public static String getJavaSourceVersion(Project project) {
- if (project.getConfiguration() != null) {
- return project.getConfiguration().getString("sonar.java.source");
- }
- return null;
+ String version = project.getConfiguration() != null ? project.getConfiguration().getString("sonar.java.source") : null;
+ return StringUtils.isNotBlank(version) ? version : "1.5";
}
/**
diff --git a/sonar-server/pom.xml b/sonar-server/pom.xml
index cc87d53cef3..53441136766 100644
--- a/sonar-server/pom.xml
+++ b/sonar-server/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-server</artifactId>
<packaging>war</packaging>
@@ -448,6 +448,12 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.sonar.plugins</groupId>
+ <artifactId>sonar-i18n-en-plugin</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</profile>
diff --git a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java
index 3f3ee2f382c..6afe5f7d449 100644
--- a/sonar-server/src/main/java/org/sonar/server/platform/Platform.java
+++ b/sonar-server/src/main/java/org/sonar/server/platform/Platform.java
@@ -162,11 +162,9 @@ public final class Platform {
servicesContainer.as(Characteristics.NO_CACHE).addComponent(MeasuresDao.class);
servicesContainer.as(Characteristics.NO_CACHE).addComponent(org.sonar.api.database.daos.MeasuresDao.class);
servicesContainer.as(Characteristics.NO_CACHE).addComponent(ProfilesDao.class);
- servicesContainer.as(Characteristics.NO_CACHE).addComponent(AsyncMeasuresDao.class);
servicesContainer.as(Characteristics.NO_CACHE).addComponent(DaoFacade.class);
servicesContainer.as(Characteristics.NO_CACHE).addComponent(DefaultRulesManager.class);
servicesContainer.as(Characteristics.NO_CACHE).addComponent(ProfilesManager.class);
- servicesContainer.as(Characteristics.NO_CACHE).addComponent(AsyncMeasuresService.class);
servicesContainer.as(Characteristics.NO_CACHE).addComponent(Backup.class);
servicesContainer.as(Characteristics.CACHE).addComponent(AuthenticatorFactory.class);
servicesContainer.as(Characteristics.CACHE).addComponent(ServerLifecycleNotifier.class);
diff --git a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
index 7e1e99c67cc..8c60ad0fab7 100644
--- a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
+++ b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
@@ -32,7 +32,6 @@ import org.sonar.api.rules.RulePriority;
import org.sonar.api.rules.RuleRepository;
import org.sonar.api.utils.ValidationMessages;
import org.sonar.api.web.*;
-import org.sonar.jpa.dao.AsyncMeasuresService;
import org.sonar.jpa.dialect.Dialect;
import org.sonar.jpa.session.DatabaseConnector;
import org.sonar.markdown.Markdown;
@@ -261,22 +260,10 @@ public final class JRubyFacade {
return getContainer().getComponent(Backup.class);
}
- public void registerAsyncMeasure(long asyncMeasureId) {
- getAsyncMeasuresService().registerMeasure(asyncMeasureId);
- }
-
- public void deleteAsyncMeasure(long asyncMeasureId) {
- getAsyncMeasuresService().deleteMeasure(asyncMeasureId);
- }
-
private ProfilesManager getProfilesManager() {
return getContainer().getComponent(ProfilesManager.class);
}
- private AsyncMeasuresService getAsyncMeasuresService() {
- return getContainer().getComponent(AsyncMeasuresService.class);
- }
-
public void reloadConfiguration() {
getContainer().getComponent(CoreConfiguration.class).reload();
}
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/api_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/api_controller.rb
index 594635c62a1..f1e0100884c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/api_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/api_controller.rb
@@ -20,42 +20,93 @@
require 'json'
require 'time'
class Api::ApiController < ApplicationController
-
- protected
-
+
+ class ApiException < Exception
+ attr_reader :code, :msg
+
+ def initialize(code, msg)
+ @code = code
+ @msg = msg
+ end
+ end
+
+ rescue_from ApiException do |exception|
+ render_error(exception.msg, exception.code)
+ end
+
+ rescue_from ActiveRecord::RecordInvalid do |exception|
+ render_error(exception.message, 400)
+ end
+
+ rescue_from ActiveRecord::RecordNotFound do |exception|
+ render_error(exception.message, 404)
+ end
+
+ protected
+
def text_not_supported
"Not supported"
end
-
+
def xml_not_supported
xml = Builder::XmlMarkup.new(:indent => 0)
xml.instruct!
xml.not_supported
end
-
+
def json_not_supported
JSON({:not_supported => true})
end
-
+
def jsonp(json)
- text=( (json.is_a? String) ? json : JSON(json))
-
+ text=((json.is_a? String) ? json : JSON(json))
+
if params['callback']
- params['callback'] + '(' + text + ');'
+ params['callback'] + '(' + text + ');'
else
text
end
end
-
+
+ # deprecated. Use Api::Utils.format_datetime
+ def format_datetime(datetime)
+ Api::Utils.format_datetime(datetime)
+ end
+
+ # deprecated. Use Api::Utils.parse_datetime
+ def parse_datetime(datetime_string, default_is_now=true)
+ Api::Utils.parse_datetime(datetime_string, default_is_now)
+ end
+
+ def load_resource(resource_key, role=nil)
+ resource=Project.by_key(resource_key)
+ not_found("Resource not found: #{resource_key}") if resource.nil?
+ access_denied if role && !has_role?(role, resource)
+ resource
+ end
+
+
+
+ #----------------------------------------------------------------------------
+ # ERRORS
+ #----------------------------------------------------------------------------
+ def not_found(message)
+ raise ApiException.new(404, message)
+ end
+
+ def bad_request(message)
+ raise ApiException.new(400, message)
+ end
+
def access_denied
- render_error('Unauthorized', 401)
+ raise ApiException.new(401, 'Unauthorized')
end
-
+
def render_error(msg, http_status=400)
- respond_to do |format|
- format.json{ render :json => error_to_json(msg, http_status), :status => http_status }
- format.xml{ render :xml => error_to_xml(msg, http_status), :status => http_status}
- format.text{ render :text => msg, :status => http_status }
+ respond_to do |format|
+ format.json { render :json => error_to_json(msg, http_status), :status => http_status }
+ format.xml { render :xml => error_to_xml(msg, http_status), :status => http_status }
+ format.text { render :text => msg, :status => http_status }
end
end
@@ -68,7 +119,7 @@ class Api::ApiController < ApplicationController
def error_to_xml(msg, error_code=nil)
xml = Builder::XmlMarkup.new(:indent => 0)
- xml.error do
+ xml.error do
xml.code(error_code) if error_code
xml.msg(msg) if msg
end
@@ -78,23 +129,5 @@ class Api::ApiController < ApplicationController
render_error(msg, 200)
end
- # deprecated. Use Api::Utils.format_datetime
- def format_datetime(datetime)
- Api::Utils.format_datetime(datetime)
- end
-
- # deprecated. Use Api::Utils.parse_datetime
- def parse_datetime(datetime_string, default_is_now=true)
- Api::Utils.parse_datetime(datetime_string, default_is_now)
- end
-
- class ApiException < Exception
- attr_reader :code, :msg
- def initialize(code, msg)
- @code = code
- @msg = msg
- end
- end
-
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/events_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/events_controller.rb
index afc773baa48..8f842296cb4 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/events_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/events_controller.rb
@@ -43,6 +43,7 @@ class Api::EventsController < Api::ApiController
conditions<<'resource_id IS NULL'
end
+ from=nil
if params[:fromDateTime]
from=parse_datetime(params[:fromDateTime], false)
elsif params[:fromDate]
@@ -53,6 +54,7 @@ class Api::EventsController < Api::ApiController
values[:from]=from
end
+ to=nil
if params[:toDateTime]
to=parse_datetime(params[:toDateTime], false)
elsif params[:toDate]
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/manual_measures_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/manual_measures_controller.rb
new file mode 100644
index 00000000000..e131f23c309
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/manual_measures_controller.rb
@@ -0,0 +1,117 @@
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2011 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+
+require 'json'
+
+class Api::ManualMeasuresController < Api::ApiController
+
+ #
+ # GET /api/manual_measures?resource=<resource>&metric=<optional metric>
+ #
+ def index
+ resource=load_resource(params[:resource], :user)
+
+ metric=nil
+ if params[:metric].present?
+ metric=Metric.by_key(params[:metric])
+ bad_request("Unknown metric: #{params[:metric]}") if metric.nil?
+ end
+
+ result = resource.manual_measures
+ if metric
+ result = result.select{|m| m.metric_id==metric.id}
+ end
+
+ respond_to do |format|
+ format.json { render :json => jsonp(manual_measures_to_json(result)) }
+ format.xml { render :xml => xml_not_supported }
+ end
+ end
+
+ #
+ # POST /api/manual_measures?resource=<resource>&metric=<metric>&val=<optional decimal value>&text=<optional text>
+ # Create or update measure.
+ #
+ def create
+ resource=load_resource(params[:resource], :admin)
+
+ metric=Metric.by_key(params[:metric])
+ bad_request("Unknown metric: #{params[:metric]}") if metric.nil?
+
+ value=params[:val]
+ bad_request("Not a numeric value: #{value}") if value && !Api::Utils.is_number?(value)
+
+ measure=ManualMeasure.find(:first, :conditions => ['resource_id=? and metric_id=?', resource.id, metric.id])
+ if measure.nil?
+ measure=ManualMeasure.new(:resource => resource, :user => current_user, :metric_id => metric.id)
+ end
+
+ measure.value = value
+ measure.text_value = params[:text]
+ measure.description = params[:desc]
+ measure.url = params[:url]
+ measure.save!
+
+ respond_to do |format|
+ format.json { render :json => jsonp(manual_measure_to_json(measure)) }
+ format.xml { render :xml => xml_not_supported }
+ end
+ end
+
+
+ #
+ # DELETE /api/manual_measures?resource=<resource>&metric=<metric>
+ #
+ def destroy
+ resource=load_resource(params[:resource], :admin)
+
+ metric=Metric.by_key(params[:metric])
+ bad_request("Unknown metric: #{params[:metric]}") if metric.nil?
+
+ count = ManualMeasure.delete_all(['resource_id=? and metric_id=?', resource.id, metric.id])
+
+ render_success "Deleted #{count} measures"
+ end
+
+ private
+
+ def manual_measures_to_json(manual_measures)
+ json = []
+ manual_measures.each do |m|
+ json<<manual_measure_to_json(m)
+ end
+ json
+ end
+
+ def manual_measure_to_json(manual_measure)
+ hash={:id => manual_measure.id, :metric => manual_measure.metric.key}
+ hash[:val]=manual_measure.value if manual_measure.value
+ hash[:text]=manual_measure.text_value if manual_measure.text_value
+ hash[:desc]=manual_measure.description if manual_measure.description
+ hash[:url]=manual_measure.url if manual_measure.url
+ hash[:created_at]=format_datetime(manual_measure.created_at)
+ hash[:updated_at]=format_datetime(manual_measure.updated_at) if manual_measure.updated_at
+ if manual_measure.user
+ hash[:login]=manual_measure.user.login
+ hash[:username]=manual_measure.user.name
+ end
+ hash
+ end
+end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb
index f70f303af8b..8a68161aaeb 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb
@@ -105,7 +105,6 @@ class ComponentsController < ApplicationController
'rule_id' => nil,
'rule_priority' => nil,
'characteristic_id' => nil}))
- measures.concat(AsyncMeasureSnapshot.search(page_sids, mids))
end
measures
else
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/metrics_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/metrics_controller.rb
index d206ed13d0b..435943a7b61 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/metrics_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/metrics_controller.rb
@@ -26,10 +26,10 @@ class MetricsController < ApplicationController
def index
@metrics = Metric.all.select {|metric| metric.user_managed?}
- @domains = Metric.all.map {|metric| metric.domain}.compact.uniq.sort
+ @domains = Metric.all.map {|metric| metric.domain(false)}.compact.uniq.sort
if params['id']
@metric=Metric.find(params['id'].to_i)
- params['domain']=@metric.domain
+ params['domain']=@metric.domain(false)
else
@metric=Metric.new
end
@@ -44,8 +44,8 @@ class MetricsController < ApplicationController
end
metric.attributes=params[:metric]
- if metric.short_name
- metric.name = metric.short_name.downcase.gsub(/\s/, '_')[0..59]
+ if metric.short_name(false)
+ metric.name = metric.short_name(false).downcase.gsub(/\s/, '_')[0..59]
end
unless params[:newdomain].blank?
metric.domain = params[:newdomain]
@@ -67,13 +67,12 @@ class MetricsController < ApplicationController
rescue
flash[:error] = metric.errors.full_messages.join("<br/>\n")
end
- redirect_to :action => 'index', :domain => metric.domain
+ redirect_to :action => 'index', :domain => metric.domain(false)
end
def delete_from_web
metric = Metric.by_id(params[:id].to_i) if params[:id] && params[:id].size > 0
if metric
- AsyncMeasureSnapshot.delete_all("metric_id = #{metric.id}")
del_count = Metric.delete(params[:id].to_i)
flash[:notice] = 'Successfully deleted.' if del_count == 1
flash[:error] = 'Unable to delete this metric.' if del_count != 1
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb
index 24b1d8aa46e..00be0035799 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb
@@ -18,8 +18,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
#
class ProjectController < ApplicationController
- verify :method => :post, :only => [ :set_links, :add_review, :set_exclusions, :delete_exclusions ], :redirect_to => { :action => :index }
- verify :method => :delete, :only => [ :delete, :delete_review ], :redirect_to => { :action => :index }
+ verify :method => :post, :only => [ :set_links, :set_exclusions, :delete_exclusions ], :redirect_to => { :action => :index }
+ verify :method => :delete, :only => [ :delete ], :redirect_to => { :action => :index }
SECTION=Navigation::SECTION_RESOURCE
@@ -27,73 +27,6 @@ class ProjectController < ApplicationController
redirect_to :overwrite_params => {:controller => :dashboard, :action => 'index'}
end
- def show_reviews
- @snapshot = Snapshot.find(params[:sid].to_i)
- render :partial => 'dashboard_reviews'
- end
-
- def edit_review
- @snapshot = Snapshot.find(params[:sid].to_i)
- return access_denied unless has_role?(:admin, @snapshot)
-
- @review = ProjectMeasure.new(:measure_date => @snapshot.created_at, :value => 0)
- @review_types = Metric.review_types
- render :partial => 'dashboard_edit_review'
- end
-
- def add_review
- @snapshot=Snapshot.find(params[:sid].to_i)
- return access_denied unless has_role?(:admin, @snapshot)
-
- measure = ProjectMeasure.new(params[:review])
- measure.project = @snapshot.project
-
- if measure.metric.nil?
- flash[:error] = 'Please select a metric'
- redirect_to :action => 'index', :id => measure.project_id
- return
- end
-
- if measure.measure_date <= @snapshot.created_at.to_date
- if measure.metric.val_type==Metric::VALUE_TYPE_STRING
- measure.text_value=params['review']['value']
- measure.value=0
- end
- measure.url=params[:url] if params[:url]
- measure.description=params[:description] if params[:description]
- begin
- measure.save!
- java_facade.registerAsyncMeasure(measure.id.to_i)
- flash[:notice] = 'Measure added'
- rescue
- flash[:error] = measure.errors.full_messages.join("<br/>")
- end
-
- else
- flash[:error] = "The date should not be after #{l(@snapshot.created_at.to_date)}"
- end
-
- if request.xhr?
- render :update do |page|
- page.redirect_to :action => 'index', :id => measure.project_id
- end
- else
- redirect_to :action => 'index', :id => measure.project_id
- end
- end
-
- def delete_review
- measure = ProjectMeasure.find(params[:id].to_i)
- if measure && measure.review?
- return access_denied unless has_role?(:admin, measure.project)
-
- java_facade.deleteAsyncMeasure(measure.id.to_i)
- redirect_to :action => 'index', :id => measure.project_id
- else
- redirect_to_default
- end
- end
-
def delete
if params[:id]
@project = Project.by_key(params[:id])
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb
index d2841e7b3d9..47d0d223998 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/timemachine_controller.rb
@@ -53,7 +53,6 @@ class TimemachineController < ApplicationController
end
measures=ProjectMeasure.find(:all, :conditions => {:rule_id => nil, :rule_priority => nil, :snapshot_id => @sids, :characteristic_id => nil})
- measures.concat(AsyncMeasureSnapshot.search(@sids))
rows_by_metric_id={}
@rows=[]
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
index 2e42bf097eb..616860899f2 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
@@ -41,7 +41,7 @@ module ApplicationHelper
def qualifier_icon(object)
qualifier=(object.respond_to?('qualifier') ? object.qualifier : object.to_s)
if qualifier
- image_tag("q/#{qualifier}.png", :alt => Resourceable.qualifier_name(qualifier))
+ image_tag("q/#{qualifier}.png", :alt => message(Resourceable.qualifier_name(qualifier)))
else
image_tag('e16.gif')
end
@@ -56,8 +56,13 @@ module ApplicationHelper
end
# i18n
- def message(key, default, *parameters)
- Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, key, default, parameters.to_java)
+ def message(key, options={})
+ default = options[:default]
+ params = options[:params]
+ if params.nil?
+ params=[]
+ end
+ Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, key, default, params.to_java)
end
# deprecated since 2.5. Use trend_icon() instead
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb
index 9e258c7e108..f86d510e0bb 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb
@@ -46,17 +46,17 @@ module DashboardHelper
if mode
if mode=='days'
- label = "Added over %s days" % mode_param
+ label = message('added_over_x_days', :params => mode_param.to_s)
elsif mode=='version'
- label = "Added since version %s" % mode_param
+ label = message('added_since_version', :params => mode_param.to_s)
elsif mode=='previous_analysis'
if !date.nil?
- label = "Added since previous analysis (%s)" % date.strftime("%Y %b. %d")
+ label = message('added_since_previous_analysis_detailed', :params => date.strftime("%Y %b. %d").to_s)
else
- label = "Added since previous analysis"
+ label = message('added_since_previous_analysis')
end
elsif mode=='date'
- label = "Added since #{date.strftime("%Y %b %d")}"
+ label = message('added_since', :params => date.strftime("%Y %b %d").to_s)
end
if label
selected=(params[:period]==index.to_s ? 'selected' : '')
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb
index 81f59c5ffb3..4f827a2823d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb
@@ -171,14 +171,14 @@ module FiltersHelper
def period_name(property)
if property=='previous_analysis'
- "&Delta; since previous analysis"
+ message('delta_since_previous_analysis')
elsif property =~ /^[\d]+(\.[\d]+){0,1}$/
# is integer
- "&Delta; over #{property} days"
+ message('delta_over_x_days', :params => property)
elsif property =~ /\d{4}-\d{2}-\d{2}/
- "&Delta; since #{property}"
+ message('delta_since', :params => property)
elsif !property.blank?
- "&Delta; since version #{property}"
+ message('delta_since_version', :params => property)
else
nil
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb
index 9ed45df354e..5a196ca16b7 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/api/utils.rb
@@ -37,6 +37,10 @@ class Api::Utils
true if Float(s) rescue false
end
+ def self.is_integer?(s)
+ s.to_s =~ /\A[+-]?\d+\Z/
+ end
+
def self.markdown_to_html(markdown)
markdown ? Java::OrgSonarServerUi::JRubyFacade.markdownToHtml(ERB::Util.html_escape(markdown)) : ''
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb
index b1bf557b18d..e4462407d9b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb
@@ -38,7 +38,7 @@ class Filter < ActiveRecord::Base
def criterion(family, key=nil)
criteria.each do |criterion|
if criterion.family==family && criterion.key==key
- return criterion if ((key.nil? && criterion.key.nil?) || (key && key==criterion.key))
+ return criterion if ((key.nil? && criterion.key.nil?) || (key && key==criterion.key))
end
end
nil
@@ -95,13 +95,6 @@ class Filter < ActiveRecord::Base
column('links')
end
- def display_user_managed_metrics?
- columns.each do |col|
- return true if col.metric && col.metric.user_managed?
- end
- false
- end
-
def default_view
read_attribute(:default_view) || VIEW_LIST
end
@@ -145,7 +138,7 @@ class Filter < ActiveRecord::Base
columns.each do |col|
return col if col.id==col_id
end
- return nil
+ nil
end
def clean_columns_order
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/filter_column.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/filter_column.rb
index d2208f6e47f..8b014ac9e57 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/filter_column.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/filter_column.rb
@@ -23,7 +23,7 @@ class FilterColumn < ActiveRecord::Base
belongs_to :filter
validates_inclusion_of :sort_direction, :in => %w( ASC DESC ), :allow_nil => true
-
+
def self.create_from_string(string)
if FAMILIES.include?(string)
FilterColumn.new(:family => string)
@@ -39,48 +39,14 @@ class FilterColumn < ActiveRecord::Base
def name
if on_metric?
- metric ? metric.short_name : kee
+ Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, "metric." + kee + ".name", nil, [].to_java)
else
- case family
- when 'date'
- 'Build date'
- when 'language'
- 'Language'
- when 'name'
- 'Name'
- when 'links'
- 'Links'
- when 'version'
- 'Version'
- when 'key'
- 'Key'
- else
- kee
- end
+ Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, family, kee, [].to_java)
end
end
def display_name
- if on_metric?
- metric ? metric.short_name : kee
- else
- case family
- when 'date'
- 'Build date'
- when 'language'
- 'Language'
- when 'name'
- 'Name'
- when 'links'
- 'Links'
- when 'version'
- 'Version'
- when 'key'
- 'Key'
- else
- kee
- end
- end
+ name
end
def metric
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb
index 82dad3b41fa..7ce80b37ea3 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb
@@ -58,10 +58,6 @@
if @metric_ids.size>0
measures=ProjectMeasure.find(:all, :conditions => ['rule_priority is null and rule_id is null and characteristic_id is null and snapshot_id in (?)', @page_sids])
- if filter.display_user_managed_metrics?
- measures.concat(AsyncMeasureSnapshot.search(@page_sids, @metric_ids))
- end
-
measures.each do |m|
snapshot=@snapshots_by_id[m.snapshot_id]
@measures_by_snapshot[snapshot]||={}
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/manual_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/manual_measure.rb
new file mode 100644
index 00000000000..e5500e0d5f9
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/manual_measure.rb
@@ -0,0 +1,44 @@
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2011 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+class ManualMeasure < ActiveRecord::Base
+ belongs_to :resource, :class_name => 'Project'
+ belongs_to :user
+ validates_uniqueness_of :metric_id, :scope => :resource_id
+ validates_length_of :text_value, :maximum => 4000, :allow_nil => true, :allow_blank => true
+ validates_length_of :url, :maximum => 4000, :allow_nil => true, :allow_blank => true
+ validates_length_of :description, :maximum => 4000, :allow_nil => true, :allow_blank => true
+ validate :validate_metric
+
+ def metric
+ @metric ||=
+ begin
+ Metric.by_id(metric_id)
+ end
+ end
+
+ def metric=(m)
+ @metric = m
+ write_attribute(:metric_id, m.id) if m.id
+ end
+
+ def validate_metric
+ errors.add_to_base("Not a valid metric") unless metric && metric.enabled?
+ end
+end \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb
index 43411eb8b8d..22bfb6f2ff0 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/metric.rb
@@ -40,6 +40,8 @@ class Metric < ActiveRecord::Base
ORIGIN_JAVA='JAV'
CACHE_KEY='metrics'
+ I18N_DOMAIN_CACHE_KEY='i18n_domains'
+ I18N_SHORT_NAME_CACHE_KEY='i18n_metric_short_names'
validates_length_of :name, :within => 1..64
validates_uniqueness_of :name
@@ -60,16 +62,79 @@ class Metric < ActiveRecord::Base
short_name<=>other.short_name
end
- def self.domains
+ def self.domains(translate=true)
all.collect{|metric|
- metric.domain
+ metric.domain(translate)
}.compact.uniq.sort
end
+ def self.i18n_domain_for(to_translate)
+ return nil if to_translate.nil?
+
+ localeMap = Metric.i18n_domain_cache[to_translate]
+ locale = I18n.locale
+
+ return localeMap[locale] if not localeMap.nil? and localeMap.has_key?(locale)
+
+ i18n_key = 'domain.' + to_translate
+ result = Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, i18n_key, to_translate, [].to_java)
+ localeMap[locale] = result if not localeMap.nil?
+ result
+ end
+
def key
name
end
+ def domain(translate=true)
+ default_string = read_attribute(:domain)
+ return default_string unless translate
+ Metric.i18n_domain_for(default_string)
+ end
+
+ def domain=(value)
+ write_attribute(:domain, value)
+ end
+
+ def short_name(translate=true)
+ default_string = read_attribute(:short_name)
+ return default_string unless translate
+
+ metric_name = read_attribute(:name)
+ return nil if metric_name.nil?
+
+ localeMap = Metric.i18n_short_name_cache[metric_name]
+ locale = I18n.locale
+
+ return localeMap[locale] if not localeMap.nil? and localeMap.has_key?(locale)
+
+ i18n_key = 'metric.' + metric_name + '.name'
+ result = Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, i18n_key, default_string, [].to_java)
+ localeMap[locale] = result if not localeMap.nil?
+ result
+ end
+
+ def short_name=(value)
+ write_attribute(:short_name, value)
+ end
+
+ def description(translate=true)
+ default_string = read_attribute(:description)
+ return default_string unless translate
+
+ metric_name = read_attribute(:name)
+
+ return nil if metric_name.nil?
+
+ i18n_key = 'metric.' + metric_name + '.description'
+ result = Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, i18n_key, default_string, [].to_java)
+ result
+ end
+
+ def description=(value)
+ write_attribute(:description, value)
+ end
+
def user_managed?
user_managed==true
end
@@ -156,8 +221,8 @@ class Metric < ActiveRecord::Base
metrics
end
- def self.by_domain(domain)
- all.select{|metric| metric.domain==domain}.sort
+ def self.by_domain(domain, translate=true)
+ all.select{|metric| metric.domain(translate)==domain}.sort
end
def self.major_metrics_id
@@ -166,6 +231,8 @@ class Metric < ActiveRecord::Base
def self.clear_cache
Caches.clear(CACHE_KEY)
+ Caches.clear(I18N_DOMAIN_CACHE_KEY)
+ Caches.clear(I18N_SHORT_NAME_CACHE_KEY)
end
def self.default_time_machine_metrics
@@ -309,4 +376,25 @@ class Metric < ActiveRecord::Base
c
end
+ def self.i18n_domain_cache
+ c = Caches.cache(I18N_DOMAIN_CACHE_KEY)
+ if c.size==0
+ domains(false).each do |domain|
+ locale_map={}
+ c[domain]=locale_map
+ end
+ end
+ c
+ end
+
+ def self.i18n_short_name_cache
+ c = Caches.cache(I18N_SHORT_NAME_CACHE_KEY)
+ if c.size==0
+ all.each do |metric|
+ locale_map={}
+ c[metric.name]=locale_map
+ end
+ end
+ c
+ end
end \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
index 9658c9dfcb3..5c7273c0296 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
@@ -28,6 +28,7 @@ class Project < ActiveRecord::Base
belongs_to :profile, :class_name => 'Profile', :foreign_key => 'profile_id'
has_many :user_roles, :foreign_key => 'resource_id'
has_many :group_roles, :foreign_key => 'resource_id'
+ has_many :manual_measures, :foreign_key => 'resource_id'
belongs_to :root, :class_name => 'Project', :foreign_key => 'root_id'
def self.by_key(k)
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb
index 54675821f79..1921ddfe8c3 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb
@@ -31,9 +31,6 @@ class ProjectMeasure < ActiveRecord::Base
belongs_to :characteristic
has_one :measure_data, :class_name => 'MeasureData', :foreign_key => 'measure_id'
- has_many :async_measure_snapshots
- has_many :snapshots, :through => :async_measure_snapshots
-
validates_numericality_of :value, :if => :numerical_metric?
validate :validate_date, :validate_value
@@ -213,49 +210,6 @@ class ProjectMeasure < ActiveRecord::Base
end
end
- # return reviews from the snapshot and also reviews created after the snapshot
- def self.find_reviews_for_last_snapshot(snapshot)
- ProjectMeasure.find(:all, :include => [:async_measure_snapshots, :measure_data],
- :conditions => ['async_measure_snapshots.project_id=project_measures.project_id AND ' +
- '((async_measure_snapshots.snapshot_id IS NULL AND project_measures.measure_date>?) ' +
- 'OR async_measure_snapshots.snapshot_id=?) ', snapshot.created_at, snapshot.id])
- end
-
- def self.find_reviews_for_last_snapshot_with_opts(snapshot, options)
- metrics = options[:metrics].nil? ? [] : Metric.ids_from_keys(options[:metrics].split(','))
- include = (options[:includeparams] == "true") ? [:async_measure_snapshots, :measure_data] : :async_measure_snapshots
-
- metrics_conditions = (metrics.empty?) ? "" : "AND project_measures.metric_id IN (?)"
- conditions = 'async_measure_snapshots.project_id=project_measures.project_id AND ' +
- '((async_measure_snapshots.snapshot_id IS NULL AND project_measures.measure_date>?) ' +
- 'OR async_measure_snapshots.snapshot_id=?) ' + metrics_conditions
- if metrics.empty?
- ProjectMeasure.find(:all, :include => include, :conditions => [conditions, snapshot.created_at, snapshot.id])
- else
- ProjectMeasure.find(:all, :include => include, :conditions => [conditions, snapshot.created_at, snapshot.id, metrics])
- end
- end
-
- def self.find_reviews(snapshot)
- conditions = 'async_measure_snapshots.snapshot_id=? ' + metrics_conditions
- ProjectMeasure.find(:all, :include => [:async_measure_snapshots, :measure_data],
- :conditions => ['async_measure_snapshots.snapshot_id=? ', snapshot.id])
- end
-
-
- def self.find_reviews_with_opts(snapshot, options={})
- metrics = options[:metrics].nil? ? [] : Metric.ids_from_keys(options[:metrics].split(','))
- include = (options[:includeparams] == "true") ? [:async_measure_snapshots, :measure_data] : :async_measure_snapshots
-
- metrics_conditions = (metrics.empty?) ? "" : "AND project_measures.metric_id IN (?)"
- conditions = 'async_measure_snapshots.snapshot_id=? ' + metrics_conditions
- if metrics.empty?
- ProjectMeasure.find(:all, :include => include, :conditions => [conditions, snapshot.id])
- else
- ProjectMeasure.find(:all, :include => include, :conditions => [conditions, snapshot.id, metrics])
- end
- end
-
def tip
if rule_id
rule.description
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb
index 6b2a91db46d..cbb73768094 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb
@@ -58,6 +58,42 @@ class Rule < ActiveRecord::Base
name<=>rule.name
end
+ def name(translate=true)
+ default_string = read_attribute(:name)
+ return default_string unless translate
+
+ rule_plugin_name = read_attribute(:plugin_name)
+ rule_plugin_rule_key = read_attribute(:plugin_rule_key)
+
+ return nil if (rule_plugin_name.nil? or rule_plugin_rule_key.nil?)
+
+ i18n_key = 'rule.' + rule_plugin_name + '.' + rule_plugin_rule_key + '.name'
+ result = Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, i18n_key, default_string, [].to_java)
+ result
+ end
+
+ def name=(value)
+ write_attribute(:name, value)
+ end
+
+ def description(translate=true)
+ default_string = read_attribute(:description)
+ return default_string unless translate
+
+ rule_plugin_name = read_attribute(:plugin_name)
+ rule_plugin_rule_key = read_attribute(:plugin_rule_key)
+
+ return nil if (rule_plugin_name.nil? or rule_plugin_rule_key.nil?)
+
+ i18n_key = 'rule.' + rule_plugin_name + '.' + rule_plugin_rule_key + '.description'
+ result = Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, i18n_key, default_string, [].to_java)
+ result
+ end
+
+ def description=(value)
+ write_attribute(:description, value)
+ end
+
def config_key
plugin_config_key
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb
index d7c67334baa..f5da840eb28 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rules_parameter.rb
@@ -39,6 +39,24 @@ class RulesParameter < ActiveRecord::Base
def get_allowed_tokens
return param_type[2,param_type.length-3].split( "," )
end
+
+ def description(translate=true)
+ default_string = read_attribute(:description)
+ return default_string unless translate
+
+ rule_plugin_name = rule.plugin_name
+ rule_plugin_rule_key = rule.plugin_rule_key
+
+ return nil if (rule_plugin_name.nil? or rule_plugin_rule_key.nil?)
+
+ i18n_key = 'rule.' + rule_plugin_name + '.' + rule_plugin_rule_key + '.param.' + read_attribute(:name)
+ result = Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, i18n_key, nil, [].to_java)
+ result
+ end
+
+ def description=(value)
+ write_attribute(:description, value)
+ end
def readable_param_type
return "String" if param_type == PARAM_TYPE_STRING
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb
index 9a0d2b5eaa3..5a6fd0ea838 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/snapshot.rb
@@ -35,10 +35,6 @@ class Snapshot < ActiveRecord::Base
has_one :source, :class_name => 'SnapshotSource', :dependent => :destroy
has_many :violations, :class_name => 'RuleFailure'
- has_many :async_measure_snapshots
- has_many :async_measures, :through => :async_measure_snapshots
-
-
STATUS_UNPROCESSED = 'U'
STATUS_PROCESSED = 'P'
@@ -98,10 +94,6 @@ class Snapshot < ActiveRecord::Base
parent_snapshot_id.nil?
end
- def all_measures
- measures + async_measures
- end
-
def descendants
children.map(&:descendants).flatten + children
end
@@ -219,7 +211,7 @@ class Snapshot < ActiveRecord::Base
@measures_hash ||=
begin
hash = {}
- all_measures.each do |measure|
+ measures.each do |measure|
hash[measure.metric_id]=measure
end
hash
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_criterion.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_criterion.html.erb
index 93067046dda..34d80b2abce 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_criterion.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_criterion.html.erb
@@ -7,7 +7,7 @@
}
</script>
<select name="criteria[<%= id -%>][metric_id]" id="metric-<%= id -%>">
- <option value="">Select a metric</option>
+ <option value=""><%= message('select_a_metric') -%></option>
<% Metric.domains.each do |domain| %>
<optgroup label="<%= h domain -%>">
<% Metric.by_domain(domain).select{|m| !m.data? && !m.hidden?}.each do |metric| %>
@@ -17,16 +17,16 @@
<% end %>
</select>
<select name="criteria[<%= id -%>][type]" id="type-<%= id -%>">
- <option value="value" <%= 'selected' unless (criterion && criterion.variation) -%>>Value</option>
- <option value="variation" <%= 'selected' if criterion && criterion.variation -%>>Variation</option>
+ <option value="value" <%= 'selected' unless (criterion && criterion.variation) -%>><%= message('value') -%></option>
+ <option value="variation" <%= 'selected' if criterion && criterion.variation -%>><%= message('variation') -%></option>
</select>
<select name="criteria[<%= id -%>][operator]" id="op-<%= id -%>">
<option value=""></option>
- <option value="<" <%= 'selected' if (criterion && criterion.operator=='<') -%>>Less than</option>
- <option value="<=" <%= 'selected' if (criterion && criterion.operator=='<=') -%>>Less or equals</option>
- <option value="=" <%= 'selected' if (criterion && criterion.operator=='=') -%>>Equals</option>
- <option value=">" <%= 'selected' if (criterion && criterion.operator=='>') -%>>Greater than</option>
- <option value=">=" <%= 'selected' if (criterion && criterion.operator=='>=') -%>>Greater or equals</option>
+ <option value="<" <%= 'selected' if (criterion && criterion.operator=='<') -%>><%= message('less_than') -%></option>
+ <option value="<=" <%= 'selected' if (criterion && criterion.operator=='<=') -%>><%= message('less_or_equals') -%></option>
+ <option value="=" <%= 'selected' if (criterion && criterion.operator=='=') -%>><%= message('equals') -%></option>
+ <option value=">" <%= 'selected' if (criterion && criterion.operator=='>') -%>><%= message('greater_than') -%></option>
+ <option value=">=" <%= 'selected' if (criterion && criterion.operator=='>=') -%>><%= message('greater_or_equals') -%></option>
</select>
<input type="text" name="criteria[<%= id -%>][value]" size="5" value="<%= criterion.value if criterion -%>" id="val-<%= id -%>"></input>
-<a href="#" onClick="reset_criterion(<%= id -%>);return false;">Reset</a> \ No newline at end of file
+<a href="#" onClick="reset_criterion(<%= id -%>);return false;"><%= message('reset_verb') -%></a> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_list.html.erb
index d899960b1eb..69d17e09b5e 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_list.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_list.html.erb
@@ -1,12 +1,12 @@
<tr>
<td class="first">
- Add column:
+ <%= message('filters.add_column') -%>:
</td>
<td>
<form id="add_column_form" action="<%= url_for :action => 'add_column', :id => @filter.id -%>" method="post">
<select name="column_type" id="select_column_type">
- <option value="value" selected>Value</option>
- <option value="variation">Variation</option>
+ <option value="value" selected><%= message('value') -%></option>
+ <option value="variation"><%= message('variation') -%></option>
</select>
<select name="column" id="select_column">
@@ -17,22 +17,22 @@
<% if metric.display? %><option value="metric,<%= metric.id -%>"><%= metric.short_name -%></option><% end %>
<% end %>
<% if domain=='General' %>
- <% unless @filter.column('date') %><option value="date">Build date</option><% end %>
- <% unless @filter.column('key') %><option value="key">Key</option><% end %>
- <% unless @filter.column('language') %><option value="language">Language</option><% end %>
- <% unless @filter.column('links') %><option value="links">Links</option><% end %>
- <% unless @filter.column('name') %><option value="name">Name</option><% end %>
- <% unless @filter.column('version') %><option value="version">Version</option><% end %>
+ <% unless @filter.column('date') %><option value="date"><%= message('build_date') -%></option><% end %>
+ <% unless @filter.column('key') %><option value="key"><%= message('key') -%></option><% end %>
+ <% unless @filter.column('language') %><option value="language"><%= message('language') -%></option><% end %>
+ <% unless @filter.column('links') %><option value="links"><%= message('links') -%></option><% end %>
+ <% unless @filter.column('name') %><option value="name"><%= message('name') -%></option><% end %>
+ <% unless @filter.column('version') %><option value="version"><%= message('version') -%></option><% end %>
<% end %>
</optgroup>
<% end %>
</select>
- <input type="submit" id="add_column_button" value="Add"></input>
+ <input type="submit" id="add_column_button" value="<%= message('add_verb') -%>"></input>
</form>
</td>
</tr>
<tr>
- <td class="first">Default sorted column:</td>
+ <td class="first"><%= message('filters.default_sorted_column') -%>:</td>
<td>
<form id="sorted_column_form" action="<%= url_for :action => 'set_sorted_column' -%>" method="post">
<select name="id">
@@ -44,20 +44,20 @@
<% end %>
</select>
<select name="sort">
- <option value="ASC" <%= 'selected' if default_sorted_column && default_sorted_column.ascending? -%>>Ascending</option>
- <option value="DESC" <%= 'selected' if default_sorted_column && default_sorted_column.descending? -%>>Descending</option>
+ <option value="ASC" <%= 'selected' if default_sorted_column && default_sorted_column.ascending? -%>><%= message('ascending') -%></option>
+ <option value="DESC" <%= 'selected' if default_sorted_column && default_sorted_column.descending? -%>><%= message('descending') -%></option>
</select>
- <input type="submit" id="add_column_submit" value="Change" />
+ <input type="submit" id="add_column_submit" value="<%= message('change_verb') -%>" />
</form>
</td>
</tr>
<tr>
- <td class="first">Page size:</td>
+ <td class="first"><%= message('page_size') -%>:</td>
<td>
<form id="page_size_form" action="<%= url_for :action => 'set_page_size' -%>" method="post">
<input type="hidden" name="id" value="<%= @filter.id -%>"></input>
<input type="text" name="size" value="<%= @filter.page_size -%>" maxsize="3" size="3"></input>
- <input type="submit" id="set_page_size_submit" value="Change"/>
- <span class="comments">Min <%= ::Filter::MIN_PAGE_SIZE -%>, max <%= ::Filter::MAX_PAGE_SIZE -%></span>
+ <input type="submit" id="set_page_size_submit" value="<%= message('change_verb') -%>"/>
+ <span class="comments"><%= message('min') -%> <%= ::Filter::MIN_PAGE_SIZE -%>, <%= message('max').downcase -%> <%= ::Filter::MAX_PAGE_SIZE -%></span>
</td>
</tr> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_treemap.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_treemap.html.erb
index 39c8b2dc1e3..748def5b202 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_treemap.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_treemap.html.erb
@@ -5,14 +5,14 @@
%>
<form class="admin" action="<%= url_for :action => 'set_columns', :id => @filter.id -%>" method="POST">
<tr>
- <td class="first">Size:</td>
+ <td class="first"><%= message('size') -%>:</td>
<td>
<%= select_tag 'columns[]', options_grouped_by_domain(Sonar::TreemapBuilder.size_metrics({:exclude_user_managed => true}), size_metric.key),
:id => 'size_metric' %>
</td>
</tr>
<tr>
- <td class="first">Color:</td>
+ <td class="first"><%= message('color') -%>:</td>
<td>
<%= select_tag 'columns[]', options_grouped_by_domain(Sonar::TreemapBuilder.color_metrics, color_metric.key),
:id => 'color_metric' %>
@@ -22,7 +22,7 @@
<tr>
<td class="first"> </td>
<td>
- <input type="submit" value="Change">
+ <input type="submit" value="<%= message('change_verb') -%>">
</td>
</tr>
</form> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb
index b6231d2f023..78b86a04143 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb
@@ -5,7 +5,7 @@
<div class="operations">
<form action="<%= url_for :overwrite_params => {:period => nil} -%>" style="display: inline" method="get">
<select name="period" onchange="submit()" class="small">
- <option value="">Time changes...</option>
+ <option value=""><%= message('time_changes') -%>...</option>
<% period_names.each_with_index do |name, index| %>
<option value="<%= index+1 -%>" <%= 'selected' if @filter_context.period_index==index+1 -%>><%= name -%></value>
<% end %>
@@ -28,9 +28,9 @@
<tr class="admin"><th></th>
<% filter.columns.each do |column| %>
<th nowrap class="<%= column_align(column) -%>">
- <%= link_to image_tag("controls/resultset_previous.png"), {:action => 'left_column', :id => column.id}, :title => 'Move left', :method => :post if filter.first_column!=column %>
- <%= link_to image_tag("bin_closed.png"), {:action => 'delete_column', :id => column.id}, :title => 'Remove this column', :method => :post if column.deletable? %>
- <%= link_to image_tag("controls/resultset_next.png"), {:action => 'right_column', :id => column.id}, :title => 'Move right', :method => :post if filter.last_column!=column %>
+ <%= link_to image_tag("controls/resultset_previous.png"), {:action => 'left_column', :id => column.id}, :title => message('move_left'), :method => :post if filter.first_column!=column %>
+ <%= link_to image_tag("bin_closed.png"), {:action => 'delete_column', :id => column.id}, :title => message('remove_column'), :method => :post if column.deletable? %>
+ <%= link_to image_tag("controls/resultset_next.png"), {:action => 'right_column', :id => column.id}, :title => message('move_right'), :method => :post if filter.last_column!=column %>
</th>
<% end %>
</tr>
@@ -40,7 +40,7 @@
<tfoot>
<tr>
<td colspan="<%= filter.columns.size + 1 -%>">
- <span id="results_count"><%= pluralize(@filter_context.size, 'result') %></span>
+ <span id="results_count"><%= pluralize(@filter_context.size, message('result').downcase) %></span>
<% if @filter_context.page_count>1 %>
|
@@ -53,7 +53,7 @@
<% if @filter.projects_homepage? %>
&nbsp;&nbsp; <a href="<%= url_for :controller => :feeds, :action => 'projects', :id => EventCategory::KEY_ALERT -%>" class="nolink"><%= image_tag 'rss-12x12.png' %></a>
- <a href="<%= url_for :controller => :feeds, :action => 'projects', :id => EventCategory::KEY_ALERT -%>" class="action">Alerts feed</a>
+ <a href="<%= url_for :controller => :feeds, :action => 'projects', :id => EventCategory::KEY_ALERT -%>" class="action"><%= message('alerts_feed') -%></a>
<% end %>
</td>
</tr>
@@ -129,6 +129,6 @@
</table>
<br/>
<% if @filter_context.security_exclusions? %>
- <p class="notes">Due to security settings, some results are not being displayed.</p>
+ <p class="notes"><%= message('results_not_display_due_to_security') -%></p>
<% end %>
</div> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_tabs.html.erb
index dddf84fb4ed..d6570269035 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_tabs.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_tabs.html.erb
@@ -1,11 +1,11 @@
<% if logged_in? %>
<div id="page-operations">
<ul class="operations">
- <li><a href="<%= url_for :action => 'new' -%>" >Add filter</a></li>
+ <li><a href="<%= url_for :action => 'new' -%>" ><%= message('filters.add_filter') -%></a></li>
<% if @filter && @filter.id && editable_filter?(@filter) %>
- <li><a href="<%= url_for :action => 'edit', :id => @filter.id -%>">Edit filter</a></li>
+ <li><a href="<%= url_for :action => 'edit', :id => @filter.id -%>"><%= message('filters.edit_filter') -%></a></li>
<% end %>
- <li class="last"><%= link_to 'Manage filters', {:action => 'manage'} -%></li>
+ <li class="last"><%= link_to message('filters.manage_filters'), {:action => 'manage'} -%></li>
</ul>
</div>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb
index f927de3ecb4..93d0455651d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb
@@ -1,5 +1,5 @@
<% if @filter.period? %>
-Treemap does not support yet the selection of a period.
+<%= message('filters.treemap_not_supported_for_period_selection') -%>
<% else %>
<%
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/manage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/manage.html.erb
index abf745ddd85..2c8b206dff1 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/manage.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/manage.html.erb
@@ -1,20 +1,20 @@
<%= render :partial => 'filters/tabs', :locals => {:selected_tab => nil} %>
-<h1>My filters</h1>
+<h1><%= message('filters.my_filters') -%></h1>
<br/>
<table class="data" id="actives">
<thead>
<tr>
- <th>Name</th>
- <th>Author</th>
- <th>Shared</th>
- <th>Order</th>
- <th>Operations</th>
+ <th><%= message('name') -%></th>
+ <th><%= message('author') -%></th>
+ <th><%= message('shared') -%></th>
+ <th><%= message('order') -%></th>
+ <th><%= message('operations') -%></th>
</tr>
</thead>
<tbody>
<% if @actives.nil? || @actives.empty? %>
- <tr class="even"><td colspan="5">No filters</td></tr>
+ <tr class="even"><td colspan="5"><%= message('filters.no_filters') -%></td></tr>
<%
else
@@ -39,10 +39,10 @@
</td>
<td>
<% if editable_filter?(active.filter) %>
- <%= link_to 'Edit', {:action => 'edit', :id => active.filter_id}, :id => "edit-#{u active.name}" %> |
- <%= link_to 'Delete', {:action => 'deactivate', :id => active.filter_id}, :method => :post, :confirm => 'Do you want to delete this filter ?', :id => "delete-#{u active.name}" %>
+ <%= link_to message('edit'), {:action => 'edit', :id => active.filter_id}, :id => "edit-#{u active.name}" %> |
+ <%= link_to message('delete'), {:action => 'deactivate', :id => active.filter_id}, :method => :post, :confirm => message('filters.do_you_want_to_delete'), :id => "delete-#{u active.name}" %>
<% else %>
- <%= link_to 'Unfollow', {:action => 'deactivate', :id => active.filter_id}, :method => :post, :confirm => 'Do you want to stop following this filter ?', :id => "unfollow-#{u active.name}" %>
+ <%= link_to message('unfollow'), {:action => 'deactivate', :id => active.filter_id}, :method => :post, :confirm => message('filters.do_you_want_to_stop_following'), :id => "unfollow-#{u active.name}" %>
<% end %>
</td>
</tr>
@@ -53,20 +53,20 @@
</table>
<br/><br/><br/>
-<h1>Shared filters</h1>
-<p>These filters are shared by administrators and can be followed without copying them.</p>
+<h1><%= message('filters.shared_filters') -%></h1>
+<p><%= message('filters.shared_filters_description') -%></p>
<br/>
<table class="data" id="shared">
<thead>
<tr>
- <th>Name</th>
- <th>Author</th>
- <th>Operations</th>
+ <th><%= message('name') -%></th>
+ <th><%= message('author') -%></th>
+ <th><%= message('operations') -%></th>
</tr>
</thead>
<tbody>
<% if @shared_filters.nil? || @shared_filters.empty? %>
- <tr class="even"><td colspan="3">No results.</td></tr>
+ <tr class="even"><td colspan="3"><%= message('no_results') -%>.</td></tr>
<% else %>
<% @shared_filters.each do |filter| %>
<tr class="<%= cycle('even', 'odd') -%>">
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb
index 5428a8aeb1e..654cbca200b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb
@@ -23,12 +23,12 @@ table#columns td {
<table class="form">
<tbody>
<tr>
- <td class="first">Name:</td>
+ <td class="first"><%= message('name') -%>:</td>
<td>
<input type="text" name="name" id="name" value="<%= @filter.name -%>" class="spaced"></input>
<% if is_admin? %>
<span class="spacer"></span>
- <label for="shared">Shared:</label>
+ <label for="shared"><%= message('shared') -%>:</label>
<input type="checkbox" name="shared" id="shared" <%= 'checked' if @filter.shared -%>></input>
<% end %>
</td>
@@ -36,74 +36,74 @@ table#columns td {
</tbody>
<tbody id="simple-form">
<tr>
- <td class="first">Path:</td>
+ <td class="first"><%= message('path') -%>:</td>
<td>
<b><span id="path_name"><%= @filter.resource ? @filter.resource.path_name : params[:path_name] -%></span></b>
<input type="hidden" name="path_id" id="path_id" value="<%= @filter.resource ? @filter.resource.id : params[:path_id] -%>"></input>
- <a onclick="searchPopup(this);return false;" href="<%= url_for :action => :search_path, :search => (@filter.resource ? @filter.resource.name : nil) -%>">Search</a>
- <a href="#" onClick="$('path_name').innerText='';$('path_name').innerHTML='';Form.Element.clear('path_id');return false;">Reset</a>
+ <a onclick="searchPopup(this);return false;" href="<%= url_for :action => :search_path, :search => (@filter.resource ? @filter.resource.name : nil) -%>"><%= message('search_verb') -%></a>
+ <a href="#" onClick="$('path_name').innerText='';$('path_name').innerHTML='';Form.Element.clear('path_id');return false;"><%= message('reset_verb') -%></a>
</td>
</tr>
<tr>
- <td class="first">Search for:</td>
+ <td class="first"><%= message('filters.search_for') -%>:</td>
<td>
<% qualifiers=(@filter.criterion('qualifier') ? @filter.criterion('qualifier').text_values : []) %>
<% if controller.java_facade.hasPlugin('views') %>
- <input type="checkbox" name="qualifiers[]" value="VW" <%= 'checked' if qualifiers.include?('VW') -%> id="q-VW"></input> <label for="q-VW">Views</label>
+ <input type="checkbox" name="qualifiers[]" value="VW" <%= 'checked' if qualifiers.include?('VW') -%> id="q-VW"></input> <label for="q-VW"><%= message('views') -%></label>
<span class="spacer"> </span>
- <input type="checkbox" name="qualifiers[]" value="SVW" <%= 'checked' if qualifiers.include?('SVW') -%> id="q-SVW"></input> <label for="q-SVW">Sub-views</label>
+ <input type="checkbox" name="qualifiers[]" value="SVW" <%= 'checked' if qualifiers.include?('SVW') -%> id="q-SVW"></input> <label for="q-SVW"><%= message('sub_views') -%></label>
<span class="spacer"> </span>
<% end %>
- <input type="checkbox" name="qualifiers[]" value="TRK" <%= 'checked' if qualifiers.include?('TRK') -%> id="q-TRK"></input> <label for="q-TRK">Projects</label>
+ <input type="checkbox" name="qualifiers[]" value="TRK" <%= 'checked' if qualifiers.include?('TRK') -%> id="q-TRK"></input> <label for="q-TRK"><%= message('projects') -%></label>
<span class="spacer"> </span>
- <input type="checkbox" name="qualifiers[]" value="BRC" <%= 'checked' if qualifiers.include?('BRC') -%> id="q-BRC"></input> <label for="q-BRC">Sub-projects</label>
+ <input type="checkbox" name="qualifiers[]" value="BRC" <%= 'checked' if qualifiers.include?('BRC') -%> id="q-BRC"></input> <label for="q-BRC"><%= message('sub_projects') -%></label>
<span class="spacer"> </span>
- <input type="checkbox" name="qualifiers[]" value="DIR,PAC" <%= 'checked' if qualifiers.include?('DIR') -%> id="q-DIR"></input> <label for="q-DIR">Directories/Packages</label>
+ <input type="checkbox" name="qualifiers[]" value="DIR,PAC" <%= 'checked' if qualifiers.include?('DIR') -%> id="q-DIR"></input> <label for="q-DIR"><%= message('directories') -%>/<%= message('packages') -%></label>
<span class="spacer"> </span>
- <input type="checkbox" name="qualifiers[]" value="FIL,CLA" <%= 'checked' if qualifiers.include?('FIL') -%> id="q-FIL"></input> <label for="q-FIL">Files/Classes</label>
+ <input type="checkbox" name="qualifiers[]" value="FIL,CLA" <%= 'checked' if qualifiers.include?('FIL') -%> id="q-FIL"></input> <label for="q-FIL"><%= message('files') -%>/<%= message('classes') -%></label>
<span class="spacer"> </span>
- <input type="checkbox" name="qualifiers[]" value="UTS" <%= 'checked' if qualifiers.include?('UTS') -%> id="q-UTS"></input> <label for="q-UTS">Unit tests</label>
+ <input type="checkbox" name="qualifiers[]" value="UTS" <%= 'checked' if qualifiers.include?('UTS') -%> id="q-UTS"></input> <label for="q-UTS"><%= message('unit_tests') -%></label>
<span class="spacer"> </span>
</td>
</tr>
<tr>
- <td class="first">Criteria:</td>
+ <td class="first"><%= message('criteria') -%>:</td>
<td>
<%= render :partial => 'filters/criterion', :locals => {:id => '0', :criterion => (@filter.measure_criteria.size>0 ? @filter.measure_criteria[0] : nil)} %>
</td>
</tr>
<tr>
- <td class="first">and: </td>
+ <td class="first"><%= message('and').downcase -%>: </td>
<td>
<%= render :partial => 'filters/criterion', :locals => {:id => '1', :criterion => (@filter.measure_criteria.size>1 ? @filter.measure_criteria[1] : nil) } %>
</td>
</tr>
<tr>
- <td class="first">and: </td>
+ <td class="first"><%= message('and').downcase -%>: </td>
<td>
<%= render :partial => 'filters/criterion', :locals => {:id => '2', :criterion => (@filter.measure_criteria.size>2 ? @filter.measure_criteria[2] : nil) } %>
</td>
</tr>
<% unless @filter.advanced_search? %>
<tr id="advanced-search-link">
- <td align="right"><a href="#" onClick="$('advanced-search').show();$('advanced-search-link').hide();return false;">Advanced search</a></td>
+ <td align="right"><a href="#" onClick="$('advanced-search').show();$('advanced-search-link').hide();return false;"><%= message('filters.advanced_search') -%></a></td>
<td></td>
</tr>
<% end %>
</tbody>
<tbody id="advanced-search" style="<%= 'display: none' unless @filter.advanced_search? -%>">
<tr>
- <td class="first">Default period:</td>
+ <td class="first"><%= message('filters.default_period') -%>:</td>
<td>
<select id="period_index" name="period_index">
- <option value="">None</option>
+ <option value=""><%= message('none') -%></option>
<% period_names.each_with_index do |name, index| %>
<option value="<%= index+1 -%>" <%= 'selected' if @filter.period_index==index+1 -%>><%= name -%></value>
<% end %>
@@ -111,64 +111,66 @@ table#columns td {
</td>
</tr>
<tr>
- <td class="first">Language:</td>
+ <td class="first"><%= message('language') -%>:</td>
<td>
<% languages=(@filter.criterion('language') ? @filter.criterion('language').text_values : []) %>
<% controller.java_facade.getLanguages().each do |language| %>
<input type="checkbox" name="languages[]" value="<%= language.getKey() -%>" <%= 'checked' if languages.include?(language.getKey()) -%> id="lang-<%= language.getKey() -%>"> </input> <label for="lang-<%= language.getKey() -%>"><%= language.getName() -%></label>
<% end %>
- <span class="comments">When no language is selected, no filter will apply</span>
+ <span class="comments"><%= message('filters.when_no_language_no_filter_apply') -%></span>
</td>
</tr>
<tr>
- <td class="first"><%= image_tag 'star.png' %> <label for="favourites">Favourites only:</label></td>
+ <td class="first"><%= image_tag 'star.png' %> <label for="favourites"><%= message('filters.favourite_only') -%>:</label></td>
<td>
<input type="checkbox" name="favourites" id="favourites" <%= 'checked' if @filter.favourites -%>></input>
</td>
</tr>
<tr>
- <td class="first"><label for="key_regexp">Resource key like:</label></td>
+ <td class="first"><label for="key_regexp"><%= message('filters.resource_key_like') -%>:</label></td>
<td>
<% key_regexp_criterion=@filter.criterion('key') %>
<input type="text" name="key_regexp" id="key_regexp" value="<%= key_regexp_criterion.text_value if key_regexp_criterion -%>"></input>
- <span class="comments">Use the character * to match zero or more characters.</span>
+ <span class="comments"><%= message('filters.use_star_to_match') -%></span>
</td>
</tr>
<tr>
- <td class="first"><label for="name_regexp">Resource name like:</label></td>
+ <td class="first"><label for="name_regexp"><%= message('filters.resource_name_like') -%>:</label></td>
<td>
<% name_regexp_criterion=@filter.criterion('name') %>
<input type="text" name="name_regexp" id="name_regexp" value="<%= name_regexp_criterion.text_value if name_regexp_criterion -%>"></input>
- <span class="comments">Use the character * to match zero or more characters.</span>
+ <span class="comments"><%= message('filters.use_star_to_match') -%></span>
</td>
</tr>
<tr>
- <td class="first"><label for="date">Build date:</label></td>
+ <td class="first"><label for="date"><%= message('build_date') -%>:</label></td>
<td>
<% date_criterion = @filter.criterion('date') %>
<select id="date_operator" name="date_operator">
<option value=""></option>
- <option value="<" <%= 'selected' if (date_criterion && date_criterion.operator=='<') -%>>Prior to last</value>
- <option value=">=" <%= 'selected' if (date_criterion && date_criterion.operator=='>=') -%>>During last</value>
+ <option value="<" <%= 'selected' if (date_criterion && date_criterion.operator=='<') -%>><%= message('filters.prior_to_last') -%></value>
+ <option value=">=" <%= 'selected' if (date_criterion && date_criterion.operator=='>=') -%>><%= message('filters.during_last') -%></value>
</select>
- <input type="text" name="date_value" id="date_value" size="3" value="<%= date_criterion.value.to_i if date_criterion -%>"></input> days
+ <input type="text" name="date_value" id="date_value" size="3" value="<%= date_criterion.value.to_i if date_criterion -%>"></input> <%= message('days').downcase -%>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="2">
- <input type="submit" value="Save & Preview" onclick="filter_form.preview.value='true';return true;"/>
+ <input type="submit" value="<%= message('save_and_preview') -%>" onclick="filter_form.preview.value='true';return true;"/>
<span class="spacer"> </span>
- <input type="submit" value="Save & Close" />
+ <input type="submit" value="<%= message('save_and_close') -%>" />
<span class="spacer"> </span>
- <% if @filter.id %>
- <input name="delete" class="red-button" value="Delete" type="button"
- onclick="if (confirm('Do you want to delete this filter ?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = '<%= url_for :action => 'delete', :id => @filter.id %>';f.submit(); };return false;">
+ <% if @filter.id
+ confirmation_message = message('filters.do_you_want_to_delete')
+ %>
+ <input name="delete" class="red-button" value="<%= message('delete') -%>" type="button"
+ onclick="if (confirm('<%= confirmation_message -%>')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = '<%= url_for :action => 'delete', :id => @filter.id %>';f.submit(); };return false;">
<span class="spacer"> </span>
- <a href="<%= url_for :action => 'index', :name => @filter.name -%>">Cancel</a>
+ <a href="<%= url_for :action => 'index', :name => @filter.name -%>"><%= message('cancel') -%></a>
<% else %>
- <a href="<%= url_for :action => 'index' -%>">Cancel</a>
+ <a href="<%= url_for :action => 'index' -%>"><%= message('cancel') -%></a>
<% end %>
</td>
</tr>
@@ -182,16 +184,16 @@ $('name').focus();
<br/>
<% if @filter_context %>
- <h1>Display</h1>
+ <h1><%= message('display') -%></h1>
<div class="admin">
<table class="form" id="view-form">
<tr>
- <td class="first">Display as:</td>
+ <td class="first"><%= message('filters.display_as') -%>:</td>
<td>
<form action="<%= url_for :action => :set_view, :id => @filter.id -%>" method="POST">
- <input type="radio" name="view" value="list" <%= 'checked' if @filter.default_view==::Filter::VIEW_LIST -%> id="view-list" onClick="$('view-loading').show();submit();"></input> <label for="view-list">Table</label>
+ <input type="radio" name="view" value="list" <%= 'checked' if @filter.default_view==::Filter::VIEW_LIST -%> id="view-list" onClick="$('view-loading').show();submit();"></input> <label for="view-list"><%= message('table') -%></label>
<span class="spacer"> </span>
- <input type="radio" name="view" value="treemap" <%= 'checked' if @filter.default_view==::Filter::VIEW_TREEMAP -%> id="view-treemap" onClick="$('view-loading').show();submit();"></input> <label for="view-treemap">Treemap</label>
+ <input type="radio" name="view" value="treemap" <%= 'checked' if @filter.default_view==::Filter::VIEW_TREEMAP -%> id="view-treemap" onClick="$('view-loading').show();submit();"></input> <label for="view-treemap"><%= message('treemap') -%></label>
<span class="spacer"> </span>
<%= image_tag 'loading.gif', :id => 'view-loading', :style=>'display: none' %>
</form>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/search_path.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/search_path.html.erb
index 02dc65cf144..a3dc8ced1fe 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/search_path.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/search_path.html.erb
@@ -1,10 +1,10 @@
-<h1>Search</h1>
+<h1><%= message('search_verb') -%></h1>
<br/>
<form action="<%= url_for :action => :search_path -%>" method="post" id="search_form">
<input type="text" name="search" id="search" value="<%= params[:search] -%>"></input>
- <input type="submit" value="Search" id="search_submit" /><br/>
- <p class="note">Search by name</p>
+ <input type="submit" value="<%= message('search_verb') -%>" id="search_submit" /><br/>
+ <p class="note"><%= message('filters.search_by_name') -%></p>
</form>
<br/>
@@ -28,7 +28,7 @@
</thead>
<tbody>
<% if @snapshots.empty? %>
- <tr class="even"><td colspan="3">No results</td></tr>
+ <tr class="even"><td colspan="3"><%= message('no_results') -%></td></tr>
<% else
@snapshots.each do |snapshot| %>
@@ -38,7 +38,7 @@
<% path_name=snapshot.path_name %>
<%= path_name -%>
</td>
- <td><a href="#" onClick="selectPath(<%= snapshot.project_id-%>, '<%= escape_javascript(path_name) -%>')">Select</a></td>
+ <td><a href="#" onClick="selectPath(<%= snapshot.project_id-%>, '<%= escape_javascript(path_name) -%>')"><%= message('select_verb') -%></a></td>
</tr>
<% end
end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb
index dbe6685989b..ade8c73ef2f 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb
@@ -3,13 +3,13 @@
<table>
<tr>
<td>
- <span class="comments">Size:</span><br/>
+ <span class="comments"><%= message('size') -%>:</span><br/>
<%= select_tag 'size_metric', options_grouped_by_domain(Sonar::TreemapBuilder.size_metrics({:exclude_user_managed => true}), @size_metric.key),
:id => 'size_metric', :class => 'small', :onchange => "load_treemap(this.form.size_metric.value,this.form.color_metric.value, false);return false;" %>
</td>
<td class="sep"> </td>
<td>
- <span class="comments">Color: <%= render :partial => 'components/treemap_gradient', :locals => {:color_metric => @color_metric} %></span>
+ <span class="comments"><%= message('color') -%>: <%= render :partial => 'components/treemap_gradient', :locals => {:color_metric => @color_metric} %></span>
<br/>
<%= select_tag 'color_metric', options_grouped_by_domain(Sonar::TreemapBuilder.color_metrics, @color_metric.key),
:id => 'color_metric', :class => 'small', :onchange => "load_treemap(this.form.size_metric.value,this.form.color_metric.value, false);return false;" %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb
index 66344364c10..59c9aa6eee1 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb
@@ -1,5 +1,5 @@
<ol id="crumbs">
- <li><a href="<%= ApplicationController.root_context -%>/">Home</a></li>
+ <li><a href="<%= ApplicationController.root_context -%>/"><%= message('layout.home') -%></a></li>
<%
if @snapshot
resources=[]
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
index 5a09ff6a1f3..004552333e9 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
@@ -3,20 +3,20 @@
<div id="hd">
<%= render :partial => 'layouts/breadcrumb' %>
<ol id="nav">
- <li><input type="text" autocomplete="off" size="15" name="search" id="projectSearch" onFocus="this.size=30;this.value='';autocompleteProjects('<%= ApplicationController.root_context -%>/api/resources?scopes=<%= Project::SCOPE_SET -%>&qualifiers=<%= Project::QUALIFIER_VIEW-%>,<%= Project::QUALIFIER_SUBVIEW-%>,<%= Project::QUALIFIER_PROJECT-%>', '<%= ApplicationController.root_context -%>/dashboard/index/', this, $('projectResults'));return true;" onBlur="javacript:this.size=15" value="Search"/><div id="projectResults" style="display:none"></div></li>
+ <li><input type="text" autocomplete="off" size="15" name="search" id="projectSearch" onFocus="this.size=30;this.value='';autocompleteProjects('<%= ApplicationController.root_context -%>/api/resources?scopes=<%= Project::SCOPE_SET -%>&qualifiers=<%= Project::QUALIFIER_VIEW-%>,<%= Project::QUALIFIER_SUBVIEW-%>,<%= Project::QUALIFIER_PROJECT-%>', '<%= ApplicationController.root_context -%>/dashboard/index/', this, $('projectResults'));return true;" onBlur="javacript:this.size=15" value="<%= message('search_verb') -%>"/><div id="projectResults" style="display:none"></div></li>
<li>
- <a href="javascript:window.print()"><img src="<%= ApplicationController.root_context -%>/images/print.gif" alt="Print" title="Print" /></a>
- <% if @project %><a href="<%= url_for :overwrite_params => {:id => @project.key}-%>" id="permalink"><img src="<%= ApplicationController.root_context -%>/images/permalink.gif" alt="Permalink" title="Permalink" /></a><% end %>
+ <a href="javascript:window.print()"><img src="<%= ApplicationController.root_context -%>/images/print.gif" alt="<%= message('layout.print') -%>" title="<%=message('layout.print')-%>" /></a>
+ <% if @project %><a href="<%= url_for :overwrite_params => {:id => @project.key}-%>" id="permalink"><img src="<%= ApplicationController.root_context -%>/images/permalink.gif" alt="<%=message('layout.permalink')-%>" title="<%=message('layout.permalink')-%>" /></a><% end %>
</li>
<% if logged_in? %>
<li>
<img src="<%= ApplicationController.root_context -%>/images/user.gif"/><a href="<%= ApplicationController.root_context -%>/account/index"><%= current_user.name(true) -%></a>
- &raquo; <a href="<%= ApplicationController.root_context -%>/sessions/logout">Log out</a>
+ &raquo; <a href="<%= ApplicationController.root_context -%>/sessions/logout"><%= message('layout.logout') -%></a>
</li>
<% else %>
- <li><a href="<%= ApplicationController.root_context -%>/sessions/new"><%= message('app.view.layouts.layout.login', 'Log in') -%></a></li>
+ <li><a href="<%= ApplicationController.root_context -%>/sessions/new"><%= message('layout.login') -%></a></li>
<% end %>
- <li><a href="<%= ApplicationController.root_context -%>/profiles">Configuration</a></li>
+ <li><a href="<%= ApplicationController.root_context -%>/profiles"><%= message('layout.configuration') -%></a></li>
</ol>
</div>
@@ -25,68 +25,68 @@
<div id="sidebar">
<ul>
<% if selected_section==Navigation::SECTION_HOME %>
- <li class="<%= 'selected' if controller.controller_path=='filters' -%>"><a href="<%= ApplicationController.root_context -%>/filters/index">Filters</a></li>
- <li class="<%= 'selected' if controller.controller_path=='reviews' -%>"><a href="<%= ApplicationController.root_context -%>/reviews/index">Reviews</a></li>
- <li class="<%= 'selected' if controller.controller_path=='dependencies' -%>"><a href="<%= ApplicationController.root_context -%>/dependencies/index">Dependencies</a></li>
+ <li class="<%= 'selected' if controller.controller_path=='filters' -%>"><a href="<%= ApplicationController.root_context -%>/filters/index"><%= message('filters.page') -%></a></li>
+ <li class="<%= 'selected' if controller.controller_path=='reviews' -%>"><a href="<%= ApplicationController.root_context -%>/reviews/index"><%= message('reviews.page') -%></a></li>
+ <li class="<%= 'selected' if controller.controller_path=='dependencies' -%>"><a href="<%= ApplicationController.root_context -%>/dependencies/index"><%= message('dependencies.page') -%></a></li>
<% controller.java_facade.getPages(Navigation::SECTION_HOME, nil, nil, nil).each do |page|
selected=request.request_uri.include?("/plugins/home/#{page.getId()}") %>
- <li class="<%= 'selected' if selected -%>"><a href="<%= ApplicationController.root_context -%>/plugins/home/<%= page.getId() -%>"><%= page.getTitle()-%></a></li>
+ <li class="<%= 'selected' if selected -%>"><a href="<%= ApplicationController.root_context -%>/plugins/home/<%= page.getId() -%>"><%= message(page.getId() + '.page', :default => page.getTitle()) -%></a></li>
<% end %>
<% elsif (selected_section==Navigation::SECTION_RESOURCE) %>
<% ActiveDashboard.user_dashboards(current_user).each do |active_dashboard| %>
<li class="<%= 'selected' if @dashboard && controller.controller_path=='dashboard' && active_dashboard.dashboard_id==@dashboard.id -%>"><a href="<%= ApplicationController.root_context -%>/dashboard/index/<%= @project.id -%>?did=<%= active_dashboard.dashboard_id -%>"><%= active_dashboard.dashboard.name -%></a></li>
<% end %>
- <li class="<%= 'selected' if request.request_uri.include?('/components/index') -%>"><a href="<%= ApplicationController.root_context -%>/components/index/<%= @project.id -%>">Components</a></li>
- <li class="<%= 'selected' if request.request_uri.include?('/drilldown/violations') -%>"><a href="<%= ApplicationController.root_context -%>/drilldown/violations/<%= @project.id -%>">Violations drilldown</a></li>
- <li class="<%= 'selected' if controller.controller_path=='timemachine' -%>"><a href="<%= ApplicationController.root_context -%>/timemachine/index/<%= @project.id -%>">Time machine</a></li>
- <li class="<%= 'selected' if request.request_uri.include?('/cloud/index') -%>"><a href="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>">Clouds</a></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/components/index') -%>"><a href="<%= ApplicationController.root_context -%>/components/index/<%= @project.id -%>"><%= message('components.page') -%></a></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/drilldown/violations') -%>"><a href="<%= ApplicationController.root_context -%>/drilldown/violations/<%= @project.id -%>"><%= message('violations_drilldown.page') -%></a></li>
+ <li class="<%= 'selected' if controller.controller_path=='timemachine' -%>"><a href="<%= ApplicationController.root_context -%>/timemachine/index/<%= @project.id -%>"><%= message('timemachine.page') -%></a></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/cloud/index') -%>"><a href="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>"><%= message('clouds.page') -%></a></li>
<% controller.java_facade.getPages(Navigation::SECTION_RESOURCE, @project.scope, @project.qualifier, @project.language).each do |page| %>
- <li class="<%= 'selected' if request.request_uri.include?("page=#{page.getId()}") -%>"><a href="<%= ApplicationController.root_context -%>/plugins/resource/<%= @project.id-%>?page=<%= page.getId() -%>"><%= page.getTitle() %></a></li>
+ <li class="<%= 'selected' if request.request_uri.include?("page=#{page.getId()}") -%>"><a href="<%= ApplicationController.root_context -%>/plugins/resource/<%= @project.id-%>?page=<%= page.getId() -%>"><%= message(page.getId() + '.page', :default => page.getTitle()) %></a></li>
<% end %>
<% if has_role?(:admin, @project) && @project.set? %>
- <li class="h2">System</li>
+ <li class="h2"><%= message('sidebar.project_system') -%></li>
<% if (@project.project? || @project.module?) %>
- <li class="<%= 'selected' if request.request_uri.include?('/project/settings') -%>"><a href="<%= ApplicationController.root_context -%>/project/settings/<%= @project.id -%>">Settings</a></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/project/settings') -%>"><a href="<%= ApplicationController.root_context -%>/project/settings/<%= @project.id -%>"><%= message('project_settings.page') -%></a></li>
<% end %>
<% if (@project.project? || @project.view? || @project.subview?) %>
- <li class="<%= 'selected' if request.request_uri.include?('/project_roles') -%>"><a href="<%= ApplicationController.root_context -%>/project_roles/index?resource=<%= @project.id -%>">Project roles</a></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/project_roles') -%>"><a href="<%= ApplicationController.root_context -%>/project_roles/index?resource=<%= @project.id -%>"><%= message('project_roles.page') -%></a></li>
<% end %>
<% end %>
<% elsif selected_section==Navigation::SECTION_CONFIGURATION %>
- <li class="<%= 'selected' if request.request_uri.include?('/profiles') || request.request_uri.include?('/rules_configuration') -%>"><a href="<%= ApplicationController.root_context -%>/profiles">Quality profiles</a></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/profiles') || request.request_uri.include?('/rules_configuration') -%>"><a href="<%= ApplicationController.root_context -%>/profiles"><%= message('quality_profiles.page') -%></a></li>
<% if is_admin? %>
- <li class="<%= 'selected' if controller.controller_path=='event_categories' -%>"><a href="<%= ApplicationController.root_context -%>/event_categories/index">Event categories</a></li>
- <li class="<%= 'selected' if controller.controller_path=='metrics' -%>"><a href="<%= ApplicationController.root_context -%>/metrics/index">Manual metrics</a></li>
- <li class="<%= 'selected' if controller.controller_path=='admin_filters' -%>"><a href="<%= ApplicationController.root_context -%>/admin_filters/index">Default filters</a></li>
- <li class="<%= 'selected' if controller.controller_path=='admin_dashboards' -%>"><a href="<%= ApplicationController.root_context -%>/admin_dashboards/index">Default dashboards</a></li>
- <li class="<%= 'selected' if controller.controller_path=='account' -%>"><a href="<%= ApplicationController.root_context -%>/account/index">My profile</a></li>
+ <li class="<%= 'selected' if controller.controller_path=='event_categories' -%>"><a href="<%= ApplicationController.root_context -%>/event_categories/index"><%= message('event_categories.page') -%></a></li>
+ <li class="<%= 'selected' if controller.controller_path=='metrics' -%>"><a href="<%= ApplicationController.root_context -%>/metrics/index"><%= message('manual_metrics.page') -%></a></li>
+ <li class="<%= 'selected' if controller.controller_path=='admin_filters' -%>"><a href="<%= ApplicationController.root_context -%>/admin_filters/index"><%= message('default_filters.page') -%></a></li>
+ <li class="<%= 'selected' if controller.controller_path=='admin_dashboards' -%>"><a href="<%= ApplicationController.root_context -%>/admin_dashboards/index"><%= message('default_dashboards.page') -%></a></li>
+ <li class="<%= 'selected' if controller.controller_path=='account' -%>"><a href="<%= ApplicationController.root_context -%>/account/index"><%= message('my_profile.page') -%></a></li>
<% controller.java_facade.getPages(Navigation::SECTION_CONFIGURATION, nil,nil, nil).each do |page| %>
- <li class="<%= 'selected' if request.request_uri.include?("plugins/configuration/#{page.getId()}") -%>"><a href="<%= ApplicationController.root_context -%>/plugins/configuration/<%= page.getId() -%>"><%= page.getTitle() %></a></li>
+ <li class="<%= 'selected' if request.request_uri.include?("plugins/configuration/#{page.getId()}") -%>"><a href="<%= ApplicationController.root_context -%>/plugins/configuration/<%= page.getId() -%>"><%= message(page.getId() + '.page', :default => page.getTitle()) %></a></li>
<% end %>
- <li class="h2">Security</li>
- <li class="<%= 'selected' if request.request_uri.include?('/users') -%>"><a href="<%= ApplicationController.root_context -%>/users">Users</a></li>
- <li class="<%= 'selected' if request.request_uri.include?('/groups') -%>"><a href="<%= ApplicationController.root_context -%>/groups/index">Groups</a></li>
- <li class="<%= 'selected' if request.request_uri.include?('/roles/global') -%>"><a href="<%= ApplicationController.root_context -%>/roles/global">Global roles</a></li>
- <li class="<%= 'selected' if request.request_uri.include?('/roles/projects') -%>"><a href="<%= ApplicationController.root_context -%>/roles/projects">Project roles</a></li>
+ <li class="h2"><%= message('sidebar.security') -%></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/users') -%>"><a href="<%= ApplicationController.root_context -%>/users"><%= message('users.page') -%></a></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/groups') -%>"><a href="<%= ApplicationController.root_context -%>/groups/index"><%= message('user_groups.page') -%></a></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/roles/global') -%>"><a href="<%= ApplicationController.root_context -%>/roles/global"><%= message('global_roles.page') -%></a></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/roles/projects') -%>"><a href="<%= ApplicationController.root_context -%>/roles/projects"><%= message('project_roles.page') -%></a></li>
- <li class="h2">System</li>
- <li class="<%= 'selected' if request.request_uri.include?('/settings') -%>"><a href="<%= ApplicationController.root_context -%>/settings/index">Settings</a></li>
- <li class="<%= 'selected' if controller.controller_path=='backup' -%>"><a href="<%= ApplicationController.root_context -%>/backup">Backup</a></li>
- <li class="<%= 'selected' if controller.controller_path=='system' -%>"><a href="<%= ApplicationController.root_context -%>/system">System Info</a></li>
+ <li class="h2"><%= message('sidebar.system') -%></li>
+ <li class="<%= 'selected' if request.request_uri.include?('/settings') -%>"><a href="<%= ApplicationController.root_context -%>/settings/index"><%= message('settings.page') -%></a></li>
+ <li class="<%= 'selected' if controller.controller_path=='backup' -%>"><a href="<%= ApplicationController.root_context -%>/backup"><%= message('backup.page') -%></a></li>
+ <li class="<%= 'selected' if controller.controller_path=='system' -%>"><a href="<%= ApplicationController.root_context -%>/system"><%= message('system_info.page') -%></a></li>
<% update_center_activated = controller.java_facade.getConfigurationValue('sonar.updatecenter.activate') || 'true';
if update_center_activated=='true' %>
- <li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>"><a href="<%= ApplicationController.root_context -%>/updatecenter">Update Center</a></li>
+ <li class="<%= 'selected' if controller.controller_path=='updatecenter' -%>"><a href="<%= ApplicationController.root_context -%>/updatecenter"><%= message('update_center.page') -%></a></li>
<% end %>
<% end %>
<% end %>
</ul>
- <div id="logo"><center><a href="http://www.sonarsource.org/"><%= image_tag('sonar.png', :alt => 'Embrace Quality', :class => 'png') -%></a></center></div>
+ <div id="logo"><center><a href="http://www.sonarsource.org/"><%= image_tag('sonar.png', :alt => message('layout.sonar.slogan'), :class => 'png') -%></a></center></div>
</div>
<% if @sidebar %><div id="sidebarconf"><%= render :partial => @sidebar %></div><% else %><div id="sidebarconf" class="hidden"> </div><% end %>
@@ -107,6 +107,19 @@
<% controller.java_facade.getWebFooters().each do |footer| %>
<% if footer.getHtml() %><div><%= footer.getHtml().to_s %></div><% end %>
<% end %>
-<div id="ftlinks">Powered by <a href="http://www.sonarsource.com" target="SonarSource" class="external">SonarSource</a> - Open Source <a href="http://www.sonarsource.org/documentation/license/" target="license" class="external">LGPL</a> - v.<%= sonar_version -%> - <a href="http://sonar-plugins.codehaus.org" class="external" target="plugins">Plugins</a> - <a href="http://sonar.codehaus.org/documentation" class="external" target="sonar_doc" class="external">Documentation</a> - <a href="http://sonar.codehaus.org/support/" target="support" class="external">Ask a question</a> - <a href="http://jira.codehaus.org/browse/SONAR" target="issuetracker" class="external">Bug/feature request</a></div>
+<div id="ftlinks">
+ <%= message('layout.powered_by') -%> <a href="http://www.sonarsource.com" target="SonarSource" class="external">SonarSource</a>
+ -
+ Open Source <a href="http://www.sonarsource.org/documentation/license/" target="license" class="external">LGPL</a>
+ -
+ v.<%= sonar_version -%>
+ -
+ <a href="http://sonar-plugins.codehaus.org" class="external" target="plugins"><%= message('layout.plugins') -%></a>
+ -
+ <a href="http://sonar.codehaus.org/documentation" class="external" target="sonar_doc" class="external"><%= message('layout.documentation') -%></a>
+ -
+ <a href="http://sonar.codehaus.org/support/" target="support" class="external"><%= message('layout.ask_a_questions') -%></a>
+ -
+ <a href="http://jira.codehaus.org/browse/SONAR" target="issuetracker" class="external"><%= message('layout.bug_feature_request') -%></a></div>
</div>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb
index 96c67ece219..d3fc617b3c1 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb
@@ -8,7 +8,7 @@
<td class="sep"> </td>
<% if m=measure('new_line_coverage') %>
- <td class="name">Line coverage:</td>
+ <td class="name"><%= message('metric.line_coverage.name') -%>:</td>
<td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%></td>
<% else %>
<td colspan="2"></td>
@@ -16,7 +16,7 @@
<td class="sep"> </td>
<% if m=measure('new_branch_coverage') %>
- <td class="name">Branch coverage:</td>
+ <td class="name"><%= message('metric.branch_coverage.name') -%>:</td>
<td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%></td>
<% else %>
<td colspan="2"></td>
@@ -25,7 +25,7 @@
<tr>
<td class="sep"> </td>
<% if m=measure('new_uncovered_lines') %>
- <td class="name">Uncovered lines:</td>
+ <td class="name"><%= message('metric.uncovered_lines.name') -%>:</td>
<td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%>/<%= format_variation('new_lines_to_cover', :period => @period, :style => 'none') -%></td>
<% else %>
<td colspan="2"></td>
@@ -33,7 +33,7 @@
<td class="sep"> </td>
<% if m=measure('new_uncovered_conditions') %>
- <td class="name">Uncovered conditions: </td>
+ <td class="name"><%= message('metric.uncovered_conditions.name') -%>: </td>
<td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%>/<%= format_variation('new_conditions_to_cover', :period => @period, :style => 'none') -%></td>
<% else %>
<td colspan="2"></td>
@@ -45,16 +45,16 @@
<tr>
<td class="big" rowspan="2"><%= format_measure('coverage', :default => '-') -%></td>
<td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('line_coverage'), :title => 'Line coverage'} -%>
+ <%= render :partial => 'measure', :locals => {:measure => measure('line_coverage'), :title => message('metric.line_coverage.name')} -%>
<td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('branch_coverage'), :title => 'Branch coverage'} -%>
+ <%= render :partial => 'measure', :locals => {:measure => measure('branch_coverage'), :title => message('metric.branch_coverage.name')} -%>
</tr>
<tr>
<td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_lines'), :title => 'Uncovered lines', :ratio => measure('lines_to_cover')} -%>
+ <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_lines'), :title => message('metric.uncovered_lines.name'), :ratio => measure('lines_to_cover')} -%>
<td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_conditions'), :title => 'Uncovered conditions', :ratio => measure('conditions_to_cover')} -%>
+ <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_conditions'), :title => message('metric.uncovered_conditions.name'), :ratio => measure('conditions_to_cover')} -%>
</tr>
</table>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_source.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_source.html.erb
index de5451252c1..e825e52289d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_source.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_source.html.erb
@@ -5,31 +5,31 @@
<table class="metrics">
<% if m=measure('lines') %>
<tr>
- <td class="name">Lines:</td>
+ <td class="name"><%= message('metric.lines.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('ncloc') %>
<tr>
- <td class="name">Lines of code:</td>
+ <td class="name"><%= message('metric.ncloc.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('functions') %>
<tr>
- <td class="name">Methods:</td>
+ <td class="name"><%= message('metric.functions.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('accessors') %>
<tr>
- <td class="name">Accessors:</td>
+ <td class="name"><%= message('metric.accessors.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('paragraphs') %>
<tr>
- <td class="name">Paragraphs:</td>
+ <td class="name"><%= message('metric.paragraphs.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
@@ -39,25 +39,25 @@
<table class="metrics">
<% if m=measure('statements') %>
<tr>
- <td class="name">Statements:</td>
+ <td class="name"><%= message('metric.statements.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('complexity') %>
<tr>
- <td class="name">Complexity:</td>
+ <td class="name"><%= message('metric.complexity.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('function_complexity') %>
<tr>
- <td class="name">Complexity/method:</td>
+ <td class="name"><%= message('metric.function_complexity.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('paragraph_complexity') %>
<tr>
- <td class="name">Complexity/paragraph:</td>
+ <td class="name"><%= message('metric.paragraph_complexity.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
@@ -67,25 +67,25 @@
<table class="metrics">
<% if m=measure('comment_lines_density') %>
<tr>
- <td class="name">Comments:</td>
+ <td class="name"><%= message('metric.comment_lines_density.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('comment_lines') %>
<tr>
- <td class="name">Comment lines:</td>
+ <td class="name"><%= message('metric.comment_lines.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('commented_out_code_lines') %>
<tr>
- <td class="name">Commented-out LOC:</td>
+ <td class="name"><%= message('metric.commented_out_code_lines.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('comment_blank_lines') %>
<tr>
- <td class="name">Blank comments:</td>
+ <td class="name"><%= message('metric.comment_blank_lines.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
@@ -95,19 +95,19 @@
<table class="metrics">
<% if m=measure('public_documented_api_density') %>
<tr>
- <td class="name">Public documented API:</td>
+ <td class="name"><%= message('metric.public_documented_api_density.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('public_undocumented_api') %>
<tr>
- <td class="name">Public undocumented API:</td>
+ <td class="name"><%= message('metric.public_undocumented_api.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('public_api') %>
<tr>
- <td class="name">Public API:</td>
+ <td class="name"><%= message('metric.public_api.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
@@ -117,25 +117,25 @@
<table class="metrics">
<% if m=measure('classes') %>
<tr>
- <td class="name">Classes:</td>
+ <td class="name"><%= message('metric.classes.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('noc') %>
<tr>
- <td class="name">Number of Children:</td>
+ <td class="name"><%= message('metric.noc.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('dit') %>
<tr>
- <td class="name">Depth in Tree:</td>
+ <td class="name"><%= message('metric.dit.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
<% if m=measure('rfc') %>
<tr>
- <td class="name">Response for Class (RFC):</td>
+ <td class="name"><%= message('metric.rfc.name') -%>:</td>
<td class="value"><%= format_measure(m) -%></td>
</tr>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_violations.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_violations.html.erb
index 9e6522c5f88..58ed8b42cc9 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_violations.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_violations.html.erb
@@ -2,31 +2,31 @@
<% if @period && measure('new_violations') %>
<table>
<tr>
- <td><span class="big"><%= format_variation('new_violations', :default => 0, :period => @period, :style => 'none') -%></span> new violations</td>
+ <td><span class="big"><%= format_variation('new_violations', :default => 0, :period => @period, :style => 'none') -%></span>&nbsp;<%= message('new_violations').downcase -%></td>
<td class="sep"> </td>
<td><%= image_tag 'priority/BLOCKER.png' -%></td>
- <td class="name">Blocker:</td>
+ <td class="name"><%= message('blocker') -%>:</td>
<td class="value"><%= format_variation('new_blocker_violations', :default => 0, :period => @period, :style => 'none') -%></td>
<td class="sep"> </td>
<td><%= image_tag 'priority/CRITICAL.png' -%></td>
- <td class="name">Critical:</td>
+ <td class="name"><%= message('critical') -%>:</td>
<td class="value"><%= format_variation('new_critical_violations', :default => 0, :period => @period, :style => 'none') -%></td>
<td class="sep"> </td>
<td><%= image_tag 'priority/MAJOR.png' -%></td>
- <td class="name">Major:</td>
+ <td class="name"><%= message('major') -%>:</td>
<td class="value"><%= format_variation('new_major_violations', :default => 0, :period => @period, :style => 'none') -%></td>
<td class="sep"> </td>
<td><%= image_tag 'priority/MINOR.png' -%></td>
- <td class="name">Minor:</td>
+ <td class="name"><%= message('minor') -%>:</td>
<td class="value"><%= format_variation('new_minor_violations', :default => 0, :period => @period, :style => 'none') -%></td>
<td class="sep"> </td>
<td><%= image_tag 'priority/INFO.png' -%></td>
- <td class="name">Info:</td>
+ <td class="name"><%= message('info') -%>:</td>
<td class="value"><%= format_variation('new_info_violations', :default => 0, :period => @period, :style => 'none') -%></td>
</tr>
</table>
@@ -34,31 +34,31 @@
<% else %>
<table class="sourceHeader">
<tr>
- <td nowrap><span class="big"><%= format_measure('violations', :default => 0) -%></span> violations</td>
+ <td nowrap><span class="big"><%= format_measure('violations', :default => 0) -%></span>&nbsp;<%= message('violations').downcase -%></td>
<td class="sep"> </td>
<td nowrap><%= image_tag 'priority/BLOCKER.png' -%></td>
- <td class="name">Blocker:</td>
+ <td class="name"><%= message('blocker') -%>:</td>
<td class="value"><%= format_measure('blocker_violations', :default => 0) -%></td>
<td class="sep"> </td>
<td><%= image_tag 'priority/CRITICAL.png' -%></td>
- <td class="name">Critical:</td>
+ <td class="name"><%= message('critical') -%>:</td>
<td class="value"><%= format_measure('critical_violations', :default => 0) -%></td>
<td class="sep"> </td>
<td><%= image_tag 'priority/MAJOR.png' -%></td>
- <td class="name">Major:</td>
+ <td class="name"><%= message('major') -%>:</td>
<td class="value"><%= format_measure('major_violations', :default => 0) -%></td>
<td class="sep"> </td>
<td><%= image_tag 'priority/MINOR.png' -%></td>
- <td class="name">Minor:</td>
+ <td class="name"><%= message('minor') -%>:</td>
<td class="value"><%= format_measure('minor_violations', :default => 0) -%></td>
<td class="sep"> </td>
<td><%= image_tag 'priority/INFO.png' -%></td>
- <td class="name">Info:</td>
+ <td class="name"><%= message('info') -%>:</td>
<td class="value"><%= format_measure('info_violations', :default => 0) -%></td>
</tr>
</table>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
index 7e765102206..df02860d42c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
@@ -28,7 +28,7 @@
if @expandable %>
<td class="<%= 'first' if first -%>">
<input type="checkbox" value="true" name="expand" id="expand" <%= 'checked' if @expanded -%> onclick="applyOptions()"/>
- <label for="expand">Full source</label>
+ <label for="expand"><%= message('full_source') -%></label>
</td>
<% first=false
end %>
@@ -36,7 +36,7 @@
<% if @scm_available && !@display_violations && @snapshot.project_snapshot.periods? %>
<td class="<%= 'first' if first -%>">
<select id="period" name="period" onchange="applyOptions()">
- <option value="">Time changes...</option>
+ <option value=""><%= message('time_changes') -%>...</option>
<%= period_select_options(@snapshot, 1) -%>
<%= period_select_options(@snapshot, 2) -%>
<%= period_select_options(@snapshot, 3) -%>
@@ -51,7 +51,7 @@
<% if @display_violations %>
<td class="<%= 'first' if first -%>">
<select id="period" name="period" onchange="applyOptions()">
- <option value="">Time changes...</option>
+ <option value=""><%= message('time_changes') -%>...</option>
<%= violation_period_select_options(@snapshot, 1) -%>
<%= violation_period_select_options(@snapshot, 2) -%>
<%= violation_period_select_options(@snapshot, 3) -%>
@@ -67,10 +67,10 @@
<% if @display_coverage %>
<td class="<%= 'first' if first -%>">
<select id="coverage_filter" name="coverage_filter" onchange="applyOptions()">
- <option value="lines_to_cover" <%= 'selected' if @coverage_filter=='lines_to_cover' -%>>Lines to cover</option>
- <option value="uncovered_lines" <%= 'selected' if @coverage_filter=='uncovered_lines' -%>>Uncovered lines</option>
- <option value="conditions_to_cover" <%= 'selected' if @coverage_filter=='conditions_to_cover' -%>>Branches to cover</option>
- <option value="uncovered_conditions" <%= 'selected' if @coverage_filter=='uncovered_conditions' -%>>Uncovered branches</option>
+ <option value="lines_to_cover" <%= 'selected' if @coverage_filter=='lines_to_cover' -%>><%= message('metric.lines_to_cover.name') -%></option>
+ <option value="uncovered_lines" <%= 'selected' if @coverage_filter=='uncovered_lines' -%>><%= message('metric.uncovered_lines.name') -%></option>
+ <option value="conditions_to_cover" <%= 'selected' if @coverage_filter=='conditions_to_cover' -%>><%= message('metric.conditions_to_cover.name') -%></option>
+ <option value="uncovered_conditions" <%= 'selected' if @coverage_filter=='uncovered_conditions' -%>><%= message('metric.uncovered_conditions.name') -%></option>
</select>
</td>
<% first=false
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb
index 06d89dc5414..5546d9d64ce 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb
@@ -32,14 +32,14 @@
end
%>
<select id="rule" name="rule" onchange="applyOptions()">
- <option value="">All violations</option>
- <option value="f-positive" <%= 'selected' if params[:rule]=="f-positive" -%>>False-Positives only</option>
- <optgroup label="Severity">
+ <option value=""><%= message('all_violations') -%></option>
+ <option value="f-positive" <%= 'selected' if params[:rule]=="f-positive" -%>><%= message('false_positives_only') -%></option>
+ <optgroup label="<%= message('severity') -%>">
<% if blocker_violations
value=(@period ? blocker_violations.variation(@period) : blocker_violations.value)
if value && value>0
%>
- <option value="<%= Sonar::RulePriority::BLOCKER.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::BLOCKER.to_s -%>>Blocker (<%= blocker_violations.format_numeric_value(value) -%>)</option>
+ <option value="<%= Sonar::RulePriority::BLOCKER.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::BLOCKER.to_s -%>><%= message('blocker') -%> (<%= blocker_violations.format_numeric_value(value) -%>)</option>
<% end
end %>
@@ -47,7 +47,7 @@
value=(@period ? critical_violations.variation(@period) : critical_violations.value)
if value && value>0
%>
- <option value="<%= Sonar::RulePriority::CRITICAL.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::CRITICAL.to_s -%>>Critical (<%= critical_violations.format_numeric_value(value) -%>)</option>
+ <option value="<%= Sonar::RulePriority::CRITICAL.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::CRITICAL.to_s -%>><%= message('critical') -%> (<%= critical_violations.format_numeric_value(value) -%>)</option>
<% end
end
%>
@@ -56,7 +56,7 @@
value=(@period ? major_violations.variation(@period) : major_violations.value)
if value && value>0
%>
- <option value="<%= Sonar::RulePriority::MAJOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MAJOR.to_s -%>>Major (<%= major_violations.format_numeric_value(value) -%>)</option>
+ <option value="<%= Sonar::RulePriority::MAJOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MAJOR.to_s -%>><%= message('major') -%> (<%= major_violations.format_numeric_value(value) -%>)</option>
<% end
end
%>
@@ -65,7 +65,7 @@
value=(@period ? minor_violations.variation(@period) : minor_violations.value)
if value && value>0
%>
- <option value="<%= Sonar::RulePriority::MINOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MINOR.to_s -%>>Minor (<%= minor_violations.format_numeric_value(value) -%>)</option>
+ <option value="<%= Sonar::RulePriority::MINOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MINOR.to_s -%>><%= message('minor') -%> (<%= minor_violations.format_numeric_value(value) -%>)</option>
<% end
end
%>
@@ -74,7 +74,7 @@
value=(@period ? info_violations.variation(@period) : info_violations.value)
if value && value>0
%>
- <option value="<%= Sonar::RulePriority::INFO.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::INFO.to_s -%>>Info (<%= info_violations.format_numeric_value(value) -%>)</option>
+ <option value="<%= Sonar::RulePriority::INFO.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::INFO.to_s -%>><%= message('info') -%> (<%= info_violations.format_numeric_value(value) -%>)</option>
<% end
end
%>
@@ -82,7 +82,7 @@
</optgroup>
- <optgroup label="Rule">
+ <optgroup label="<%= message('rule') -%>">
<%= options_for_select(rule_options, params[:rule].to_i) -%>
</optgroup>
</select> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb
index 3374fc037fc..9c629eaad77 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb
@@ -13,22 +13,22 @@
first=true
if @snapshot.source
%>
- <li class="<%= 'first' if first -%>"><a href="<%= ApplicationController.root_context -%>/api/sources?resource=<%= @resource.key -%>&amp;format=txt">Raw</a></li>
+ <li class="<%= 'first' if first -%>"><a href="<%= ApplicationController.root_context -%>/api/sources?resource=<%= @resource.key -%>&amp;format=txt"><%= message('raw') -%></a></li>
<% first=false
end
if request.xhr? %>
- <li class="<%= 'first' if first -%>"><a href="<%= ApplicationController.root_context -%>/resource/index/<%= @resource.key -%>" onclick="window.open(this.href,'resource','height=800,width=900,scrollbars=1,resizable=1');return false;">New Window</a></li>
+ <li class="<%= 'first' if first -%>"><a href="<%= ApplicationController.root_context -%>/resource/index/<%= @resource.key -%>" onclick="window.open(this.href,'resource','height=800,width=900,scrollbars=1,resizable=1');return false;"><%= message('new_window') -%></a></li>
<% end %>
</ul>
<ul class="tabs" >
<% if request.xhr? %>
<% @extensions.each do |extension| %>
- <li><a href="#" onclick="loadAjaxTab('<%= @resource.id -%>','<%= extension.getId() -%>',<%= display_title -%>)" class="<%= 'selected' if @extension && @extension.getId()==extension.getId() -%>"><%= extension.getTitle() -%></a></li>
+ <li><a href="#" onclick="loadAjaxTab('<%= @resource.id -%>','<%= extension.getId() -%>',<%= display_title -%>)" class="<%= 'selected' if @extension && @extension.getId()==extension.getId() -%>"><%= message(extension.getId() + '.page', :default => extension.getTitle()) %></a></li>
<% end %>
<% else %>
<script>function loadTab(url) {$('resource-loading').show();document.location.href=url;return false;}</script>
<% @extensions.each do |extension| %>
- <li><a href="#" onClick="loadTab('<%= url_for(:overwrite_params => {:tab => extension.getId(), :metric => nil}) -%>')" class="<%= 'selected' if @extension && @extension.getId()==extension.getId() -%>"><%= extension.getTitle() -%></a></li>
+ <li><a href="#" onClick="loadTab('<%= url_for(:overwrite_params => {:tab => extension.getId(), :metric => nil}) -%>')" class="<%= 'selected' if @extension && @extension.getId()==extension.getId() -%>"><%= message(extension.getId() + '.page', :default => extension.getTitle()) %></a></li>
<% end %>
<% end %>
<li>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
index e77da238aeb..b692a19a301 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
@@ -22,19 +22,19 @@
<% if violation.switched_off? %>
<%= image_tag("sep12.png") -%>
&nbsp;
- <span class="falsePositive">False-Positive</span>
+ <span class="falsePositive"><%= message('false_positive') -%></span>
&nbsp;
<% end %>
<% if violation.review && violation.review.isReopened? %>
<%= image_tag("sep12.png") -%>
&nbsp;
- <span class="review-reopened">Reopened</span>
+ <span class="review-reopened"><%= message('reopened') -%></span>
&nbsp;
<% end %>
<% if violation.review && violation.review.assignee_id %>
<%= image_tag("sep12.png") -%>
&nbsp;
- Assigned to: <%= h(violation.review.assignee.name) -%>
+ <%= message('assigned_to') -%>: <%= h(violation.review.assignee.name) -%>
&nbsp;
<% end %>
@@ -46,14 +46,14 @@
unless violation.switched_off?
%>
&nbsp;
- <%= link_to_remote (violation.review.isResolved? ? "Reopen" : "Resolve"),
+ <%= link_to_remote (violation.review.isResolved? ? message('reopen') : message('resolve')),
:url => { :controller => "reviews", :action => "violation_change_status", :id => violation.id},
:update => "vId" + violation.id.to_s,
- :confirm => violation.review.isResolved? ? "Do you want to reopen this review?" : "Do you want to resolve this review?" -%>
+ :confirm => violation.review.isResolved? ? message('reviews.do_you_want_to_reopen') : message('reviews.do_you_want_to_resolve') -%>
<% unless violation.review && violation.review.isResolved? %>
&nbsp;
- <%= link_to_remote (violation.review.assignee_id ? "Reassign" : "Assign"),
+ <%= link_to_remote (violation.review.assignee_id ? message('reassign') : message('assign')),
:url => { :controller => "reviews", :action => "violation_assign_form", :violation_id => violation.id},
:update => "vActions" + violation.id.to_s,
:complete => "$('vActions" + violation.id.to_s + "').show();$('commentActions" + violation.id.to_s + "').hide();$('assignee_login').focus();" -%>
@@ -63,7 +63,7 @@
else
%>
&nbsp;
- <%= link_to_remote "Review",
+ <%= link_to_remote message('review_verb'),
:url => { :controller => "reviews", :action => "violation_comment_form", :id => violation.id },
:update => "reviewForm" + violation.id.to_s,
:complete => "$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus();$('vActions#{violation.id}').hide();" -%>
@@ -71,7 +71,7 @@
&nbsp;
<% if (!violation.review) || (violation.review && violation.review.can_change_false_positive_flag?) %>
- <%= link_to_remote (violation.switched_off? ? "Unflag as false-positive" : "Flag as false-positive"),
+ <%= link_to_remote (violation.switched_off? ? message('reviews.unflag_as_false_positive') : message('reviews.flag_as_false_positive')),
:url => { :controller => "reviews", :action => "violation_false_positive_form", :id => violation.id, :false_positive => !violation.switched_off? },
:update => "reviewForm" + violation.id.to_s,
:complete => "$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus();$('vActions" + violation.id.to_s + "').hide();$('commentActions" + violation.id.to_s + "').hide();" -%>
@@ -97,7 +97,7 @@
&nbsp;&nbsp;
<%= image_tag("sep12.png") -%>
&nbsp;&nbsp;
- <%= link_to_remote "Add comment",
+ <%= link_to_remote message('add_comment'),
:url => { :controller => "reviews", :action => "violation_comment_form", :id => violation.id },
:update => "reviewForm" + violation.id.to_s,
:complete => "$('vActions#{violation.id}').hide();$('commentActions" + violation.id.to_s + "').hide();$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus()" -%>
@@ -105,16 +105,16 @@
if current_user.id == review_comment.user_id
%>
&nbsp;
- <%= link_to_remote "Edit",
+ <%= link_to_remote message('edit'),
:url => { :controller => "reviews", :action => "violation_comment_form", :comment_id => review_comment.id, :id => violation.id },
:update => "lastComment" + violation.id.to_s,
:complete => "$('vActions#{violation.id}').hide();$('commentActions#{violation.id}').hide();$('commentText#{violation.id}').focus();" -%>
<% unless comment_index == 0 %>
&nbsp;
- <%= link_to_remote "Delete",
+ <%= link_to_remote message('delete'),
:url => { :controller => "reviews", :action => "violation_delete_comment", :comment_id => review_comment.id, :id => violation.id },
:update => "vId" + violation.id.to_s,
- :confirm => "Do you want to delete this comment?" -%>
+ :confirm => message('reviews.do_you_want_to_delete_comment') -%>
<% end %>
<%
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.html.erb
index b4a6ccb4897..697a71e35ed 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/login.html.erb
@@ -3,7 +3,7 @@
<td align="center">
<div id="login_form">
<form action="<%= url_for :controller => 'sessions', :action => 'login' -%>" method="post">
- <h3><%= label_tag 'login' %></h3>
+ <h3><%= label_tag message('login') %></h3>
<p>
<%= text_field_tag 'login', '', {:maxlength => 40, :size => 30, :disabled => false} %>
@@ -11,15 +11,15 @@
<br/><span class="desc">Not a member? <%= link_to 'Sign up', :controller => 'users', :action => 'new' -%> for an account.</span>
<% end %>
</p>
- <h3><%= label_tag 'password' %></h3>
+ <h3><%= label_tag message('password') %></h3>
<p>
<%= password_field_tag 'password', nil, :size => 30 %>
</p>
<p>
- <%= check_box_tag 'remember_me', '1', @remember_me %> <%= label_tag 'remember_me', 'Remember me on this computer' %>
+ <%= check_box_tag 'remember_me', '1', @remember_me %> <%= label_tag 'remember_me', message('sessions.remember_me') %>
</p>
<p>
- <%= submit_tag 'Log in' %> or <a href="<%= home_path -%>" class="action">Cancel</a>
+ <%= submit_tag message('sessions.log_in') %> or <a href="<%= home_path -%>" class="action"><%= message('cancel') -%></a>
</p>
</form>
<% if flash[:loginerror] %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/new.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/new.html.erb
index b5705d7ff98..7153b891a25 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/new.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/sessions/new.html.erb
@@ -7,22 +7,22 @@
<div class="notice"><%= flash[:notice] %></div>
<% end %>
- <h3><%= label_tag 'login' %></h3>
+ <h3><%= label_tag message('login') %></h3>
<p>
<%= text_field_tag 'login', '', {:maxlength => 40, :size => 30, :disabled => false} %>
<% if Property.value('sonar.allowUsersToSignUp')=='true' %>
<br/><span class="desc">Not a member? <%= link_to 'Sign up', :controller => 'users', :action => 'new' -%> for an account.</span>
<% end %>
</p>
- <h3><%= label_tag 'password' %></h3>
+ <h3><%= label_tag message('password') %></h3>
<p>
<%= password_field_tag 'password', nil, :size => 30 %>
</p>
<p>
- <%= check_box_tag 'remember_me', '1', @remember_me %> <%= label_tag 'remember_me', 'Remember me on this computer' %>
+ <%= check_box_tag 'remember_me', '1', @remember_me %> <%= label_tag 'remember_me', message('sessions.remember_me') %>
</p>
<p>
- <%= submit_tag 'Log in' %> or <a href="<%= home_path -%>" class="action">Cancel</a>
+ <%= submit_tag message('sessions.log_in') %> <a href="<%= home_path -%>" class="action"><%= message('cancel') -%></a>
</p>
</form>
<% if flash[:loginerror] %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/config/routes.rb b/sonar-server/src/main/webapp/WEB-INF/config/routes.rb
index ba3c53ba26b..e0e0afe2416 100644
--- a/sonar-server/src/main/webapp/WEB-INF/config/routes.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/config/routes.rb
@@ -11,6 +11,7 @@ ActionController::Routing::Routes.draw do |map|
api.resources :events, :only => [:index, :show, :create, :destroy]
api.resources :user_properties, :only => [:index, :show, :create, :destroy], :requirements => { :id => /.*/ }
api.resources :favorites, :only => [:index, :show, :create, :destroy], :requirements => { :id => /.*/ }
+ api.resources :manual_measures, :only => [:index, :create, :destroy], :requirements => { :id => /.*/ }
api.resources :reviews, :only => [:index, :show, :create], :member => {
:add_comment => :put,
:reassign => :put,
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb
index bd930663577..80976a2a65b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/001_initial_schema.rb
@@ -65,12 +65,6 @@ class InitialSchema < ActiveRecord::Migration
t.column :description, :text
end
- create_table :parameters do |t|
- t.column :param_key, :string, :null => false, :limit => 100, :null => false
- t.column :value, :decimal, :null => false, :precision => 30, :scale => 20
- t.column :value2, :decimal, :null => true, :precision => 30, :scale => 20
- end
-
create_table :rule_failures do |t|
t.column :snapshot_id, :integer, :null => false
t.column :rule_id, :integer, :null => false
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/048_create_async_measure_snapshots_table.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/048_create_async_measure_snapshots_table.rb
index 269022642c2..2f56659b79b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/048_create_async_measure_snapshots_table.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/048_create_async_measure_snapshots_table.rb
@@ -23,11 +23,11 @@ class CreateAsyncMeasureSnapshotsTable < ActiveRecord::Migration
create_table :async_measure_snapshots do |t|
t.column :project_measure_id, :integer, :null => true
t.column :measure_date, :datetime, :null => true
- t.column :snapshot_id, :integer, :null => true
+ t.column :snapshot_id, :integer, :null => true
t.column :snapshot_date, :datetime, :null => true
- t.column :metric_id, :integer, :null => true
- t.column :project_id, :integer, :null => true
- end
+ t.column :metric_id, :integer, :null => true
+ t.column :project_id, :integer, :null => true
+ end
add_index :async_measure_snapshots, :snapshot_id, :name => 'async_m_s_snapshot_id'
add_index :async_measure_snapshots, :project_measure_id, :name => 'async_m_s_measure_id'
add_index :async_measure_snapshots, [:project_id, :metric_id], :name => 'async_m_s_project_metric'
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb
index a30b36ad7f2..140b7c90213 100644
--- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/151_create_dashboards.rb
@@ -77,10 +77,9 @@ class CreateDashboards < ActiveRecord::Migration
dashboard.widgets.build(:widget_key => 'description', :name => 'Description', :column_index => 1, :row_index => 6, :configured => true)
dashboard.widgets.build(:widget_key => 'rules', :name => 'Rules', :column_index => 2, :row_index => 1, :configured => true)
dashboard.widgets.build(:widget_key => 'alerts', :name => 'Alerts', :column_index => 2, :row_index => 2, :configured => true)
- dashboard.widgets.build(:widget_key => 'custom_measures', :name => 'Custom measures', :column_index => 2, :row_index => 3, :configured => true)
- dashboard.widgets.build(:widget_key => 'file_design', :name => 'File design', :column_index => 2, :row_index => 4, :configured => true)
- dashboard.widgets.build(:widget_key => 'package_design', :name => 'Package design', :column_index => 2, :row_index => 5, :configured => true)
- dashboard.widgets.build(:widget_key => 'ckjm', :name => 'CKJM', :column_index => 2, :row_index => 6, :configured => true)
+ dashboard.widgets.build(:widget_key => 'file_design', :name => 'File design', :column_index => 2, :row_index => 3, :configured => true)
+ dashboard.widgets.build(:widget_key => 'package_design', :name => 'Package design', :column_index => 2, :row_index => 4, :configured => true)
+ dashboard.widgets.build(:widget_key => 'ckjm', :name => 'CKJM', :column_index => 2, :row_index => 5, :configured => true)
dashboard.save
dashboard
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/async_measure_snapshot.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/210_drop_parameters_table.rb
index 2f37204dded..f9ac8869054 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/async_measure_snapshot.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/210_drop_parameters_table.rb
@@ -17,32 +17,18 @@
# License along with Sonar; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
#
-class AsyncMeasureSnapshot < ActiveRecord::Base
-
- belongs_to :async_measure, :foreign_key => 'project_measure_id', :class_name => "ProjectMeasure"
- belongs_to :snapshot
- def self.search(sids, metric_ids=nil)
- sql='async_measure_snapshots.snapshot_id IN (:sids)'
- hash={:sids => sids}
- if metric_ids
- sql+=' AND async_measure_snapshots.metric_id IN (:mids)'
- hash[:mids]=metric_ids
- end
- async_measures=AsyncMeasureSnapshot.find(:all,
- :include => ['async_measure'],
- :conditions => [sql, hash])
+#
+# Sonar 2.10
+#
+class DropParametersTable < ActiveRecord::Migration
- result=[]
- async_measures.each do |am|
- clone=am.async_measure.clone
- clone.snapshot_id=am.snapshot_id
- result<<clone
+ def self.up
+ begin
+ drop_table('parameters')
+ rescue
+ # ignore, it's a fresh install
end
- result
end
- def measure
- async_measure
- end
-end \ No newline at end of file
+end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/211_create_manual_measures.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/211_create_manual_measures.rb
new file mode 100644
index 00000000000..cc3dee143af
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/211_create_manual_measures.rb
@@ -0,0 +1,40 @@
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2011 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+
+#
+# Sonar 2.10
+#
+class CreateManualMeasures < ActiveRecord::Migration
+
+ def self.up
+ create_table 'manual_measures' do |t|
+ t.column 'metric_id', :integer, :null => false
+ t.column 'resource_id', :integer, :null => true
+ t.column 'value', :decimal, :null => true, :precision => 30, :scale => 20
+ t.column 'text_value', :string, :null => true, :limit => 4000
+ t.column 'user_id', :integer, :null => true
+ t.column 'description', :string, :null => true, :limit => 4000
+ t.column 'url', :string, :null => true, :limit => 4000
+ t.timestamps
+ end
+ alter_to_big_primary_key('manual_measures')
+ end
+
+end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/212_move_async_measures.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/212_move_async_measures.rb
new file mode 100644
index 00000000000..be05b3d0a39
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/212_move_async_measures.rb
@@ -0,0 +1,55 @@
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2011 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+
+#
+# Sonar 2.10
+#
+class MoveAsyncMeasures < ActiveRecord::Migration
+
+ class ManualMeasure < ActiveRecord::Base
+ end
+
+ class ProjectMeasure < ActiveRecord::Base
+ end
+
+ class AsyncMeasureSnapshot < ActiveRecord::Base
+ belongs_to :measure, :foreign_key => 'project_measure_id', :class_name => "ProjectMeasure"
+ end
+
+ def self.up
+ deprecated_measures=AsyncMeasureSnapshot.find(:all, :include => 'measure')
+
+ say_with_time "Moving #{deprecated_measures.size} measures" do
+ deprecated_measures.each do |dm|
+ ManualMeasure.create(
+ :resource_id => dm.project_id,
+ :metric_id => dm.measure.metric_id,
+ :value => dm.measure.value,
+ :text_value => dm.measure.text_value,
+ :created_at => dm.measure_date,
+ :updated_at => dm.measure_date,
+ :url => dm.measure.url,
+ :description => dm.measure.description
+ )
+ end
+ end
+ end
+
+end
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/213_drop_async_measures_table.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/213_drop_async_measures_table.rb
new file mode 100644
index 00000000000..7346d954978
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/213_drop_async_measures_table.rb
@@ -0,0 +1,33 @@
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2011 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+
+#
+# Sonar 2.10
+#
+class DropAsyncMeasuresTable < ActiveRecord::Migration
+
+ def self.up
+ remove_index('async_measure_snapshots', :name => 'async_m_s_snapshot_id')
+ remove_index('async_measure_snapshots', :name => 'async_m_s_measure_id')
+ remove_index('async_measure_snapshots', :name => 'async_m_s_project_metric')
+ drop_table('async_measure_snapshots')
+ end
+
+end
diff --git a/sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb b/sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb
index a880840fde5..341d249bbcc 100644
--- a/sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb
@@ -37,16 +37,16 @@ module Resourceable
QUALIFIER_LIB='LIB'
QUALIFIERS=[QUALIFIER_VIEW,QUALIFIER_SUBVIEW,QUALIFIER_PROJECT,QUALIFIER_MODULE,QUALIFIER_DIRECTORY,QUALIFIER_PACKAGE,QUALIFIER_FILE,QUALIFIER_CLASS,QUALIFIER_UNIT_TEST_CLASS,QUALIFIER_LIB]
QUALIFIER_NAMES={
- QUALIFIER_VIEW => 'View',
- QUALIFIER_SUBVIEW => 'Sub-view',
- QUALIFIER_PROJECT => 'Project',
- QUALIFIER_MODULE => 'Sub-project',
- QUALIFIER_DIRECTORY => 'Directory',
- QUALIFIER_PACKAGE => 'Package',
- QUALIFIER_FILE => 'File',
- QUALIFIER_CLASS => 'Class',
- QUALIFIER_UNIT_TEST_CLASS => 'Unit test',
- QUALIFIER_LIB => 'Library'
+ QUALIFIER_VIEW => 'view',
+ QUALIFIER_SUBVIEW => 'sub_view',
+ QUALIFIER_PROJECT => 'project',
+ QUALIFIER_MODULE => 'sub_project',
+ QUALIFIER_DIRECTORY => 'directory',
+ QUALIFIER_PACKAGE => 'package',
+ QUALIFIER_FILE => 'file',
+ QUALIFIER_CLASS => 'class',
+ QUALIFIER_UNIT_TEST_CLASS => 'unit_test',
+ QUALIFIER_LIB => 'library'
}
def set?
scope==SCOPE_SET
diff --git a/sonar-server/src/test/java/org/sonar/server/database/JndiDatabaseConnectorTest.java b/sonar-server/src/test/java/org/sonar/server/database/JndiDatabaseConnectorTest.java
index 27e55256fc7..37e28fb7b5d 100644
--- a/sonar-server/src/test/java/org/sonar/server/database/JndiDatabaseConnectorTest.java
+++ b/sonar-server/src/test/java/org/sonar/server/database/JndiDatabaseConnectorTest.java
@@ -27,18 +27,15 @@ import org.junit.Test;
import org.sonar.api.database.DatabaseProperties;
import org.sonar.jpa.entity.SchemaMigration;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.spi.InitialContextFactory;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.util.Hashtable;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;
public class JndiDatabaseConnectorTest {
diff --git a/sonar-squid/pom.xml b/sonar-squid/pom.xml
index 1840046641a..2d0959d3b49 100644
--- a/sonar-squid/pom.xml
+++ b/sonar-squid/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<groupId>org.codehaus.sonar</groupId>
diff --git a/sonar-testing-harness/pom.xml b/sonar-testing-harness/pom.xml
index ba1bd47d142..cb2dca64067 100644
--- a/sonar-testing-harness/pom.xml
+++ b/sonar-testing-harness/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-testing-harness</artifactId>
<packaging>jar</packaging>
diff --git a/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl b/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
index c8c81e9de40..c9feaaa71f9 100644
--- a/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
+++ b/sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl
@@ -67,20 +67,6 @@ create table ALERTS (
primary key (id)
);
-create table ASYNC_MEASURE_SNAPSHOTS (
- ID INTEGER not null,
- PROJECT_MEASURE_ID INTEGER,
- MEASURE_DATE TIMESTAMP,
- SNAPSHOT_ID INTEGER,
- SNAPSHOT_DATE TIMESTAMP,
- METRIC_ID INTEGER,
- PROJECT_ID INTEGER,
- primary key (id)
-);
-CREATE INDEX ASYNC_M_S_MEASURE_ID ON ASYNC_MEASURE_SNAPSHOTS (PROJECT_MEASURE_ID);
-CREATE INDEX ASYNC_M_S_PROJECT_METRIC ON ASYNC_MEASURE_SNAPSHOTS (PROJECT_ID, METRIC_ID);
-CREATE INDEX ASYNC_M_S_SNAPSHOT_ID ON ASYNC_MEASURE_SNAPSHOTS (SNAPSHOT_ID);
-
create table CHARACTERISTICS (
ID INTEGER not null,
QUALITY_MODEL_ID INTEGER,
@@ -245,14 +231,6 @@ create table METRICS (
);
CREATE UNIQUE INDEX METRICS_UNIQUE_NAME ON METRICS (NAME);
-create table PARAMETERS (
- ID INTEGER not null,
- PARAM_KEY VARCHAR(100) not null,
- VALUE DECIMAL(30, 20) not null,
- VALUE2 DECIMAL(30, 20),
- primary key (id)
-);
-
create table PROJECTS (
ID INTEGER not null,
NAME VARCHAR(256),
diff --git a/sonar-ws-client/pom.xml b/sonar-ws-client/pom.xml
index bde7a6da92d..313e69d17a5 100644
--- a/sonar-ws-client/pom.xml
+++ b/sonar-ws-client/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar</artifactId>
- <version>2.9</version>
+ <version>2.10-SNAPSHOT</version>
</parent>
<artifactId>sonar-ws-client</artifactId>
<packaging>jar</packaging>
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/Connector.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/Connector.java
index 105bdbafbdc..cf874703859 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/Connector.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/Connector.java
@@ -29,8 +29,6 @@ import org.sonar.wsclient.services.UpdateQuery;
*/
public abstract class Connector {
- protected static final int TIMEOUT_MS = 30000;
-
/**
* @return JSON response or null if 404 NOT FOUND error
* @throws ConnectionException if connection error or HTTP status not in (200, 404)
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java
index 25545be4446..966095110bc 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient3Connector.java
@@ -19,34 +19,14 @@
*/
package org.sonar.wsclient.connectors;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-
-import org.apache.commons.httpclient.Credentials;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.HttpMethodBase;
-import org.apache.commons.httpclient.HttpStatus;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.auth.AuthScope;
-import org.apache.commons.httpclient.methods.DeleteMethod;
-import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
import org.sonar.wsclient.Host;
-import org.sonar.wsclient.services.AbstractQuery;
-import org.sonar.wsclient.services.CreateQuery;
-import org.sonar.wsclient.services.DeleteQuery;
-import org.sonar.wsclient.services.Query;
-import org.sonar.wsclient.services.UpdateQuery;
+import org.sonar.wsclient.services.*;
+
+import java.io.*;
/**
* @since 2.1
@@ -71,8 +51,8 @@ public class HttpClient3Connector extends Connector {
private void createClient() {
final HttpConnectionManagerParams params = new HttpConnectionManagerParams();
- params.setConnectionTimeout(TIMEOUT_MS);
- params.setSoTimeout(TIMEOUT_MS);
+ params.setConnectionTimeout(AbstractQuery.DEFAULT_TIMEOUT_MILLISECONDS);
+ params.setSoTimeout(AbstractQuery.DEFAULT_TIMEOUT_MILLISECONDS);
params.setDefaultMaxConnectionsPerHost(MAX_HOST_CONNECTIONS);
params.setMaxTotalConnections(MAX_TOTAL_CONNECTIONS);
final MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
@@ -109,6 +89,7 @@ public class HttpClient3Connector extends Connector {
String json = null;
try {
httpClient.executeMethod(method);
+
if (method.getStatusCode() == HttpStatus.SC_OK) {
json = getResponseBodyAsString(method);
@@ -132,26 +113,26 @@ public class HttpClient3Connector extends Connector {
private HttpMethodBase newGetRequest(Query<?> query) {
HttpMethodBase method = new GetMethod(server.getHost() + query.getUrl());
- setJsonHeader(method);
+ initRequest(method, query);
return method;
}
private HttpMethodBase newDeleteRequest(DeleteQuery<?> query) {
HttpMethodBase method = new DeleteMethod(server.getHost() + query.getUrl());
- setJsonHeader(method);
+ initRequest(method, query);
return method;
}
private HttpMethodBase newPostRequest(CreateQuery<?> query) {
PostMethod method = new PostMethod(server.getHost() + query.getUrl());
- setJsonHeader(method);
+ initRequest(method, query);
setRequestEntity(method, query);
return method;
}
private HttpMethodBase newPutRequest(UpdateQuery<?> query) {
PutMethod method = new PutMethod(server.getHost() + query.getUrl());
- setJsonHeader(method);
+ initRequest(method, query);
setRequestEntity(method, query);
return method;
}
@@ -166,8 +147,9 @@ public class HttpClient3Connector extends Connector {
}
}
- private void setJsonHeader(HttpMethodBase request) {
+ private void initRequest(HttpMethodBase request, AbstractQuery query) {
request.setRequestHeader("Accept", "application/json");
+ request.getParams().setSoTimeout(query.getTimeoutMilliseconds());
}
private String getResponseBodyAsString(HttpMethod method) {
@@ -190,9 +172,8 @@ public class HttpClient3Connector extends Connector {
if (reader != null) {
try {
reader.close();
-
} catch (Exception e) {
- // TODO
+ throw new RuntimeException("Fail to close HTTP stream", e);
}
}
}
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java
index 382f5bd3614..471323b4fed 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java
@@ -45,6 +45,7 @@ import org.apache.http.client.protocol.ClientContext;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.params.CoreConnectionPNames;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.BasicHttpContext;
@@ -115,8 +116,8 @@ public class HttpClient4Connector extends Connector {
private DefaultHttpClient createClient() {
DefaultHttpClient client = new DefaultHttpClient();
HttpParams params = client.getParams();
- HttpConnectionParams.setConnectionTimeout(params, TIMEOUT_MS);
- HttpConnectionParams.setSoTimeout(params, TIMEOUT_MS);
+ HttpConnectionParams.setConnectionTimeout(params, AbstractQuery.DEFAULT_TIMEOUT_MILLISECONDS);
+ HttpConnectionParams.setSoTimeout(params, AbstractQuery.DEFAULT_TIMEOUT_MILLISECONDS);
if (server.getUsername() != null) {
client.getCredentialsProvider()
.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(server.getUsername(), server.getPassword()));
@@ -141,26 +142,26 @@ public class HttpClient4Connector extends Connector {
private HttpGet newGetMethod(Query<?> query) {
HttpGet get = new HttpGet(server.getHost() + query.getUrl());
- setJsonHeader(get);
+ initRequest(get, query);
return get;
}
private HttpDelete newDeleteMethod(DeleteQuery<?> query) {
HttpDelete delete = new HttpDelete(server.getHost() + query.getUrl());
- setJsonHeader(delete);
+ initRequest(delete, query);
return delete;
}
private HttpPost newPostMethod(CreateQuery<?> query) {
HttpPost post = new HttpPost(server.getHost() + query.getUrl());
- setJsonHeader(post);
+ initRequest(post, query);
setRequestEntity(post, query);
return post;
}
private HttpPut newPutMethod(UpdateQuery<?> query) {
HttpPut put = new HttpPut(server.getHost() + query.getUrl());
- setJsonHeader(put);
+ initRequest(put, query);
setRequestEntity(put, query);
return put;
}
@@ -175,8 +176,9 @@ public class HttpClient4Connector extends Connector {
}
}
- private void setJsonHeader(HttpRequestBase request) {
+ private void initRequest(HttpRequestBase request, AbstractQuery query) {
request.setHeader("Accept", "application/json");
+ request.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, query.getTimeoutMilliseconds());
}
static final class PreemptiveAuth implements HttpRequestInterceptor {
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/AbstractQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/AbstractQuery.java
index 288dfba7ee2..141dd14fab3 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/AbstractQuery.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/AbstractQuery.java
@@ -27,11 +27,20 @@ import java.util.Date;
public abstract class AbstractQuery<MODEL extends Model> {
/**
+ * Default timeout for waiting data, in milliseconds.
+ *
+ * @since 2.10
+ */
+ public static final int DEFAULT_TIMEOUT_MILLISECONDS = 30 * 1000;
+
+ private int timeoutMilliseconds = DEFAULT_TIMEOUT_MILLISECONDS;
+
+ /**
* Must start with a slash, for example: /api/metrics
* <p>
* IMPORTANT: In implementations of this method we must use helper methods to construct URL.
* </p>
- *
+ *
* @see #encode(String)
* @see #appendUrlParameter(StringBuilder, String, Object)
* @see #appendUrlParameter(StringBuilder, String, Object[])
@@ -47,6 +56,25 @@ public abstract class AbstractQuery<MODEL extends Model> {
}
/**
+ * Get the timeout for waiting data, in milliseconds. A value of zero is interpreted as an infinite timeout.
+ *
+ * @since 2.10
+ */
+ public final int getTimeoutMilliseconds() {
+ return timeoutMilliseconds;
+ }
+
+ /**
+ * Set the timeout for waiting data, in milliseconds. Avalue of zero is interpreted as an infinite timeout.
+ *
+ * @since 2.10
+ */
+ public final AbstractQuery<MODEL> setTimeoutMilliseconds(int i) {
+ this.timeoutMilliseconds = (i < 0 ? 0 : i);
+ return this;
+ }
+
+ /**
* Encodes single parameter value.
*/
protected static String encode(String value) {
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Query.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Query.java
index 9189b4c283b..f4203367dce 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Query.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Query.java
@@ -20,8 +20,6 @@
package org.sonar.wsclient.services;
/**
- * GET HTTP request
- *
* @since 2.1
*/
public abstract class Query<MODEL extends Model> extends AbstractQuery<MODEL> {