Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/api-snapshot-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Test with utplsql-java-api snapshot

on:
workflow_dispatch:
inputs:
api_version:
description: 'utplsql-java-api snapshot version (e.g. 3.2.4-SNAPSHOT)'
required: true

repository_dispatch:
types: [utPLSQL-java-api-build]

defaults:
run:
shell: bash

jobs:
build:
name: Test with utplsql-java-api ${{ github.event.client_payload.api_version || inputs.api_version }}
runs-on: ubuntu-latest
env:
UTPLSQL_VERSION: develop
UTPLSQL_FILE: utPLSQL
DB_URL: "//localhost:1521/FREEPDB1"
DB_USER: APP
DB_PASS: APP

services:
oracle:
image: gvenzl/oracle-free:23-slim-faststart
env:
ORACLE_PASSWORD: oracle
DB_URL: "//localhost:1521/FREEPDB1"
DB_USER: APP
DB_PASS: pass
ports:
- 1521:1521
options: >-
--health-cmd healthcheck.sh
--health-interval 10s
--health-timeout 5s
--health-retries 10
--name oracle

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-java@v5
with:
distribution: 'adopt'
java-version: '17'

- name: Install utplsql
run: .github/scripts/install_utplsql.sh

- name: Install demo project
run: .github/scripts/install_demo_project.sh

- name: Build and Test
run: |
API_VERSION="${{ github.event.client_payload.api_version || inputs.api_version }}"
mvn verify appassembler:assemble -Dutplsql-java-api.version="$API_VERSION"

slack-workflow-status:
if: always()
name: Post Workflow Status To Slack
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Slack Workflow Notification
uses: Gamesight/slack-workflow-status@master
with:
repo_token: ${{secrets.GITHUB_TOKEN}}
slack_webhook_url: ${{secrets.SLACK_WEBHOOK_URL}}
name: 'Github Actions[bot]'
icon_url: 'https://octodex.github.com/images/mona-the-rivetertocat.png'
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Build and test

on:
push:
branches: [ develop ]

pull_request:
branches: [ develop ]
Expand Down Expand Up @@ -29,17 +30,17 @@ jobs:
strategy:
fail-fast: false
matrix:
utplsql_version: ["v3.1.14","develop"]
utplsql_version: ["v3.2.01","develop"]
utplsql_file: ["utPLSQL"]
jdk: ['8', '11', '17','21','25']
jdk: ['11', '17', '21', '25']
services:
oracle:
image: gvenzl/oracle-free:23-slim-faststart
env:
ORACLE_PASSWORD: oracle
DB_URL: "//localhost:1521/FREEPDB1"
DB_USER: APP
DB_PASS: APP
DB_PASS: pass
ports:
- 1521:1521
options: >-
Expand Down
119 changes: 61 additions & 58 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@

<groupId>org.utplsql</groupId>
<artifactId>cli</artifactId>
<version>3.1.10-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>

<name>utPLSQL CLI</name>
<description>CLI for running Unit Tests with utPLSQL v3+.</description>
<url>https://github.com/utPLSQL/utPLSQL-cli</url>

<properties>
<utplsql-java-api.version>3.2.3</utplsql-java-api.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<junit.jupiter.version>5.5.2</junit.jupiter.version>
<oracle.jdbc.version>21.9.0.0</oracle.jdbc.version>
<junit.jupiter.version>5.12.2</junit.jupiter.version>
<picocli.version>4.7.7</picocli.version>
<logback.version>1.5.18</logback.version>
<hamcrest.version>2.2</hamcrest.version>
<travisBuildNumber>local</travisBuildNumber>

<sonar.organization>utplsql</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>

<licenses>
Expand All @@ -26,26 +32,44 @@
</license>
</licenses>

<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/utPLSQL/utPLSQL-java-api/issues</url>
</issueManagement>

<developers>
<developer>
<name>Vinicius Avellar Moreira</name>
<organization>utPLSQL.org</organization>
<organizationUrl>https://utplsql.org</organizationUrl>
<email>amvinicius@gmail.com</email>
</developer>
<developer>
<name>Samuel Nitsche</name>
<organization>utPLSQL.org</organization>
<organizationUrl>https://utplsql.org</organizationUrl>
<email>derpesse@gmail.com</email>
</developer>
<developer>
<name>Jacek Gebal</name>
<organization>utPLSQL.org</organization>
<organizationUrl>https://utplsql.org</organizationUrl>
<email>jgebal@gmail.com</email>
</developer>
<developer>
<name>Simon Martinelli</name>
<organization>utPLSQL.org</organization>
<organizationUrl>https://utplsql.org</organizationUrl>
<email>simon@martineli.ch</email>
<url>https://martinelli.ch</url>
</developer>
</developers>

<dependencies>
<dependency>
<groupId>org.utplsql</groupId>
<artifactId>java-api</artifactId>
<version>3.1.9</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ucp</artifactId>
</exclusion>
<exclusion>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
</exclusion>
<exclusion>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>orai18n</artifactId>
</exclusion>
</exclusions>
<artifactId>utplsql-java-api</artifactId>
<version>${utplsql-java-api.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
Expand All @@ -55,32 +79,13 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.13</version>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.6.3</version>
<version>${picocli.version}</version>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>${oracle.jdbc.version}</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ucp</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle.database.nls</groupId>
<artifactId>orai18n</artifactId>
<version>${oracle.jdbc.version}</version>
<scope>compile</scope>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -91,17 +96,22 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.1</version>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.10</version>
<version>2.1.0</version>
<configuration>
<copyConfigurationDirectory>true</copyConfigurationDirectory>
<useWildcardClassPath>true</useWildcardClassPath>
Expand All @@ -119,7 +129,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<version>3.5.5</version>
<configuration>
<excludes>
<exclude>**/*IT.java</exclude>
Expand All @@ -129,7 +139,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<version>3.5.5</version>
<executions>
<execution>
<goals>
Expand All @@ -142,7 +152,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<version>3.8.0</version>
<configuration>
<finalName>utPLSQL-cli</finalName>
<appendAssemblyId>false</appendAssemblyId>
Expand All @@ -154,7 +164,7 @@
<plugin>
<groupId>net.nicoulaj.maven.plugins</groupId>
<artifactId>checksum-maven-plugin</artifactId>
<version>1.10</version>
<version>1.11</version>
<configuration>
<fileSets>
<fileSet>
Expand All @@ -172,7 +182,7 @@
<plugin>
<groupId>com.amashchenko.maven.plugin</groupId>
<artifactId>gitflow-maven-plugin</artifactId>
<version>1.18.0</version>
<version>1.21.0</version>
<configuration>
<verbose>true</verbose>
<gitFlowConfig>
Expand Down Expand Up @@ -201,16 +211,9 @@

<repositories>
<repository>
<id>utplsql-java-api</id>
<url>
https://packagecloud.io/utplsql/utplsql-java-api/maven2
</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>central-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/utplsql/cli/RunAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
} catch (DatabaseNotCompatibleException | UtPLSQLNotInstalledException | DatabaseConnectionFailed | ReporterTimeoutException e) {
System.out.println(e.getMessage());
returnCode = Cli.DEFAULT_ERROR_CODE;
} catch (Throwable e) {

Check warning on line 112 in src/main/java/org/utplsql/cli/RunAction.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Catch Exception instead of Throwable.

See more on https://sonarcloud.io/project/issues?id=utPLSQL_utPLSQL-cli&issues=AZ253k2CLbYehPOn8sXy&open=AZ253k2CLbYehPOn8sXy&pullRequest=228
e.printStackTrace();
returnCode = Cli.DEFAULT_ERROR_CODE;
}
Expand Down Expand Up @@ -192,8 +192,8 @@

compatibilityProxy = checkFrameworkCompatibility(conn);

logger.info("Successfully connected to database. UtPLSQL core: {}", compatibilityProxy.getVersionDescription());
logger.info("Oracle-Version: {}", new DefaultDatabaseInformation().getOracleVersion(conn));
logger.info("Connected to Oracle database: {}", new DefaultDatabaseInformation().getOracleVersion(conn));

Check warning on line 195 in src/main/java/org/utplsql/cli/RunAction.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Invoke method(s) only conditionally.

See more on https://sonarcloud.io/project/issues?id=utPLSQL_utPLSQL-cli&issues=AZ253k2CLbYehPOn8sXx&open=AZ253k2CLbYehPOn8sXx&pullRequest=228
logger.info("utPLSQL core: {}", compatibilityProxy.getVersionDescription());
} catch (SQLException e) {
if (e.getErrorCode() == 1017 || e.getErrorCode() == 12514) {
throw new DatabaseConnectionFailed(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ public LocalAssetsCoverageHTMLReporter(String selfType, Object[] attributes) {
public Reporter init(Connection con, CompatibilityProxy compatibilityProxy, ReporterFactory reporterFactory) throws SQLException {
super.init(con, compatibilityProxy, reporterFactory);

if (hasOutputToFile()) {
if (hasOutputToFile() && assetsAreBundled()) {
writeReportAssetsTo(getPhysicalAssetPath());
}

return this;
}

private static boolean assetsAreBundled() {
return CoverageHTMLReporter.class.getResource("/CoverageHTMLReporter") != null;
}

private String getNameOfOutputFile() {
Path outputPath = Paths.get(options.getOutputFileName());
return outputPath.getName(outputPath.getNameCount() - 1).toString();
Expand All @@ -51,7 +55,7 @@ private Path getPhysicalAssetPath() {
}

private void setAssetsPathFromOptions() {
if (hasOutputToFile()) {
if (hasOutputToFile() && assetsAreBundled()) {
setAssetsPath(getNameOfOutputFile() + "_assets/");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/utplsql/cli/CliVersionInfoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class CliVersionInfoTest {

@Test
void getCliVersionInfo() {
assertTrue(CliVersionInfo.getVersion().startsWith("3.1"));
assertTrue(CliVersionInfo.getVersion().startsWith("3.2"));
}
}
6 changes: 3 additions & 3 deletions src/test/java/org/utplsql/cli/TestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class TestHelper {
private static String sPass;

static {
sUrl = EnvironmentVariableUtil.getEnvValue("DB_URL", "192.168.99.100:1521:XE");
sUser = EnvironmentVariableUtil.getEnvValue("DB_USER", "app");
sPass = EnvironmentVariableUtil.getEnvValue("DB_PASS", "app");
sUrl = EnvironmentVariableUtil.getEnvValue("DB_URL", "//localhost:1521/FREEPDB1");
sUser = EnvironmentVariableUtil.getEnvValue("DB_USER", "APP");
sPass = EnvironmentVariableUtil.getEnvValue("DB_PASS", "pass");
}

static RunPicocliCommand createPicocliRunCommand(String... args ) {
Expand Down
Loading