aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/analysis/MutableAnalysisMetadataHolder.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImpl.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/notification/NotificationService.java9
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java8
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/batch/TreeRootHolderRule.java24
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImplTest.java2
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js13
-rw-r--r--server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-actions.hbs2
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java2
10 files changed, 45 insertions, 23 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/analysis/MutableAnalysisMetadataHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/analysis/MutableAnalysisMetadataHolder.java
index 1733010fc93..e485012782b 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/analysis/MutableAnalysisMetadataHolder.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/analysis/MutableAnalysisMetadataHolder.java
@@ -24,6 +24,7 @@ import java.util.Date;
public interface MutableAnalysisMetadataHolder extends AnalysisMetadataHolder {
/**
+ * @throws NullPointerException if specified date is {@code null}
* @throws IllegalStateException if the analysis date has already been set
*/
void setAnalysisDate(Date date);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImpl.java b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImpl.java
index d9e346a7028..4737c4010dd 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImpl.java
@@ -33,7 +33,7 @@ public class CeProcessingSchedulerImpl implements CeProcessingScheduler {
this.executorService = processingExecutorService;
this.workerRunnable = workerRunnable;
- this.delayBetweenTasks = 10;
+ this.delayBetweenTasks = 2;
this.delayForFirstStart = 0;
this.timeUnit = TimeUnit.SECONDS;
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/notification/NotificationService.java b/server/sonar-server/src/main/java/org/sonar/server/notification/NotificationService.java
index 185a54e54c4..66af432960c 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/notification/NotificationService.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/notification/NotificationService.java
@@ -24,6 +24,7 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -60,6 +61,7 @@ import org.sonar.db.DbClient;
})
@ServerSide
public class NotificationService implements Startable {
+ private static final String THREAD_NAME_PREFIX = "sq-notification-service-";
private static final Logger LOG = Loggers.get(NotificationService.class);
@@ -93,7 +95,12 @@ public class NotificationService implements Startable {
@Override
public void start() {
- executorService = Executors.newSingleThreadScheduledExecutor();
+ executorService =
+ Executors.newSingleThreadScheduledExecutor(
+ new ThreadFactoryBuilder()
+ .setNameFormat(THREAD_NAME_PREFIX + "%d")
+ .setPriority(Thread.MIN_PRIORITY)
+ .build());
executorService.scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java
index 1418ce274b3..4df7a40f815 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java
@@ -28,7 +28,6 @@ import org.sonar.core.util.UuidFactoryImpl;
import org.sonar.db.DaoModule;
import org.sonar.db.DatabaseChecker;
import org.sonar.db.DefaultDatabase;
-import org.sonar.db.MyBatis;
import org.sonar.db.purge.PurgeProfiler;
import org.sonar.db.semaphore.SemaphoresImpl;
import org.sonar.db.version.DatabaseVersion;
@@ -78,7 +77,9 @@ public class PlatformLevel1 extends PlatformLevel {
EmbeddedDatabaseFactory.class,
DefaultDatabase.class,
DatabaseChecker.class,
- MyBatis.class,
+ // must instantiate deprecated class in 5.2 and only this one (and not its replacement)
+ // to avoid having two SqlSessionFactory instances
+ org.sonar.core.persistence.MyBatis.class,
IndexQueue.class,
DatabaseServerCompatibility.class,
DatabaseVersion.class,
@@ -116,8 +117,7 @@ public class PlatformLevel1 extends PlatformLevel {
IssueIndex.class,
// Classes kept for backward compatibility of plugins/libs (like sonar-license) that are directly calling classes from the core
- org.sonar.core.properties.PropertiesDao.class,
- org.sonar.core.persistence.MyBatis.class);
+ org.sonar.core.properties.PropertiesDao.class);
addAll(CorePropertyDefinitions.all());
addAll(CePropertyDefinitions.all());
add(MigrationStepModule.class);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/batch/TreeRootHolderRule.java b/server/sonar-server/src/test/java/org/sonar/server/computation/batch/TreeRootHolderRule.java
index c1888493a45..92335b9abde 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/batch/TreeRootHolderRule.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/batch/TreeRootHolderRule.java
@@ -21,7 +21,6 @@ package org.sonar.server.computation.batch;
import java.util.HashMap;
import java.util.Map;
-import java.util.Objects;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
@@ -33,6 +32,9 @@ import org.sonar.server.computation.component.ReportTreeRootHolder;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.component.TypeAwareVisitorAdapter;
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
import static org.sonar.server.computation.component.ComponentVisitor.Order.POST_ORDER;
public class TreeRootHolderRule implements TestRule, MutableTreeRootHolder, ReportTreeRootHolder {
@@ -55,31 +57,31 @@ public class TreeRootHolderRule implements TestRule, MutableTreeRootHolder, Repo
private void clear() {
this.root = null;
+ this.componentsByRef.clear();
}
@Override
public Component getRoot() {
- if (root == null) {
- throw new IllegalStateException("Root has not been set in " + TreeRootHolder.class.getSimpleName());
- }
+ checkInitialized();
+
return root;
}
@Override
public Component getComponentByRef(int ref) {
- if (root == null) {
- throw new IllegalStateException("Root has not been set in " + TreeRootHolder.class.getSimpleName());
- }
+ checkInitialized();
Component component = componentsByRef.get(ref);
- if (component == null) {
- throw new IllegalArgumentException(String.format("Component '%s' hasn't been found", ref));
- }
+ checkArgument(component != null, "Component with ref '%s' hasn't been found", ref);
return component;
}
+ private void checkInitialized() {
+ checkState(root != null, "Root has not been set in %s", TreeRootHolder.class.getSimpleName());
+ }
+
public TreeRootHolderRule setRoot(Component newRoot) {
- this.root = Objects.requireNonNull(newRoot);
+ this.root = requireNonNull(newRoot);
if (newRoot.getType().isReportType()) {
new DepthTraversalTypeAwareCrawler(new TypeAwareVisitorAdapter(CrawlerDepthLimit.FILE, POST_ORDER) {
@Override
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImplTest.java
index 9dfa6da2453..c94bbd4312d 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImplTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/taskprocessor/CeProcessingSchedulerImplTest.java
@@ -37,7 +37,7 @@ public class CeProcessingSchedulerImplTest {
public void startScheduling_schedules_CeWorkerRunnable_at_fixed_rate_run_head_of_queue() {
underTest.startScheduling();
- verify(processingExecutorService).scheduleAtFixedRate(same(workerRunnable), eq(0L), eq(10L), eq(TimeUnit.SECONDS));
+ verify(processingExecutorService).scheduleAtFixedRate(same(workerRunnable), eq(0L), eq(2L), eq(TimeUnit.SECONDS));
verifyNoMoreInteractions(processingExecutorService);
}
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js b/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js
index 7ea7ef2dc96..b5f9167033d 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/profile-details-view.js
@@ -17,7 +17,7 @@ export default Marionette.LayoutView.extend({
},
modelEvents: {
- 'change': 'render',
+ 'change': 'onChange',
'flashChangelog': 'flashChangelog'
},
@@ -47,6 +47,13 @@ export default Marionette.LayoutView.extend({
});
},
+ onChange: function () {
+ var changed = Object.keys(this.model.changedAttributes());
+ if (!(changed.length === 1 && changed[0] === 'projectCount')) {
+ this.render();
+ }
+ },
+
initProjectsSelect: function () {
var key = this.model.get('key');
this.projectsSelectList = new window.SelectList({
@@ -73,8 +80,8 @@ export default Marionette.LayoutView.extend({
noResults: t('quality_gates.projects.noResults')
},
tooltips: {
- select: t('quality_gates.projects.select_hint'),
- deselect: t('quality_gates.projects.deselect_hint')
+ select: t('quality_profiles.projects.select_hint'),
+ deselect: t('quality_profiles.projects.deselect_hint')
}
});
this.listenTo(this.projectsSelectList.collection, 'change:selected', this.onProjectsChange);
diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-actions.hbs b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-actions.hbs
index 17700533484..672a7a6ec17 100644
--- a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-actions.hbs
+++ b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-actions.hbs
@@ -34,7 +34,7 @@
<ul class="dropdown-menu">
<li><a class="js-filter-by-language" href="#">{{t 'quality_profiles.all_profiles'}}</a></li>
{{#each languages}}
- <li><a class="js-filter-by-language" href="#" data-language="{{key}}">{{tp 'quality_profiles.x_profiles' name}}</a></li>
+ <li><a class="js-filter-by-language" href="#" data-language="{{key}}">{{name}}</a></li>
{{/each}}
</ul>
</div>
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 241cfb7725b..6d52e0d462c 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -1821,6 +1821,9 @@ quality_profiles.all_profiles=All Profiles
quality_profiles.x_profiles={0} Profiles
quality_profiles.x_projects={0} projects
quality_profiles.no_results=No profiles found. Try installing a language plugin.
+quality_profiles.projects.select_hint=Click to associate this project with the quality profile
+quality_profiles.projects.deselect_hint=Click to remove association between this project and the quality profile
+
@@ -2087,7 +2090,7 @@ notification.dispatcher.ChangesOnMyIssue=Changes in issues assigned to me or rep
notification.dispatcher.NewIssues=New issues
notification.dispatcher.NewAlerts=New quality gate status
notification.dispatcher.NewFalsePositiveIssue=Issues resolved as false positive or won't fix
-notification.dispatcher.SQ-MyNewIssues=My New Issues
+notification.dispatcher.SQ-MyNewIssues=My new issues
#------------------------------------------------------------------------------
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java
index d6a22bd65ba..bdaa27ff1be 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java
@@ -69,7 +69,9 @@ import static com.google.common.base.Preconditions.checkArgument;
* public void handle(Request request, Response response) {
* // read request parameters and generates response output
* response.newJsonWriter()
+ * .beginObject()
* .prop("hello", request.mandatoryParam("key"))
+ * .endObject()
* .close();
* }
* })