aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidExecutor.java3
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java2
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSearchProxy.java57
-rw-r--r--plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSensor.java6
-rw-r--r--plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidExecutorTest.java9
-rw-r--r--plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidPluginTest.java2
-rw-r--r--plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidSearchProxyTest.java45
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/batch/SquidSearch.java52
8 files changed, 5 insertions, 171 deletions
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidExecutor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidExecutor.java
index a8b26ed1b2a..01494e6ea56 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidExecutor.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidExecutor.java
@@ -213,9 +213,8 @@ public final class SquidExecutor {
return bytecodeScanned;
}
- public void initSonarProxy(SquidSearchProxy proxy) {
+ void flush() {
squid.flush();
- proxy.setTarget(squid);
}
public Squid getSquid() {
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java
index 7196337aca9..075cfd34a5a 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidPlugin.java
@@ -59,7 +59,7 @@ public class SquidPlugin implements Plugin {
}
public List getExtensions() {
- return Arrays.asList(SquidSearchProxy.class, SquidSensor.class, SquidRuleRepository.class, JavaSourceImporter.class,
+ return Arrays.asList(SquidSensor.class, SquidRuleRepository.class, JavaSourceImporter.class,
ClassComplexityDistributionBuilder.class, FunctionComplexityDistributionBuilder.class, ClassesDecorator.class,
ChidamberKemererDistributionBuilder.class, FunctionsDecorator.class);
}
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSearchProxy.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSearchProxy.java
deleted file mode 100644
index 0dad86dd95a..00000000000
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSearchProxy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar 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.
- *
- * Sonar 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 Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.squid;
-
-import java.util.Collection;
-
-import org.sonar.api.BatchExtension;
-import org.sonar.api.batch.SquidSearch;
-import org.sonar.squid.Squid;
-import org.sonar.squid.api.Query;
-import org.sonar.squid.api.SourceCode;
-
-public class SquidSearchProxy implements SquidSearch, BatchExtension {
-
- private Squid target;
-
- public Squid getTarget() {
- return target;
- }
-
- public void setTarget(Squid target) {
- this.target = target;
- }
-
- public Collection<SourceCode> search(Query... query) {
- checkTarget();
- return target.search(query);
- }
-
- public SourceCode search(String key) {
- checkTarget();
- return target.search(key);
- }
-
- private void checkTarget() {
- if (target == null) {
- throw new IllegalStateException("Squid service is not initialized");
- }
- }
-}
diff --git a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSensor.java b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSensor.java
index 9024be2db3d..1e4da4853f3 100644
--- a/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSensor.java
+++ b/plugins/sonar-squid-java-plugin/src/main/java/org/sonar/plugins/squid/SquidSensor.java
@@ -41,14 +41,12 @@ import java.util.List;
@DependedUpon(value = JavaUtils.BARRIER_AFTER_SQUID, classes = NoSonarFilter.class)
public class SquidSensor implements Sensor {
- private SquidSearchProxy proxy;
private NoSonarFilter noSonarFilter;
private RulesProfile profile;
private ProjectClasspath projectClasspath;
private ResourceCreationLock lock;
- public SquidSensor(RulesProfile profile, SquidSearchProxy proxy, NoSonarFilter noSonarFilter, ProjectClasspath projectClasspath, ResourceCreationLock lock) {
- this.proxy = proxy;
+ public SquidSensor(RulesProfile profile, NoSonarFilter noSonarFilter, ProjectClasspath projectClasspath, ResourceCreationLock lock) {
this.noSonarFilter = noSonarFilter;
this.profile = profile;
this.projectClasspath = projectClasspath;
@@ -79,7 +77,7 @@ public class SquidSensor implements Sensor {
SquidExecutor squidExecutor = new SquidExecutor(analyzePropertyAccessors, fieldNamesToExcludeFromLcom4Computation, factory, charset);
squidExecutor.scan(getMainSourceFiles(project), getMainBytecodeFiles(project));
squidExecutor.save(project, context, noSonarFilter);
- squidExecutor.initSonarProxy(proxy);
+ squidExecutor.flush();
}
private void browseTestSources(Project project, SensorContext context) {
diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidExecutorTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidExecutorTest.java
index 0238de92434..dc0b363b0b5 100644
--- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidExecutorTest.java
+++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidExecutorTest.java
@@ -115,15 +115,6 @@ public class SquidExecutorTest {
assertTrue(SquidExecutor.hasBytecode(Arrays.asList(new File("test-resources/commons-collections-3.2.1/bin"))));
}
- @Test
- public void flushSquidAfterUsage() {
- Squid squid = mock(Squid.class);
- SquidExecutor executor = new SquidExecutor(squid);
- executor.initSonarProxy(new SquidSearchProxy());
-
- verify(squid).flush();
- }
-
private CheckFactory createCheckFactory() {
RulesProfile profile = RulesProfile.create();
CheckFactory checkFactory = AnnotationCheckFactory.create(profile, "repo", Collections.<Class> emptyList());
diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidPluginTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidPluginTest.java
index 0357049ac11..52db97389cf 100644
--- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidPluginTest.java
+++ b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidPluginTest.java
@@ -31,6 +31,6 @@ public class SquidPluginTest {
@Test
public void coverageForFun() {
assertThat(new SquidPlugin().getKey(), not(nullValue()));
- assertThat(new SquidPlugin().getExtensions().size(), is(9));
+ assertThat(new SquidPlugin().getExtensions().size(), is(8));
}
}
diff --git a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidSearchProxyTest.java b/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidSearchProxyTest.java
deleted file mode 100644
index 016bb315e6d..00000000000
--- a/plugins/sonar-squid-java-plugin/src/test/java/org/sonar/plugins/squid/SquidSearchProxyTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar 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.
- *
- * Sonar 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 Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.plugins.squid;
-
-import org.junit.Test;
-import org.sonar.squid.Squid;
-import org.sonar.squid.api.SourceFile;
-import org.sonar.squid.indexer.QueryByType;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
-public class SquidSearchProxyTest {
-
- @Test
- public void isProxy() {
- Squid squid = mock(Squid.class);
- SquidSearchProxy proxy = new SquidSearchProxy();
- proxy.setTarget(squid);
-
- proxy.search("foo");
- verify(squid).search("foo");
-
- QueryByType query = new QueryByType(SourceFile.class);
- proxy.search(query);
- verify(squid).search(query);
- }
-}
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/batch/SquidSearch.java b/sonar-deprecated/src/main/java/org/sonar/api/batch/SquidSearch.java
deleted file mode 100644
index 71c871818f1..00000000000
--- a/sonar-deprecated/src/main/java/org/sonar/api/batch/SquidSearch.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2011 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar 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.
- *
- * Sonar 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 Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
- */
-package org.sonar.api.batch;
-
-import java.util.Collection;
-
-import org.sonar.api.BatchExtension;
-import org.sonar.squid.api.Query;
-import org.sonar.squid.api.SourceCode;
-
-/**
- * The extension point to access the Squid data tree
- *
- * @since 1.11
- * @deprecated since 2.6. Data on classes/methods are now injected into sonar index. There's no need to use
- * this component anymore.
- */
-@Deprecated
-public interface SquidSearch extends BatchExtension {
- /**
- * Returns a list of SourceCode objects base a set of queries given
- *
- * @param query the set of query
- * @return SourceCode objects
- */
- Collection<SourceCode> search(Query... query);
-
- /**
- * Returns a SourceObject given its key
- *
- * @param key the key
- * @return SourceCode object
- */
- SourceCode search(String key);
-}