Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ arrow = "18.1.0"
flatbuffers = "2.0.0"

[libraries]
hamcrest = { group = "org.hamcrest", name = "hamcrest", version.ref = "hamcrest" }
hdrhistogram = { group = "org.hdrhistogram", name = "HdrHistogram", version.ref = "hdrhistogram" }
jakartaannotation = { group = "jakarta.annotation", name = "jakarta.annotation-api", version.ref = "jakarta_annotation" }
jodatime = { group = "joda-time", name = "joda-time", version.ref = "joda" }
jna = { group = "net.java.dev.jna", name = "jna", version.ref = "jna" }
jtscore = { group = "org.locationtech.jts", name = "jts-core", version.ref = "jts" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
jzlib = { group = "com.jcraft", name = "jzlib", version.ref = "jzlib" }
log4japi = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" }
log4jjul = { group = "org.apache.logging.log4j", name = "log4j-jul", version.ref = "log4j" }
Expand Down
5 changes: 3 additions & 2 deletions libs/agent-sm/agent-policy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ base {
archivesName = 'opensearch-agent-policy'
}

disableTasks('forbiddenApisMain')
disableTasks('forbiddenApisMain', 'forbiddenApisTest', 'testingConventions')

dependencies {
testImplementation(project(":test:framework"))
testImplementation libs.junit
testImplementation libs.hamcrest
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
*/
package org.opensearch.secure_sm.policy;

import org.opensearch.test.OpenSearchTestCase;
import org.junit.Test;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.List;

public class PolicyParserTests extends OpenSearchTestCase {
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

public class PolicyParserTests {
private static final String POLICY = """
grant codeBase "TestCodeBase" {
permission java.net.NetPermission "accessUnixDomainSocket";
Expand All @@ -26,6 +29,7 @@ public class PolicyParserTests extends OpenSearchTestCase {
};
""";

@Test
public void testPolicy() throws IOException, PolicyParser.ParsingException {
try (Reader reader = new StringReader(POLICY)) {
final List<GrantEntry> grantEntries = PolicyParser.read(reader);
Expand Down
Loading