Skip to content

Commit

Permalink
#988:Adapted Java integration tests for new ScriptOptions parser
Browse files Browse the repository at this point in the history
  • Loading branch information
tomuben committed Oct 21, 2024
1 parent c289794 commit c438beb
Show file tree
Hide file tree
Showing 5 changed files with 308 additions and 91 deletions.
13 changes: 13 additions & 0 deletions test_container/tests/lang/java/get_connection.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ class PRINT_CONNECTION {
}
/

CREATE or replace java SCALAR SCRIPT print_connection_v2(conn varchar (1000))
emits(type varchar(200), addr varchar(2000000), usr varchar(2000000), pwd varchar(2000000))
as
%env SCRIPT_OPTIONS_PARSER_VERSION=2;
%jvmoption -Xms64m -Xmx128m -Xss512k;
class PRINT_CONNECTION_V2 {
static void run(ExaMetadata exa, ExaIterator ctx) throws Exception {
ExaConnectionInformation c = exa.getConnection(ctx.getString("conn"));
ctx.emit(c.getType().toString().toLowerCase(),c.getAddress(),c.getUser(), c.getPassword());
}
}
/

CREATE or replace java SET SCRIPT print_connection_set_emits(conn varchar (1000))
emits(type varchar(200), addr varchar(2000000), usr varchar(2000000), pwd varchar(2000000))
as
Expand Down
6 changes: 6 additions & 0 deletions test_container/tests/test/generic/get_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ def test_connection_not_found(self):
SELECT fn1.print_connection('FOO')
''')

@requires('PRINT_CONNECTION_V2')
def test_print_existing_connection_v2(self):
rows = self.query('''
SELECT fn1.print_connection_v2('FOOCONN')
''')
self.assertRowsEqual([('password', 'a', 'b', 'c')], rows)

class GetConnectionAccessControlTest(udf.TestCase):
def setUp(self):
Expand Down
Loading

0 comments on commit c438beb

Please sign in to comment.