]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5382 Remove dependencies WS client
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 21 Apr 2015 12:39:41 +0000 (14:39 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 21 Apr 2015 12:39:54 +0000 (14:39 +0200)
server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Dependency.java [deleted file]
server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyQuery.java [deleted file]
server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyTree.java [deleted file]
server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyTreeQuery.java [deleted file]
server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/DependencyTreeUnmarshaller.java [deleted file]
server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/DependencyUnmarshaller.java [deleted file]
server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java
server/sonar-ws-client/src/test/java/org/sonar/wsclient/services/DependencyQueryTest.java [deleted file]
server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/DependencyTreeUnmarshallerTest.java [deleted file]
server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/DependencyUnmarshallerTest.java [deleted file]

diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Dependency.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Dependency.java
deleted file mode 100644 (file)
index 085e52f..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.wsclient.services;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-public class Dependency extends Model {
-
-  private String id;
-  private Long fromId;
-  private Long toId;
-  private String usage;
-  private Integer weight;
-  private String fromKey;
-  private String fromName;
-  private String fromQualifier;
-  private String toKey;
-  private String toName;
-  private String toQualifier;
-
-  @CheckForNull
-  public String getId() {
-    return id;
-  }
-
-  public Dependency setId(@Nullable String id) {
-    this.id = id;
-    return this;
-  }
-
-  @CheckForNull
-  public Long getFromId() {
-    return fromId;
-  }
-
-  public Dependency setFromId(@Nullable Long fromId) {
-    this.fromId = fromId;
-    return this;
-  }
-
-  @CheckForNull
-  public Long getToId() {
-    return toId;
-  }
-
-  public Dependency setToId(@Nullable Long toId) {
-    this.toId = toId;
-    return this;
-  }
-
-  @CheckForNull
-  public String getFromKey() {
-    return fromKey;
-  }
-
-  public Dependency setFromKey(@Nullable String fromKey) {
-    this.fromKey = fromKey;
-    return this;
-  }
-
-  @CheckForNull
-  public String getToKey() {
-    return toKey;
-  }
-
-  public Dependency setToKey(@Nullable String toKey) {
-    this.toKey = toKey;
-    return this;
-  }
-
-  @CheckForNull
-  public String getUsage() {
-    return usage;
-  }
-
-  public Dependency setUsage(@Nullable String usage) {
-    this.usage = usage;
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getWeight() {
-    return weight;
-  }
-
-  public Dependency setWeight(@Nullable Integer weight) {
-    this.weight = weight;
-    return this;
-  }
-
-  @CheckForNull
-  public String getFromName() {
-    return fromName;
-  }
-
-  public Dependency setFromName(@Nullable String fromName) {
-    this.fromName = fromName;
-    return this;
-  }
-
-  @CheckForNull
-  public String getFromQualifier() {
-    return fromQualifier;
-  }
-
-  public Dependency setFromQualifier(@Nullable String fromQualifier) {
-    this.fromQualifier = fromQualifier;
-    return this;
-  }
-
-  @CheckForNull
-  public String getToName() {
-    return toName;
-  }
-
-  public Dependency setToName(@Nullable String toName) {
-    this.toName = toName;
-    return this;
-  }
-
-  @CheckForNull
-  public String getToQualifier() {
-    return toQualifier;
-  }
-
-  public Dependency setToQualifier(@Nullable String toQualifier) {
-    this.toQualifier = toQualifier;
-    return this;
-  }
-
-  @Override
-  public boolean equals(Object o) {
-    if (this == o) {
-      return true;
-    }
-    if (o == null || getClass() != o.getClass()) {
-      return false;
-    }
-
-    Dependency that = (Dependency) o;
-    return id.equals(that.id);
-  }
-
-  @Override
-  public int hashCode() {
-    return id.hashCode();
-  }
-
-  @Override
-  public String toString() {
-    return new StringBuilder()
-      .append(fromKey)
-      .append(" -> ")
-      .append(toKey)
-      .toString();
-  }
-}
diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyQuery.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyQuery.java
deleted file mode 100644 (file)
index e5acd48..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.wsclient.services;
-
-/**
- * The web service "dependency" is since Sonar 2.0
- */
-public class DependencyQuery extends Query<Dependency> {
-  public static final String BASE_URL = "/api/dependencies";
-
-  private String resourceIdOrKey = null;
-  private String direction = null;
-  private String parentId = null;
-  private String id = null;
-  public static final String INCOMING_DIRECTION = "in";
-  public static final String OUTGOING_DIRECTION = "out";
-
-  public String getResourceIdOrKey() {
-    return resourceIdOrKey;
-  }
-
-  public DependencyQuery setResourceIdOrKey(String resourceIdOrKey) {
-    this.resourceIdOrKey = resourceIdOrKey;
-    return this;
-  }
-
-  public DependencyQuery setResourceId(long resourceId) {
-    this.resourceIdOrKey = String.valueOf(resourceId);
-    return this;
-  }
-
-  public String getDirection() {
-    return direction;
-  }
-
-  public DependencyQuery setDirection(String direction) {
-    this.direction = direction;
-    return this;
-  }
-
-  @Override
-  public String getUrl() {
-    StringBuilder url = new StringBuilder(BASE_URL);
-    url.append('?');
-    appendUrlParameter(url, "resource", resourceIdOrKey);
-    appendUrlParameter(url, "dir", direction);
-    appendUrlParameter(url, "parent", parentId);
-    appendUrlParameter(url, "id", id);
-    return url.toString();
-  }
-
-  public String getParentId() {
-    return parentId;
-  }
-
-  public String getId() {
-    return id;
-  }
-
-  public DependencyQuery setId(String id) {
-    this.id = id;
-    return this;
-  }
-
-  public DependencyQuery setParentId(String parentId) {
-    this.parentId = parentId;
-    return this;
-  }
-
-  @Override
-  public Class<Dependency> getModelClass() {
-    return Dependency.class;
-  }
-
-  /**
-   * Resources that depend upon a resource
-   * 
-   * @param resourceIdOrKey the target resource. Can be the primary key (a number) or the logical key (String)
-   */
-  public static DependencyQuery createForIncomingDependencies(String resourceIdOrKey) {
-    DependencyQuery query = new DependencyQuery();
-    query.setResourceIdOrKey(resourceIdOrKey);
-    query.setDirection(INCOMING_DIRECTION);
-    return query;
-  }
-
-  /**
-   * Resources that are depended upon a resource = all the resources that a resource depends upon
-   * 
-   * @param resourceIdOrKey the target resource. Can be the primary key (an integer) or the logical key (String)
-   */
-  public static DependencyQuery createForOutgoingDependencies(String resourceIdOrKey) {
-    DependencyQuery query = new DependencyQuery();
-    query.setResourceIdOrKey(resourceIdOrKey);
-    query.setDirection(OUTGOING_DIRECTION);
-    return query;
-  }
-
-  /**
-   * Resources that depend upon or are depended upon a resource. It equals the merge of createForIncomingDependencies(resourceIdOrKey)
-   * and createForOutgoingDependencies(resourceIdOrKey)
-   * 
-   * @param resourceIdOrKey the target resource. Can be the primary key (an integer) or the logical key (String)
-   */
-  public static DependencyQuery createForResource(String resourceIdOrKey) {
-    DependencyQuery query = new DependencyQuery();
-    query.setResourceIdOrKey(resourceIdOrKey);
-    return query;
-  }
-
-  public static DependencyQuery createForResource(long resourceId) {
-    DependencyQuery query = new DependencyQuery();
-    query.setResourceId(resourceId);
-    return query;
-  }
-
-  public static DependencyQuery createForSubDependencies(String dependencyId) {
-    DependencyQuery query = new DependencyQuery();
-    query.setParentId(dependencyId);
-    return query;
-  }
-
-  public static DependencyQuery createForId(String id) {
-    DependencyQuery query = new DependencyQuery();
-    query.setId(id);
-    return query;
-  }
-}
diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyTree.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyTree.java
deleted file mode 100644 (file)
index c2118fb..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.wsclient.services;
-
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-
-import java.util.List;
-
-/**
- * Experimental
- */
-public class DependencyTree extends Model {
-  private String depId;
-  private String resourceId;
-  private String resourceKey;
-  private String resourceName;
-  private String usage;
-  private String resourceScope;
-  private String resourceQualifier;
-  private String resourceVersion;
-  private Integer weight;
-  private List<DependencyTree> to;
-
-  @CheckForNull
-  public String getDepId() {
-    return depId;
-  }
-
-  public DependencyTree setDepId(@Nullable String depId) {
-    this.depId = depId;
-    return this;
-  }
-  @CheckForNull
-  public String getResourceId() {
-    return resourceId;
-  }
-
-  public DependencyTree setResourceId(@Nullable String resourceId) {
-    this.resourceId = resourceId;
-    return this;
-  }
-  @CheckForNull
-  public String getResourceKey() {
-    return resourceKey;
-  }
-
-  public DependencyTree setResourceKey(@Nullable String resourceKey) {
-    this.resourceKey = resourceKey;
-    return this;
-  }
-  @CheckForNull
-  public String getResourceName() {
-    return resourceName;
-  }
-
-  public DependencyTree setResourceName(@Nullable String resourceName) {
-    this.resourceName = resourceName;
-    return this;
-  }
-  @CheckForNull
-  public String getUsage() {
-    return usage;
-  }
-
-  public DependencyTree setUsage(@Nullable String usage) {
-    this.usage = usage;
-    return this;
-  }
-  @CheckForNull
-  public String getResourceScope() {
-    return resourceScope;
-  }
-
-  public DependencyTree setResourceScope(@Nullable String resourceScope) {
-    this.resourceScope = resourceScope;
-    return this;
-  }
-  @CheckForNull
-  public String getResourceQualifier() {
-    return resourceQualifier;
-  }
-
-  public DependencyTree setResourceQualifier(@Nullable String resourceQualifier) {
-    this.resourceQualifier = resourceQualifier;
-    return this;
-  }
-  @CheckForNull
-  public String getResourceVersion() {
-    return resourceVersion;
-  }
-
-  public DependencyTree setResourceVersion(@Nullable String resourceVersion) {
-    this.resourceVersion = resourceVersion;
-    return this;
-  }
-
-  @CheckForNull
-  public Integer getWeight() {
-    return weight;
-  }
-
-  public DependencyTree setWeight(@Nullable Integer weight) {
-    this.weight = weight;
-    return this;
-  }
-
-  public List<DependencyTree> getTo() {
-    return to;
-  }
-
-  public DependencyTree setTo(List<DependencyTree> to) {
-    this.to = to;
-    return this;
-  }
-}
diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyTreeQuery.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/services/DependencyTreeQuery.java
deleted file mode 100644 (file)
index 2521a24..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.wsclient.services;
-
-/**
- * @since 2.1
- */
-public class DependencyTreeQuery extends Query<DependencyTree> {
-  private static final String BASE_URL = "/api/dependency_tree";
-
-  private String resourceId;
-  private String[] scopes;
-
-  public DependencyTreeQuery(String resourceId) {
-    this.resourceId = resourceId;
-  }
-
-  public String getResourceId() {
-    return resourceId;
-  }
-
-  public String[] getScopes() {
-    return scopes;
-  }
-
-  public DependencyTreeQuery setResourceId(String resourceId) {
-    this.resourceId = resourceId;
-    return this;
-  }
-
-  public DependencyTreeQuery setScopes(String... scopes) {
-    this.scopes = scopes;
-    return this;
-  }
-
-  @Override
-  public String getUrl() {
-    StringBuilder url = new StringBuilder(BASE_URL);
-    url.append('?');
-    appendUrlParameter(url, "resource", resourceId);
-    appendUrlParameter(url, "scopes", scopes);
-    return url.toString();
-  }
-
-  @Override
-  public Class<DependencyTree> getModelClass() {
-    return DependencyTree.class;
-  }
-
-  public static DependencyTreeQuery createForResource(String resourceIdOrKey) {
-    return new DependencyTreeQuery(resourceIdOrKey);
-  }
-
-  public static DependencyTreeQuery createForProject(String projectIdOrKey) {
-    return new DependencyTreeQuery(projectIdOrKey).setScopes(Resource.SCOPE_SET);
-  }
-}
diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/DependencyTreeUnmarshaller.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/DependencyTreeUnmarshaller.java
deleted file mode 100644 (file)
index 044a9d0..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.wsclient.unmarshallers;
-
-import org.sonar.wsclient.services.DependencyTree;
-import org.sonar.wsclient.services.WSUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class DependencyTreeUnmarshaller extends AbstractUnmarshaller<DependencyTree> {
-  @Override
-  protected DependencyTree parse(Object json) {
-    WSUtils utils = WSUtils.getINSTANCE();
-    DependencyTree tree = new DependencyTree()
-        .setDepId(utils.getString(json, "did"))
-        .setResourceId(utils.getString(json, "rid"))
-        .setResourceKey(utils.getString(json, "k"))
-        .setResourceName(utils.getString(json, "n"))
-        .setResourceScope(utils.getString(json, "s"))
-        .setResourceQualifier(utils.getString(json, "q"))
-        .setResourceVersion(utils.getString(json, "v"))
-        .setUsage(utils.getString(json, "u"))
-        .setWeight(utils.getInteger(json, "w"));
-
-    List<DependencyTree> to = new ArrayList<DependencyTree>();
-    tree.setTo(to);
-
-    Object toJson = utils.getField(json, "to");
-    if (toJson != null) {
-      for (int i = 0; i < utils.getArraySize(toJson); i++) {
-        to.add(parse(utils.getArrayElement(toJson, i)));
-      }
-    }
-    return tree;
-  }
-}
diff --git a/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/DependencyUnmarshaller.java b/server/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/DependencyUnmarshaller.java
deleted file mode 100644 (file)
index 3f50088..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.wsclient.unmarshallers;
-
-import org.sonar.wsclient.services.Dependency;
-import org.sonar.wsclient.services.WSUtils;
-
-public class DependencyUnmarshaller extends AbstractUnmarshaller<Dependency> {
-
-  @Override
-  protected Dependency parse(Object json) {
-    WSUtils utils = WSUtils.getINSTANCE();
-    return new Dependency()
-        .setId(utils.getString(json, "id"))
-        .setFromId(utils.getLong(json, "fi"))
-        .setToId(utils.getLong(json, "ti"))
-        .setFromKey(utils.getString(json, "fk"))
-        .setToKey(utils.getString(json, "tk"))
-        .setUsage(utils.getString(json, "u"))
-        .setWeight(utils.getInteger(json, "w"))
-        .setFromName(utils.getString(json, "fn"))
-        .setFromQualifier(utils.getString(json, "fq"))
-        .setToName(utils.getString(json, "tn"))
-        .setToQualifier(utils.getString(json, "tq"));
-  }
-}
index 654e72fbb983d7e2701fb1fdd64c68521f7fc720..52d6759ba074f7a5df22956d87c631c7492428d0 100644 (file)
  */
 package org.sonar.wsclient.unmarshallers;
 
-import org.sonar.wsclient.services.*;
+import org.sonar.wsclient.services.Authentication;
+import org.sonar.wsclient.services.Event;
+import org.sonar.wsclient.services.Favourite;
+import org.sonar.wsclient.services.ManualMeasure;
+import org.sonar.wsclient.services.Metric;
+import org.sonar.wsclient.services.Model;
+import org.sonar.wsclient.services.Plugin;
+import org.sonar.wsclient.services.Profile;
+import org.sonar.wsclient.services.Property;
+import org.sonar.wsclient.services.Resource;
+import org.sonar.wsclient.services.ResourceSearchResult;
+import org.sonar.wsclient.services.Server;
+import org.sonar.wsclient.services.ServerSetup;
+import org.sonar.wsclient.services.Source;
+import org.sonar.wsclient.services.TimeMachine;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -31,15 +45,13 @@ public final class Unmarshallers {
   private static volatile Map<Class, Unmarshaller> unmarshallers;
 
   static {
-    unmarshallers = new HashMap<Class, Unmarshaller>();
+    unmarshallers = new HashMap<>();
     unmarshallers.put(Metric.class, new MetricUnmarshaller());
-    unmarshallers.put(Dependency.class, new DependencyUnmarshaller());
     unmarshallers.put(Resource.class, new ResourceUnmarshaller());
     unmarshallers.put(Property.class, new PropertyUnmarshaller());
     unmarshallers.put(Source.class, new SourceUnmarshaller());
     unmarshallers.put(Server.class, new ServerUnmarshaller());
     unmarshallers.put(ServerSetup.class, new ServerSetupUnmarshaller());
-    unmarshallers.put(DependencyTree.class, new DependencyTreeUnmarshaller());
     unmarshallers.put(Event.class, new EventUnmarshaller());
     unmarshallers.put(Favourite.class, new FavouriteUnmarshaller());
     unmarshallers.put(Plugin.class, new PluginUnmarshaller());
diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/services/DependencyQueryTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/services/DependencyQueryTest.java
deleted file mode 100644 (file)
index 92617f8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.wsclient.services;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.core.IsNull.nullValue;
-import static org.junit.Assert.assertThat;
-
-import org.junit.Test;
-
-public class DependencyQueryTest extends QueryTestCase {
-
-  @Test
-  public void createAllDependencies() {
-    DependencyQuery query = DependencyQuery.createForResource("12");
-    assertThat(query.getUrl(), is("/api/dependencies?resource=12&"));
-    assertThat(query.getResourceIdOrKey(), is("12"));
-    assertThat(query.getDirection(), nullValue());
-  }
-
-  @Test
-  public void incomingDependencies() {
-    DependencyQuery query = DependencyQuery.createForIncomingDependencies("12");
-    assertThat(query.getUrl(), is("/api/dependencies?resource=12&dir=" + DependencyQuery.INCOMING_DIRECTION + "&"));
-    assertThat(query.getResourceIdOrKey(), is("12"));
-    assertThat(query.getDirection(), is(DependencyQuery.INCOMING_DIRECTION));
-  }
-
-  @Test
-  public void outgoingDependencies() {
-    DependencyQuery query = DependencyQuery.createForOutgoingDependencies("12");
-    assertThat(query.getUrl(), is("/api/dependencies?resource=12&dir=" + DependencyQuery.OUTGOING_DIRECTION + "&"));
-    assertThat(query.getResourceIdOrKey(), is("12"));
-    assertThat(query.getDirection(), is(DependencyQuery.OUTGOING_DIRECTION));
-  }
-}
diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/DependencyTreeUnmarshallerTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/DependencyTreeUnmarshallerTest.java
deleted file mode 100644 (file)
index 10cff27..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.wsclient.unmarshallers;
-
-import org.junit.Test;
-import org.sonar.wsclient.services.DependencyTree;
-
-import java.util.List;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-public class DependencyTreeUnmarshallerTest extends UnmarshallerTestCase {
-  @Test
-  public void singleDepthOfDependencies() {
-    List<DependencyTree> trees = new DependencyTreeUnmarshaller().toModels("[]");
-    assertThat(trees.size(), is(0));
-
-    trees = new DependencyTreeUnmarshaller().toModels(loadFile("/dependency_tree/single_depth.json"));
-    assertThat(trees.size(), is(2));
-    assertThat(trees.get(0).getDepId(), is("12345"));
-    assertThat(trees.get(0).getResourceId(), is("2000"));
-    assertThat(trees.get(0).getResourceName(), is("Commons Lang"));
-    assertThat(trees.get(0).getResourceVersion(), is("1.4"));
-    assertThat(trees.get(0).getResourceScope(), is("PRJ"));
-    assertThat(trees.get(0).getResourceQualifier(), is("LIB"));
-    assertThat(trees.get(0).getUsage(), is("compile"));
-    assertThat(trees.get(0).getWeight(), is(1));
-    assertThat(trees.get(0).getTo().size(), is(0));
-  }
-
-  @Test
-  public void manyDepthsOfDependencies() {
-    List<DependencyTree> trees = new DependencyTreeUnmarshaller().toModels(loadFile("/dependency_tree/many_depths.json"));
-    assertThat(trees.size(), is(1));
-    List<DependencyTree> secondLevelTrees = trees.get(0).getTo();
-    assertThat(secondLevelTrees.size(), is(2));
-
-    assertThat(secondLevelTrees.get(0).getDepId(), is("12346"));
-    assertThat(secondLevelTrees.get(0).getResourceName(), is("SLF4J"));
-
-    assertThat(secondLevelTrees.get(1).getDepId(), is("12347"));
-    assertThat(secondLevelTrees.get(1).getResourceName(), is("Commons Lang"));
-  }
-
-}
diff --git a/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/DependencyUnmarshallerTest.java b/server/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/DependencyUnmarshallerTest.java
deleted file mode 100644 (file)
index 5f0482b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube 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.
- *
- * SonarQube 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.wsclient.unmarshallers;
-
-import org.junit.Test;
-import org.sonar.wsclient.services.Dependency;
-
-import java.util.Collection;
-
-import static org.hamcrest.Matchers.nullValue;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-public class DependencyUnmarshallerTest extends UnmarshallerTestCase {
-
-  @Test
-  public void toModel() {
-    Dependency dependency = new DependencyUnmarshaller().toModel("[]");
-    assertThat(dependency, nullValue());
-
-    dependency = new DependencyUnmarshaller().toModel(loadFile("/dependencies/single.json"));
-    assertThat(dependency.getId(), is("1649"));
-    assertThat(dependency.getFromId(), is(33L));
-    assertThat(dependency.getFromKey(), is("org.apache.shiro:shiro-core:org.apache.shiro.authc.pam"));
-    assertThat(dependency.getToId(), is(45L));
-    assertThat(dependency.getToKey(), is("org.apache.shiro:shiro-core:org.apache.shiro.realm"));
-    assertThat(dependency.getUsage(), is("USES"));
-    assertThat(dependency.getWeight(), is(5));
-    assertThat(dependency.getFromName(), is("pam"));
-    assertThat(dependency.getToName(), is("realm"));
-    assertThat(dependency.getFromQualifier(), is("PAC"));
-    assertThat(dependency.getToQualifier(), is("PAC"));
-  }
-
-  @Test
-  public void toModels() {
-    Collection<Dependency> dependencies = new DependencyUnmarshaller().toModels("[]");
-    assertThat(dependencies.size(), is(0));
-
-    dependencies = new DependencyUnmarshaller().toModels(loadFile("/dependencies/many.json"));
-    assertThat(dependencies.size(), is(15));
-  }
-
-}