Remove suppresions for "unchecked" for hamcrest varargs methods Backport(41528) #42749
In hamcrest 2.1 warnings for unchecked varargs were fixed by hamcrest using @SafeVarargs for those matchers where this warning occurred. This PR is aimed to remove these annotations when Matchers.contains ,Matchers.containsInAnyOrder or Matchers.hasItems was used backport #41528
This commit is contained in:
parent
01446ff4bd
commit
d5061a151a
|
@ -291,7 +291,6 @@ public class BulkProcessorIT extends ESRestHighLevelClientTestCase {
|
|||
assertMultiGetResponse(highLevelClient().mget(multiGetRequest, RequestOptions.DEFAULT), testDocs);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testGlobalParametersAndSingleRequest() throws Exception {
|
||||
createIndexWithMultipleShards("test");
|
||||
|
||||
|
@ -326,7 +325,6 @@ public class BulkProcessorIT extends ESRestHighLevelClientTestCase {
|
|||
assertThat(blogs, everyItem(hasProperty(fieldFromSource("fieldNameXYZ"), equalTo("valueXYZ"))));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testGlobalParametersAndBulkProcessor() throws Exception {
|
||||
createIndexWithMultipleShards("test");
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ import static org.hamcrest.Matchers.nullValue;
|
|||
|
||||
public class BulkRequestWithGlobalParametersIT extends ESRestHighLevelClientTestCase {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testGlobalPipelineOnBulkRequest() throws IOException {
|
||||
createFieldAddingPipleine("xyz", "fieldNameXYZ", "valueXYZ");
|
||||
|
||||
|
@ -83,7 +82,6 @@ public class BulkRequestWithGlobalParametersIT extends ESRestHighLevelClientTest
|
|||
assertThat(hits, everyItem(hasProperty(fieldFromSource("fieldXYZ"), nullValue())));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testMixPipelineOnRequestAndGlobal() throws IOException {
|
||||
createFieldAddingPipleine("globalId", "fieldXYZ", "valueXYZ");
|
||||
createFieldAddingPipleine("perIndexId", "someNewField", "someValue");
|
||||
|
@ -153,7 +151,6 @@ public class BulkRequestWithGlobalParametersIT extends ESRestHighLevelClientTest
|
|||
assertThat(hits, everyItem(hasType("global_type")));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testTypeGlobalAndPerRequest() throws IOException {
|
||||
BulkRequest request = new BulkRequest(null, "global_type");
|
||||
request.add(new IndexRequest("index1", "local_type", "1")
|
||||
|
@ -171,7 +168,6 @@ public class BulkRequestWithGlobalParametersIT extends ESRestHighLevelClientTest
|
|||
.and(hasType("global_type"))));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testGlobalRouting() throws IOException {
|
||||
createIndexWithMultipleShards("index");
|
||||
BulkRequest request = new BulkRequest(null);
|
||||
|
@ -189,7 +185,6 @@ public class BulkRequestWithGlobalParametersIT extends ESRestHighLevelClientTest
|
|||
assertThat(hits, containsInAnyOrder(hasId("1"), hasId("2")));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testMixLocalAndGlobalRouting() throws IOException {
|
||||
BulkRequest request = new BulkRequest(null);
|
||||
request.routing("globalRouting");
|
||||
|
|
|
@ -67,7 +67,6 @@ public class JsonLoggerTests extends ESTestCase {
|
|||
super.tearDown();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testJsonLayout() throws IOException {
|
||||
final Logger testLogger = LogManager.getLogger("test");
|
||||
|
||||
|
@ -90,7 +89,6 @@ public class JsonLoggerTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testPrefixLoggerInJson() throws IOException {
|
||||
Logger shardIdLogger = Loggers.getLogger("shardIdLogger", ShardId.fromString("[indexName][123]"));
|
||||
shardIdLogger.info("This is an info message with a shardId");
|
||||
|
|
|
@ -442,7 +442,6 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
return StreamsUtils.copyToStringFromClasspath("/org/elasticsearch/xpack/restart/" + watch);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void assertOldTemplatesAreDeleted() throws IOException {
|
||||
Map<String, Object> templates = entityAsMap(client().performRequest(new Request("GET", "/_template")));
|
||||
assertThat(templates.keySet(), not(hasItems(is("watches"), startsWith("watch-history"), is("triggered_watches"))));
|
||||
|
|
|
@ -23,7 +23,6 @@ import static org.hamcrest.Matchers.hasItem;
|
|||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class SearchGroupsResolverTests extends GroupsResolverTestCase {
|
||||
|
||||
private static final String BRUCE_BANNER_DN = "uid=hulk,ou=people,dc=oldap,dc=test,dc=elasticsearch,dc=com";
|
||||
|
|
|
@ -35,7 +35,6 @@ public class ActiveDirectoryGroupsResolverTests extends GroupsResolverTestCase {
|
|||
}
|
||||
|
||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/35738")
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testResolveSubTree() throws Exception {
|
||||
Settings settings = Settings.builder()
|
||||
.put("xpack.security.authc.realms.active_directory.ad.group_search.scope", LdapSearchScope.SUB_TREE)
|
||||
|
|
|
@ -66,7 +66,6 @@ public class ActiveDirectorySessionFactoryTests extends AbstractActiveDirectoryT
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testAdAuth() throws Exception {
|
||||
RealmConfig config = configureRealm("ad-test", buildAdSettings(AD_LDAP_URL, AD_DOMAIN, false));
|
||||
try (ActiveDirectorySessionFactory sessionFactory = getActiveDirectorySessionFactory(config, sslService, threadPool)) {
|
||||
|
@ -101,7 +100,6 @@ public class ActiveDirectorySessionFactoryTests extends AbstractActiveDirectoryT
|
|||
return new RealmConfig(identifier, mergedSettings, env, new ThreadContext(globalSettings));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testNetbiosAuth() throws Exception {
|
||||
final String adUrl = randomFrom(AD_LDAP_URL, AD_LDAP_GC_URL);
|
||||
RealmConfig config = configureRealm("ad-test", buildAdSettings(adUrl, AD_DOMAIN, false));
|
||||
|
@ -139,7 +137,6 @@ public class ActiveDirectorySessionFactoryTests extends AbstractActiveDirectoryT
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testAuthenticate() throws Exception {
|
||||
Settings settings = buildAdSettings(REALM_ID, AD_LDAP_URL, AD_DOMAIN, "CN=Users,DC=ad,DC=test,DC=elasticsearch,DC=com",
|
||||
LdapSearchScope.ONE_LEVEL, false);
|
||||
|
@ -163,7 +160,6 @@ public class ActiveDirectorySessionFactoryTests extends AbstractActiveDirectoryT
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testAuthenticateBaseUserSearch() throws Exception {
|
||||
Settings settings = buildAdSettings(REALM_ID, AD_LDAP_URL, AD_DOMAIN,
|
||||
"CN=Bruce Banner, CN=Users,DC=ad,DC=test,DC=elasticsearch,DC=com", LdapSearchScope.BASE, false);
|
||||
|
@ -208,7 +204,6 @@ public class ActiveDirectorySessionFactoryTests extends AbstractActiveDirectoryT
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testAuthenticateWithUserPrincipalName() throws Exception {
|
||||
Settings settings = buildAdSettings(REALM_ID, AD_LDAP_URL, AD_DOMAIN, "CN=Users,DC=ad,DC=test,DC=elasticsearch,DC=com",
|
||||
LdapSearchScope.ONE_LEVEL, false);
|
||||
|
@ -229,7 +224,6 @@ public class ActiveDirectorySessionFactoryTests extends AbstractActiveDirectoryT
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testAuthenticateWithSAMAccountName() throws Exception {
|
||||
Settings settings = buildAdSettings(REALM_ID, AD_LDAP_URL, AD_DOMAIN, "CN=Users,DC=ad,DC=test,DC=elasticsearch,DC=com",
|
||||
LdapSearchScope.ONE_LEVEL, false);
|
||||
|
@ -251,7 +245,6 @@ public class ActiveDirectorySessionFactoryTests extends AbstractActiveDirectoryT
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testCustomUserFilter() throws Exception {
|
||||
Settings settings = Settings.builder()
|
||||
.put(buildAdSettings(REALM_ID, AD_LDAP_URL, AD_DOMAIN, "CN=Users,DC=ad,DC=test,DC=elasticsearch,DC=com",
|
||||
|
@ -275,7 +268,6 @@ public class ActiveDirectorySessionFactoryTests extends AbstractActiveDirectoryT
|
|||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testStandardLdapConnection() throws Exception {
|
||||
String groupSearchBase = "DC=ad,DC=test,DC=elasticsearch,DC=com";
|
||||
String userTemplate = "CN={0},CN=Users,DC=ad,DC=test,DC=elasticsearch,DC=com";
|
||||
|
@ -341,7 +333,6 @@ public class ActiveDirectorySessionFactoryTests extends AbstractActiveDirectoryT
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testStandardLdapWithAttributeGroups() throws Exception {
|
||||
String userTemplate = "CN={0},CN=Users,DC=ad,DC=test,DC=elasticsearch,DC=com";
|
||||
Settings settings = LdapTestCase.buildLdapSettings(new String[]{AD_LDAP_URL}, userTemplate, false);
|
||||
|
|
|
@ -29,7 +29,6 @@ public class UserAttributeGroupsResolverTests extends GroupsResolverTestCase {
|
|||
public static final String BRUCE_BANNER_DN = "cn=Bruce Banner,CN=Users,DC=ad,DC=test,DC=elasticsearch,DC=com";
|
||||
private static final RealmConfig.RealmIdentifier REALM_ID = new RealmConfig.RealmIdentifier("ldap", "realm1");
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testResolve() throws Exception {
|
||||
//falling back on the 'memberOf' attribute
|
||||
UserAttributeGroupsResolver resolver = new UserAttributeGroupsResolver(config(REALM_ID, Settings.EMPTY));
|
||||
|
@ -42,7 +41,6 @@ public class UserAttributeGroupsResolverTests extends GroupsResolverTestCase {
|
|||
containsString("Philanthropists")));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testResolveFromPreloadedAttributes() throws Exception {
|
||||
SearchRequest preSearch = new SearchRequest(BRUCE_BANNER_DN, SearchScope.BASE, LdapUtils.OBJECT_CLASS_PRESENCE_FILTER, "memberOf");
|
||||
final Collection<Attribute> attributes = ldapConnection.searchForEntry(preSearch).getAttributes();
|
||||
|
@ -57,7 +55,6 @@ public class UserAttributeGroupsResolverTests extends GroupsResolverTestCase {
|
|||
containsString("Philanthropists")));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testResolveCustomGroupAttribute() throws Exception {
|
||||
Settings settings = Settings.builder()
|
||||
.put("user_group_attribute", "seeAlso")
|
||||
|
|
Loading…
Reference in New Issue