From 67ff6070437876c08adafb5ac244252d81c315e7 Mon Sep 17 00:00:00 2001 From: Jacek Date: Tue, 26 Jan 2021 08:49:58 +0100 Subject: [PATCH] SONAR-14371 Create 'alm_integrations' WS module in CE --- .../ws/AlmIntegrationsWSModule.java | 31 ++++++++++++++ .../almintegration/ws/AlmIntegrationsWs.java | 42 +++++++++++++++++++ .../ws/AlmIntegrationsWsAction.java | 26 ++++++++++++ .../platformlevel/PlatformLevel4.java | 6 ++- 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWSModule.java create mode 100644 server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWs.java create mode 100644 server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWsAction.java diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWSModule.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWSModule.java new file mode 100644 index 00000000000..8f15ca75fcf --- /dev/null +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWSModule.java @@ -0,0 +1,31 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program 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. + * + * This program 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. + */ +package org.sonar.server.almintegration.ws; + +import org.sonar.core.platform.Module; + +public class AlmIntegrationsWSModule extends Module { + @Override + protected void configureModule() { + // TODO:: move alm_integrations actions here + add( + AlmIntegrationsWs.class); + } +} diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWs.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWs.java new file mode 100644 index 00000000000..f1f5290537d --- /dev/null +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWs.java @@ -0,0 +1,42 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program 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. + * + * This program 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. + */ +package org.sonar.server.almintegration.ws; + +import java.util.List; +import org.sonar.api.server.ws.WebService; + +public class AlmIntegrationsWs implements WebService { + private final List actions; + + public AlmIntegrationsWs(List actions) { + this.actions = actions; + } + + @Override + public void define(Context context) { + NewController controller = context.createController("api/alm_integrations") + .setDescription("Manage ALM Integrations") + .setSince("8.2"); + + actions.forEach(a -> a.define(controller)); + + controller.done(); + } +} diff --git a/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWsAction.java b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWsAction.java new file mode 100644 index 00000000000..3a2cc43a584 --- /dev/null +++ b/server/sonar-webserver-webapi/src/main/java/org/sonar/server/almintegration/ws/AlmIntegrationsWsAction.java @@ -0,0 +1,26 @@ +/* + * SonarQube + * Copyright (C) 2009-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program 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. + * + * This program 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. + */ +package org.sonar.server.almintegration.ws; + +import org.sonar.server.ws.WsAction; + +public interface AlmIntegrationsWsAction extends WsAction { + // marker interface +} diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index 6c384bd979c..962bafff35c 100644 --- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -39,6 +39,7 @@ import org.sonar.core.component.DefaultResourceTypes; import org.sonar.core.extension.CoreExtensionsInstaller; import org.sonar.core.platform.ComponentContainer; import org.sonar.core.platform.PlatformEditionProvider; +import org.sonar.server.almintegration.ws.AlmIntegrationsWSModule; import org.sonar.server.almsettings.MultipleAlmFeatureProvider; import org.sonar.server.authentication.AuthenticationModule; import org.sonar.server.authentication.DefaultAdminCredentialsVerifierNotificationHandler; @@ -61,6 +62,7 @@ import org.sonar.server.component.index.ComponentIndexDefinition; import org.sonar.server.component.index.ComponentIndexer; import org.sonar.server.component.ws.ComponentViewerJsonWriter; import org.sonar.server.component.ws.ComponentsWsModule; +import org.sonar.server.developers.ws.DevelopersWsModule; import org.sonar.server.duplication.ws.DuplicationsParser; import org.sonar.server.duplication.ws.DuplicationsWs; import org.sonar.server.duplication.ws.ShowResponseBuilder; @@ -72,7 +74,6 @@ import org.sonar.server.es.RecoveryIndexer; import org.sonar.server.es.metadata.EsDbCompatibilityImpl; import org.sonar.server.es.metadata.MetadataIndexDefinition; import org.sonar.server.es.metadata.MetadataIndexImpl; -import org.sonar.server.developers.ws.DevelopersWsModule; import org.sonar.server.extension.CoreExtensionBootstraper; import org.sonar.server.extension.CoreExtensionStopper; import org.sonar.server.favorite.FavoriteModule; @@ -484,6 +485,9 @@ public class PlatformLevel4 extends PlatformLevel { CancelAllAction.class, PluginsWs.class, + // ALM integrations + AlmIntegrationsWSModule.class, + // Branch BranchFeatureProxyImpl.class, -- 2.39.5