Skip to content

Commit

Permalink
Merge pull request #158 from utPLSQL/bugfix/issue-157-missing-line-br…
Browse files Browse the repository at this point in the history
…eak-after-suite

Bugfix/issue 157 missing line break after suite
  • Loading branch information
PhilippSalvisberg authored Jul 23, 2022
2 parents e2de011 + 196438f commit 84e3b9e
Show file tree
Hide file tree
Showing 8 changed files with 324 additions and 59 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,11 @@ Please file your bug reports, enhancement requests, questions and other support
3. [Create a branch](https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/), commit and publish your changes and enhancements
4. [Create a pull request](https://help.github.com/articles/creating-a-pull-request/)

## How to Build
## How to Build

1. [Download](http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html) and install SQL Developer 21.4.2
2. [Download](https://maven.apache.org/download.cgi) and install Apache Maven 3.8.3
1. [Download](http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html) and install SQL Developer 21.4.3
2. [Download](https://maven.apache.org/download.cgi) and install Apache Maven 3.8.6
3. [Download](https://git-scm.com/downloads) and install a git command line client
4. Clone the utPLSQL-SQLDeveloper repository
5. Open a terminal window in the utPLSQL-SQLDeveloper root folder and type
Expand All @@ -154,7 +155,7 @@ Please file your bug reports, enhancement requests, questions and other support

6. Run maven build by the following command

mvn -Dsqldev.basedir=/Applications/SQLDeveloper21.4.2.app/Contents/Resources/sqldeveloper -DskipTests=true clean package
mvn -Dsqldev.basedir=/Applications/SQLDeveloper21.4.3.app/Contents/Resources/sqldeveloper -DskipTests=true clean package

Amend the parameter sqldev.basedir to match the path of your SQL Developer installation. This folder is used to reference Oracle jar files which are not available in public Maven repositories
7. The resulting file ```utplsql_for_SQLDev_x.x.x-SNAPSHOT.zip``` in the ```target``` directory can be installed within SQL Developer
Expand Down
116 changes: 73 additions & 43 deletions sqldev/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
<packaging>bundle</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version>
<jdk.version.test>1.8</jdk.version.test>
<jdk.version>8</jdk.version>
<jdk.test.version>17</jdk.test.version>
<!-- requires SQL Developer 4.1.0 or higher (first version based on JDK 1.8) -->
<sqldev.basedir>/Applications/SQLDeveloper21.4.2.app/Contents/Resources/sqldeveloper</sqldev.basedir>
<!-- last version of SQL Developer that uses JDK 8 is 21.4.3 -->
<sqldev.basedir>/Applications/SQLDeveloper21.4.3.app/Contents/Resources/sqldeveloper</sqldev.basedir>
<final.name>utplsql_for_SQLDev_${project.version}</final.name>
<!-- arguments to by added by jacoco plugin for test runs with coverage -->
<!-- -noverify is required in some environments to avoid java.lang.VerifyError -->
Expand Down Expand Up @@ -206,19 +207,19 @@
<!-- used mainly to access the database via JdbcTemplate -->
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.3.16</version>
<version>5.3.22</version>
</dependency>
<dependency>
<!-- transitive reference, but IntelliJ wants to have it explicit (to avoid warnings) -->
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.3.20</version>
<version>5.3.22</version>
</dependency>
<dependency>
<!-- used for HtmlUtils.htmlEscape in RunnerPanel -->
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.16</version>
<version>5.3.22</version>
</dependency>
<dependency>
<!-- optional, for RunGenerator and TestGenerator -->
Expand All @@ -244,7 +245,6 @@
<!-- Build Settings -->
<build>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
Expand All @@ -253,36 +253,16 @@
</includes>
</resource>
</resources>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>3.10.0</version>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<!-- used by Maven build -->
<testSource>${jdk.version.test}</testSource>
<testTarget>${jdk.version.test}</testTarget>
<includes>
<include>**/*.java</include>
</includes>
</configuration>
<executions>
<!-- used by Eclipse when updating project -->
<execution>
<id>test-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<source>${jdk.version.test}</source>
<target>${jdk.version.test}</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -316,7 +296,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.0.0</version><!--$NO-MVN-MAN-VER$-->
<version>3.1.0</version><!--$NO-MVN-MAN-VER$-->
<executions>
<execution>
<phase>prepare-package</phase>
Expand All @@ -337,7 +317,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
<executions>
<execution>
<phase>initialize</phase>
Expand All @@ -357,7 +337,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.1.0</version>
<version>3.3.0</version>
<executions>
<execution>
<id>parse-version</id>
Expand Down Expand Up @@ -427,7 +407,7 @@
<!-- - Error:osgi: [org.utplsql.sqldev] Invalid value for Bundle-Version, ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion} does not match \d{1,9}(\.\d{1,9}(\.\d{1,9}(\.[-\w]+)?)?)? -->
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>4.2.1</version>
<version>5.1.7</version> <!-- Classes found in the wrong director warning with 5.1.7, TODO: find solution to remove it -->
<extensions>true</extensions>
<configuration>
<finalName>${project.name}</finalName>
Expand Down Expand Up @@ -497,7 +477,7 @@
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version><!--$NO-MVN-MAN-VER$-->
<version>3.4.1</version><!--$NO-MVN-MAN-VER$-->
<configuration>
<finalName>${final.name}</finalName>
<appendAssemblyId>false</appendAssemblyId>
Expand All @@ -519,7 +499,7 @@
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.9</version>
<version>1.11</version>
<executions>
<execution>
<id>calculate-checksums</id>
Expand All @@ -533,7 +513,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<version>0.8.8</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -645,4 +625,54 @@
<tag>master</tag>
<url>https://github.com/utPLSQL/utPLSQL-SQLDeveloper</url>
</scm>

<!-- Profiles as workaround for https://youtrack.jetbrains.com/issue/IDEA-85478 as described in -->
<!-- https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009767720-I-want-to-run-tests-with-different-java-version-than-my-source-java-version -->
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>3.10.1</version>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- different Java version for main and test -->
<!-- works with Maven builder from IDE or command line -->
<release>${jdk.version}</release>
<testRelease>${jdk.test.version}</testRelease>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>idea</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>idea.maven.embedder.version</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>3.10.1</version>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- IDEA requires same Java version for main and test -->
<!-- see https://youtrack.jetbrains.com/issue/IDEA-85478 -->
<release>${jdk.test.version}</release>
<testRelease>${jdk.test.version}</testRelease>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private void run() {
PreferenceModel preferences;
try {
preferences = PreferenceModel.getInstance(Preferences.getPreferences());
} catch (NoClassDefFoundError error) {
} catch (NoClassDefFoundError | ExceptionInInitializerError error) {
// not running in SQL Developer (in tests)
preferences = PreferenceModel.getInstance(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public String generateSpec() {
final String packageName = context.getTestPackagePrefix() + objectName + context.getTestPackageSuffix();
sb.append("create or replace package ");
sb.append(packageName);
sb.append(" is\n\n");
sb.append(" is\n");
if (context.isGenerateComments()) {
sb.append("\t-- generated by utPLSQL for SQL Developer on ");
sb.append("\n\t-- generated by utPLSQL for SQL Developer on ");
sb.append(today);
sb.append("\n\n");
}
Expand All @@ -53,8 +53,9 @@ public String generateSpec() {
if (!context.getSuitePath().isEmpty()) {
sb.append("\t--%suitepath(");
sb.append(context.getSuitePath());
sb.append(")\n\n");
sb.append(")\n");
}
sb.append("\n");
for (final String u : units) {
final String unit = u.toLowerCase();
if (context.getNumberOfTestsPerUnit() > 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,30 +77,30 @@ private CharSequence getCode() {
StringBuilder sb = new StringBuilder();
if (!debug) {
if (preferences.isResetPackage()) {
sb.append("EXECUTE dbms_session.reset_package;\n");
sb.append("execute dbms_session.reset_package;\n");
}
sb.append("SET SERVEROUTPUT ON SIZE UNLIMITED\n");
sb.append("set serveroutput on size unlimited\n");
if (preferences.isClearScreen()) {
sb.append("CLEAR SCREEN\n");
sb.append("clear screen\n");
}
if (pathList.size() == 1) {
sb.append("EXECUTE ut.run('");
sb.append("execute ut.run('");
sb.append(pathList.get(0));
sb.append("');\n");
} else {
// we want a horizontal dense output because we resize the worksheet to fit the command in common cases
sb.append("EXECUTE ut.run(ut_varchar2_list(");
sb.append("execute ut.run(ut_varchar2_list(");
sb.append(StringTools.getCSV(pathList, "").replace("\n", ""));
sb.append("));\n");
}
} else {
sb.append("BEGIN\n");
sb.append("begin\n");
sb.append(" ut.run(\n");
sb.append(" ut_varchar2_list(\n");
sb.append(StringTools.getCSV(pathList, 9));
sb.append(" )\n");
sb.append(" );\n");
sb.append("END;\n");
sb.append("end;\n");
}
return sb;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ private void syncDetailTab() {
private PreferenceModel getPreferenceModel() {
try {
return PreferenceModel.getInstance(Preferences.getPreferences());
} catch (NoClassDefFoundError e) {
} catch (NoClassDefFoundError | ExceptionInInitializerError e) {
// running outside of SQL Developer
return PreferenceModel.getInstance(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ public void setupDefaultPreferences() {
preferences = PreferenceModel.getInstance(null);
// the second call will call will succeed and use preferences from user.home
// this ensures that the test and the runner use the same preferences
preferences = PreferenceModel.getInstance(Preferences.getPreferences());
try {
preferences = PreferenceModel.getInstance(Preferences.getPreferences());
} catch (NoClassDefFoundError e2) {
// the second call also failed. no other option left (new behavior with Java17)
preferences = PreferenceModel.getInstance(null);
}
} finally {
// set defaults manually, since all tests are using the same preference store
preferences.setShowSuccessfulTests(true);
Expand Down
Loading

0 comments on commit 84e3b9e

Please sign in to comment.