forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(validation): additional URN validation adjustments (datahub-proje…
- Loading branch information
1 parent
1cde28f
commit d9de671
Showing
4 changed files
with
82 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,36 @@ public void testValidateDatasetUrn() { | |
// If no exception is thrown, test passes | ||
} | ||
|
||
@Test(expectedExceptions = IllegalArgumentException.class) | ||
@Test | ||
public void testSimpleUrnColon() { | ||
Urn invalidUrn = UrnUtils.getUrn("urn:li:corpuser:foo:bar"); | ||
ValidationApiUtils.validateUrn(entityRegistry, invalidUrn, true); | ||
ValidationApiUtils.validateUrn( | ||
entityRegistry, UrnUtils.getUrn("urn:li:corpuser:foo:bar"), true); | ||
ValidationApiUtils.validateUrn( | ||
entityRegistry, UrnUtils.getUrn("urn:li:dataPlatform:abc:def"), true); | ||
ValidationApiUtils.validateUrn( | ||
entityRegistry, UrnUtils.getUrn("urn:li:corpuser:foo:[email protected]"), true); | ||
// If no exception is thrown, test passes | ||
} | ||
|
||
@Test | ||
public void testSimpleUrnComma() { | ||
ValidationApiUtils.validateUrn(entityRegistry, UrnUtils.getUrn("urn:li:corpuser:,"), true); | ||
// If no exception is thrown, test passes | ||
} | ||
|
||
@Test(expectedExceptions = IllegalArgumentException.class) | ||
public void testTupleUrnComma() { | ||
ValidationApiUtils.validateUrn( | ||
entityRegistry, UrnUtils.getUrn("urn:li:dashboard:(looker,dashboards,thelook)"), true); | ||
} | ||
|
||
@Test(expectedExceptions = IllegalArgumentException.class) | ||
public void testFabricTypeCasing() { | ||
// prod != PROD | ||
ValidationApiUtils.validateUrn( | ||
entityRegistry, | ||
UrnUtils.getUrn("urn:li:dataset:(urn:li:dataPlatform:abc:def,table_name,prod)"), | ||
true); | ||
} | ||
|
||
@Test | ||
|
@@ -34,7 +60,7 @@ public void testComplexUrnColon() throws URISyntaxException { | |
} | ||
|
||
@Test(expectedExceptions = IllegalArgumentException.class) | ||
public void testUrnFabricType() { | ||
public void testFabricTypeParen() { | ||
Urn invalidUrn = UrnUtils.getUrn("urn:li:dataset:(urn:li:dataPlatform:hdfs,/path/to/data,())"); | ||
ValidationApiUtils.validateUrn(entityRegistry, invalidUrn, true); | ||
} | ||
|
@@ -83,20 +109,20 @@ public void testValidComplexUrn() { | |
UrnUtils.getUrn( | ||
"urn:li:dataset:(urn:li:dataPlatform:bigquery,myproject.dataset.table,PROD)"); | ||
|
||
ValidationApiUtils.validateUrn(entityRegistry, validUrn); | ||
ValidationApiUtils.validateUrn(entityRegistry, validUrn, true); | ||
// If no exception is thrown, test passes | ||
} | ||
|
||
@Test(expectedExceptions = NullPointerException.class) | ||
public void testUrnNull() { | ||
ValidationApiUtils.validateUrn(entityRegistry, null); | ||
ValidationApiUtils.validateUrn(entityRegistry, null, true); | ||
} | ||
|
||
@Test | ||
public void testValidPartialUrlEncode() { | ||
Urn validUrn = UrnUtils.getUrn("urn:li:assertion:123=-%28__% weekly__%29"); | ||
|
||
ValidationApiUtils.validateUrn(entityRegistry, validUrn); | ||
ValidationApiUtils.validateUrn(entityRegistry, validUrn, true); | ||
// If no exception is thrown, test passes | ||
} | ||
|
||
|
@@ -106,7 +132,23 @@ public void testValidPartialUrlEncode2() { | |
UrnUtils.getUrn( | ||
"urn:li:dataset:(urn:li:dataPlatform:s3,urn:li:dataset:%28urn:li:dataPlatform:s3%2Ctest-datalake-concepts%prog_maintenance%2CPROD%29,PROD)"); | ||
|
||
ValidationApiUtils.validateUrn(entityRegistry, validUrn); | ||
ValidationApiUtils.validateUrn(entityRegistry, validUrn, true); | ||
// If no exception is thrown, test passes | ||
} | ||
|
||
@Test | ||
public void testValidColon() { | ||
Urn validUrn = | ||
UrnUtils.getUrn("urn:li:dashboard:(looker,dashboards.thelook::cohort_data_tool)"); | ||
|
||
ValidationApiUtils.validateUrn(entityRegistry, validUrn, true); | ||
// If no exception is thrown, test passes | ||
} | ||
|
||
@Test | ||
public void testNoTupleComma() { | ||
Urn invalidUrn = UrnUtils.getUrn("urn:li:corpuser:,"); | ||
ValidationApiUtils.validateUrn(entityRegistry, invalidUrn, true); | ||
// If no exception is thrown, test passes | ||
} | ||
} |