|
27 | 27 | import org.apache.lucene.search.Sort; |
28 | 28 | import org.apache.lucene.util.IOUtils; |
29 | 29 | import org.apache.lucene.util.LuceneTestCase; |
30 | | -import org.apache.lucene.util.TestUtil; |
31 | 30 | import org.elasticsearch.ElasticsearchException; |
32 | 31 | import org.elasticsearch.ExceptionsHelper; |
33 | 32 | import org.elasticsearch.action.ActionListener; |
|
141 | 140 | import org.junit.BeforeClass; |
142 | 141 |
|
143 | 142 | import java.io.IOException; |
144 | | -import java.io.InputStream; |
145 | 143 | import java.lang.annotation.Annotation; |
146 | 144 | import java.lang.annotation.ElementType; |
147 | 145 | import java.lang.annotation.Inherited; |
|
151 | 149 | import java.net.InetAddress; |
152 | 150 | import java.net.InetSocketAddress; |
153 | 151 | import java.net.URL; |
154 | | -import java.nio.file.DirectoryStream; |
155 | 152 | import java.nio.file.Files; |
156 | 153 | import java.nio.file.Path; |
157 | 154 | import java.util.ArrayList; |
@@ -2113,48 +2110,7 @@ protected String routingKeyForShard(String index, int shard) { |
2113 | 2110 | return internalCluster().routingKeyForShard(resolveIndex(index), shard, random()); |
2114 | 2111 | } |
2115 | 2112 |
|
2116 | | - /** |
2117 | | - * Return settings that could be used to start a node that has the given zipped home directory. |
2118 | | - */ |
2119 | | - protected Settings prepareBackwardsDataDir(Path backwardsIndex, Object... settings) throws IOException { |
2120 | | - Path indexDir = createTempDir(); |
2121 | | - Path dataDir = indexDir.resolve("data"); |
2122 | | - try (InputStream stream = Files.newInputStream(backwardsIndex)) { |
2123 | | - TestUtil.unzip(stream, indexDir); |
2124 | | - } |
2125 | | - assertTrue(Files.exists(dataDir)); |
2126 | | - |
2127 | | - // list clusters in the datapath, ignoring anything from extrasfs |
2128 | | - final Path[] list; |
2129 | | - try (DirectoryStream<Path> stream = Files.newDirectoryStream(dataDir)) { |
2130 | | - List<Path> dirs = new ArrayList<>(); |
2131 | | - for (Path p : stream) { |
2132 | | - if (!p.getFileName().toString().startsWith("extra")) { |
2133 | | - dirs.add(p); |
2134 | | - } |
2135 | | - } |
2136 | | - list = dirs.toArray(new Path[0]); |
2137 | | - } |
2138 | | - |
2139 | | - if (list.length != 1) { |
2140 | | - StringBuilder builder = new StringBuilder("Backwards index must contain exactly one cluster\n"); |
2141 | | - for (Path line : list) { |
2142 | | - builder.append(line.toString()).append('\n'); |
2143 | | - } |
2144 | | - throw new IllegalStateException(builder.toString()); |
2145 | | - } |
2146 | | - Path src = list[0].resolve(NodeEnvironment.NODES_FOLDER); |
2147 | | - Path dest = dataDir.resolve(NodeEnvironment.NODES_FOLDER); |
2148 | | - assertTrue(Files.exists(src)); |
2149 | | - Files.move(src, dest); |
2150 | | - assertFalse(Files.exists(src)); |
2151 | | - assertTrue(Files.exists(dest)); |
2152 | | - Settings.Builder builder = Settings.builder() |
2153 | | - .put(settings) |
2154 | | - .put(Environment.PATH_DATA_SETTING.getKey(), dataDir.toAbsolutePath()); |
2155 | 2113 |
|
2156 | | - return builder.build(); |
2157 | | - } |
2158 | 2114 |
|
2159 | 2115 | @Override |
2160 | 2116 | protected NamedXContentRegistry xContentRegistry() { |
|
0 commit comments