You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

QProfileTesting.java 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2019 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.server.qualityprofile;
  21. import org.sonar.db.organization.OrganizationDto;
  22. import org.sonar.db.qualityprofile.QProfileDto;
  23. /**
  24. * Utility class for tests involving quality profiles.
  25. * @deprecated replaced by {@link org.sonar.db.qualityprofile.QualityProfileDbTester}
  26. */
  27. @Deprecated
  28. public class QProfileTesting {
  29. public static final QProfileName XOO_P1_NAME = new QProfileName("xoo", "P1");
  30. public static final String XOO_P1_KEY = "XOO_P1";
  31. public static final QProfileName XOO_P2_NAME = new QProfileName("xoo", "P2");
  32. public static final String XOO_P2_KEY = "XOO_P2";
  33. public static final QProfileName XOO_P3_NAME = new QProfileName("xoo", "P3");
  34. public static final String XOO_P3_KEY = "XOO_P3";
  35. /**
  36. * @deprecated provide organization as dto
  37. */
  38. @Deprecated
  39. public static QProfileDto newQProfileDto(String organizationUuid, QProfileName name, String key) {
  40. return new QProfileDto()
  41. .setKee(key)
  42. .setRulesProfileUuid("rp-" + key)
  43. .setOrganizationUuid(organizationUuid)
  44. .setName(name.getName())
  45. .setLanguage(name.getLanguage());
  46. }
  47. /**
  48. * @deprecated provide organization as dto
  49. */
  50. @Deprecated
  51. public static QProfileDto newXooP1(String organizationUuid) {
  52. return newQProfileDto(organizationUuid, XOO_P1_NAME, XOO_P1_KEY);
  53. }
  54. /**
  55. * @deprecated provide organization as dto
  56. */
  57. @Deprecated
  58. public static QProfileDto newXooP2(String organizationUuid) {
  59. return newQProfileDto(organizationUuid, XOO_P2_NAME, XOO_P2_KEY);
  60. }
  61. /**
  62. * @deprecated provide organization as dto
  63. */
  64. @Deprecated
  65. public static QProfileDto newXooP3(String organizationUuid) {
  66. return newQProfileDto(organizationUuid, XOO_P3_NAME, XOO_P3_KEY);
  67. }
  68. public static QProfileDto newQProfileDto(OrganizationDto organization, QProfileName name, String uuid) {
  69. return new QProfileDto()
  70. .setKee(uuid)
  71. .setRulesProfileUuid("rp-" + uuid)
  72. .setOrganizationUuid(organization.getUuid())
  73. .setName(name.getName())
  74. .setLanguage(name.getLanguage());
  75. }
  76. public static QProfileDto newXooP1(OrganizationDto organization) {
  77. return newQProfileDto(organization, XOO_P1_NAME, XOO_P1_KEY);
  78. }
  79. public static QProfileDto newXooP2(OrganizationDto organization) {
  80. return newQProfileDto(organization, XOO_P2_NAME, XOO_P2_KEY);
  81. }
  82. public static QProfileDto newXooP3(OrganizationDto organization) {
  83. return newQProfileDto(organization, XOO_P3_NAME, XOO_P3_KEY);
  84. }
  85. }