Search in sources :

Example 1 with RestRequestService

use of com.github.ambry.rest.RestRequestService in project ambry by linkedin.

the class FrontendRestRequestServiceFactoryTest method getFrontendRestRequestServiceTest.

/**
 * Tests the instantiation of an {@link FrontendRestRequestService} instance through the
 * {@link FrontendRestRequestServiceFactory}.
 * @throws Exception
 */
@Test
public void getFrontendRestRequestServiceTest() throws Exception {
    // dud properties. server should pick up defaults
    JSONObject jsonObject = new JSONObject().put("POST", "http://uploadUrl:15158").put("GET", "http://downloadUrl:15158");
    Properties properties = new Properties();
    CommonTestUtils.populateRequiredRouterProps(properties);
    properties.setProperty(FrontendConfig.URL_SIGNER_ENDPOINTS, jsonObject.toString());
    properties.setProperty("clustermap.cluster.name", "Cluster-Name");
    properties.setProperty("clustermap.datacenter.name", "Datacenter-Name");
    properties.setProperty("clustermap.host.name", "localhost");
    VerifiableProperties verifiableProperties = new VerifiableProperties(properties);
    FrontendRestRequestServiceFactory frontendRestRequestServiceFactory = new FrontendRestRequestServiceFactory(verifiableProperties, new MockClusterMap(), new InMemoryRouter(verifiableProperties, new MockClusterMap()), new InMemAccountService(false, true));
    RestRequestService ambryRestRequestService = frontendRestRequestServiceFactory.getRestRequestService();
    assertNotNull("No RestRequestService returned", ambryRestRequestService);
    assertEquals("Did not receive an FrontendRestRequestService instance", FrontendRestRequestService.class.getCanonicalName(), ambryRestRequestService.getClass().getCanonicalName());
}
Also used : InMemoryRouter(com.github.ambry.router.InMemoryRouter) InMemAccountService(com.github.ambry.account.InMemAccountService) RestRequestService(com.github.ambry.rest.RestRequestService) JSONObject(org.json.JSONObject) VerifiableProperties(com.github.ambry.config.VerifiableProperties) Properties(java.util.Properties) VerifiableProperties(com.github.ambry.config.VerifiableProperties) MockClusterMap(com.github.ambry.clustermap.MockClusterMap) Test(org.junit.Test)

Aggregations

InMemAccountService (com.github.ambry.account.InMemAccountService)1 MockClusterMap (com.github.ambry.clustermap.MockClusterMap)1 VerifiableProperties (com.github.ambry.config.VerifiableProperties)1 RestRequestService (com.github.ambry.rest.RestRequestService)1 InMemoryRouter (com.github.ambry.router.InMemoryRouter)1 Properties (java.util.Properties)1 JSONObject (org.json.JSONObject)1 Test (org.junit.Test)1