aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-08-16 18:04:05 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-08-18 12:33:51 +0200
commit573352ecc54c0d1fce506e12554cad995461c4bb (patch)
tree0430aa55644b37dba89c4842f036fdf113fa4863 /server
parent7a5c0b120f17dbdcccde625c2183db8df0c3a1df (diff)
downloadsonarqube-573352ecc54c0d1fce506e12554cad995461c4bb.tar.gz
sonarqube-573352ecc54c0d1fce506e12554cad995461c4bb.zip
SONAR-7842 rename table CE_TASK_DATA to CE_TASK_INPUT
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueImpl.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueCleaner.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/queue/ReportSubmitter.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ExtractReportStep.java8
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueCleanerTest.java8
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/queue/ReportSubmitterTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ExtractReportStepTest.java2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1305_drop_index_ce_task_data_uuid.rb33
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1306_rename_ce_task_data_to_ce_task_input.rb30
9 files changed, 78 insertions, 15 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueImpl.java b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueImpl.java
index 316f7a65042..36fb3574fac 100644
--- a/server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueImpl.java
+++ b/server/sonar-server/src/main/java/org/sonar/ce/queue/CeQueueImpl.java
@@ -41,7 +41,7 @@ import org.sonar.db.component.ComponentDto;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Predicates.notNull;
import static com.google.common.collect.FluentIterable.from;
-import static java.util.Collections.singletonList;
+import static java.util.Collections.singleton;
import static org.sonar.db.component.ComponentDtoFunctions.toUuid;
@ComputeEngineSide
@@ -171,7 +171,7 @@ public class CeQueueImpl implements CeQueue {
protected void remove(DbSession dbSession, CeQueueDto queueDto, CeActivityDto activityDto) {
dbClient.ceActivityDao().insert(dbSession, activityDto);
dbClient.ceQueueDao().deleteByUuid(dbSession, queueDto.getUuid());
- dbClient.ceTaskDataDao().deleteByUuids(dbSession, singletonList(queueDto.getUuid()));
+ dbClient.ceTaskInputDao().deleteByUuids(dbSession, singleton(queueDto.getUuid()));
dbSession.commit();
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueCleaner.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueCleaner.java
index 21673dddb30..6716faaa905 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueCleaner.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/CeQueueCleaner.java
@@ -69,8 +69,8 @@ public class CeQueueCleaner {
// Reports that have been processed are not kept in database yet.
// They are supposed to be systematically dropped.
// Let's clean-up orphans if any.
- List<String> uuids = dbClient.ceTaskDataDao().selectUuidsNotInQueue(dbSession);
- dbClient.ceTaskDataDao().deleteByUuids(dbSession, uuids);
+ List<String> uuids = dbClient.ceTaskInputDao().selectUuidsNotInQueue(dbSession);
+ dbClient.ceTaskInputDao().deleteByUuids(dbSession, uuids);
dbSession.commit();
}
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/ReportSubmitter.java b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/ReportSubmitter.java
index f60f66626ab..92141581e99 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/queue/ReportSubmitter.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/queue/ReportSubmitter.java
@@ -97,7 +97,7 @@ public class ReportSubmitter {
// the report file must be saved before submitting the task
CeTaskSubmit.Builder submit = queue.prepareSubmit();
try (DbSession dbSession = dbClient.openSession(false)) {
- dbClient.ceTaskDataDao().insert(dbSession, submit.getUuid(), reportInput);
+ dbClient.ceTaskInputDao().insert(dbSession, submit.getUuid(), reportInput);
dbSession.commit();
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ExtractReportStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ExtractReportStep.java
index 7e1f131b1f9..1f702e923f1 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ExtractReportStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/task/projectanalysis/step/ExtractReportStep.java
@@ -30,7 +30,7 @@ import org.sonar.api.utils.ZipUtils;
import org.sonar.ce.queue.CeTask;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
-import org.sonar.db.ce.CeTaskDataDao;
+import org.sonar.db.ce.CeTaskInputDao;
import org.sonar.server.computation.task.projectanalysis.batch.MutableBatchReportDirectoryHolder;
import org.sonar.server.computation.task.step.ComputationStep;
@@ -56,11 +56,11 @@ public class ExtractReportStep implements ComputationStep {
@Override
public void execute() {
try (DbSession dbSession = dbClient.openSession(false)) {
- Optional<CeTaskDataDao.DataStream> opt = dbClient.ceTaskDataDao().selectData(dbSession, task.getUuid());
+ Optional<CeTaskInputDao.DataStream> opt = dbClient.ceTaskInputDao().selectData(dbSession, task.getUuid());
if (opt.isPresent()) {
File unzippedDir = tempFolder.newDir();
- try (CeTaskDataDao.DataStream reportStream = opt.get();
- InputStream zipStream = new BufferedInputStream(reportStream.getInputStream())) {
+ try (CeTaskInputDao.DataStream reportStream = opt.get();
+ InputStream zipStream = new BufferedInputStream(reportStream.getInputStream())) {
ZipUtils.unzip(zipStream, unzippedDir);
} catch (IOException e) {
throw new IllegalStateException("Fail to extract report " + task.getUuid() + " from database", e);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueCleanerTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueCleanerTest.java
index 20166486196..0da9da04cd7 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueCleanerTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/CeQueueCleanerTest.java
@@ -28,7 +28,7 @@ import org.sonar.api.platform.ServerUpgradeStatus;
import org.sonar.api.utils.System2;
import org.sonar.db.DbTester;
import org.sonar.db.ce.CeQueueDto;
-import org.sonar.db.ce.CeTaskDataDao;
+import org.sonar.db.ce.CeTaskInputDao;
import org.sonar.db.ce.CeTaskTypes;
import static org.assertj.core.api.Assertions.assertThat;
@@ -75,8 +75,8 @@ public class CeQueueCleanerTest {
underTest.clean(dbTester.getSession());
- CeTaskDataDao dataDao = dbTester.getDbClient().ceTaskDataDao();
- Optional<CeTaskDataDao.DataStream> task1Data = dataDao.selectData(dbTester.getSession(), "TASK_1");
+ CeTaskInputDao dataDao = dbTester.getDbClient().ceTaskInputDao();
+ Optional<CeTaskInputDao.DataStream> task1Data = dataDao.selectData(dbTester.getSession(), "TASK_1");
assertThat(task1Data).isPresent();
task1Data.get().close();
@@ -95,7 +95,7 @@ public class CeQueueCleanerTest {
}
private void insertTaskData(String taskUuid) throws IOException {
- dbTester.getDbClient().ceTaskDataDao().insert(dbTester.getSession(), taskUuid, IOUtils.toInputStream("{binary}"));
+ dbTester.getDbClient().ceTaskInputDao().insert(dbTester.getSession(), taskUuid, IOUtils.toInputStream("{binary}"));
dbTester.getSession().commit();
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/ReportSubmitterTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/ReportSubmitterTest.java
index 0e6443b8ce3..edf310c5467 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/ReportSubmitterTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/ReportSubmitterTest.java
@@ -187,7 +187,7 @@ public class ReportSubmitterTest {
}
private void verifyReportIsPersisted(String taskUuid) {
- assertThat(dbTester.selectFirst("select task_uuid from ce_task_data where task_uuid='" + taskUuid + "'")).isNotNull();
+ assertThat(dbTester.selectFirst("select task_uuid from ce_task_input where task_uuid='" + taskUuid + "'")).isNotNull();
}
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ExtractReportStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ExtractReportStepTest.java
index f6077caf95c..977f586e3fb 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ExtractReportStepTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/step/ExtractReportStepTest.java
@@ -73,7 +73,7 @@ public class ExtractReportStepTest {
public void unzip_report() throws Exception {
File reportFile = generateReport();
try (InputStream input = FileUtils.openInputStream(reportFile)) {
- dbTester.getDbClient().ceTaskDataDao().insert(dbTester.getSession(), TASK_UUID, input);
+ dbTester.getDbClient().ceTaskInputDao().insert(dbTester.getSession(), TASK_UUID, input);
}
dbTester.getSession().commit();
dbTester.getSession().close();
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1305_drop_index_ce_task_data_uuid.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1305_drop_index_ce_task_data_uuid.rb
new file mode 100644
index 00000000000..9071519dc36
--- /dev/null
+++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1305_drop_index_ce_task_data_uuid.rb
@@ -0,0 +1,33 @@
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# SonarQube 6.1
+#
+class DropIndexCeTaskDataUuid < ActiveRecord::Migration
+
+ def self.up
+ begin
+ remove_index :ce_task_data, :name => 'ce_task_data_uuid'
+ rescue
+ #ignore
+ end
+ end
+end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1306_rename_ce_task_data_to_ce_task_input.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1306_rename_ce_task_data_to_ce_task_input.rb
new file mode 100644
index 00000000000..59f5eff810f
--- /dev/null
+++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1306_rename_ce_task_data_to_ce_task_input.rb
@@ -0,0 +1,30 @@
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2014 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# SonarQube 6.1
+#
+class RenameCeTaskDataToCeTaskInput < ActiveRecord::Migration
+
+ def self.up
+ rename_table 'ce_task_data', 'ce_task_input'
+ add_index 'ce_task_input', 'task_uuid', :name => 'ce_task_input_uuid', :unique => true
+ end
+end