use of com.github.ambry.config.VerifiableProperties in project ambry by linkedin.
the class TestUtils method getDummyConfig.
/**
* For use when the the actual values in {@link ClusterMapConfig} are unimportant.
* @return a {@link ClusterMapConfig} with some default values.
*/
static ClusterMapConfig getDummyConfig() {
Properties props = new Properties();
props.setProperty("clustermap.host.name", "localhost");
props.setProperty("clustermap.cluster.name", "cluster");
props.setProperty("clustermap.datacenter.name", "");
return new ClusterMapConfig(new VerifiableProperties(props));
}
use of com.github.ambry.config.VerifiableProperties in project ambry by linkedin.
the class CommonTestUtils method getCurrentBlobIdVersion.
/**
* Get the current active blob id version via {@link RouterConfig}
* @return the current active blob id version.
*/
public static short getCurrentBlobIdVersion() {
Properties props = new Properties();
props.setProperty("router.hostname", "localhost");
props.setProperty("router.datacenter.name", "localDC");
return new RouterConfig(new VerifiableProperties(props)).routerBlobidCurrentVersion;
}
use of com.github.ambry.config.VerifiableProperties in project ambry by linkedin.
the class AmbryBlobStorageServiceFactoryTest method getAmbryBlobStorageServiceFactoryWithBadInputTest.
/**
* Tests instantiation of {@link AmbryBlobStorageServiceFactory} with bad input.
* @throws Exception
*/
@Test
public void getAmbryBlobStorageServiceFactoryWithBadInputTest() throws Exception {
// dud properties. server should pick up defaults
Properties properties = new Properties();
VerifiableProperties verifiableProperties = new VerifiableProperties(properties);
ClusterMap clusterMap = new MockClusterMap();
RestResponseHandler restResponseHandler = new MockRestRequestResponseHandler();
Router router = new InMemoryRouter(verifiableProperties, clusterMap);
// VerifiableProperties null.
try {
new AmbryBlobStorageServiceFactory(null, clusterMap, restResponseHandler, router, new MockNotifier());
fail("Instantiation should have failed because one of the arguments was null");
} catch (IllegalArgumentException e) {
// expected. Nothing to do.
}
// ClusterMap null.
try {
new AmbryBlobStorageServiceFactory(verifiableProperties, null, restResponseHandler, router, new MockNotifier());
fail("Instantiation should have failed because one of the arguments was null");
} catch (IllegalArgumentException e) {
// expected. Nothing to do.
}
// RestResponseHandler null.
try {
new AmbryBlobStorageServiceFactory(verifiableProperties, clusterMap, null, router, new MockNotifier());
fail("Instantiation should have failed because one of the arguments was null");
} catch (IllegalArgumentException e) {
// expected. Nothing to do.
}
// Router null.
try {
new AmbryBlobStorageServiceFactory(verifiableProperties, clusterMap, restResponseHandler, null, new MockNotifier());
fail("Instantiation should have failed because one of the arguments was null");
} catch (IllegalArgumentException e) {
// expected. Nothing to do.
}
}
use of com.github.ambry.config.VerifiableProperties in project ambry by linkedin.
the class FrontendTestUrlSigningServiceFactory method runtimeExceptionRouterTest.
/**
* Checks reactions of all methods in {@link AmbryBlobStorageService} to a {@link Router} that throws
* {@link RuntimeException}.
* @throws Exception
*/
@Test
public void runtimeExceptionRouterTest() throws Exception {
// set InMemoryRouter up to throw RuntimeException
Properties properties = new Properties();
properties.setProperty(InMemoryRouter.OPERATION_THROW_EARLY_RUNTIME_EXCEPTION, "true");
router.setVerifiableProperties(new VerifiableProperties(properties));
doRuntimeExceptionRouterTest(RestMethod.GET);
doRuntimeExceptionRouterTest(RestMethod.POST);
doRuntimeExceptionRouterTest(RestMethod.DELETE);
doRuntimeExceptionRouterTest(RestMethod.HEAD);
}
use of com.github.ambry.config.VerifiableProperties in project ambry by linkedin.
the class AmbrySecurityServiceFactoryTest method getAmbrySecurityServiceFactoryTest.
/**
* Tests intantiation of {@link AmbrySecurityServiceFactory}.
* @throws Exception
*/
@Test
public void getAmbrySecurityServiceFactoryTest() throws Exception {
SecurityService securityService = new AmbrySecurityServiceFactory(new VerifiableProperties(new Properties()), new MockClusterMap(), null, null, null).getSecurityService();
Assert.assertNotNull(securityService);
}
Aggregations