aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce
diff options
context:
space:
mode:
authorAurelien Poscia <aurelien.poscia@sonarsource.com>2022-12-21 09:15:42 +0100
committersonartech <sonartech@sonarsource.com>2022-12-23 20:02:51 +0000
commitc3f0febf8d6c2e1baa376e28c212c6feb9f30525 (patch)
tree7637ba7ef02af9b02beb8e7daa1f089f56123301 /server/sonar-ce
parent6bf8a78f319ad666cb31d2100910dd34e5fcaf13 (diff)
downloadsonarqube-c3f0febf8d6c2e1baa376e28c212c6feb9f30525.tar.gz
sonarqube-c3f0febf8d6c2e1baa376e28c212c6feb9f30525.zip
SONAR-14128 Renamed WebServer to NodeInformation
Diffstat (limited to 'server/sonar-ce')
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java4
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java10
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java22
3 files changed, 18 insertions, 18 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
index c6e84e7209c..847bc10c2dc 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
@@ -114,6 +114,7 @@ import org.sonar.server.metric.UnanalyzedLanguageMetrics;
import org.sonar.server.notification.DefaultNotificationManager;
import org.sonar.server.notification.NotificationService;
import org.sonar.server.notification.email.EmailNotificationChannel;
+import org.sonar.server.platform.DefaultNodeInformation;
import org.sonar.server.platform.OfficialDistribution;
import org.sonar.server.platform.ServerFileSystemImpl;
import org.sonar.server.platform.ServerImpl;
@@ -121,7 +122,6 @@ import org.sonar.server.platform.ServerLifecycleNotifier;
import org.sonar.server.platform.StartupMetadataProvider;
import org.sonar.server.platform.TempFolderProvider;
import org.sonar.server.platform.UrlSettings;
-import org.sonar.server.platform.WebServerImpl;
import org.sonar.server.platform.db.migration.MigrationConfigurationModule;
import org.sonar.server.platform.db.migration.version.DatabaseVersion;
import org.sonar.server.platform.monitoring.DbSection;
@@ -281,7 +281,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer {
CeProcessLogging.class,
UuidFactoryImpl.INSTANCE,
NetworkUtilsImpl.INSTANCE,
- WebServerImpl.class,
+ DefaultNodeInformation.class,
LogbackHelper.class,
DefaultDatabase.class,
MyBatis.class,
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java
index a95a102f4a5..ae2ec86afcf 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/queue/InternalCeQueueImpl.java
@@ -47,7 +47,7 @@ import org.sonar.db.ce.CeQueueDao;
import org.sonar.db.ce.CeQueueDto;
import org.sonar.db.ce.CeTaskCharacteristicDto;
import org.sonar.db.component.ComponentDto;
-import org.sonar.server.platform.WebServer;
+import org.sonar.server.platform.NodeInformation;
import static com.google.common.base.Preconditions.checkArgument;
import static java.lang.String.format;
@@ -66,8 +66,8 @@ public class InternalCeQueueImpl extends CeQueueImpl implements InternalCeQueue
private final NextPendingTaskPicker nextPendingTaskPicker;
public InternalCeQueueImpl(System2 system2, DbClient dbClient, UuidFactory uuidFactory, CEQueueStatus queueStatus,
- ComputeEngineStatus computeEngineStatus, NextPendingTaskPicker nextPendingTaskPicker, WebServer webServer) {
- super(system2, dbClient, uuidFactory, webServer);
+ ComputeEngineStatus computeEngineStatus, NextPendingTaskPicker nextPendingTaskPicker, NodeInformation nodeInformation) {
+ super(system2, dbClient, uuidFactory, nodeInformation);
this.dbClient = dbClient;
this.queueStatus = queueStatus;
this.computeEngineStatus = computeEngineStatus;
@@ -114,7 +114,7 @@ public class InternalCeQueueImpl extends CeQueueImpl implements InternalCeQueue
CeQueueDto queueDto = dbClient.ceQueueDao().selectByUuid(dbSession, task.getUuid())
.orElseThrow(() -> new IllegalStateException("Task does not exist anymore: " + task));
CeActivityDto activityDto = new CeActivityDto(queueDto);
- activityDto.setNodeName(webServer.getNodeName().orElse(null));
+ activityDto.setNodeName(nodeInformation.getNodeName().orElse(null));
activityDto.setStatus(status);
executionTimeInMs = updateExecutionFields(activityDto);
updateTaskResult(activityDto, taskResult);
@@ -178,7 +178,7 @@ public class InternalCeQueueImpl extends CeQueueImpl implements InternalCeQueue
List<CeQueueDto> wornOutTasks = dbClient.ceQueueDao().selectWornout(dbSession);
wornOutTasks.forEach(queueDto -> {
CeActivityDto activityDto = new CeActivityDto(queueDto);
- activityDto.setNodeName(webServer.getNodeName().orElse(null));
+ activityDto.setNodeName(nodeInformation.getNodeName().orElse(null));
activityDto.setStatus(CeActivityDto.Status.CANCELED);
updateExecutionFields(activityDto);
remove(dbSession, queueDto, activityDto);
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java
index 445b29ec849..3bd87906698 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/queue/InternalCeQueueImplTest.java
@@ -48,7 +48,7 @@ import org.sonar.db.ce.CeTaskTypes;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.component.ComponentTesting;
import org.sonar.db.user.UserDto;
-import org.sonar.server.platform.WebServer;
+import org.sonar.server.platform.NodeInformation;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyMap;
@@ -83,15 +83,15 @@ public class InternalCeQueueImplTest {
private ComputeEngineStatus computeEngineStatus = mock(ComputeEngineStatus.class);
private Configuration config = mock(Configuration.class);
private NextPendingTaskPicker nextPendingTaskPicker = new NextPendingTaskPicker(config, db.getDbClient());
- private WebServer nodeInformationProvider = mock(WebServer.class);
+ private NodeInformation nodeInformation = mock(NodeInformation.class);
private InternalCeQueue underTest = new InternalCeQueueImpl(system2, db.getDbClient(), uuidFactory, queueStatus,
- computeEngineStatus, nextPendingTaskPicker, nodeInformationProvider);
+ computeEngineStatus, nextPendingTaskPicker, nodeInformation);
@Before
public void setUp() {
when(config.getBoolean(any())).thenReturn(Optional.of(false));
when(computeEngineStatus.getStatus()).thenReturn(STARTED);
- when(nodeInformationProvider.getNodeName()).thenReturn(Optional.of(NODE_NAME));
+ when(nodeInformation.getNodeName()).thenReturn(Optional.of(NODE_NAME));
}
@Test
@@ -215,8 +215,8 @@ public class InternalCeQueueImplTest {
}
@Test
- public void remove_sets_nodeName_in_CeActivity_when_nodeInformationProvider_defines_node_name() {
- when(nodeInformationProvider.getNodeName()).thenReturn(Optional.of(NODE_NAME));
+ public void remove_sets_nodeName_in_CeActivity_when_nodeInformation_defines_node_name() {
+ when(nodeInformation.getNodeName()).thenReturn(Optional.of(NODE_NAME));
CeTask task = submit(CeTaskTypes.REPORT, newProjectDto("PROJECT_1"));
Optional<CeTask> peek = underTest.peek(WORKER_UUID_2, true);
@@ -228,8 +228,8 @@ public class InternalCeQueueImplTest {
}
@Test
- public void remove_do_not_set_nodeName_in_CeActivity_when_nodeInformationProvider_does_not_define_node_name() {
- when(nodeInformationProvider.getNodeName()).thenReturn(Optional.empty());
+ public void remove_do_not_set_nodeName_in_CeActivity_when_nodeInformation_does_not_define_node_name() {
+ when(nodeInformation.getNodeName()).thenReturn(Optional.empty());
CeTask task = submit(CeTaskTypes.REPORT, newProjectDto("PROJECT_1"));
Optional<CeTask> peek = underTest.peek(WORKER_UUID_2, true);
@@ -278,7 +278,7 @@ public class InternalCeQueueImplTest {
db.getDbClient().ceQueueDao().deleteByUuid(db.getSession(), task.getUuid());
db.commit();
- InternalCeQueueImpl underTest = new InternalCeQueueImpl(system2, db.getDbClient(), null, queueStatus, null, null, nodeInformationProvider);
+ InternalCeQueueImpl underTest = new InternalCeQueueImpl(system2, db.getDbClient(), null, queueStatus, null, null, nodeInformation);
try {
underTest.remove(task, CeActivityDto.Status.SUCCESS, null, null);
@@ -295,7 +295,7 @@ public class InternalCeQueueImplTest {
CeTask task = submit(CeTaskTypes.REPORT, newProjectDto("PROJECT_1"));
db.getDbClient().ceQueueDao().deleteByUuid(db.getSession(), task.getUuid());
db.commit();
- InternalCeQueueImpl underTest = new InternalCeQueueImpl(system2, db.getDbClient(), null, queueStatusMock, null, null, nodeInformationProvider);
+ InternalCeQueueImpl underTest = new InternalCeQueueImpl(system2, db.getDbClient(), null, queueStatusMock, null, null, nodeInformation);
try {
underTest.remove(task, CeActivityDto.Status.FAILED, null, null);
@@ -313,7 +313,7 @@ public class InternalCeQueueImplTest {
CeTask task = submit(CeTaskTypes.REPORT, newProjectDto("PROJECT_1"));
db.executeUpdateSql("update ce_queue set status = 'PENDING', started_at = 123 where uuid = '" + task.getUuid() + "'");
db.commit();
- InternalCeQueueImpl underTest = new InternalCeQueueImpl(system2, db.getDbClient(), null, queueStatusMock, null, null, nodeInformationProvider);
+ InternalCeQueueImpl underTest = new InternalCeQueueImpl(system2, db.getDbClient(), null, queueStatusMock, null, null, nodeInformation);
underTest.cancelWornOuts();