Skip to content

Commit

Permalink
Merge branch 'hotfix/2.19.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
gquerret committed Jan 10, 2023
2 parents dbf15f2 + 5b4642d commit 6cffea3
Show file tree
Hide file tree
Showing 30 changed files with 144,269 additions and 71 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.19.0</version>
<version>2.19.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.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.sonar.openedge</groupId>
<artifactId>sonar-openedge-plugin</artifactId>
<version>2.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>database-parser</artifactId>
<version>2.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.checks</groupId>
<artifactId>openedge-checks</artifactId>
<version>2.19.0</version>
<version>2.19.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.19.0</version>
<version>2.19.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.19.0</version>
<version>2.19.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.19.0</version>
<version>2.19.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.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>proparse</artifactId>
<version>2.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
Expand Down
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.19.0</version>
<version>2.19.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.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>listing-parser</artifactId>
<version>2.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>eu.rssw.openedge.parsers</groupId>
<artifactId>profiler-parser</artifactId>
<version>2.19.0</version>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private void handleStatement(InputFile file, JPNode node) {
return;
List<JPNode> ch = node.getDirectChildren();
// Unlikely, but early exit just to be sure
if (ch.size() < 1)
if (ch.isEmpty())
return;

// Last child should be PERIOD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,22 @@
import static org.testng.Assert.assertTrue;

import java.io.File;
import java.nio.file.Path;

import org.prorefactor.proparse.classdoc.ClassDocumentation;
import org.prorefactor.proparse.classdoc.ClassDocumentation.DeprecatedInfo;
import org.prorefactor.proparse.support.IProparseEnvironment;
import org.sonar.api.batch.fs.FilePredicates;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultFilePredicates;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.plugins.openedge.OpenEdgePluginTest;
import org.sonar.plugins.openedge.api.Constants;
import org.sonar.plugins.openedge.foundation.OpenEdgeSettings;
import org.sonar.plugins.openedge.utils.TestProjectSensorContext;
import org.sonar.plugins.openedge.utils.TestProjectSensorContextExtra;
import org.sonar.plugins.openedge.utils.TestProjectSensorRtbContext;
import org.testng.annotations.Test;

import eu.rssw.pct.elements.ITypeInfo;
Expand Down Expand Up @@ -72,6 +77,22 @@ public void testTwoSessions() throws Exception {
assertNull(sess2.getSchema().lookupTable("customer"));
}

@Test
public void testRtbCompatibility() throws Exception {
SensorContextTester context = TestProjectSensorRtbContext.createContext();

OpenEdgeSettings oeSettings = new OpenEdgeSettings(context.config(), context.fileSystem(),
OpenEdgePluginTest.SONARQUBE_RUNTIME);
oeSettings.init();
FilePredicates preds = new DefaultFilePredicates(Path.of(TestProjectSensorRtbContext.BASEDIR));
InputFile input1 = context.fileSystem().inputFile(preds.hasFilename("test1.p"));
assertTrue(oeSettings.getListingFile(input1).exists());
assertTrue(oeSettings.getXrefFile(input1).exists());
InputFile input2 = context.fileSystem().inputFile(preds.hasFilename("testclass.cls"));
assertTrue(oeSettings.getListingFile(input2).exists());
assertNull(oeSettings.getXrefFile(input2));
}

@Test
public void testSonarDatabasesFromSonarQube01() throws Exception {
// No database schema, verify no DB table available
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* OpenEdge plugin for SonarQube
* Copyright (c) 2015-2023 Riverside Software
* contact AT riverside DASH software DOT fr
*
* This program 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.
*
* This program 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 02
*/
package org.sonar.plugins.openedge.utils;

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;

import org.sonar.api.batch.fs.InputFile.Type;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.plugins.openedge.api.Constants;

import com.google.common.io.Files;

public class TestProjectSensorRtbContext {
public final static String BASEDIR = "target/test-classes/project2";
public final static String DF1 = "src/schema/sp2k.df";
public final static String FILE1 = "src/procedures/test1.p";
public final static String FILE5 = "src/procedures/invalid.p";
public final static String CLASS1 = "src/classes/rssw/testclass.cls";

private TestProjectSensorRtbContext() {
// No-op
}

public static SensorContextTester createContext() throws IOException {
return createContext(new MapSettings());
}

public static SensorContextTester createContext(MapSettings settings) throws IOException {
settings.setProperty("sonar.sources", "src");
settings.setProperty(Constants.PROPATH, new File(BASEDIR).getAbsolutePath());
settings.setProperty(Constants.BINARIES, "build");
settings.setProperty(Constants.DATABASES, "src/schema/sp2k.df");
settings.setProperty(Constants.SKIP_RCODE, true);
settings.setProperty(Constants.PROPARSE_ERROR_STACKTRACE, false);
settings.setProperty(Constants.RTB_COMPATIBILITY, true);

SensorContextTester context = SensorContextTester.create(new File(BASEDIR));
context.setSettings(settings);

context.fileSystem().add(TestInputFileBuilder.create(BASEDIR, DF1) //
.setLanguage(Constants.DB_LANGUAGE_KEY) //
.setType(Type.MAIN) //
.setCharset(Charset.defaultCharset()) //
.setContents(Files.asCharSource(new File(BASEDIR, DF1), Charset.defaultCharset()).read()) //
.build());
context.fileSystem().add(TestInputFileBuilder.create(BASEDIR, FILE1) //
.setLanguage(Constants.LANGUAGE_KEY) //
.setType(Type.MAIN) //
.setCharset(Charset.defaultCharset()) //
.setContents(Files.asCharSource(new File(BASEDIR, FILE1), Charset.defaultCharset()).read()) //
.build());
context.fileSystem().add(TestInputFileBuilder.create(BASEDIR, FILE5) //
.setLanguage(Constants.LANGUAGE_KEY) //
.setType(Type.MAIN) //
.setCharset(Charset.defaultCharset()) //
.setContents(Files.asCharSource(new File(BASEDIR, FILE5), Charset.defaultCharset()).read()) //
.build());
context.fileSystem().add(TestInputFileBuilder.create(BASEDIR, CLASS1) //
.setLanguage(Constants.LANGUAGE_KEY) //
.setType(Type.MAIN) //
.setCharset(Charset.defaultCharset()) //
.setContents(Files.asCharSource(new File(BASEDIR, CLASS1), Charset.defaultCharset()).read()) //
.build());

return context;
}
}
Loading

0 comments on commit 6cffea3

Please sign in to comment.