Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove suppresions for "unchecked" for hamcrest varargs methods #41528

Merged
merged 4 commits into from
May 28, 2019
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
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ public void testBulkProcessorConcurrentRequestsReadOnlyIndex() throws Exception
assertMultiGetResponse(highLevelClient().mget(multiGetRequest, RequestOptions.DEFAULT), testDocs);
}

@SuppressWarnings("unchecked")
public void testGlobalParametersAndSingleRequest() throws Exception {
createIndexWithMultipleShards("test");

Expand Down Expand Up @@ -326,7 +325,6 @@ public void testGlobalParametersAndSingleRequest() throws Exception {
assertThat(blogs, everyItem(hasProperty(fieldFromSource("fieldNameXYZ"), equalTo("valueXYZ"))));
}

@SuppressWarnings("unchecked")
public void testGlobalParametersAndBulkProcessor() throws Exception {
createIndexWithMultipleShards("test");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

public class BulkRequestWithGlobalParametersIT extends ESRestHighLevelClientTestCase {

@SuppressWarnings("unchecked")
public void testGlobalPipelineOnBulkRequest() throws IOException {
createFieldAddingPipleine("xyz", "fieldNameXYZ", "valueXYZ");

Expand Down Expand Up @@ -83,7 +82,6 @@ public void testPipelineOnRequestOverridesGlobalPipeline() throws IOException {
assertThat(hits, everyItem(hasProperty(fieldFromSource("fieldXYZ"), nullValue())));
}

@SuppressWarnings("unchecked")
public void testMixPipelineOnRequestAndGlobal() throws IOException {
createFieldAddingPipleine("globalId", "fieldXYZ", "valueXYZ");
createFieldAddingPipleine("perIndexId", "someNewField", "someValue");
Expand Down Expand Up @@ -153,7 +151,6 @@ public void testGlobalType() throws IOException {
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")
Expand All @@ -171,7 +168,6 @@ public void testTypeGlobalAndPerRequest() throws IOException {
.and(hasType("global_type"))));
}

@SuppressWarnings("unchecked")
public void testGlobalRouting() throws IOException {
createIndexWithMultipleShards("index");
BulkRequest request = new BulkRequest(null);
Expand All @@ -189,7 +185,6 @@ public void testGlobalRouting() throws IOException {
assertThat(hits, containsInAnyOrder(hasId("1"), hasId("2")));
}

@SuppressWarnings("unchecked")
public void testMixLocalAndGlobalRouting() throws IOException {
BulkRequest request = new BulkRequest(null);
request.routing("globalRouting");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public void tearDown() throws Exception {
super.tearDown();
}

@SuppressWarnings("unchecked")
public void testJsonLayout() throws IOException {
final Logger testLogger = LogManager.getLogger("test");

Expand All @@ -90,7 +89,6 @@ public void testJsonLayout() throws IOException {
}
}

@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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ private String loadWatch(String watch) throws IOException {
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"))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public void setReferralFollowing() {
}

@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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public boolean enableWarningsCheck() {
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)) {
Expand Down Expand Up @@ -101,7 +100,6 @@ private RealmConfig configureRealm(String name, Settings settings) {
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));
Expand Down Expand Up @@ -139,7 +137,6 @@ public void testAdAuthAvengers() throws Exception {
}
}

@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);
Expand All @@ -163,7 +160,6 @@ public void testAuthenticate() throws Exception {
}
}

@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);
Expand Down Expand Up @@ -208,7 +204,6 @@ public void testAuthenticateBaseGroupSearch() throws Exception {
}
}

@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);
Expand All @@ -229,7 +224,6 @@ public void testAuthenticateWithUserPrincipalName() throws Exception {
}
}

@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);
Expand All @@ -251,7 +245,6 @@ public void testAuthenticateWithSAMAccountName() throws Exception {
}
}

@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",
Expand All @@ -275,7 +268,6 @@ public void testCustomUserFilter() throws Exception {
}


@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";
Expand Down Expand Up @@ -341,7 +333,6 @@ public void testHandlingLdapReferralErrors() throws Exception {
}
}

@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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -42,7 +41,6 @@ public void testResolve() throws Exception {
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();
Expand All @@ -57,7 +55,6 @@ public void testResolveFromPreloadedAttributes() throws Exception {
containsString("Philanthropists")));
}

@SuppressWarnings("unchecked")
public void testResolveCustomGroupAttribute() throws Exception {
Settings settings = Settings.builder()
.put("user_group_attribute", "seeAlso")
Expand Down