-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # README.md
- Loading branch information
Showing
17 changed files
with
365 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:18.4.0-slim | ||
docker run -d --name ora-utplsql -p 1521:1521 -e ORACLE_PASSWORD=oracle gvenzl/oracle-xe:21-slim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...ven/plugin/UtPlsqlMojoIT/exclude_object/expected-output/utplsql/coverage-sonar-report.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<coverage version="1"> | ||
</coverage> |
11 changes: 11 additions & 0 deletions
11
...l/maven/plugin/UtPlsqlMojoIT/exclude_object/expected-output/utplsql/sonar-test-report.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<testExecutions version="1"> | ||
<file path="plsql.examples.test_pkg_test_me"> | ||
<testCase name="test_fc_input_1" duration="1" ></testCase> | ||
<testCase name="test_fc_input_0" duration="1" ></testCase> | ||
<testCase name="test_fc_input_null" duration="1" ></testCase> | ||
<testCase name="test_pr_test_me_null" duration="1" ></testCase> | ||
<testCase name="test_pr_test_me_not_null" duration="1" ></testCase> | ||
<testCase name="test_pr_test_me_exists" duration="1" ></testCase> | ||
<testCase name="test_pr_test_me_cursor" duration="1" ></testCase> | ||
</file> | ||
</testExecutions> |
52 changes: 52 additions & 0 deletions
52
src/test/resources-its/org/utplsql/maven/plugin/UtPlsqlMojoIT/exclude_object/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.utplsql</groupId> | ||
<artifactId>owner-param</artifactId> | ||
<version>1.0.0</version> | ||
<packaging>pom</packaging> | ||
|
||
<properties> | ||
<dbUrl>jdbc:oracle:thin:@localhost:1521:xe</dbUrl> | ||
<dbUser>UT3</dbUser> | ||
<dbPass>UT3</dbPass> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.utplsql</groupId> | ||
<artifactId>utplsql-maven-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>test</goal> | ||
</goals> | ||
<configuration> | ||
<ignoreFailure>false</ignoreFailure> | ||
<paths> | ||
<path>TESTS_OWNER</path> | ||
</paths> | ||
<reporters> | ||
<reporter> | ||
<name>UT_COVERAGE_SONAR_REPORTER</name> | ||
<fileOutput>utplsql/coverage-sonar-report.xml</fileOutput> | ||
<consoleOutput>true</consoleOutput> | ||
</reporter> | ||
<reporter> | ||
<name>UT_SONAR_TEST_REPORTER</name> | ||
<fileOutput>utplsql/sonar-test-report.xml</fileOutput> | ||
<consoleOutput>true</consoleOutput> | ||
</reporter> | ||
</reporters> | ||
<excludeObject>tests_owner.test_pkg_test_me</excludeObject> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
27 changes: 27 additions & 0 deletions
27
...en/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/package_bodies/PKG_TEST_ME.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
CREATE OR REPLACE PACKAGE BODY CODE_OWNER.PKG_TEST_ME IS | ||
-- | ||
-- This | ||
-- | ||
FUNCTION FC_TEST_ME(PPARAM1 IN VARCHAR2) RETURN NUMBER IS | ||
BEGIN | ||
IF PPARAM1 IS NULL THEN | ||
RETURN NULL; | ||
ELSIF PPARAM1 = '1' THEN | ||
RETURN 1; | ||
ELSE | ||
RETURN 0; | ||
END IF; | ||
END FC_TEST_ME; | ||
|
||
PROCEDURE PR_TEST_ME(PSNAME IN VARCHAR2) IS | ||
BEGIN | ||
IF PSNAME IS NULL THEN | ||
NULL; | ||
ELSE | ||
INSERT INTO TO_TEST_ME (SNAME) VALUES (PSNAME); | ||
COMMIT; | ||
END IF; | ||
END PR_TEST_ME; | ||
|
||
END PKG_TEST_ME; | ||
/ |
8 changes: 8 additions & 0 deletions
8
...ql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/packages/PKG_TEST_ME.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- | ||
-- This package is used TO demonstrate the utPL/SQL possibilities | ||
-- | ||
CREATE OR REPLACE PACKAGE CODE_OWNER.PKG_TEST_ME AS | ||
FUNCTION FC_TEST_ME(PPARAM1 IN VARCHAR2) RETURN NUMBER; | ||
PROCEDURE PR_TEST_ME(PSNAME IN VARCHAR2); | ||
END PKG_TEST_ME; | ||
/ |
8 changes: 8 additions & 0 deletions
8
...plsql/maven/plugin/UtPlsqlMojoIT/exclude_object/scripts/sources/foo/tables/TO_TEST_ME.tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- | ||
-- This is a table used to demonstrate the UNIT test framework. | ||
-- | ||
CREATE TABLE TO_TEST_ME | ||
( | ||
SNAME VARCHAR2(10) | ||
) | ||
/ |
126 changes: 126 additions & 0 deletions
126
.../plugin/UtPlsqlMojoIT/exclude_object/scripts/test/bar/package_bodies/TEST_PKG_TEST_ME.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
CREATE OR REPLACE PACKAGE BODY TESTS_OWNER.TEST_PKG_TEST_ME AS | ||
|
||
--------------------------------------------------------------------------- | ||
PROCEDURE SETUP_GLOBAL IS | ||
BEGIN | ||
-- Put here the code which is valid for all tests and that should be | ||
-- executed once. | ||
NULL; | ||
END SETUP_GLOBAL; | ||
|
||
--------------------------------------------------------------------------- | ||
PROCEDURE TEARDOWN_GLOBAL IS | ||
BEGIN | ||
-- Put here the code that should be called only once after all the test | ||
-- have executed | ||
NULL; | ||
END TEARDOWN_GLOBAL; | ||
|
||
--------------------------------------------------------------------------- | ||
PROCEDURE SETUP_TEST IS | ||
BEGIN | ||
-- Nothing to clean up globally | ||
NULL; | ||
END SETUP_TEST; | ||
|
||
PROCEDURE TEARDOWN_TEST IS | ||
BEGIN | ||
-- Nothing to clean up globally | ||
NULL; | ||
END TEARDOWN_TEST; | ||
|
||
PROCEDURE TEST_FC_INPUT_1 IS | ||
BEGIN | ||
-- Ok this is a real test where I check that the function return 1 | ||
-- when called with a '1' parameter | ||
UT.EXPECT(PKG_TEST_ME.FC_TEST_ME('1')).TO_EQUAL(1); | ||
END; | ||
|
||
PROCEDURE SETUP_TEST_FC_INPUT_1 IS | ||
BEGIN | ||
-- Nothing to be done really | ||
NULL; | ||
END; | ||
|
||
PROCEDURE TEARDOWN_TEST_FC_INPUT_1 IS | ||
BEGIN | ||
-- Nothing to be done really | ||
NULL; | ||
END; | ||
|
||
PROCEDURE TEST_FC_INPUT_0 IS | ||
BEGIN | ||
-- Ok this is a real test where I check that the function return 0 | ||
-- when called with a '0' parameter | ||
UT.EXPECT(PKG_TEST_ME.FC_TEST_ME('0')).TO_EQUAL(0); | ||
END; | ||
|
||
PROCEDURE TEST_FC_INPUT_NULL IS | ||
BEGIN | ||
-- Ok I check that the function return NULL | ||
-- when called with a NULL parameter | ||
UT.EXPECT(PKG_TEST_ME.FC_TEST_ME(NULL)).TO_BE_NULL; | ||
END TEST_FC_INPUT_NULL; | ||
|
||
PROCEDURE TEST_PR_TEST_ME_NULL IS | ||
VNCOUNT1 PLS_INTEGER; | ||
VNCOUNT2 PLS_INTEGER; | ||
BEGIN | ||
-- In this example I check that the procedure does | ||
-- not insert anything when passing it a NULL parameter | ||
SELECT COUNT(1) INTO VNCOUNT1 FROM TO_TEST_ME; | ||
PKG_TEST_ME.PR_TEST_ME(NULL); | ||
SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME; | ||
UT.EXPECT(VNCOUNT1).TO_EQUAL(VNCOUNT2); | ||
END; | ||
|
||
PROCEDURE TEST_PR_TEST_ME_NOT_NULL IS | ||
VNCOUNT1 PLS_INTEGER; | ||
VNCOUNT2 PLS_INTEGER; | ||
VSNAME TO_TEST_ME.SNAME%TYPE; | ||
BEGIN | ||
-- In this test I will check that I do insert a value | ||
-- when the parameter is not null. I futher check that | ||
-- the procedure has inserted the value I specified. | ||
SELECT COUNT(1) INTO VNCOUNT1 FROM TO_TEST_ME; | ||
VSNAME := TO_CHAR(VNCOUNT1); | ||
PKG_TEST_ME.PR_TEST_ME(VSNAME); | ||
SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME; | ||
|
||
-- Check that I have inserted the value | ||
UT.EXPECT(VNCOUNT1 + 1).TO_EQUAL(VNCOUNT2); | ||
SELECT COUNT(1) INTO VNCOUNT2 FROM TO_TEST_ME T WHERE T.SNAME = VSNAME; | ||
|
||
-- Check that I inserted the one I said I would insert | ||
UT.EXPECT(VNCOUNT2).TO_EQUAL(1); | ||
DELETE FROM TO_TEST_ME T WHERE T.SNAME = VSNAME; | ||
COMMIT; | ||
END; | ||
|
||
PROCEDURE TEST_PR_TEST_ME_EXISTS IS | ||
BEGIN | ||
-- In case the value exists the procedure should fail with an exception. | ||
BEGIN | ||
PKG_TEST_ME.PR_TEST_ME('EXISTS'); | ||
PKG_TEST_ME.PR_TEST_ME('EXISTS'); | ||
EXCEPTION | ||
WHEN OTHERS THEN | ||
UT.FAIL('Unexpected exception raised'); | ||
END; | ||
END; | ||
|
||
PROCEDURE TEST_PR_TEST_ME_CURSOR IS | ||
TYPE REF_CURSOR IS REF CURSOR; | ||
VEXPECTED REF_CURSOR; | ||
VACTUAL REF_CURSOR; | ||
BEGIN | ||
EXECUTE IMMEDIATE 'TRUNCATE TABLE CODE_OWNER.TO_TEST_ME'; | ||
OPEN VEXPECTED FOR | ||
SELECT T.SNAME FROM TO_TEST_ME T; | ||
OPEN VACTUAL FOR | ||
SELECT T.SNAME FROM TO_TEST_ME T; | ||
UT.EXPECT(VEXPECTED).TO_(EQUAL(VACTUAL)); | ||
END; | ||
|
||
END; | ||
/ |
Oops, something went wrong.