Run tests through forbidden-apis.
This commit is contained in:
parent
34fb5e48e2
commit
2663d04a96
|
@ -0,0 +1,3 @@
|
|||
@defaultMessage Convert to URI
|
||||
java.net.URL#getPath()
|
||||
java.net.URL#getFile()
|
5
pom.xml
5
pom.xml
|
@ -1077,6 +1077,7 @@
|
|||
</bundledSignatures>
|
||||
<signaturesFiles>
|
||||
<signaturesFile>core-signatures.txt</signaturesFile>
|
||||
<signaturesFile>all-signatures.txt</signaturesFile>
|
||||
</signaturesFiles>
|
||||
<signatures>${forbidden.signatures}</signatures>
|
||||
</configuration>
|
||||
|
@ -1098,6 +1099,10 @@
|
|||
<bundledSignature>jdk-unsafe</bundledSignature>
|
||||
<bundledSignature>jdk-deprecated</bundledSignature>
|
||||
</bundledSignatures>
|
||||
<signaturesFiles>
|
||||
<signaturesFile>test-signatures.txt</signaturesFile>
|
||||
<signaturesFile>all-signatures.txt</signaturesFile>
|
||||
</signaturesFiles>
|
||||
<signatures>${forbidden.test.signatures}</signatures>
|
||||
</configuration>
|
||||
<phase>test-compile</phase>
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.junit.Test;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.*;
|
||||
|
@ -73,8 +73,8 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
|
|||
public void testLocalPluginInstallSingleFolder() throws Exception {
|
||||
//When we have only a folder in top-level (no files either) we remove that folder while extracting
|
||||
String pluginName = "plugin-test";
|
||||
URL url = PluginManagerTests.class.getResource("plugin_single_folder.zip");
|
||||
downloadAndExtract(pluginName, "file://" + url.getFile());
|
||||
URI uri = URI.create(PluginManagerTests.class.getResource("plugin_single_folder.zip").toString());
|
||||
downloadAndExtract(pluginName, "file://" + uri.getPath());
|
||||
|
||||
cluster().startNode(SETTINGS);
|
||||
|
||||
|
@ -87,8 +87,8 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
|
|||
//When we have only a folder in top-level (no files either) but it's called _site, we make it work
|
||||
//we can either remove the folder while extracting and then re-add it manually or just leave it as it is
|
||||
String pluginName = "plugin-test";
|
||||
URL url = PluginManagerTests.class.getResource("plugin_folder_site.zip");
|
||||
downloadAndExtract(pluginName, "file://" + url.getFile());
|
||||
URI uri = URI.create(PluginManagerTests.class.getResource("plugin_folder_site.zip").toString());
|
||||
downloadAndExtract(pluginName, "file://" + uri.getPath());
|
||||
|
||||
String nodeName = cluster().startNode(SETTINGS);
|
||||
|
||||
|
@ -100,8 +100,8 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
|
|||
public void testLocalPluginWithoutFolders() throws Exception {
|
||||
//When we don't have folders at all in the top-level, but only files, we don't modify anything
|
||||
String pluginName = "plugin-test";
|
||||
URL url = PluginManagerTests.class.getResource("plugin_without_folders.zip");
|
||||
downloadAndExtract(pluginName, "file://" + url.getFile());
|
||||
URI uri = URI.create(PluginManagerTests.class.getResource("plugin_without_folders.zip").toString());
|
||||
downloadAndExtract(pluginName, "file://" + uri.getPath());
|
||||
|
||||
cluster().startNode(SETTINGS);
|
||||
|
||||
|
@ -113,8 +113,8 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
|
|||
public void testLocalPluginFolderAndFile() throws Exception {
|
||||
//When we have a single top-level folder but also files in the top-level, we don't modify anything
|
||||
String pluginName = "plugin-test";
|
||||
URL url = PluginManagerTests.class.getResource("plugin_folder_file.zip");
|
||||
downloadAndExtract(pluginName, "file://" + url.getFile());
|
||||
URI uri = URI.create(PluginManagerTests.class.getResource("plugin_folder_file.zip").toString());
|
||||
downloadAndExtract(pluginName, "file://" + uri.getPath());
|
||||
|
||||
cluster().startNode(SETTINGS);
|
||||
|
||||
|
@ -125,8 +125,8 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
|
|||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testSitePluginWithSourceThrows() throws Exception {
|
||||
String pluginName = "plugin-with-source";
|
||||
URL url = PluginManagerTests.class.getResource("plugin_with_sourcefiles.zip");
|
||||
downloadAndExtract(pluginName, "file://" + url.getFile());
|
||||
URI uri = URI.create(PluginManagerTests.class.getResource("plugin_with_sourcefiles.zip").toString());
|
||||
downloadAndExtract(pluginName, "file://" + uri.getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,7 +197,8 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void testInstallPlugin() throws IOException {
|
||||
PluginManager pluginManager = pluginManager("file://".concat(PluginManagerTests.class.getResource("plugin_with_classfile.zip").getFile()));
|
||||
PluginManager pluginManager = pluginManager("file://".concat(
|
||||
URI.create(PluginManagerTests.class.getResource("plugin_with_classfile.zip").toString()).getPath()));
|
||||
|
||||
pluginManager.downloadAndExtract("plugin");
|
||||
File[] plugins = pluginManager.getListInstalledPlugins();
|
||||
|
@ -207,7 +208,8 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void testInstallSitePlugin() throws IOException {
|
||||
PluginManager pluginManager = pluginManager("file://".concat(PluginManagerTests.class.getResource("plugin_without_folders.zip").getFile()));
|
||||
PluginManager pluginManager = pluginManager("file://".concat(
|
||||
URI.create(PluginManagerTests.class.getResource("plugin_without_folders.zip").toString()).getPath()));
|
||||
|
||||
pluginManager.downloadAndExtract("plugin-site");
|
||||
File[] plugins = pluginManager.getListInstalledPlugins();
|
||||
|
@ -301,13 +303,16 @@ public class PluginManagerTests extends ElasticsearchIntegrationTest {
|
|||
@Test
|
||||
public void testRemovePlugin() throws Exception {
|
||||
// We want to remove plugin with plugin short name
|
||||
singlePluginInstallAndRemove("plugintest", "file://".concat(PluginManagerTests.class.getResource("plugin_without_folders.zip").getFile()));
|
||||
singlePluginInstallAndRemove("plugintest", "file://".concat(
|
||||
URI.create(PluginManagerTests.class.getResource("plugin_without_folders.zip").toString()).getPath()));
|
||||
|
||||
// We want to remove plugin with groupid/artifactid/version form
|
||||
singlePluginInstallAndRemove("groupid/plugintest/1.0.0", "file://".concat(PluginManagerTests.class.getResource("plugin_without_folders.zip").getFile()));
|
||||
singlePluginInstallAndRemove("groupid/plugintest/1.0.0", "file://".concat(
|
||||
URI.create(PluginManagerTests.class.getResource("plugin_without_folders.zip").toString()).getPath()));
|
||||
|
||||
// We want to remove plugin with groupid/artifactid form
|
||||
singlePluginInstallAndRemove("groupid/plugintest", "file://".concat(PluginManagerTests.class.getResource("plugin_without_folders.zip").getFile()));
|
||||
singlePluginInstallAndRemove("groupid/plugintest", "file://".concat(
|
||||
URI.create(PluginManagerTests.class.getResource("plugin_without_folders.zip").toString()).getPath()));
|
||||
}
|
||||
|
||||
@Test(expected = ElasticsearchIllegalArgumentException.class)
|
||||
|
|
Loading…
Reference in New Issue