Skip to content

Commit

Permalink
Rename some trino-plugin-toolkit test resources
Browse files Browse the repository at this point in the history
They have same names as test resources in trino-main. This allows
toolkit's and main's test jars to be used together on a plugin's
classpath. The chosen prefix, `file-based-system-`, is already used for
a few other test resources used in the same test class.
  • Loading branch information
findepi committed Jan 18, 2022
1 parent adbc1fd commit 5d88fa5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ public void testTableRulesForCheckCanSetTableProperties()
@Test
public void testCanSetUserOperations()
{
SystemAccessControl accessControl = newFileBasedSystemAccessControl("catalog_principal.json");
SystemAccessControl accessControl = newFileBasedSystemAccessControl("file-based-system-catalog_principal.json");

try {
accessControl.checkCanSetUser(Optional.empty(), alice.getUser());
Expand Down Expand Up @@ -780,7 +780,7 @@ public void testCanSetUserOperations()
catch (AccessDeniedException expected) {
}

SystemAccessControl accessControlNoPatterns = newFileBasedSystemAccessControl("catalog.json");
SystemAccessControl accessControlNoPatterns = newFileBasedSystemAccessControl("file-based-system-catalog.json");
accessControlNoPatterns.checkCanSetUser(kerberosValidAlice.getPrincipal(), kerberosValidAlice.getUser());
}

Expand Down Expand Up @@ -851,7 +851,7 @@ public void testInvalidQuery()
@Test
public void testQueryNotSet()
{
SystemAccessControl accessControlManager = newFileBasedSystemAccessControl("catalog.json");
SystemAccessControl accessControlManager = newFileBasedSystemAccessControl("file-based-system-catalog.json");

accessControlManager.checkCanExecuteQuery(new SystemSecurityContext(bob, queryId));
accessControlManager.checkCanViewQueryOwnedBy(new SystemSecurityContext(bob, queryId), any);
Expand Down Expand Up @@ -939,7 +939,7 @@ public void testSystemInformation()
@Test
public void testSystemInformationNotSet()
{
SystemAccessControl accessControlManager = newFileBasedSystemAccessControl("catalog.json");
SystemAccessControl accessControlManager = newFileBasedSystemAccessControl("file-based-system-catalog.json");

assertThatThrownBy(() -> accessControlManager.checkCanReadSystemInformation(new SystemSecurityContext(bob, Optional.empty())))
.isInstanceOf(AccessDeniedException.class)
Expand Down Expand Up @@ -974,7 +974,7 @@ public void testSystemInformationDocsExample()
@Test
public void testSchemaOperations()
{
SystemAccessControl accessControl = newFileBasedSystemAccessControl("catalog.json");
SystemAccessControl accessControl = newFileBasedSystemAccessControl("file-based-system-catalog.json");

TrinoPrincipal user = new TrinoPrincipal(PrincipalType.USER, "some_user");
TrinoPrincipal role = new TrinoPrincipal(PrincipalType.ROLE, "some_user");
Expand Down Expand Up @@ -1308,7 +1308,7 @@ public void testRefreshing()
{
File configFile = newTemporaryFile();
configFile.deleteOnExit();
copy(new File(getResourcePath("catalog.json")), configFile);
copy(new File(getResourcePath("file-based-system-catalog.json")), configFile);

SystemAccessControl accessControl = newFileBasedSystemAccessControl(ImmutableMap.of(
SECURITY_CONFIG_FILE, configFile.getAbsolutePath(),
Expand All @@ -1319,7 +1319,7 @@ public void testRefreshing()
accessControl.checkCanCreateView(alice, aliceView);
accessControl.checkCanCreateView(alice, aliceView);

copy(new File(getResourcePath("security-config-file-with-unknown-rules.json")), configFile);
copy(new File(getResourcePath("file-based-system-security-config-file-with-unknown-rules.json")), configFile);
sleep(2);

assertThatThrownBy(() -> accessControl.checkCanCreateView(alice, aliceView))
Expand All @@ -1331,7 +1331,7 @@ public void testRefreshing()
.isInstanceOf(IllegalArgumentException.class)
.hasMessageStartingWith("Invalid JSON file");

copy(new File(getResourcePath("catalog.json")), configFile);
copy(new File(getResourcePath("file-based-system-catalog.json")), configFile);
sleep(2);

accessControl.checkCanCreateView(alice, aliceView);
Expand All @@ -1340,7 +1340,7 @@ public void testRefreshing()
@Test
public void parseUnknownRules()
{
assertThatThrownBy(() -> newFileBasedSystemAccessControl("security-config-file-with-unknown-rules.json"))
assertThatThrownBy(() -> newFileBasedSystemAccessControl("file-based-system-security-config-file-with-unknown-rules.json"))
.hasMessageContaining("Invalid JSON");
}

Expand Down

0 comments on commit 5d88fa5

Please sign in to comment.