use of com.github.ambry.rest.RestServer in project ambry by linkedin.
the class FrontendIntegrationTest method setup.
/**
* Sets up an Ambry frontend server.
* @throws Exception
*/
@BeforeClass
public static void setup() throws Exception {
ambryRestServer = new RestServer(FRONTEND_VERIFIABLE_PROPS, CLUSTER_MAP, new LoggingNotificationSystem(), SSLFactory.getNewInstance(new SSLConfig(FRONTEND_VERIFIABLE_PROPS)));
ambryRestServer.start();
plaintextNettyClient = new NettyClient("localhost", PLAINTEXT_SERVER_PORT, null);
sslNettyClient = new NettyClient("localhost", SSL_SERVER_PORT, SSLFactory.getNewInstance(new SSLConfig(SSL_CLIENT_VERIFIABLE_PROPS)));
}
use of com.github.ambry.rest.RestServer in project ambry by linkedin.
the class FrontendIntegrationTest method disableUndeleteTest.
/**
* Test when the undelete is disabled.
*/
@Test
public void disableUndeleteTest() throws Exception {
assumeTrue(!enableUndeleteTested);
enableUndeleteTested = true;
File trustStoreFile = File.createTempFile("truststore", ".jks");
trustStoreFile.deleteOnExit();
VerifiableProperties vprop = buildFrontendVProps(trustStoreFile, false, PLAINTEXT_SERVER_PORT + 100, SSL_SERVER_PORT + 100);
RestServer ambryRestServer = new RestServer(vprop, CLUSTER_MAP, new LoggingNotificationSystem(), SSLFactory.getNewInstance(new SSLConfig(vprop)));
ambryRestServer.start();
NettyClient plaintextNettyClient = new NettyClient("localhost", PLAINTEXT_SERVER_PORT + 100, null);
NettyClient sslNettyClient = new NettyClient("localhost", SSL_SERVER_PORT + 100, SSLFactory.getNewInstance(new SSLConfig(SSL_CLIENT_VERIFIABLE_PROPS)));
NettyClient nettyClient = useSSL ? sslNettyClient : plaintextNettyClient;
String blobId = "randomblobid";
HttpHeaders headers = new DefaultHttpHeaders();
headers.set(RestUtils.Headers.BLOB_ID, addClusterPrefix ? "/" + CLUSTER_NAME + blobId : blobId);
headers.set(RestUtils.Headers.SERVICE_ID, "updateBlobTtlAndVerify");
FullHttpRequest httpRequest = buildRequest(HttpMethod.PUT, "/" + Operations.UNDELETE, headers, null);
ResponseParts responseParts = nettyClient.sendRequest(httpRequest, null, null).get();
HttpResponse response = getHttpResponse(responseParts);
assertEquals("Unexpected response status", HttpResponseStatus.BAD_REQUEST, response.status());
plaintextNettyClient.close();
sslNettyClient.close();
ambryRestServer.shutdown();
}
use of com.github.ambry.rest.RestServer in project ambry by linkedin.
the class FrontendQuotaIntegrationTest method setup.
/**
* Sets up an Ambry frontend server.
* @throws Exception
*/
@Before
public void setup() throws Exception {
ACCOUNT = ACCOUNT_SERVICE.createAndAddRandomAccount(QuotaResourceType.ACCOUNT);
CONTAINER = ACCOUNT.getContainerById(Container.DEFAULT_PUBLIC_CONTAINER_ID);
VerifiableProperties quotaProps = buildFrontendVPropsForQuota(TRUST_STORE_FILE, true, quotaMode, ACCOUNT, throttleRequest);
ambryRestServer = new RestServer(quotaProps, CLUSTER_MAP, new LoggingNotificationSystem(), SSLFactory.getNewInstance(new SSLConfig(FRONTEND_VERIFIABLE_PROPS)));
ambryRestServer.start();
this.frontendConfig = FRONTEND_CONFIG;
this.nettyClient = new NettyClient("localhost", PLAINTEXT_SERVER_PORT, null);
}
Aggregations