You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2023/04/11 08:36:59 UTC
[shardingsphere] branch master updated: Add sonar plugin (#25105)
This is an automated email from the ASF dual-hosted git repository.
panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new de7273ca926 Add sonar plugin (#25105)
de7273ca926 is described below
commit de7273ca926684a4340cec74a32711bcd46eb114
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Tue Apr 11 16:36:51 2023 +0800
Add sonar plugin (#25105)
---
.../shadow/yaml/ShadowRuleConfigurationYamlIT.java | 16 ++++++++--------
pom.xml | 10 ++++++++++
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/yaml/ShadowRuleConfigurationYamlIT.java b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/yaml/ShadowRuleConfigurationYamlIT.java
index bcf7b50e98c..60006b52572 100644
--- a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/yaml/ShadowRuleConfigurationYamlIT.java
+++ b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/yaml/ShadowRuleConfigurationYamlIT.java
@@ -51,32 +51,32 @@ class ShadowRuleConfigurationYamlIT extends YamlRuleConfigurationIT {
assertUserIdSelectMatchAlgorithm(shadowRuleConfiguration.get());
assertSqlHintAlgorithm(shadowRuleConfiguration.get());
}
-
+
private void assertDataSourceMap(final YamlRootConfiguration actual) {
assertThat(actual.getDataSources().size(), is(2));
assertTrue(actual.getDataSources().containsKey("ds"));
assertTrue(actual.getDataSources().containsKey("shadow_ds"));
}
-
+
private void assertTOrder(final YamlShadowRuleConfiguration actual) {
assertThat(actual.getTables().get("t_order").getDataSourceNames().iterator().next(), is("shadowDataSource"));
assertThat(actual.getTables().get("t_order").getShadowAlgorithmNames().size(), is(2));
assertTrue(actual.getTables().get("t_order").getShadowAlgorithmNames().containsAll(Arrays.asList("user-id-insert-match-algorithm", "user-id-select-match-algorithm")));
}
-
+
private void assertTOrderItem(final YamlShadowRuleConfiguration actual) {
assertThat(actual.getTables().get("t_order_item").getDataSourceNames().iterator().next(), is("shadowDataSource"));
assertThat(actual.getTables().get("t_order_item").getShadowAlgorithmNames().size(), is(3));
assertTrue(actual.getTables().get("t_order_item").getShadowAlgorithmNames().containsAll(
Arrays.asList("user-id-insert-match-algorithm", "user-id-update-match-algorithm", "user-id-select-match-algorithm")));
}
-
+
private void assertTAddress(final YamlShadowRuleConfiguration actual) {
assertThat(actual.getTables().get("t_address").getDataSourceNames().iterator().next(), is("shadowDataSource"));
assertThat(actual.getTables().get("t_address").getShadowAlgorithmNames().size(), is(3));
assertTrue(actual.getTables().get("t_address").getShadowAlgorithmNames().containsAll(Arrays.asList("user-id-insert-match-algorithm", "user-id-select-match-algorithm", "sql-hint-algorithm")));
}
-
+
private void assertUserIdInsertMatchAlgorithm(final YamlShadowRuleConfiguration actual) {
assertThat(actual.getShadowAlgorithms().get("user-id-insert-match-algorithm").getType(), is("REGEX_MATCH"));
Properties props = actual.getShadowAlgorithms().get("user-id-insert-match-algorithm").getProps();
@@ -88,7 +88,7 @@ class ShadowRuleConfigurationYamlIT extends YamlRuleConfigurationIT {
assertTrue(props.containsKey("regex"));
assertThat(props.getProperty("regex"), is("[1]"));
}
-
+
private void assertUserIdUpdateMatchAlgorithm(final YamlShadowRuleConfiguration actual) {
assertThat(actual.getShadowAlgorithms().get("user-id-update-match-algorithm").getType(), is("REGEX_MATCH"));
Properties props = actual.getShadowAlgorithms().get("user-id-update-match-algorithm").getProps();
@@ -100,7 +100,7 @@ class ShadowRuleConfigurationYamlIT extends YamlRuleConfigurationIT {
assertTrue(props.containsKey("regex"));
assertThat(props.getProperty("regex"), is("[1]"));
}
-
+
private void assertUserIdSelectMatchAlgorithm(final YamlShadowRuleConfiguration actual) {
assertThat(actual.getShadowAlgorithms().get("user-id-select-match-algorithm").getType(), is("REGEX_MATCH"));
Properties props = actual.getShadowAlgorithms().get("user-id-select-match-algorithm").getProps();
@@ -112,7 +112,7 @@ class ShadowRuleConfigurationYamlIT extends YamlRuleConfigurationIT {
assertTrue(props.containsKey("regex"));
assertThat(props.getProperty("regex"), is("[1]"));
}
-
+
private void assertSqlHintAlgorithm(final YamlShadowRuleConfiguration actual) {
assertThat(actual.getShadowAlgorithms().get("sql-hint-algorithm").getType(), is("SQL_HINT"));
Properties props = actual.getShadowAlgorithms().get("sql-hint-algorithm").getProps();
diff --git a/pom.xml b/pom.xml
index a2dd1a24ec9..7325e249d68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,10 @@
<shade.package>org.apache.shardingsphere.shade</shade.package>
<antlr.output.directory>${basedir}/target/generated-sources/antlr4</antlr.output.directory>
+ <sonar.organization>apache</sonar.organization>
+ <sonar.host.url>https://sonarcloud.io</sonar.host.url>
+ <sonar.exclusions>**/autogen/**/*</sonar.exclusions>
+
<!-- 3rd party library versions -->
<guava.version>30.0-jre</guava.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
@@ -149,6 +153,7 @@
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
<cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
+ <sonar-maven-plugin.version>3.9.1.2184</sonar-maven-plugin.version>
<!-- Report plugin versions -->
<maven-site-plugin.version>4.0.0-M6</maven-site-plugin.version>
@@ -988,6 +993,11 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.sonarsource.scanner.maven</groupId>
+ <artifactId>sonar-maven-plugin</artifactId>
+ <version>${sonar-maven-plugin.version}</version>
+ </plugin>
<!-- Report plugins -->
<plugin>