Skip to content

Added version_compatibility_check function to ut_runner #464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 28, 2017

Conversation

jgebal
Copy link
Member

@jgebal jgebal commented Aug 21, 2017

Resolves #430
Added version parsing.
Changed value of gc_version variable in ut_utils

@jgebal jgebal added this to the v3.0.3 milestone Aug 21, 2017
@jgebal jgebal self-assigned this Aug 21, 2017
@jgebal jgebal requested review from viniciusam and Pazus August 21, 2017 08:02
@@ -384,5 +384,18 @@ create or replace package body ut_utils is
commit;
end;

function to_version(p_version_no varchar2) return t_version is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this function should raise an exception with proper message if an illegal version-no string is provided.

@@ -43,6 +43,19 @@ create or replace package body ut_runner is
return ut_utils.gc_version;
end;

function version_compatibility_check( a_requested varchar2, a_current varchar2 := null ) return boolean is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For boolean is not a SQL type but only PL/SQL (I guess it's still working that way) it might be more complicated to implement the Java request to this function, cause we can't just select version_compatibility_check(?) from dual
What do you think about return 0/1? Or adding another function, wrapping the boolean one and returning 0/1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting observation.
We already have bool ->init and int->bool so the change will be quite simple.
I'm just wondering how would the select statement behave with overloaded functions (with boolan and integer return type) - will need to check

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't overload a funtion with a version which differes ony in return type.

ut.expect( ut3.ut_runner.version_compatibility_check('v3.0.0.0','v3.0.0.123') ).to_be_true;
ut.expect( ut3.ut_runner.version_compatibility_check('v3.0.0','v3.0.0.0') ).to_be_true;
end;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be tests to ensure version_compatibility_check behaves correctly (exception) when providing illegal version strings

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point

jgebal added 2 commits August 26, 2017 19:14
…wing exception on version check, added tests for throwing exception.
# Conflicts:
#	test/install_and_run_tests.sh
#	test/install_tests.sql
#	test/ut_utils/test_ut_utils.pkb
@Pazus
Copy link
Member

Pazus commented Aug 27, 2017

I'm ok with the changes so lets wait for @pesse reviewal.

Copy link
Member

@pesse pesse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really great now, only the documentation about what error code is thrown is wrong

*
* @param a_version_no string representation of version in format vX.X.X.X where X is a positive integer
* @return t_version record with up to four positive numbers containing version
* @throws 20010 if passed version string is not matching version pattern
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@throws 20214, not 20010

* @param a_requested requested utPLSQL version string
* @param a_current current utPLSQL version string, if null is passed, defaults to current framework version
* @return 1/0 1-true, 0-false
* @exception 20010 if passed version string is not matching version pattern
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@throws 20214, not 20010

@jgebal jgebal merged commit 312fb95 into develop Aug 28, 2017
@jgebal jgebal deleted the feature/add_version_check branch August 30, 2017 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants