@Override @Before public void setUp() throws IOException { cluster = ServerTestUtils.getLocalCluster(2, new int[][] {{0, 1, 2, 3}, {4, 5, 6, 7}}); servers = new VoldemortServer[2]; servers[0] = ServerTestUtils.startVoldemortServer( ServerTestUtils.createServerConfig( useNio, 0, TestUtils.createTempDir().getAbsolutePath(), null, storesXmlfile, new Properties()), cluster); servers[1] = ServerTestUtils.startVoldemortServer( ServerTestUtils.createServerConfig( useNio, 1, TestUtils.createTempDir().getAbsolutePath(), null, storesXmlfile, new Properties()), cluster); adminClient = ServerTestUtils.getAdminClient(cluster); }
// This method is susceptible to BindException issues due to TOCTOU // problem with getLocalCluster (which is used to construct cluster that is // passed in). // TODO: Refactor AbstractRebalanceTest to take advantage of // ServerTestUtils.startVoldemortCluster. @Override protected Cluster startServers( Cluster cluster, String storeXmlFile, List<Integer> nodeToStart, Map<String, String> configProps) throws IOException { for (int node : nodeToStart) { Properties properties = new Properties(); if (null != configProps) { for (Entry<String, String> property : configProps.entrySet()) { properties.put(property.getKey(), property.getValue()); } } VoldemortConfig config = ServerTestUtils.createServerConfig( useNio, node, TestUtils.createTempDir().getAbsolutePath(), null, storeXmlFile, properties); VoldemortServer server = ServerTestUtils.startVoldemortServer(socketStoreFactory, config, cluster); serverMap.put(node, server); } return cluster; }
private AbstractSocketService getAdminServer( Node node, Cluster cluster, List<StoreDefinition> storeDefs, StorageEngine<ByteArray, byte[], byte[]> storageEngine) throws IOException { StoreRepository storeRepository = new StoreRepository(); storeRepository.addStorageEngine(storageEngine); storeRepository.addLocalStore(storageEngine); SocketRequestHandlerFactory requestHandlerFactory = new SocketRequestHandlerFactory( null, storeRepository, ServerTestUtils.createMetadataStore(cluster, storeDefs), ServerTestUtils.createServerConfig( useNio, 0, TestUtils.createTempDir().getAbsolutePath(), null, null, new Properties()), null, null, null, null); return ServerTestUtils.getSocketService( useNio, requestHandlerFactory, node.getAdminPort(), 2, 2, 10000); }