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