[TEST] add SuppresForbidden annotation for client project

This commit is contained in:
javanna 2016-06-09 17:39:52 +02:00 committed by Luca Cavanna
parent 33bdab1a5a
commit bd773359d5
3 changed files with 39 additions and 3 deletions

View File

@ -53,10 +53,11 @@ forbiddenApisMain {
//excludes don't seem to work though and we don't want to have our own @SuppressForbidden
forbiddenApisTest.enabled=false
//forbiddenApisTest {
forbiddenApisTest {
//client does not depend on core, so only jdk signatures should be checked
//signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
//}
signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
suppressAnnotations = ['**.SuppressForbidden']
}
//JarHell is part of es core, which we don't want to pull in
jarHell.enabled=false

View File

@ -56,6 +56,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
* Integration test to check interaction between {@link RestClient} and {@link org.apache.http.client.HttpClient}.
* Works against a real http server, one single host.
*/
@SuppressForbidden(reason = "uses sun HttpServer")
public class RestClientIntegTests extends LuceneTestCase {
private static HttpServer httpServer;

View File

@ -0,0 +1,34 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.client;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation to suppress forbidden-apis errors inside a whole class, a method, or a field.
*/
@Retention(RetentionPolicy.CLASS)
@Target({ ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
public @interface SuppressForbidden {
String reason();
}