use of voldemort.restclient.R2Store in project voldemort by voldemort.
the class RestServerAPITest method oneTimeSetUp.
@BeforeClass
public static void oneTimeSetUp() {
voldemortConfig = VoldemortConfig.loadFromVoldemortHome("config/single_node_rest_server/");
key = new ByteArray("key1".getBytes());
vectorClock = new VectorClock();
vectorClock.incrementVersion(voldemortConfig.getNodeId(), System.currentTimeMillis());
value = new Versioned<byte[]>("value1".getBytes(), vectorClock);
server = new VoldemortServer(voldemortConfig);
if (!server.isStarted())
server.start();
logger.info("********************Starting REST Server********************");
restClientConfig = new RESTClientConfig();
restClientConfig.setHttpBootstrapURL("http://localhost:8085").setTimeoutMs(1500, TimeUnit.MILLISECONDS).setMaxR2ConnectionPoolSize(100);
clientFactory = new HttpClientFactory();
Map<String, String> properties = new HashMap<String, String>();
properties.put(HttpClientFactory.HTTP_POOL_SIZE, Integer.toString(restClientConfig.getMaxR2ConnectionPoolSize()));
transportClient = clientFactory.getClient(properties);
r2store = new R2Store("test", restClientConfig.getHttpBootstrapURL(), "2", transportClient, restClientConfig, 0);
store = r2store;
deleteCreatedKeys(key);
}
use of voldemort.restclient.R2Store in project voldemort by voldemort.
the class RestServiceR2StoreTest method setUp.
@Override
@Before
public void setUp() throws IOException {
logger.info(" Initial SEED used for random number generator: " + TestUtils.SEED);
final int numServers = 1;
this.nodeId = 0;
servers = new VoldemortServer[numServers];
// Setup the cluster
Properties props = new Properties();
props.setProperty("rest.enable", "true");
props.setProperty("http.enable", "true");
Cluster customCluster = clusterMapper.readCluster(new FileReader(clusterXmlFile), false);
logger.info(" Node " + customCluster.getNodes().iterator().next().getStateString());
cluster = ServerTestUtils.startVoldemortCluster(servers, null, clusterXmlFile, storesXmlfile, props, customCluster);
// Creating R2Store
RESTClientConfig restClientConfig = new RESTClientConfig();
restClientConfig.setHttpBootstrapURL("http://localhost:" + cluster.getNodeById(0).getRestPort()).setTimeoutMs(10000, TimeUnit.MILLISECONDS).setMaxR2ConnectionPoolSize(100);
clientFactory = new HttpClientFactory();
Map<String, String> properties = new HashMap<String, String>();
properties.put(HttpClientFactory.HTTP_POOL_SIZE, Integer.toString(restClientConfig.getMaxR2ConnectionPoolSize()));
TransportClient transportClient = clientFactory.getClient(properties);
R2Store r2Store = new R2Store(STORE_NAME, restClientConfig.getHttpBootstrapURL(), "0", transportClient, restClientConfig, 0);
store = r2Store;
}
Aggregations