]> source.dussan.org Git - sonarqube.git/commitdiff
Clean-up JRubyFacade
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 17 Jun 2016 19:30:27 +0000 (21:30 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 20 Jun 2016 21:16:20 +0000 (23:16 +0200)
server/sonar-server/src/main/java/org/sonar/server/component/DefaultRubyComponentService.java
server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
server/sonar-server/src/test/java/org/sonar/server/component/DefaultRubyComponentServiceTest.java
sonar-plugin-api/src/main/java/org/sonar/api/component/RubyComponentService.java

index 8ed51f62c646e77196212d8e2c9b01ddf6a85e36..5d0611a6338a518cb917d4850d6747be784b8788 100644 (file)
@@ -38,13 +38,11 @@ import static org.sonar.server.ws.WsUtils.checkRequest;
 public class DefaultRubyComponentService implements RubyComponentService {
 
   private final ResourceDao resourceDao;
-  private final DefaultComponentFinder finder;
   private final ComponentService componentService;
   private final PermissionService permissionService;
 
-  public DefaultRubyComponentService(ResourceDao resourceDao, DefaultComponentFinder finder, ComponentService componentService, PermissionService permissionService) {
+  public DefaultRubyComponentService(ResourceDao resourceDao, ComponentService componentService, PermissionService permissionService) {
     this.resourceDao = resourceDao;
-    this.finder = finder;
     this.componentService = componentService;
     this.permissionService = permissionService;
   }
@@ -80,24 +78,6 @@ public class DefaultRubyComponentService implements RubyComponentService {
     return componentInDb.getId();
   }
 
-  public DefaultComponentQueryResult find(Map<String, Object> params) {
-    ComponentQuery query = toQuery(params);
-    List<Component> components = resourceDao.selectProjectsByQualifiers(query.qualifiers());
-    return finder.find(query, components);
-  }
-
-  public DefaultComponentQueryResult findWithUncompleteProjects(Map<String, Object> params) {
-    ComponentQuery query = toQuery(params);
-    List<Component> components = resourceDao.selectProjectsIncludingNotCompletedOnesByQualifiers(query.qualifiers());
-    return finder.find(query, components);
-  }
-
-  public DefaultComponentQueryResult findGhostsProjects(Map<String, Object> params) {
-    ComponentQuery query = toQuery(params);
-    List<Component> components = resourceDao.selectGhostsProjects(query.qualifiers());
-    return finder.find(query, components);
-  }
-
   public List<ResourceDto> findProvisionedProjects(Map<String, Object> params) {
     ComponentQuery query = toQuery(params);
     return resourceDao.selectProvisionedProjects(query.qualifiers());
index aafd283563da5721468dc1466fc90f57f68964c2..35ffcdb81dc3070d756741e236398695011ff4fd 100644 (file)
@@ -59,15 +59,8 @@ import org.sonar.server.platform.ServerIdGenerator;
 import org.sonar.server.platform.ServerSettings;
 import org.sonar.server.platform.SettingsChangeNotifier;
 import org.sonar.server.platform.ws.UpgradesAction;
-import org.sonar.server.plugins.InstalledPluginReferentialFactory;
-import org.sonar.server.plugins.PluginDownloader;
-import org.sonar.server.plugins.ServerPluginRepository;
-import org.sonar.server.plugins.UpdateCenterMatrixFactory;
 import org.sonar.server.rule.RuleRepositories;
 import org.sonar.server.user.NewUserNotifier;
-import org.sonar.updatecenter.common.PluginReferential;
-import org.sonar.updatecenter.common.UpdateCenter;
-import org.sonar.updatecenter.common.Version;
 
 import static com.google.common.collect.Lists.newArrayList;
 
@@ -103,14 +96,6 @@ public final class JRubyFacade {
     return get(ResourceTypes.class).get(qualifier);
   }
 
-  public String getResourceTypeStringProperty(String resourceTypeQualifier, String resourceTypeProperty) {
-    ResourceType resourceType = getResourceType(resourceTypeQualifier);
-    if (resourceType != null) {
-      return resourceType.getStringProperty(resourceTypeProperty);
-    }
-    return null;
-  }
-
   public List<String> getQualifiersWithProperty(final String propertyKey) {
     List<String> qualifiers = newArrayList();
     for (ResourceType type : getResourceTypes()) {
@@ -138,37 +123,6 @@ public final class JRubyFacade {
   }
 
   // UPDATE CENTER ------------------------------------------------------------
-  public void downloadPlugin(String pluginKey, String pluginVersion) {
-    get(PluginDownloader.class).download(pluginKey, Version.create(pluginVersion));
-  }
-
-  public void cancelPluginDownloads() {
-    get(PluginDownloader.class).cancelDownloads();
-  }
-
-  public List<String> getPluginDownloads() {
-    return get(PluginDownloader.class).getDownloadedPluginFilenames();
-  }
-
-  public void uninstallPlugin(String pluginKey) {
-    get(ServerPluginRepository.class).uninstall(pluginKey);
-  }
-
-  public void cancelPluginUninstalls() {
-    get(ServerPluginRepository.class).cancelUninstalls();
-  }
-
-  public List<String> getPluginUninstalls() {
-    return get(ServerPluginRepository.class).getUninstalledPluginFilenames();
-  }
-
-  public UpdateCenter getUpdatePluginCenter(boolean forceReload) {
-    return get(UpdateCenterMatrixFactory.class).getUpdateCenter(forceReload).orNull();
-  }
-
-  public PluginReferential getInstalledPluginReferential() {
-    return get(InstalledPluginReferentialFactory.class).getInstalledPluginReferential();
-  }
 
   // PLUGINS ------------------------------------------------------------------
   public PropertyDefinitions getPropertyDefinitions() {
index 2dc8a1ff88c015a3c99227dc27035231c3d513ce..d19252b2a41e958200056092cfc55a0fb78a5153 100644 (file)
@@ -45,7 +45,6 @@ import static org.mockito.Mockito.when;
 public class DefaultRubyComponentServiceTest {
 
   ResourceDao resourceDao = mock(ResourceDao.class);
-  DefaultComponentFinder finder = mock(DefaultComponentFinder.class);
   ComponentService componentService = mock(ComponentService.class);
   PermissionService permissionService = mock(PermissionService.class);
 
@@ -53,7 +52,7 @@ public class DefaultRubyComponentServiceTest {
 
   @Before
   public void before() {
-    service = new DefaultRubyComponentService(resourceDao, finder, componentService, permissionService);
+    service = new DefaultRubyComponentService(resourceDao, componentService, permissionService);
   }
 
   @Test
@@ -117,60 +116,6 @@ public class DefaultRubyComponentServiceTest {
     service.createComponent("1234", "New Project", Qualifiers.PROJECT);
   }
 
-  @Test
-  public void should_find() {
-    List<String> qualifiers = newArrayList("TRK");
-
-    Map<String, Object> map = newHashMap();
-    map.put("keys", newArrayList("org.codehaus.sonar"));
-    map.put("names", newArrayList("Sonar"));
-    map.put("qualifiers", qualifiers);
-    map.put("pageSize", 10l);
-    map.put("pageIndex", 50);
-    map.put("sort", "NAME");
-    map.put("asc", true);
-
-    service.find(map);
-    verify(resourceDao).selectProjectsByQualifiers(anyListOf(String.class));
-    verify(finder).find(any(ComponentQuery.class), anyListOf(Component.class));
-  }
-
-  @Test
-  public void should_find_with_uncomplete_projects() {
-    List<String> qualifiers = newArrayList("TRK");
-
-    Map<String, Object> map = newHashMap();
-    map.put("keys", newArrayList("org.codehaus.sonar"));
-    map.put("names", newArrayList("Sonar"));
-    map.put("qualifiers", qualifiers);
-    map.put("pageSize", 10l);
-    map.put("pageIndex", 50);
-    map.put("sort", "NAME");
-    map.put("asc", true);
-
-    service.findWithUncompleteProjects(map);
-    verify(resourceDao).selectProjectsIncludingNotCompletedOnesByQualifiers(anyListOf(String.class));
-    verify(finder).find(any(ComponentQuery.class), anyListOf(Component.class));
-  }
-
-  @Test
-  public void should_find_ghosts_projects() {
-    List<String> qualifiers = newArrayList("TRK");
-
-    Map<String, Object> map = newHashMap();
-    map.put("keys", newArrayList("org.codehaus.sonar"));
-    map.put("names", newArrayList("Sonar"));
-    map.put("qualifiers", qualifiers);
-    map.put("pageSize", 10l);
-    map.put("pageIndex", 50);
-    map.put("sort", "NAME");
-    map.put("asc", true);
-
-    service.findGhostsProjects(map);
-    verify(resourceDao).selectGhostsProjects(anyListOf(String.class));
-    verify(finder).find(any(ComponentQuery.class), anyListOf(Component.class));
-  }
-
   @Test
   public void should_find_provisioned_projects() {
     List<String> qualifiers = newArrayList("TRK");
index d38076c14ddf83c11514660929004bacc852c021..441364646ed21b447320c07a47d2bfd25d7f21e3 100644 (file)
@@ -24,8 +24,10 @@ import org.sonar.api.server.ServerSide;
 
 /**
  * @since 3.6
+ * @deprecated in 6.0
  */
 @ServerSide
+@Deprecated
 public interface RubyComponentService {
 
   @CheckForNull