@@ -90,7 +90,7 @@ public class ComponentNewValue extends NewValue { | |||
} | |||
@CheckForNull | |||
public boolean isPrivate() { | |||
public Boolean isPrivate() { | |||
return isPrivate; | |||
} | |||
@@ -0,0 +1,24 @@ | |||
/* | |||
* 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. | |||
*/ | |||
@ParametersAreNonnullByDefault | |||
package org.sonar.db.audit.model; | |||
import javax.annotation.ParametersAreNonnullByDefault; | |||
@@ -156,10 +156,6 @@ public class ComponentKeyUpdaterDao implements Dao { | |||
} | |||
} | |||
private static ComponentKeyUpdaterMapper mapper(DbSession dbSession) { | |||
return dbSession.getMapper(ComponentKeyUpdaterMapper.class); | |||
} | |||
public static void checkExistentKey(ComponentKeyUpdaterMapper mapper, String resourceKey) { | |||
if (mapper.countResourceByKey(resourceKey) > 0) { | |||
throw new IllegalArgumentException("Impossible to update key: a component with key \"" + resourceKey + "\" already exists."); |
@@ -0,0 +1,24 @@ | |||
/* | |||
* 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. | |||
*/ | |||
@ParametersAreNonnullByDefault | |||
package org.sonar.db.portfolio; | |||
import javax.annotation.ParametersAreNonnullByDefault; | |||
@@ -136,13 +136,13 @@ public class ClusterSettings implements Consumer<Props> { | |||
} | |||
private Set<AddressAndPort> parseAndCheckHosts(Property property, String value) { | |||
Set<AddressAndPort> res = parseHosts( value); | |||
Set<AddressAndPort> res = parseHosts(value); | |||
checkValidHosts(property, res); | |||
return res; | |||
} | |||
private void checkValidHosts(Property property, Set<AddressAndPort> addressAndPorts) { | |||
List<String> invalidHosts = addressAndPorts.stream() | |||
List<String> invalidHosts = addressAndPorts.stream() | |||
.map(AddressAndPort::getHost) | |||
.filter(t -> !network.toInetAddress(t).isPresent()) | |||
.sorted() | |||
@@ -231,7 +231,9 @@ public class ClusterSettings implements Consumer<Props> { | |||
private static class AddressAndPort { | |||
private static final int NO_PORT = -1; | |||
/** the host from setting, can be a hostname or an IP address */ | |||
/** | |||
* the host from setting, can be a hostname or an IP address | |||
*/ | |||
private final String host; | |||
private final int port; | |||
@@ -0,0 +1,24 @@ | |||
/* | |||
* 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. | |||
*/ | |||
@ParametersAreNonnullByDefault | |||
package org.sonar.server.rule; | |||
import javax.annotation.ParametersAreNonnullByDefault; | |||
@@ -19,7 +19,6 @@ | |||
*/ | |||
package org.sonar.server.authentication; | |||
import org.picocontainer.Startable; | |||
import org.sonar.api.utils.log.Logger; | |||
import org.sonar.api.utils.log.Loggers; | |||
import org.sonar.db.DbClient; |
@@ -35,7 +35,6 @@ import java.util.function.Function; | |||
import java.util.stream.Collectors; | |||
import javax.annotation.CheckForNull; | |||
import javax.annotation.Nullable; | |||
import org.sonar.api.config.Configuration; | |||
import org.sonar.api.config.PropertyDefinition; | |||
import org.sonar.api.config.PropertyDefinitions; | |||
import org.sonar.api.server.ws.Change; | |||
@@ -60,7 +59,6 @@ import static org.sonar.api.CoreProperties.SERVER_ID; | |||
import static org.sonar.api.CoreProperties.SERVER_STARTTIME; | |||
import static org.sonar.api.PropertyType.PROPERTY_SET; | |||
import static org.sonar.api.web.UserRole.USER; | |||
import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_ENABLED; | |||
import static org.sonar.server.setting.ws.PropertySetExtractor.extractPropertySetKeys; | |||
import static org.sonar.server.setting.ws.SettingsWsParameters.PARAM_COMPONENT; | |||
import static org.sonar.server.setting.ws.SettingsWsParameters.PARAM_KEYS; | |||
@@ -81,16 +79,14 @@ public class ValuesAction implements SettingsWsAction { | |||
private final UserSession userSession; | |||
private final PropertyDefinitions propertyDefinitions; | |||
private final SettingsWsSupport settingsWsSupport; | |||
private final boolean isSonarCloud; | |||
public ValuesAction(DbClient dbClient, ComponentFinder componentFinder, UserSession userSession, PropertyDefinitions propertyDefinitions, | |||
SettingsWsSupport settingsWsSupport, Configuration configuration) { | |||
SettingsWsSupport settingsWsSupport) { | |||
this.dbClient = dbClient; | |||
this.componentFinder = componentFinder; | |||
this.userSession = userSession; | |||
this.propertyDefinitions = propertyDefinitions; | |||
this.settingsWsSupport = settingsWsSupport; | |||
this.isSonarCloud = configuration.getBoolean(SONARCLOUD_ENABLED.getKey()).orElse(false); | |||
} | |||
@Override |
@@ -21,7 +21,6 @@ package org.sonar.server.setting.ws; | |||
import com.google.common.base.Joiner; | |||
import com.google.common.collect.ImmutableMap; | |||
import java.util.Comparator; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
@@ -31,7 +30,6 @@ import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.ExpectedException; | |||
import org.sonar.api.PropertyType; | |||
import org.sonar.api.config.Configuration; | |||
import org.sonar.api.config.PropertyDefinition; | |||
import org.sonar.api.config.PropertyDefinitions; | |||
import org.sonar.api.config.PropertyFieldDefinition; | |||
@@ -72,7 +70,6 @@ import static org.sonar.db.component.ComponentTesting.newModuleDto; | |||
import static org.sonar.db.permission.GlobalPermission.SCAN; | |||
import static org.sonar.db.property.PropertyTesting.newComponentPropertyDto; | |||
import static org.sonar.db.property.PropertyTesting.newGlobalPropertyDto; | |||
import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_ENABLED; | |||
import static org.sonarqube.ws.MediaTypes.JSON; | |||
import static org.sonarqube.ws.Settings.Setting.ParentValueOneOfCase.PARENTVALUEONEOF_NOT_SET; | |||
@@ -935,13 +932,7 @@ public class ValuesActionTest { | |||
private WsActionTester newTester() { | |||
MapSettings settings = new MapSettings(); | |||
Configuration configuration = settings.asConfig(); | |||
return new WsActionTester(new ValuesAction(dbClient, TestComponentFinder.from(db), userSession, definitions, support, configuration)); | |||
return new WsActionTester(new ValuesAction(dbClient, TestComponentFinder.from(db), userSession, definitions, support)); | |||
} | |||
private WsActionTester newSonarCloudTester() { | |||
MapSettings settings = new MapSettings().setProperty(SONARCLOUD_ENABLED.getKey(), "true"); | |||
Configuration configuration = settings.asConfig(); | |||
return new WsActionTester(new ValuesAction(dbClient, TestComponentFinder.from(db), userSession, definitions, support, configuration)); | |||
} | |||
} |
@@ -19,16 +19,8 @@ | |||
*/ | |||
package org.sonar.core.config; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import org.sonar.api.CoreProperties; | |||
import org.sonar.api.PropertyType; | |||
import org.sonar.api.config.PropertyDefinition; | |||
import org.sonar.api.resources.Qualifiers; | |||
public class SvnProperties { | |||
private static final String CATEGORY_SVN = "SVN"; | |||
public static final String USER_PROP_KEY = "sonar.svn.username"; | |||
public static final String PRIVATE_KEY_PATH_PROP_KEY = "sonar.svn.privateKeyPath"; | |||
public static final String PASSWORD_PROP_KEY = "sonar.svn.password.secured"; |