Skip to content

Commit

Permalink
added secure correlation alerts tests
Browse files Browse the repository at this point in the history
Signed-off-by: Riya Saxena <[email protected]>
  • Loading branch information
riysaxen-amzn committed Sep 11, 2024
1 parent 81ef997 commit 95a8125
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.opensearch.securityanalytics.correlation.alerts;

import org.apache.hc.core5.http.HttpHost;
import org.junit.After;
import org.junit.Before;
import org.opensearch.client.RestClient;
import org.opensearch.commons.rest.SecureRestClientBuilder;
import org.opensearch.securityanalytics.SecurityAnalyticsRestTestCase;
import java.io.IOException;

public class SecureCorrelationAlertsRestAPIT {
static String SECURITY_ANALYTICS_FULL_ACCESS_ROLE = "security_analytics_full_access";
static String SECURITY_ANALYTICS_READ_ACCESS_ROLE = "security_analytics_read_access";
static String TEST_HR_BACKEND_ROLE = "HR";
static String TEST_IT_BACKEND_ROLE = "IT";
private final String user = "userAlert";
private static final String[] EMPTY_ARRAY = new String[0];
private RestClient userClient;

@Before
public void create() throws IOException {
String[] backendRoles = { TEST_HR_BACKEND_ROLE };
createUserWithData(user, user, SECURITY_ANALYTICS_FULL_ACCESS_ROLE, backendRoles );
if (userClient == null) {
userClient = new SecureRestClientBuilder(getClusterHosts().toArray(new HttpHost[]{}), isHttps(), user, password).setSocketTimeout(60000).build();
}
}

@After
public void cleanup() throws IOException {
userClient.close();
deleteUser(user);
}
}

0 comments on commit 95a8125

Please sign in to comment.