Skip to content

Commit 0f6517b

Browse files
committed
Moved test data classes to .data package
Signed-off-by: Nils Bandener <[email protected]>
1 parent 2c0a701 commit 0f6517b

20 files changed

+112
-97
lines changed

src/integrationTest/java/org/opensearch/security/http/ServiceAccountAuthenticationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
import org.junit.Test;
2121
import org.junit.runner.RunWith;
2222

23-
import org.opensearch.test.framework.TestIndex;
2423
import org.opensearch.test.framework.TestSecurityConfig;
2524
import org.opensearch.test.framework.cluster.ClusterManager;
2625
import org.opensearch.test.framework.cluster.LocalCluster;
2726
import org.opensearch.test.framework.cluster.TestRestClient;
27+
import org.opensearch.test.framework.data.TestIndex;
2828

2929
import static org.opensearch.security.support.ConfigConstants.SECURITY_RESTAPI_ROLES_ENABLED;
3030
import static org.opensearch.security.support.ConfigConstants.SECURITY_SYSTEM_INDICES_ENABLED_KEY;

src/integrationTest/java/org/opensearch/security/privileges/PrivilegesEvaluatorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
import org.opensearch.script.mustache.MustacheModulePlugin;
2121
import org.opensearch.script.mustache.RenderSearchTemplateAction;
22-
import org.opensearch.test.framework.TestIndex;
2322
import org.opensearch.test.framework.TestSecurityConfig;
2423
import org.opensearch.test.framework.TestSecurityConfig.Role;
2524
import org.opensearch.test.framework.cluster.ClusterManager;
2625
import org.opensearch.test.framework.cluster.LocalCluster;
2726
import org.opensearch.test.framework.cluster.TestRestClient;
27+
import org.opensearch.test.framework.data.TestIndex;
2828

2929
import static org.hamcrest.MatcherAssert.assertThat;
3030
import static org.hamcrest.Matchers.equalTo;

src/integrationTest/java/org/opensearch/security/privileges/dlsfls/FlsFmIntegrationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
import org.bouncycastle.util.encoders.Hex;
2929

3030
import org.opensearch.plugin.mapper.MapperSizePlugin;
31-
import org.opensearch.test.framework.TestData;
32-
import org.opensearch.test.framework.TestIndex;
3331
import org.opensearch.test.framework.TestSecurityConfig;
3432
import org.opensearch.test.framework.cluster.ClusterManager;
3533
import org.opensearch.test.framework.cluster.LocalCluster;
3634
import org.opensearch.test.framework.cluster.TestRestClient;
35+
import org.opensearch.test.framework.data.TestData;
36+
import org.opensearch.test.framework.data.TestIndex;
3737

3838
import com.rfksystems.blake2b.Blake2b;
3939

src/integrationTest/java/org/opensearch/security/privileges/int_tests/DataStreamAuthorizationReadOnlyIntTests.java

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@
2121
import org.junit.Test;
2222
import org.junit.runner.RunWith;
2323

24-
import org.opensearch.test.framework.TestComponentTemplate;
25-
import org.opensearch.test.framework.TestDataStream;
26-
import org.opensearch.test.framework.TestIndex;
27-
import org.opensearch.test.framework.TestIndexOrAliasOrDatastream;
28-
import org.opensearch.test.framework.TestIndexTemplate;
2924
import org.opensearch.test.framework.TestSecurityConfig;
3025
import org.opensearch.test.framework.cluster.LocalCluster;
3126
import org.opensearch.test.framework.cluster.TestRestClient;
27+
import org.opensearch.test.framework.data.TestComponentTemplate;
28+
import org.opensearch.test.framework.data.TestDataStream;
29+
import org.opensearch.test.framework.data.TestIndex;
30+
import org.opensearch.test.framework.data.TestIndexOrAliasOrDatastream;
31+
import org.opensearch.test.framework.data.TestIndexTemplate;
3232
import org.opensearch.test.framework.matcher.RestIndexMatchers;
3333

3434
import static org.hamcrest.MatcherAssert.assertThat;
3535
import static org.hamcrest.Matchers.is;
36-
import static org.opensearch.test.framework.TestIndex.openSearchSecurityConfigIndex;
3736
import static org.opensearch.test.framework.TestSecurityConfig.AuthcDomain.AUTHC_HTTPBASIC_INTERNAL;
37+
import static org.opensearch.test.framework.data.TestIndex.openSearchSecurityConfigIndex;
3838
import static org.opensearch.test.framework.matcher.RestIndexMatchers.OnResponseIndexMatcher.containsExactly;
3939
import static org.opensearch.test.framework.matcher.RestIndexMatchers.OnUserIndexMatcher.limitedTo;
4040
import static org.opensearch.test.framework.matcher.RestIndexMatchers.OnUserIndexMatcher.limitedToNone;
@@ -523,9 +523,7 @@ public void search_termsAggregation_index() throws Exception {
523523
if (user == SUPER_UNLIMITED_USER || user == UNLIMITED_USER) {
524524
assertThat(
525525
httpResponse,
526-
containsExactly(ALL_INDICES).at("aggregations.indices.buckets[*].key")
527-
.reducedBy(user.reference(READ))
528-
.whenEmpty(isOk())
526+
containsExactly(ALL_INDICES).at("aggregations.indices.buckets[*].key").reducedBy(user.reference(READ)).whenEmpty(isOk())
529527
);
530528
} else {
531529
// Users without full privileges will not see hidden indices here; thus on a cluster with only data streams, the result is
@@ -587,8 +585,7 @@ public void getDataStream_all() throws Exception {
587585
// The legacy mode does not support dnfof for indices:admin/data_stream/get
588586
assertThat(
589587
httpResponse,
590-
containsExactly(ALL_DATA_STREAMS).at("$.data_streams[*].name")
591-
.butForbiddenIfIncomplete(user.reference(READ))
588+
containsExactly(ALL_DATA_STREAMS).at("$.data_streams[*].name").butForbiddenIfIncomplete(user.reference(READ))
592589
);
593590
}
594591
}
@@ -600,8 +597,7 @@ public void getDataStream_wildcard() throws Exception {
600597
// The legacy mode does not support dnfof for indices:admin/data_stream/get
601598
assertThat(
602599
httpResponse,
603-
containsExactly(ALL_DATA_STREAMS).at("$.data_streams[*].name")
604-
.butForbiddenIfIncomplete(user.reference(READ))
600+
containsExactly(ALL_DATA_STREAMS).at("$.data_streams[*].name").butForbiddenIfIncomplete(user.reference(READ))
605601
);
606602
}
607603
}
@@ -648,8 +644,7 @@ public void getDataStreamStats_all() throws Exception {
648644
// The legacy mode does not support dnfof for indices:monitor/data_stream/stats
649645
assertThat(
650646
httpResponse,
651-
containsExactly(ALL_DATA_STREAMS).at("$.data_streams[*].data_stream")
652-
.butForbiddenIfIncomplete(user.reference(READ))
647+
containsExactly(ALL_DATA_STREAMS).at("$.data_streams[*].data_stream").butForbiddenIfIncomplete(user.reference(READ))
653648
);
654649
}
655650
}
@@ -661,8 +656,7 @@ public void getDataStreamStats_wildcard() throws Exception {
661656
// The legacy mode does not support dnfof for indices:monitor/data_stream/stats
662657
assertThat(
663658
httpResponse,
664-
containsExactly(ALL_DATA_STREAMS).at("$.data_streams[*].data_stream")
665-
.butForbiddenIfIncomplete(user.reference(READ))
659+
containsExactly(ALL_DATA_STREAMS).at("$.data_streams[*].data_stream").butForbiddenIfIncomplete(user.reference(READ))
666660
);
667661
}
668662
}

src/integrationTest/java/org/opensearch/security/privileges/int_tests/DataStreamAuthorizationReadWriteIntTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
import org.junit.runner.RunWith;
2727

2828
import org.opensearch.action.admin.indices.refresh.RefreshRequest;
29-
import org.opensearch.test.framework.TestComponentTemplate;
30-
import org.opensearch.test.framework.TestDataStream;
31-
import org.opensearch.test.framework.TestIndex;
32-
import org.opensearch.test.framework.TestIndexOrAliasOrDatastream;
33-
import org.opensearch.test.framework.TestIndexTemplate;
3429
import org.opensearch.test.framework.TestSecurityConfig;
3530
import org.opensearch.test.framework.TestSecurityConfig.Role;
3631
import org.opensearch.test.framework.cluster.LocalCluster;
3732
import org.opensearch.test.framework.cluster.TestRestClient;
3833
import org.opensearch.test.framework.cluster.TestRestClient.HttpResponse;
34+
import org.opensearch.test.framework.data.TestComponentTemplate;
35+
import org.opensearch.test.framework.data.TestDataStream;
36+
import org.opensearch.test.framework.data.TestIndex;
37+
import org.opensearch.test.framework.data.TestIndexOrAliasOrDatastream;
38+
import org.opensearch.test.framework.data.TestIndexTemplate;
3939
import org.opensearch.test.framework.matcher.RestIndexMatchers;
4040

4141
import static org.hamcrest.MatcherAssert.assertThat;

src/integrationTest/java/org/opensearch/security/privileges/int_tests/IndexAuthorizationReadOnlyIntTests.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@
3030
import org.opensearch.plugins.Plugin;
3131
import org.opensearch.plugins.SystemIndexPlugin;
3232
import org.opensearch.script.mustache.MustacheModulePlugin;
33-
import org.opensearch.test.framework.TestAlias;
34-
import org.opensearch.test.framework.TestData;
35-
import org.opensearch.test.framework.TestIndex;
36-
import org.opensearch.test.framework.TestIndexOrAliasOrDatastream;
3733
import org.opensearch.test.framework.TestSecurityConfig;
3834
import org.opensearch.test.framework.cluster.LocalCluster;
3935
import org.opensearch.test.framework.cluster.TestRestClient;
36+
import org.opensearch.test.framework.data.TestAlias;
37+
import org.opensearch.test.framework.data.TestData;
38+
import org.opensearch.test.framework.data.TestIndex;
39+
import org.opensearch.test.framework.data.TestIndexOrAliasOrDatastream;
4040
import org.opensearch.test.framework.matcher.RestIndexMatchers;
4141

4242
import static java.util.stream.Collectors.joining;
4343
import static org.apache.commons.lang3.StringEscapeUtils.escapeJson;
4444
import static org.hamcrest.MatcherAssert.assertThat;
45-
import static org.opensearch.test.framework.TestIndex.openSearchSecurityConfigIndex;
4645
import static org.opensearch.test.framework.TestSecurityConfig.AuthcDomain.AUTHC_HTTPBASIC_INTERNAL;
4746
import static org.opensearch.test.framework.cluster.TestRestClient.json;
47+
import static org.opensearch.test.framework.data.TestIndex.openSearchSecurityConfigIndex;
4848
import static org.opensearch.test.framework.matcher.RestIndexMatchers.IndexMatcher;
4949
import static org.opensearch.test.framework.matcher.RestIndexMatchers.OnResponseIndexMatcher.containsExactly;
5050
import static org.opensearch.test.framework.matcher.RestIndexMatchers.OnUserIndexMatcher.limitedTo;
@@ -697,9 +697,7 @@ public void search_staticIndices_systemIndex_alias() throws Exception {
697697
} else if (clusterConfig == ClusterConfig.LEGACY_PRIVILEGES_EVALUATION_SYSTEM_INDEX_PERMISSION) {
698698
assertThat(
699699
httpResponse,
700-
containsExactly(system_index_plugin).at("hits.hits[*]._index")
701-
.reducedBy(user.reference(READ))
702-
.whenEmpty(isForbidden())
700+
containsExactly(system_index_plugin).at("hits.hits[*]._index").reducedBy(user.reference(READ)).whenEmpty(isForbidden())
703701
);
704702
} else {
705703
if (user.reference(READ).covers(alias_with_system_index)) {

src/integrationTest/java/org/opensearch/security/privileges/int_tests/IndexAuthorizationReadWriteIntTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
import org.opensearch.action.admin.indices.refresh.RefreshRequest;
2929
import org.opensearch.action.admin.indices.settings.put.UpdateSettingsRequest;
3030
import org.opensearch.common.settings.Settings;
31-
import org.opensearch.test.framework.TestAlias;
32-
import org.opensearch.test.framework.TestIndex;
33-
import org.opensearch.test.framework.TestIndexOrAliasOrDatastream;
3431
import org.opensearch.test.framework.TestSecurityConfig;
3532
import org.opensearch.test.framework.TestSecurityConfig.Role;
3633
import org.opensearch.test.framework.cluster.LocalCluster;
3734
import org.opensearch.test.framework.cluster.TestRestClient;
3835
import org.opensearch.test.framework.cluster.TestRestClient.HttpResponse;
36+
import org.opensearch.test.framework.data.TestAlias;
37+
import org.opensearch.test.framework.data.TestIndex;
38+
import org.opensearch.test.framework.data.TestIndexOrAliasOrDatastream;
3939
import org.opensearch.test.framework.matcher.RestIndexMatchers;
4040
import org.opensearch.transport.client.Client;
4141

src/integrationTest/java/org/opensearch/security/privileges/int_tests/SnapshotAuthorizationIntTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
import org.junit.runner.RunWith;
2626

2727
import org.opensearch.action.admin.indices.refresh.RefreshRequest;
28-
import org.opensearch.test.framework.TestIndex;
29-
import org.opensearch.test.framework.TestIndexOrAliasOrDatastream;
3028
import org.opensearch.test.framework.TestSecurityConfig;
3129
import org.opensearch.test.framework.cluster.LocalCluster;
3230
import org.opensearch.test.framework.cluster.TestRestClient;
31+
import org.opensearch.test.framework.data.TestIndex;
32+
import org.opensearch.test.framework.data.TestIndexOrAliasOrDatastream;
3333
import org.opensearch.test.framework.matcher.RestIndexMatchers;
3434

3535
import static org.hamcrest.MatcherAssert.assertThat;

src/integrationTest/java/org/opensearch/test/framework/TestSecurityConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
import org.opensearch.security.securityconf.impl.v7.RoleV7;
7373
import org.opensearch.security.support.ConfigConstants;
7474
import org.opensearch.test.framework.cluster.OpenSearchClientProvider.UserCredentialsHolder;
75+
import org.opensearch.test.framework.data.TestIndex;
7576
import org.opensearch.test.framework.matcher.RestIndexMatchers;
7677
import org.opensearch.transport.client.Client;
7778

src/integrationTest/java/org/opensearch/test/framework/cluster/LocalCluster.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@
5858
import org.opensearch.test.framework.AuthFailureListeners;
5959
import org.opensearch.test.framework.AuthzDomain;
6060
import org.opensearch.test.framework.OnBehalfOfConfig;
61-
import org.opensearch.test.framework.TestAlias;
62-
import org.opensearch.test.framework.TestComponentTemplate;
63-
import org.opensearch.test.framework.TestDataStream;
64-
import org.opensearch.test.framework.TestIndex;
65-
import org.opensearch.test.framework.TestIndexTemplate;
6661
import org.opensearch.test.framework.TestSecurityConfig;
6762
import org.opensearch.test.framework.TestSecurityConfig.Role;
6863
import org.opensearch.test.framework.XffConfig;
6964
import org.opensearch.test.framework.audit.TestRuleAuditLogSink;
7065
import org.opensearch.test.framework.certificate.CertificateData;
7166
import org.opensearch.test.framework.certificate.TestCertificates;
67+
import org.opensearch.test.framework.data.TestAlias;
68+
import org.opensearch.test.framework.data.TestComponentTemplate;
69+
import org.opensearch.test.framework.data.TestDataStream;
70+
import org.opensearch.test.framework.data.TestIndex;
71+
import org.opensearch.test.framework.data.TestIndexTemplate;
7272
import org.opensearch.transport.client.Client;
7373

7474
/**

0 commit comments

Comments
 (0)