use of com.github.ambry.clustermap.MockClusterAgentsFactory in project ambry by linkedin.
the class ServerHardDeleteTest method initialize.
@Before
public void initialize() throws Exception {
mockClusterAgentsFactory = new MockClusterAgentsFactory(false, true, 1, 1, 1);
mockClusterMap = mockClusterAgentsFactory.getClusterMap();
notificationSystem = new MockNotificationSystem(mockClusterMap);
time = new MockTime(SystemTime.getInstance().milliseconds());
Properties props = new Properties();
props.setProperty("host.name", mockClusterMap.getDataNodes().get(0).getHostname());
props.setProperty("port", Integer.toString(mockClusterMap.getDataNodes().get(0).getPort()));
props.setProperty("store.data.flush.interval.seconds", "1");
props.setProperty("store.enable.hard.delete", "true");
props.setProperty("store.deleted.message.retention.hours", "168");
props.setProperty("server.handle.undelete.request.enabled", "true");
props.setProperty("clustermap.cluster.name", "test");
props.setProperty("clustermap.datacenter.name", "DC1");
props.setProperty("clustermap.host.name", "localhost");
props.setProperty("clustermap.default.partition.class", MockClusterMap.DEFAULT_PARTITION_CLASS);
TestSSLUtils.addHttp2Properties(props, SSLFactory.Mode.SERVER, true);
VerifiableProperties propverify = new VerifiableProperties(props);
server = new AmbryServer(propverify, mockClusterAgentsFactory, notificationSystem, time);
server.startup();
}
use of com.github.ambry.clustermap.MockClusterAgentsFactory in project ambry by linkedin.
the class AmbryServerTest method testAmbryServerWithReporterFactory.
/**
* Test starting and shutting down the server with a custom {@link JmxReporter} factory.
* @throws Exception
*/
@Test
public void testAmbryServerWithReporterFactory() throws Exception {
ClusterAgentsFactory clusterAgentsFactory = new MockClusterAgentsFactory(false, false, 1, 1, 1);
ObjectNameFactory spyObjectNameFactory = spy(new DefaultObjectNameFactory());
Function<MetricRegistry, JmxReporter> reporterFactory = reporter -> JmxReporter.forRegistry(reporter).createsObjectNamesWith(spyObjectNameFactory).build();
DataNodeId dataNodeId = clusterAgentsFactory.getClusterMap().getDataNodeIds().get(0);
Properties props = new Properties();
props.setProperty("host.name", dataNodeId.getHostname());
props.setProperty("port", Integer.toString(dataNodeId.getPort()));
props.setProperty("clustermap.cluster.name", "test");
props.setProperty("clustermap.datacenter.name", "DC1");
props.setProperty("clustermap.host.name", dataNodeId.getHostname());
AmbryServer ambryServer = new AmbryServer(new VerifiableProperties(props), clusterAgentsFactory, null, new LoggingNotificationSystem(), SystemTime.getInstance(), reporterFactory);
ambryServer.startup();
verify(spyObjectNameFactory, atLeastOnce()).createName(anyString(), anyString(), anyString());
ambryServer.shutdown();
}
Aggregations