diff options
author | Jenkins CI <ci@sonarsource.com> | 2016-04-15 10:36:24 +0200 |
---|---|---|
committer | Jenkins CI <ci@sonarsource.com> | 2016-04-15 10:36:24 +0200 |
commit | d0fd6ac322cab2a2166b7af00d3d1e283f2c7e05 (patch) | |
tree | f8549a5b88a420ea7abe00c0ed0fcfd0ce840017 | |
parent | d464f2d6abcecd7cd2f5ca6f96d7b61b5b88444b (diff) | |
parent | 378d6b7916c97849e83eb3f77d1a9a259d4b3d50 (diff) | |
download | sonarqube-d0fd6ac322cab2a2166b7af00d3d1e283f2c7e05.tar.gz sonarqube-d0fd6ac322cab2a2166b7af00d3d1e283f2c7e05.zip |
Automatic merge from branch-5.5
* origin/branch-5.5:
Fix malformed javadoc in API
Add UserDao.selectByIds
SONAR-6948 rename method Request#getLocalConnector() to localConnector()
SONAR-6948 add javadoc for org.sonar.api.server.ws.LocalConnector
25 files changed, 126 insertions, 78 deletions
diff --git a/it/it-plugins/ws-plugin/src/main/java/LocalCallWebService.java b/it/it-plugins/ws-plugin/src/main/java/LocalCallWebService.java index b878ef2c47f..7a2ca7561aa 100644 --- a/it/it-plugins/ws-plugin/src/main/java/LocalCallWebService.java +++ b/it/it-plugins/ws-plugin/src/main/java/LocalCallWebService.java @@ -49,7 +49,7 @@ public final class LocalCallWebService implements WebService { private class ProtobufHandler implements RequestHandler { @Override public void handle(Request request, Response response) throws Exception { - WsClient client = wsClientFactory.newClient(request.getLocalConnector()); + WsClient client = wsClientFactory.newClient(request.localConnector()); WsCe.TaskTypesWsResponse ceTaskTypes = client.ce().taskTypes(); response.stream().setStatus(ceTaskTypes.getTaskTypesCount() > 0 ? 200 : 500); @@ -59,7 +59,7 @@ public final class LocalCallWebService implements WebService { private class JsonHandler implements RequestHandler { @Override public void handle(Request request, Response response) throws Exception { - WsClient client = wsClientFactory.newClient(request.getLocalConnector()); + WsClient client = wsClientFactory.newClient(request.localConnector()); WsResponse jsonResponse = client.wsConnector().call(new GetRequest("api/issues/search")); boolean ok = jsonResponse.contentType().equals(MediaTypes.JSON) @@ -72,7 +72,7 @@ public final class LocalCallWebService implements WebService { private class RequirePermissionHandler implements RequestHandler { @Override public void handle(Request request, Response response) throws Exception { - WsClient client = wsClientFactory.newClient(request.getLocalConnector()); + WsClient client = wsClientFactory.newClient(request.localConnector()); WsResponse jsonResponse = client.wsConnector().call(new GetRequest("api/system/info")); diff --git a/sonar-db/src/main/java/org/sonar/db/user/UserDao.java b/sonar-db/src/main/java/org/sonar/db/user/UserDao.java index 5d0eada9cc7..7d746d50bdf 100644 --- a/sonar-db/src/main/java/org/sonar/db/user/UserDao.java +++ b/sonar-db/src/main/java/org/sonar/db/user/UserDao.java @@ -62,6 +62,16 @@ public class UserDao implements Dao { } /** + * Select users by ids, including disabled users. An empty list is returned + * if list of ids is empty, without any db round trips. + * + * Used by the Governance plugin + */ + public List<UserDto> selectByIds(DbSession session, Collection<Long> ids) { + return DatabaseUtils.executeLargeInputs(ids, new SelectByIds(mapper(session))); + } + + /** * Search for user by login. Disabled users are ignored. * * @return the user, null if user not found @@ -219,4 +229,18 @@ public class UserDao implements Dao { return map.get(login); } } + + private static class SelectByIds implements Function<List<Long>, List<UserDto>> { + private final UserMapper mapper; + + private SelectByIds(UserMapper mapper) { + this.mapper = mapper; + } + + @Override + public List<UserDto> apply(@Nonnull List<Long> partitionOfLogins) { + return mapper.selectByIds(partitionOfLogins); + } + } + } diff --git a/sonar-db/src/main/java/org/sonar/db/user/UserMapper.java b/sonar-db/src/main/java/org/sonar/db/user/UserMapper.java index e3c32da3ad6..e577c57e241 100644 --- a/sonar-db/src/main/java/org/sonar/db/user/UserMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/user/UserMapper.java @@ -45,14 +45,11 @@ public interface UserMapper { @CheckForNull UserDto selectUserByLogin(String login); - List<UserDto> selectUsersByLogins(@Param("logins") List<String> logins); - List<UserDto> selectUsers(UserQuery query); List<UserDto> selectByLogins(List<String> logins); - @CheckForNull - GroupDto selectGroupByName(String name); + List<UserDto> selectByIds(@Param("ids") List<Long> ids); long countByEmail(String email); diff --git a/sonar-db/src/main/resources/org/sonar/db/user/UserMapper.xml b/sonar-db/src/main/resources/org/sonar/db/user/UserMapper.xml index 7d9e4d69230..36f61886772 100644 --- a/sonar-db/src/main/resources/org/sonar/db/user/UserMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/user/UserMapper.xml @@ -62,13 +62,14 @@ </foreach> </select> - <select id="selectUsersByLogins" parameterType="map" resultType="User"> + <select id="selectByIds" parameterType="string" resultType="User"> SELECT <include refid="userColumns"/> - FROM users u WHERE - (<foreach item="login" index="index" collection="logins" open="(" separator=" or " close=")"> - u.login=#{login} - </foreach>) + FROM users u + WHERE u.id in + <foreach collection="ids" open="(" close=")" item="id" separator=","> + #{id} + </foreach> </select> <select id="selectUsers" parameterType="map" resultType="User"> @@ -98,11 +99,6 @@ where lower(u.email)=#{email} AND u.active=${_true} </select> - <select id="selectGroupByName" parameterType="string" resultType="Group"> - SELECT id, name, description, created_at AS "createdAt", updated_at AS "updatedAt" - FROM groups WHERE name=#{id} - </select> - <delete id="removeUserFromGroups" parameterType="long"> DELETE FROM groups_users WHERE user_id=#{id} </delete> diff --git a/sonar-db/src/test/java/org/sonar/db/user/UserDaoTest.java b/sonar-db/src/test/java/org/sonar/db/user/UserDaoTest.java index 6afef4c64b3..2e5f9ecd41b 100644 --- a/sonar-db/src/test/java/org/sonar/db/user/UserDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/user/UserDaoTest.java @@ -77,6 +77,17 @@ public class UserDaoTest { } @Test + public void selectUsersIds() { + db.prepareDbUnit(getClass(), "selectUsersByIds.xml"); + + Collection<UserDto> users = underTest.selectByIds(session, asList(100L, 101L, 987L)); + assertThat(users).hasSize(2); + assertThat(users).extracting("login").containsOnly("marius", "inactive_user"); + + assertThat(underTest.selectByIds(session, Collections.<Long>emptyList())).isEmpty(); + } + + @Test public void selectUserByLogin_ignore_inactive() { db.prepareDbUnit(getClass(), "selectActiveUserByLogin.xml"); diff --git a/sonar-db/src/test/resources/org/sonar/db/user/UserDaoTest/selectUsersByIds.xml b/sonar-db/src/test/resources/org/sonar/db/user/UserDaoTest/selectUsersByIds.xml new file mode 100644 index 00000000000..3be84a27b69 --- /dev/null +++ b/sonar-db/src/test/resources/org/sonar/db/user/UserDaoTest/selectUsersByIds.xml @@ -0,0 +1,9 @@ +<dataset> + <users id="100" login="inactive_user" name="Disabled" email="inactive@lesbronzes.fr" created_at="1418215735482" + updated_at="1418215735485" active="[false]"/> + <users id="101" login="marius" name="Marius" email="marius@lesbronzes.fr" created_at="1418215735482" + updated_at="1418215735485" active="[true]"/> + <users id="102" login="jcdus" name="Jean-Claude Dus" email="jcdus@lesbronzes.fr" created_at="1418215735482" + updated_at="1418215735485" active="[true]"/> + +</dataset> diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtModel.java index d7e156d246b..fe6e0b4dbea 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtModel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtModel.java @@ -19,15 +19,14 @@ */ package org.sonar.api.batch.debt; -import javax.annotation.CheckForNull; - import java.util.List; +import javax.annotation.CheckForNull; /** * This class can be used to retrieve characteristics or sub-characteristics from the technical debt model during analysis. * * Unfortunately, this class cannot be used to set characteristic on {@link org.sonar.api.measures.Measure}, - * because the Measure API still uses deprecated {@link org.sonar.api.technicaldebt.batch.Characteristic}. + * because the Measure API still uses deprecated {@code org.sonar.api.technicaldebt.batch.Characteristic}. * * @since 4.3 * @deprecated since 5.1 debt model will soon be unavailable on batch side diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/InitializersPhaseHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/InitializersPhaseHandler.java index 52a242c6d15..8ac2876e933 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/InitializersPhaseHandler.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/InitializersPhaseHandler.java @@ -19,9 +19,8 @@ */ package org.sonar.api.batch.events; -import org.sonar.api.batch.Initializer; - import java.util.List; +import org.sonar.api.batch.Initializer; /** * @since 3.7 @@ -45,7 +44,7 @@ public interface InitializersPhaseHandler extends EventHandler { } /** - * Called before and after execution of all {@link Initializers}s. + * Called before and after execution of all {@link Initializer}s. */ void onInitializersPhase(InitializersPhaseEvent event); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java index ab3b876d79d..5a33360e05b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java @@ -52,7 +52,7 @@ import org.sonar.api.ce.measure.MeasureComputer.MeasureComputerDefinition.Builde * public void compute(MeasureComputerContext context) { * int ncloc = context.getMeasure("ncloc"); * List<Issue> issues = context.getIssues(); - * if (ncloc != null && !issues.isEmpty()) { + * if (ncloc != null && !issues.isEmpty()) { * double value = issues.size() / ncloc; * context.addMeasure("my_new_metric", value); * } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java index c696b22e201..df37c340bb9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java @@ -88,8 +88,10 @@ public interface I18n { /** * Return the formatted datetime. - * <br> - * Example : formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22T19:10:03+0100")) -> Jan 22, 2014 7:10 PM + * <p> + * Example: {@code formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22T19:10:03+0100"))} + * returns {@code "Jan 22, 2014 7:10 PM"}. + * </p> * * @since 4.2 */ @@ -98,7 +100,8 @@ public interface I18n { /** * Return the formatted date. * <br> - * Example : formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22")) -> Jan 22, 2014 + * Example: {@code formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22"))} + * returns {@code "Jan 22, 2014"}. * * @since 4.2 */ @@ -107,7 +110,7 @@ public interface I18n { /** * Return the formatted decimal, with always one fraction digit. * <br> - * Example : formatDouble(Locale.FRENCH, 10.56) -> 10,6 + * Example: {@code formatDouble(Locale.FRENCH, 10.56)} returns {@code "10,6"}. * * @since 4.4 */ @@ -116,7 +119,7 @@ public interface I18n { /** * Return the formatted integer. * <br> - * Example : formatInteger(Locale.ENGLISH, 100000) -> 100,000 + * Example: {@code formatInteger(Locale.ENGLISH, 100000)} returns {@code "100,000"}. * * @since 4.4 */ diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java index 7751060a6c7..80359a835f6 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java @@ -40,7 +40,7 @@ public interface ServerUpgradeStatus { boolean isFreshInstall(); /** - * The database version before the server startup. Returns <=0 if db created from scratch. + * The database version before the server startup. Returns a non-zero negative value if db created from scratch. */ int getInitialDbVersion(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java index f1b43ba1b2c..78ac0a2d6ef 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java @@ -25,8 +25,8 @@ import org.sonar.api.server.ServerSide; * Entry-point to define a new Identity provider. * Only one of this two interfaces can be used : * <ul> - * <li>{@link OAuth2IdentityProvider}</li> for OAuth2 authentication - * <li>{@link BaseIdentityProvider}</li> for other kind of authentication + * <li>{@link OAuth2IdentityProvider} for OAuth2 authentication</li> + * <li>{@link BaseIdentityProvider} for other kind of authentication</li> * </ul> * * @since 5.4 diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java index 468077674c8..eb93d97957d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java @@ -27,7 +27,7 @@ import javax.annotation.CheckForNull; * This class allows a web service to call another web service through the sonar-ws library. * The call is in-process, synchronous and does not involve the HTTP stack. * <p> - * Example of a web service that uses sonar-ws 5.5 to get some issues: + * Example of a web service that loads some issues: * <pre> * import org.sonar.api.server.ws.RequestHandler; * import org.sonarqube.ws.client.WsClientFactories; @@ -35,12 +35,20 @@ import javax.annotation.CheckForNull; * public class MyRequestHandler implements RequestHandler { * {@literal @}Override * public void handle(Request request, Response response) { - * WsClient wsClient = WsClientFactories.getLocal().newClient(request.getLocalConnector()); + * WsClient wsClient = WsClientFactories.getLocal().newClient(request.localConnector()); * SearchWsResponse issues = wsClient.issues().search(new SearchWsRequest()); * // ... * } * } * </pre> + * + * It requires to use the sonar-ws library which Maven ids are: + * <pre> + * <dependency> + * <groupId>org.sonarsource.sonarqube</groupId> + * <artifactId>sonar-ws</artifactId> + * </dependency> + * </pre> * * @since 5.5 */ diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java index fdc54cee2b0..6396ecab761 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java @@ -237,10 +237,10 @@ public abstract class Request { } /** - * Used by the sonar-ws library to allow a web service to call another web service. + * Allows a web service to call another web service. * @see LocalConnector * @since 5.5 */ @Beta - public abstract LocalConnector getLocalConnector(); + public abstract LocalConnector localConnector(); } 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 de2f60033b8..484956d7a68 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 @@ -88,6 +88,9 @@ import static java.lang.String.format; * } * </pre> * + * Since version 5.5, a web service can call another web service to get some data. See {@link Request#localConnector()} + * provided by {@link RequestHandler#handle(Request, Response)}. + * * @since 4.2 */ @ServerSide @@ -100,7 +103,7 @@ public interface WebService extends Definable<WebService.Context> { /** * Create a new controller. * <br> - * Structure of request URL is <code>http://<server>/<>controller path>/<action path>?<parameters></code>. + * Structure of request URL is <code>http://<server>/<controller path>/<action path>?<parameters></code>. * * @param path the controller path must not start or end with "/". It is recommended to start with "api/" * and to use lower-case format with underscores, for example "api/coding_rules". Usual actions @@ -378,8 +381,10 @@ public interface WebService extends Definable<WebService.Context> { /**$ * * Creates the parameter {@link org.sonar.api.server.ws.WebService.Param#TEXT_QUERY}, which is - * used to search for a subset of fields containing the supplied string.<br /> - * The fields must be in the <strong>plural</strong> form (ex: "names", "keys") + * used to search for a subset of fields containing the supplied string. + * <p> + * The fields must be in the <strong>plural</strong> form (ex: "names", "keys"). + * </p> */ public NewAction addSearchQuery(String exampleValue, String... pluralFields) { String actionDescription = format("Limit search to %s that contain the supplied string.", Joiner.on(" or ").join(pluralFields)); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/SimpleGetRequest.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/SimpleGetRequest.java index f08816d5bd7..e9d2c0827d1 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/SimpleGetRequest.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/SimpleGetRequest.java @@ -82,7 +82,7 @@ public class SimpleGetRequest extends Request { } @Override - public LocalConnector getLocalConnector() { + public LocalConnector localConnector() { throw new UnsupportedOperationException(); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java index f38a1bed2e2..58615ec636e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java @@ -53,7 +53,7 @@ public abstract class ValidatingRequest extends Request { } @Override - public LocalConnector getLocalConnector() { + public LocalConnector localConnector() { checkNotNull(localConnector, "Local connector has not been set"); return localConnector; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java index a1cd561677f..da16a352447 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java @@ -30,7 +30,7 @@ import org.sonar.api.server.ServerSide; * depends on situation: * <ul> * <li>${SONAR_HOME}/temp on server side</li> - * <li>${SONAR_HOME}/.sonartmp<rnd> on the batch side</li> + * <li>${SONAR_HOME}/.sonartmp on scanner side</li> * </ul> * @since 4.0 * diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java index a202004989e..df350a4893b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java @@ -19,26 +19,6 @@ */ package org.sonar.api.utils; -import org.apache.commons.io.IOUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import javax.annotation.Nullable; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.File; @@ -53,6 +33,24 @@ import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.annotation.Nullable; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; +import org.apache.commons.io.IOUtils; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; /** * XML Parsing tool using XPATH. It's recommended to use StaxParser when parsing big XML files. @@ -260,7 +258,7 @@ public class XpathParser { /** * Fix the error occured when parsing a string containing unicode character - * Example : &u20ac; will be replaced by € + * Example : {@code &u20ac;} will be replaced by {@code €} */ protected String fixUnicodeChar(String text) { String unicode = "&u"; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java index 7658439803c..bea1dcc2d27 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java @@ -19,12 +19,11 @@ */ package org.sonar.api.utils.text; -import org.sonar.api.utils.DateUtils; - -import javax.annotation.Nullable; import java.io.Writer; import java.util.Date; import java.util.Map; +import javax.annotation.Nullable; +import org.sonar.api.utils.DateUtils; /** * Writes JSON as a stream. This class allows plugins to not directly depend @@ -208,7 +207,7 @@ public class JsonWriter { * <ul> * <li>primitive types: String, Number, Boolean</li> * <li>java.util.Date: encoded as datetime (see {@link #valueDateTime(java.util.Date)}</li> - * <li><code>Map<Object, Object></code>. Method toString is called for the key.</li> + * <li>{@code Map<Object, Object>}. Method toString is called for the key.</li> * <li>Iterable</li> * </ul> * diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java index 73edeb1dc6f..963759254db 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java @@ -34,13 +34,13 @@ import org.sonar.api.server.ServerSide; * * <p>Example of template: <pre> - <% content_for :script do %> - <script>alert('page loaded')</script> - <% end %> + <% content_for :script do %> + <script>alert('page loaded')</script> + <% end %> - <% content_for :footer do %> - <div>this is <b>my footer</b></div> -<% end %> + <% content_for :footer do %> + <div>this is <b>my footer</b></div> +<% end %> </pre> * * @since 3.3 diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/RubyRailsWebservice.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/RubyRailsWebservice.java index 9178f9bddf9..e09bcf9b34c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/RubyRailsWebservice.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/RubyRailsWebservice.java @@ -23,7 +23,7 @@ package org.sonar.api.web; /** * Interface to create a web service by implementing a Ruby On Rails controller. * The method getTemplate() return the ROR controller code, the name of the controller class defined in the template - * MUST match the following name scheme : Api::$Webservice.getId()Controller I.E : Webservice.getId() = TestWS > Api::TestWSController. + * MUST match the following name scheme : Api::$Webservice.getId()Controller I.E : Webservice.getId() = TestWS > Api::TestWSController. * The plugin will be deployed with the following URL scheme: http://sonarhost/api/plugins/$Webservice.getId()/:action/:id * :action is the name of the controller method to call, :id is a param that will be passed to the controller, these 2 params are not mandatory * and will call the index controller method if not specified. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java index f547a7d5fa3..5003381681e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java @@ -39,7 +39,7 @@ public @interface WidgetProperty { boolean optional() default true; /** - * @since 3.3 Options for property of type WidgetPropertyType.METRIC</code>. + * @since 3.3 Options for property of type {@link WidgetPropertyType#METRIC}. * * If no option is specified, any metric will match. * If options are specified, all must match for the metric to be displayed. @@ -48,7 +48,7 @@ public @interface WidgetProperty { * For example <code>type:INT,FLOAT</code> will match any metric of type <code>INT</code> or <code>FLOAT</code>. * For example <code>type:NUMERIC</code> will match any metric of numerictype. * - * @since 3.5 Options for property of type WidgetPropertyType.SINGLE_SELECT_LIST</code> + * @since 3.5 Options for property of type {@link WidgetPropertyType#SINGLE_SELECT_LIST}. * For example {"property_1", "property_3", "property_3"}). * */ diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/LocalWsConnector.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/LocalWsConnector.java index 3b7af43aa88..ca8947e64e7 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/LocalWsConnector.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/LocalWsConnector.java @@ -37,7 +37,7 @@ class LocalWsConnector implements WsConnector { } @VisibleForTesting - LocalConnector getLocalConnector() { + LocalConnector localConnector() { return localConnector; } diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/WsClientFactoriesTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/WsClientFactoriesTest.java index 351a80dc295..886a1f6d8a4 100644 --- a/sonar-ws/src/test/java/org/sonarqube/ws/client/WsClientFactoriesTest.java +++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/WsClientFactoriesTest.java @@ -42,6 +42,6 @@ public class WsClientFactoriesTest { assertThat(client).isInstanceOf(DefaultWsClient.class); assertThat(client.wsConnector()).isInstanceOf(LocalWsConnector.class); - assertThat(((LocalWsConnector) client.wsConnector()).getLocalConnector()).isSameAs(connector); + assertThat(((LocalWsConnector) client.wsConnector()).localConnector()).isSameAs(connector); } } |