Skip to content

Commit

Permalink
Adjust tests to new plugin version
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasz-strzelecki-vml committed Oct 21, 2024
1 parent aa4d517 commit 6f1c482
Show file tree
Hide file tree
Showing 103 changed files with 934 additions and 803 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node/
sonar-example-plugin.iml
.java-version
local-docker-image/extensions/plugins/*
*.iml

# Eclipse
.classpath
Expand Down
121 changes: 112 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

<properties>
<htl.version>1.1.2-1.4.0</htl.version>
<sonar.html.version>3.0.1.1444</sonar.html.version>
<sonar.html.version>3.3.0.2534</sonar.html.version>
<sonar.java.plugin>8.5.0.37199</sonar.java.plugin>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.apiVersion>10.11.0.2468</sonar.apiVersion>
Expand Down Expand Up @@ -136,7 +136,6 @@
<version>${sonar.apiVersion}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.sonarsource.html</groupId>
<artifactId>sonar-html-plugin</artifactId>
Expand All @@ -148,7 +147,6 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.sonarsource.sslr-squid-bridge</groupId>
<artifactId>sslr-squid-bridge</artifactId>
Expand Down Expand Up @@ -176,7 +174,6 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.sonarsource.java</groupId>
<artifactId>sonar-java-plugin</artifactId>
Expand All @@ -189,9 +186,7 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<!-- packaged with the plugin -->
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.17.0</version>
Expand All @@ -201,20 +196,18 @@
<artifactId>commons-io</artifactId>
<version>2.17.0</version>
</dependency>

<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>26.0.1</version>
</dependency>

<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.scripting.sightly.compiler</artifactId>
<version>${htl.version}</version>
</dependency>


<!-- TODO: Check if versions are valid with target AEM version-->
<!-- unit tests -->
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
Expand All @@ -228,6 +221,24 @@
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.26.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
Expand All @@ -240,6 +251,98 @@
<version>32.0.0-jre</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api-impl</artifactId>
<version>10.6.0.92116</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.java</groupId>
<artifactId>java-checks-testkit</artifactId>
<version>8.4.0.37032</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.analyzer-commons</groupId>
<artifactId>sonar-analyzer-commons</artifactId>
<version>2.14.0.3087</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>aem-api</artifactId>
<version>6.0.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
<version>2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
<version>1.12.0</version>
<scope>test</scope>
</dependency>
<!-- TODO: Update dependecy with new version-->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.servlets.resolver</artifactId>
<version>2.3.2</version>
<scope>test</scope>
</dependency>
<!-- TODO: Update dependecy with new version-->
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.models.api</artifactId>
<version>1.3.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.query</artifactId>
<version>4.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>6.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>5.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component.annotations</artifactId>
<version>1.5.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* #%L
* AEM Rules for SonarQube
* %%
* Copyright (C) 2015-2019 Wunderman Thompson Technology
* Copyright (C) 2015-2024 VML
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,12 +17,10 @@
* limitations under the License.
* #L%
*/
package com.cognifide.aemrules.java.checks.slingquery;
package com.vml.aemrules.java.checks.slingquery;

import com.cognifide.aemrules.tag.Tags;
import com.cognifide.aemrules.version.AemVersion;
import java.util.HashMap;
import java.util.Map;
import com.vml.aemrules.tag.Tags;
import com.vml.aemrules.version.AemVersion;
import org.sonar.check.Priority;
import org.sonar.check.Rule;
import org.sonar.plugins.java.api.JavaFileScanner;
Expand All @@ -34,14 +32,17 @@
import org.sonar.plugins.java.api.tree.Tree;
import org.sonar.plugins.java.api.tree.VariableTree;

import java.util.HashMap;
import java.util.Map;

@Rule(
key = SlingQueryImplicitStrategyCheck.RULE_KEY,
name = SlingQueryImplicitStrategyCheck.RULE_MESSAGE,
priority = Priority.MINOR,
tags = Tags.AEM
key = SlingQueryImplicitStrategyCheck.RULE_KEY,
name = SlingQueryImplicitStrategyCheck.RULE_MESSAGE,
priority = Priority.MINOR,
tags = Tags.AEM
)
@AemVersion(
all = true
all = true
)
public class SlingQueryImplicitStrategyCheck extends BaseTreeVisitor implements JavaFileScanner {

Expand All @@ -58,11 +59,8 @@ public class SlingQueryImplicitStrategyCheck extends BaseTreeVisitor implements
private static final String SLING_QUERY = "SlingQuery";

private static final String DOLLAR_SIGN = "$";

private final Map<String, SlingQueryStates> slingQueries = new HashMap<>();
private String currentSlingQueryVariableName = null;

private Map<String, SlingQueryStates> slingQueries = new HashMap<>();

private boolean findMethodUsed = false;

private boolean searchStrategyMethodUsed = false;
Expand Down Expand Up @@ -173,4 +171,4 @@ private enum SlingQueryStates {
STRATEGY_USED,
ISSUE_RETURNED
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/vml/aemrules/rules/RulesLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package com.vml.aemrules.rules;

import com.vml.aemrules.metadata.Metadata;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.Nullable;
Expand Down
Loading

0 comments on commit 6f1c482

Please sign in to comment.