-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3cc4a9
commit 3e2483e
Showing
7 changed files
with
174 additions
and
30 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
28 changes: 28 additions & 0 deletions
28
connector-packager/tests/test_resources/null_oauth_config/connectionBuilder.js
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,28 @@ | ||
(function dsbuilder(attr) | ||
{ | ||
var params = {}; | ||
var authAttrValue = attr[connectionHelper.attributeAuthentication]; | ||
|
||
params["SERVER"] = attr[connectionHelper.attributeServer]; | ||
params["UID"] = attr[connectionHelper.attributeUsername]; | ||
if(authAttrValue =="auth-user-pass") | ||
{ | ||
params["PWD"] = attr[connectionHelper.attributePassword]; | ||
} | ||
else if(authAttrValue == "oauth") | ||
{ | ||
params["AUTHENTICATOR"] = "OAUTH"; | ||
params["TOKEN"] = attr["ACCESSTOKEN"]; | ||
} | ||
|
||
var formattedParams = []; | ||
|
||
formattedParams.push(connectionHelper.formatKeyValuePair(driverLocator.keywordDriver, driverLocator.locateDriver(attr))); | ||
|
||
for (var key in params) | ||
{ | ||
formattedParams.push(connectionHelper.formatKeyValuePair(key, params[key])); | ||
} | ||
|
||
return formattedParams; | ||
}) |
35 changes: 35 additions & 0 deletions
35
connector-packager/tests/test_resources/null_oauth_config/connectionFields.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,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<connection-fields> | ||
<field name="server" label="Server" value-type="string" category="endpoint" > | ||
<validation-rule reg-exp="^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$"/> | ||
</field> | ||
|
||
<field name="authentication" label="Authentication" category="authentication" value-type="selection" default-value="auth-user-pass" > | ||
<selection-group> | ||
<option value="auth-user-pass" label="Username and Password"/> | ||
<option value="oauth" label="OAuth"/> | ||
</selection-group> | ||
</field> | ||
|
||
<field name="username" label="Username" category="authentication" value-type="string"> | ||
<conditions> | ||
<condition field="authentication" value="auth-user-pass"/> | ||
</conditions> | ||
</field> | ||
|
||
<field name="password" label="Password" category="authentication" value-type="string" secure="true"> | ||
<conditions> | ||
<condition field="authentication" value="auth-user-pass"/> | ||
</conditions> | ||
</field> | ||
|
||
<field name="instanceurl" label="OAuth Instance Url" category="authentication" value-type="string"> | ||
<conditions> | ||
<condition field="authentication" value="oauth" /> | ||
</conditions> | ||
<validation-rule reg-exp="^https:\/\/(.+\.)?(snowflakecomputing\.(com|us|cn|de))(.*)"/> | ||
</field> | ||
|
||
|
||
</connection-fields> |
28 changes: 28 additions & 0 deletions
28
connector-packager/tests/test_resources/null_oauth_config/connectionResolver.tdr
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,28 @@ | ||
<?xml version='1.0' encoding='utf-8' ?> | ||
<tdr class='null_oauth_config'> | ||
<connection-resolver> | ||
<connection-builder> | ||
<script file='connectionBuilder.js'/> | ||
</connection-builder> | ||
<connection-normalizer> | ||
<required-attributes> | ||
<attribute-list> | ||
<attr>class</attr> | ||
<attr>server</attr> | ||
<attr>port</attr> | ||
<attr>dbname</attr> | ||
<attr>username</attr> | ||
<attr>one-time-sql</attr> | ||
<attr>service</attr> | ||
<attr>authentication</attr> | ||
<attr>password</attr> | ||
</attribute-list> | ||
</required-attributes> | ||
</connection-normalizer> | ||
</connection-resolver> | ||
<driver-resolver> | ||
<driver-match > | ||
<driver-name type='regex'>SnowflakeDSIIDriver*</driver-name> | ||
</driver-match> | ||
</driver-resolver> | ||
</tdr> |
7 changes: 7 additions & 0 deletions
7
connector-packager/tests/test_resources/null_oauth_config/dialect.tdd
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,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<dialect name='SimpleSnowflake' | ||
class='null_oauth_config' | ||
base='SnowflakeDialect' | ||
version='18.1'> | ||
</dialect> | ||
|
20 changes: 20 additions & 0 deletions
20
connector-packager/tests/test_resources/null_oauth_config/manifest.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,20 @@ | ||
<?xml version='1.0' encoding='utf-8' ?> | ||
|
||
<connector-plugin class='null_oauth_config' superclass='odbc' plugin-version='0.0.0' name='Null OAuth Config' version='18.1'> | ||
<vendor-information> | ||
<company name="Sample Company"/> | ||
<support-link url = "http://example.com"/> | ||
</vendor-information> | ||
<connection-customization class="snowflake_oauth" enabled="true" version="10.0"> | ||
<vendor name="vendor"/> | ||
<driver name="driver"/> | ||
<customizations> | ||
<customization name="CAP_QUERY_HAVING_REQUIRES_GROUP_BY" value="yes"/> | ||
<customization name="CAP_QUERY_INITIAL_SQL_SPLIT_STATEMENTS" value="yes"/> | ||
</customizations> | ||
</connection-customization> | ||
<connection-fields file='connectionFields.xml'/> | ||
<connection-resolver file="connectionResolver.tdr"/> | ||
<dialect file='dialect.tdd'/> | ||
<oauth-config file='null_config'/> | ||
</connector-plugin> |