Skip to content

Commit 0819161

Browse files
authored
Remove dependency on :test:framework in :libs:opensearch-agent-sm:agent-policy (#17821)
* Remove dependency on :test:framework in :libs:opensearch-agent-sm:agent-policy Signed-off-by: Craig Perkins <[email protected]> * Use JUnit Signed-off-by: Craig Perkins <[email protected]> * Disable more tasks Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]>
1 parent c91cdcb commit 0819161

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,13 @@ arrow = "18.1.0"
9393
flatbuffers = "2.0.0"
9494

9595
[libraries]
96+
hamcrest = { group = "org.hamcrest", name = "hamcrest", version.ref = "hamcrest" }
9697
hdrhistogram = { group = "org.hdrhistogram", name = "HdrHistogram", version.ref = "hdrhistogram" }
9798
jakartaannotation = { group = "jakarta.annotation", name = "jakarta.annotation-api", version.ref = "jakarta_annotation" }
9899
jodatime = { group = "joda-time", name = "joda-time", version.ref = "joda" }
99100
jna = { group = "net.java.dev.jna", name = "jna", version.ref = "jna" }
100101
jtscore = { group = "org.locationtech.jts", name = "jts-core", version.ref = "jts" }
102+
junit = { group = "junit", name = "junit", version.ref = "junit" }
101103
jzlib = { group = "com.jcraft", name = "jzlib", version.ref = "jzlib" }
102104
log4japi = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" }
103105
log4jjul = { group = "org.apache.logging.log4j", name = "log4j-jul", version.ref = "log4j" }

libs/agent-sm/agent-policy/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ base {
2020
archivesName = 'opensearch-agent-policy'
2121
}
2222

23-
disableTasks('forbiddenApisMain')
23+
disableTasks('forbiddenApisMain', 'forbiddenApisTest', 'testingConventions')
2424

2525
dependencies {
26-
testImplementation(project(":test:framework"))
26+
testImplementation libs.junit
27+
testImplementation libs.hamcrest
2728
}

libs/agent-sm/agent-policy/src/test/java/org/opensearch/secure_sm/policy/PolicyParserTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@
77
*/
88
package org.opensearch.secure_sm.policy;
99

10-
import org.opensearch.test.OpenSearchTestCase;
10+
import org.junit.Test;
1111

1212
import java.io.IOException;
1313
import java.io.Reader;
1414
import java.io.StringReader;
1515
import java.util.List;
1616

17-
public class PolicyParserTests extends OpenSearchTestCase {
17+
import static org.junit.Assert.assertEquals;
18+
import static org.junit.Assert.assertNull;
19+
20+
public class PolicyParserTests {
1821
private static final String POLICY = """
1922
grant codeBase "TestCodeBase" {
2023
permission java.net.NetPermission "accessUnixDomainSocket";
@@ -26,6 +29,7 @@ public class PolicyParserTests extends OpenSearchTestCase {
2629
};
2730
""";
2831

32+
@Test
2933
public void testPolicy() throws IOException, PolicyParser.ParsingException {
3034
try (Reader reader = new StringReader(POLICY)) {
3135
final List<GrantEntry> grantEntries = PolicyParser.read(reader);

0 commit comments

Comments
 (0)