Search in sources :

Example 1 with CoordinatorAdminClient

use of voldemort.restclient.admin.CoordinatorAdminClient in project voldemort by voldemort.

the class CoordinatorAdminClientTest method setUp.

@Before
public void setUp() throws Exception {
    final int numServers = 1;
    servers = new VoldemortServer[numServers];
    int[][] partitionMap = { { 0, 1, 2, 3, 4, 5, 6, 7 } };
    try {
        // Setup the cluster
        cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, true, null, storesXmlfile, new Properties());
    } catch (IOException e) {
        fail("Failure to setup the cluster");
    }
    socketUrl = servers[0].getIdentityNode().getSocketUrl().toString();
    List<String> bootstrapUrls = new ArrayList<String>();
    bootstrapUrls.add(socketUrl);
    // create a copy of the config file in a temp directory and work on that
    File src = new File(FAT_CLIENT_CONFIG_PATH_ORIGINAL);
    COPY_Of_FAT_CLIENT_CONFIG_FILE = new File(TestUtils.createTempDir(), "clientConfigs_" + System.currentTimeMillis() + ".avro");
    FileUtils.copyFile(src, COPY_Of_FAT_CLIENT_CONFIG_FILE);
    // Setup the Coordinator
    CoordinatorConfig coordinatorConfig = new CoordinatorConfig();
    coordinatorConfig.setBootstrapURLs(bootstrapUrls).setCoordinatorCoreThreads(100).setCoordinatorMaxThreads(100).setFatClientConfigPath(COPY_Of_FAT_CLIENT_CONFIG_FILE.getAbsolutePath()).setServerPort(SERVER_PORT).setAdminPort(ADMIN_PORT);
    try {
        coordinator = new CoordinatorServer(coordinatorConfig);
        coordinator.start();
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failure to start the Coordinator");
    }
    Properties props = new Properties();
    props.setProperty(ClientConfig.BOOTSTRAP_URLS_PROPERTY, BOOTSTRAP_URL);
    props.setProperty(ClientConfig.ROUTING_TIMEOUT_MS_PROPERTY, "1500");
    this.adminClient = new CoordinatorAdminClient(new RESTClientConfig(props));
}
Also used : CoordinatorServer(voldemort.rest.coordinator.CoordinatorServer) ArrayList(java.util.ArrayList) IOException(java.io.IOException) Properties(java.util.Properties) CoordinatorAdminClient(voldemort.restclient.admin.CoordinatorAdminClient) IOException(java.io.IOException) RESTClientConfig(voldemort.restclient.RESTClientConfig) CoordinatorConfig(voldemort.rest.coordinator.config.CoordinatorConfig) File(java.io.File) Before(org.junit.Before)

Example 2 with CoordinatorAdminClient

use of voldemort.restclient.admin.CoordinatorAdminClient in project voldemort by voldemort.

the class CoordinatorAdminToolTest method setUp.

@Before
public void setUp() throws Exception {
    final int numServers = 1;
    servers = new VoldemortServer[numServers];
    int[][] partitionMap = { { 0, 1, 2, 3, 4, 5, 6, 7 } };
    try {
        // Setup the cluster
        cluster = ServerTestUtils.startVoldemortCluster(numServers, servers, partitionMap, socketStoreFactory, true, null, storesXmlfile, new Properties());
    } catch (IOException e) {
        fail("Failure to setup the cluster");
    }
    socketUrl = servers[0].getIdentityNode().getSocketUrl().toString();
    List<String> bootstrapUrls = new ArrayList<String>();
    bootstrapUrls.add(socketUrl);
    // create a copy of the config file in a temp directory and work on that
    File src = new File(FAT_CLIENT_CONFIG_PATH_ORIGINAL);
    COPY_OF_FAT_CLIENT_CONFIG_FILE = new File(TestUtils.createTempDir(), "clientConfigs_" + System.currentTimeMillis() + ".avro");
    FileUtils.copyFile(src, COPY_OF_FAT_CLIENT_CONFIG_FILE);
    // Setup the Coordinator
    CoordinatorConfig coordinatorConfig = new CoordinatorConfig();
    coordinatorConfig.setBootstrapURLs(bootstrapUrls).setCoordinatorCoreThreads(100).setCoordinatorMaxThreads(100).setFatClientConfigPath(COPY_OF_FAT_CLIENT_CONFIG_FILE.getAbsolutePath()).setServerPort(SERVER_PORT).setAdminPort(ADMIN_PORT);
    try {
        coordinator = new CoordinatorServer(coordinatorConfig);
        coordinator.start();
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failure to start the Coordinator");
    }
    Properties props = new Properties();
    props.setProperty(ClientConfig.BOOTSTRAP_URLS_PROPERTY, BOOTSTRAP_URL);
    props.setProperty(ClientConfig.ROUTING_TIMEOUT_MS_PROPERTY, "1500");
    this.adminClient = new CoordinatorAdminClient(new RESTClientConfig(props));
}
Also used : CoordinatorServer(voldemort.rest.coordinator.CoordinatorServer) ArrayList(java.util.ArrayList) IOException(java.io.IOException) Properties(java.util.Properties) CoordinatorAdminClient(voldemort.restclient.admin.CoordinatorAdminClient) IOException(java.io.IOException) RESTClientConfig(voldemort.restclient.RESTClientConfig) CoordinatorConfig(voldemort.rest.coordinator.config.CoordinatorConfig) File(java.io.File) Before(org.junit.Before)

Aggregations

File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Properties (java.util.Properties)2 Before (org.junit.Before)2 CoordinatorServer (voldemort.rest.coordinator.CoordinatorServer)2 CoordinatorConfig (voldemort.rest.coordinator.config.CoordinatorConfig)2 RESTClientConfig (voldemort.restclient.RESTClientConfig)2 CoordinatorAdminClient (voldemort.restclient.admin.CoordinatorAdminClient)2