Skip to content

Commit

Permalink
Merge hotfix branch into master
Browse files Browse the repository at this point in the history
  • Loading branch information
gquerret committed May 6, 2021
2 parents d93e065 + a943b7d commit 4839c8d
Show file tree
Hide file tree
Showing 24 changed files with 208 additions and 46 deletions.
16 changes: 8 additions & 8 deletions coverage-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>coverage-report</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>

<name>JaCoCo report</name>
<description>Fake module for code coverage report in SonarQube</description>
Expand All @@ -20,37 +20,37 @@
<dependency>
<groupId>eu.rssw.openedge.rcode</groupId>
<artifactId>rcode-reader</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.sonar.openedge</groupId>
<artifactId>sonar-openedge-plugin</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
</dependencies>

Expand Down
2 changes: 1 addition & 1 deletion database-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>

<name>OpenEdge database definition lexer and parser</name>
<description>OpenEdge dump files parser</description>
Expand Down
2 changes: 1 addition & 1 deletion listing-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>

<name>OpenEdge listing so-called parser</name>
<description>OpenEdge listing files parser</description>
Expand Down
6 changes: 3 additions & 3 deletions openedge-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>

<name>OpenEdge checks</name>
<description>OpenEdge checks</description>
Expand Down Expand Up @@ -55,12 +55,12 @@
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ public Builder setSalt(String salt) {
}

public Builder setProduct(SonarProduct product) {
this.product = product == null ? SonarProduct.SONARQUBE : product;
this.product = product;
return this;
}

public Builder setType(LicenseType type) {
this.type = type == null ? LicenseType.EVALUATION : type;
this.type = type;
return this;
}

Expand All @@ -213,11 +213,11 @@ public License build() {
license.customerName = customerName;
license.repositoryName = repositoryName;
license.salt = salt;
license.product = product;
license.type = type;
license.product = product == null ? SonarProduct.SONARQUBE : product;
license.type = type == null ? LicenseType.EVALUATION : type;
license.expirationDate = expirationDate;
license.lines = lines;
license.signature = signature;
license.signature = signature == null ? new byte[0] : signature;

return license;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.sonar.plugins.openedge.api;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.assertNotNull;

import java.io.IOException;

import org.sonar.api.SonarProduct;
import org.sonar.plugins.openedge.api.LicenseRegistration.License;
import org.sonar.plugins.openedge.api.LicenseRegistration.LicenseType;
import org.testng.annotations.Test;

public class LicenseTest {

@Test
public void testDefaultValues() throws IOException {
License lic1 = new License.Builder().setCustomerName("rssw").setPermanentId("123456").build();
assertNotNull(lic1.getSig());
assertEquals(lic1.getProduct(), SonarProduct.SONARQUBE);
assertEquals(lic1.getType(), LicenseType.EVALUATION);
assertEquals(lic1.getLines(), 0L);
assertEquals(lic1.getVersion(), 1);
}

@Test
public void testEquals() throws IOException {
License lic1 = new License.Builder().setCustomerName("rssw").setPermanentId("123456").build();
License lic2 = new License.Builder().setCustomerName("rssw").setPermanentId("123456").build();
License lic3 = new License.Builder().setCustomerName("rssw2").setPermanentId("123456").build();
assertEquals(lic1, lic1);
assertNotEquals(lic1, null);
assertEquals(lic1, lic2);
assertEquals(lic1.hashCode(), lic2.hashCode());
assertNotEquals(lic1, lic3);
assertNotEquals(lic1.hashCode(), lic3.hashCode());
}

@Test
public void testEqualsSignature() throws IOException {
// Signature is not part of equality
License lic1 = new License.Builder().setCustomerName("rssw").setPermanentId("123456").setSignature(
new byte[] {1, 2, 3}).build();
License lic2 = new License.Builder().setCustomerName("rssw").setPermanentId("123456").setSignature(
new byte[] {4, 5, 6}).build();
assertEquals(lic1, lic2);
assertEquals(lic1.hashCode(), lic2.hashCode());
}

}
8 changes: 4 additions & 4 deletions openedge-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.sonar.openedge</groupId>
<artifactId>sonar-openedge-plugin</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
<packaging>sonar-plugin</packaging>

<name>OpenEdge plugin for SonarQube</name>
Expand Down Expand Up @@ -60,17 +60,17 @@
<dependency>
<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
import static org.testng.Assert.assertEquals;

import java.io.IOException;
import java.util.Iterator;

import org.sonar.api.SonarProduct;
import org.sonar.plugins.openedge.OpenEdgePluginTest;
import org.sonar.plugins.openedge.api.CheckRegistration;
import org.sonar.plugins.openedge.api.LicenseRegistration;
import org.sonar.plugins.openedge.api.LicenseRegistration.License;
import org.testng.annotations.Test;

public class OpenEdgeComponentsTest {
Expand Down Expand Up @@ -106,60 +108,118 @@ public void testSLPlusSQLicenses() throws IOException {
assertEquals(components.getLicenses().size(), 3);
}

@Test
public void testOldLicenses() throws IOException {
OpenEdgeComponents components = new OpenEdgeComponents(OpenEdgePluginTest.SERVER, new CheckRegistration[] {},
new LicenseRegistration[] {OLD_SONARQUBE_REGISTRATION, OLD_SONARLINT_REGISTRATION});
assertEquals(components.getLicenses().size(), 2);
Iterator<License> iter = components.getLicenses().iterator();
License lic1 = iter.next();
License lic2 = iter.next();
assertEquals(lic1.getProduct(), SonarProduct.SONARQUBE);
assertEquals(lic1.getPermanentId(), "123456789-X1");
assertEquals(lic2.getProduct(), SonarProduct.SONARLINT);
assertEquals(lic2.getPermanentId(), "123456789-X2");
}

@Test
public void testNewLicenses() throws IOException {
OpenEdgeComponents components = new OpenEdgeComponents(OpenEdgePluginTest.SERVER, new CheckRegistration[] {},
new LicenseRegistration[] {LICENSE_NEW_TYPE});
assertEquals(components.getLicenses().size(), 1);
Iterator<License> iter = components.getLicenses().iterator();
License lic1 = iter.next();
assertEquals(lic1.getProduct(), SonarProduct.SONARLINT);
assertEquals(lic1.getPermanentId(), "987654321");
assertEquals(lic1.getLines(), 1000L);
}

private final static LicenseRegistration OLD_SONARQUBE_REGISTRATION = new LicenseRegistration() {
@SuppressWarnings("deprecation")
@Override
public void register(Registrar context) {
context.registerLicense("123456789-X1", "Me", "salt", "rssw-oe-main", LicenseRegistration.LicenseType.COMMERCIAL,
new byte[] {}, 1420074061000L);
}
};
private final static LicenseRegistration OLD_SONARLINT_REGISTRATION = new LicenseRegistration() {
@SuppressWarnings("deprecation")
@Override
public void register(Registrar context) {
context.registerLicense("sonarlint-123456789-X2", "Me", "salt", "rssw-oe-main",
LicenseRegistration.LicenseType.COMMERCIAL, new byte[] {}, 1420074061000L);
}
};
private final static LicenseRegistration LICENSE_ME_OE_2015 = new LicenseRegistration() {
@SuppressWarnings("deprecation")
@Override
public void register(Registrar context) {
context.registerLicense("123456789", SonarProduct.SONARQUBE, "Me", "salt", "rssw-oe-main",
LicenseRegistration.LicenseType.COMMERCIAL, new byte[] {}, 1420074061000L);
}
};
private final static LicenseRegistration LICENSE_YOU_OE_2015 = new LicenseRegistration() {
@SuppressWarnings("deprecation")
@Override
public void register(Registrar context) {
context.registerLicense("987654321", SonarProduct.SONARQUBE, "You", "salt", "rssw-oe-main",
LicenseRegistration.LicenseType.COMMERCIAL, new byte[] {}, 1420074061000L);
}
};
private final static LicenseRegistration LICENSE_YOU_OTHER_2015 = new LicenseRegistration() {
@SuppressWarnings("deprecation")
@Override
public void register(Registrar context) {
context.registerLicense("987654321", SonarProduct.SONARQUBE, "You", "salt", "other-repo",
LicenseRegistration.LicenseType.COMMERCIAL, new byte[] {}, 1420074061000L);
}
};
private final static LicenseRegistration LICENSE_ME_OE_2025 = new LicenseRegistration() {
@SuppressWarnings("deprecation")
@Override
public void register(Registrar context) {
context.registerLicense("123456789", SonarProduct.SONARQUBE, "Me", "salt", "rssw-oe-main",
LicenseRegistration.LicenseType.COMMERCIAL, new byte[] {}, 1735693261000L);
}
};
private final static LicenseRegistration LICENSE_YOU_OE_2025 = new LicenseRegistration() {
@SuppressWarnings("deprecation")
@Override
public void register(Registrar context) {
context.registerLicense("987654321", SonarProduct.SONARQUBE, "You", "salt", "rssw-oe-main",
LicenseRegistration.LicenseType.COMMERCIAL, new byte[] {}, 1735693261000L);
}
};
private final static LicenseRegistration LICENSE_ME_OE_2030 = new LicenseRegistration() {
@SuppressWarnings("deprecation")
@Override
public void register(Registrar context) {
context.registerLicense("123456789", SonarProduct.SONARQUBE, "Me", "salt", "rssw-oe-main",
LicenseRegistration.LicenseType.COMMERCIAL, new byte[] {}, 1893459661000L);
}
};
private final static LicenseRegistration LICENSE_SL_ME_OE_2025 = new LicenseRegistration() {
@SuppressWarnings("deprecation")
@Override
public void register(Registrar context) {
context.registerLicense("123456789", SonarProduct.SONARLINT, "Me", "salt", "rssw-oe-main",
LicenseRegistration.LicenseType.COMMERCIAL, new byte[] {}, 1735693261000L);
}
};
private final static LicenseRegistration LICENSE_SL_YOU_OE_2025 = new LicenseRegistration() {
@SuppressWarnings("deprecation")
@Override
public void register(Registrar context) {
context.registerLicense("987654321", SonarProduct.SONARLINT, "You", "salt", "rssw-oe-main",
LicenseRegistration.LicenseType.COMMERCIAL, new byte[] {}, 1735693261000L);
}
};
private final static LicenseRegistration LICENSE_NEW_TYPE = new LicenseRegistration() {
@Override
public void register(Registrar context) {
context.registerLicense(3, "987654321", SonarProduct.SONARLINT, "You", "salt", "rssw-oe-main",
LicenseRegistration.LicenseType.COMMERCIAL, new byte[] {}, 1735693261000L, 1000L);
}
};

}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>eu.rssw</groupId>
<artifactId>sonar-openedge</artifactId>
<packaging>pom</packaging>
<version>2.13.0</version>
<version>2.13.1</version>
<name>OpenEdge plugin for SonarQube</name>
<url>http://www.riverside-software.fr/</url>
<description>Open source code analysis for OpenEdge</description>
Expand Down
2 changes: 1 addition & 1 deletion profiler-parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>

<name>OpenEdge profiler output lexer and parser</name>
<description>OpenEdge profiler files parser</description>
Expand Down
4 changes: 2 additions & 2 deletions proparse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>

<name>Proparse</name>
<description>ABL code parser</description>
Expand Down Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>eu.rssw.openedge.rcode</groupId>
<artifactId>rcode-reader</artifactId>
<version>2.13.0</version>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1674,11 +1674,11 @@ definePropertyAccessor:
;

definePropertyAccessorGetBlock:
( PUBLIC | PROTECTED | PRIVATE )? GET ( functionParams? blockColon codeBlock END GET? )? PERIOD
( PUBLIC | PROTECTED | PRIVATE | PACKAGEPRIVATE | PACKAGEPROTECTED )? GET ( functionParams? blockColon codeBlock END GET? )? PERIOD
;

definePropertyAccessorSetBlock:
( PUBLIC | PROTECTED | PRIVATE )? SET ( functionParams? blockColon codeBlock END SET? )? PERIOD
( PUBLIC | PROTECTED | PRIVATE | PACKAGEPRIVATE | PACKAGEPROTECTED )? SET ( functionParams? blockColon codeBlock END SET? )? PERIOD
;

defineQueryStatement:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public void testPackagePrivate() {
ParseUnit unit = new ParseUnit(new File(SRC_DIR, "package.cls"), session);
unit.treeParser01();
assertFalse(unit.hasSyntaxError());
assertEquals(unit.getTopNode().queryStateHead(ABLNodeType.DEFINE).size(), 3);
assertEquals(unit.getTopNode().queryStateHead(ABLNodeType.DEFINE).size(), 4);
assertEquals(unit.getTopNode().queryStateHead(ABLNodeType.METHOD).size(), 2);
}

Expand Down
Loading

0 comments on commit 4839c8d

Please sign in to comment.