Search in sources :

Example 1 with RatisSnapshotInfo

use of org.apache.hadoop.ozone.common.ha.ratis.RatisSnapshotInfo in project ozone by apache.

the class TestOzoneManagerRatisServer method init.

@Before
public void init() throws Exception {
    conf = new OzoneConfiguration();
    omID = UUID.randomUUID().toString();
    final String path = GenericTestUtils.getTempPath(omID);
    Path metaDirPath = Paths.get(path, "om-meta");
    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, metaDirPath.toString());
    conf.setTimeDuration(OMConfigKeys.OZONE_OM_RATIS_MINIMUM_TIMEOUT_KEY, RATIS_RPC_TIMEOUT, TimeUnit.MILLISECONDS);
    int ratisPort = conf.getInt(OMConfigKeys.OZONE_OM_RATIS_PORT_KEY, OMConfigKeys.OZONE_OM_RATIS_PORT_DEFAULT);
    InetSocketAddress rpcAddress = new InetSocketAddress(InetAddress.getLocalHost(), 0);
    omNodeDetails = new OMNodeDetails.Builder().setRpcAddress(rpcAddress).setRatisPort(ratisPort).setOMNodeId(omID).setOMServiceId(OzoneConsts.OM_SERVICE_ID_DEFAULT).build();
    // Starts a single node Ratis server
    ozoneManager = Mockito.mock(OzoneManager.class);
    OzoneConfiguration ozoneConfiguration = new OzoneConfiguration();
    ozoneConfiguration.set(OMConfigKeys.OZONE_OM_DB_DIRS, folder.newFolder().getAbsolutePath());
    omMetadataManager = new OmMetadataManagerImpl(ozoneConfiguration);
    when(ozoneManager.getMetadataManager()).thenReturn(omMetadataManager);
    initialTermIndex = TermIndex.valueOf(0, 0);
    RatisSnapshotInfo omRatisSnapshotInfo = new RatisSnapshotInfo();
    when(ozoneManager.getSnapshotInfo()).thenReturn(omRatisSnapshotInfo);
    secConfig = new SecurityConfig(conf);
    certClient = new OMCertificateClient(secConfig);
    omRatisServer = OzoneManagerRatisServer.newOMRatisServer(conf, ozoneManager, omNodeDetails, Collections.emptyMap(), secConfig, certClient, false);
    omRatisServer.start();
}
Also used : Path(java.nio.file.Path) OmMetadataManagerImpl(org.apache.hadoop.ozone.om.OmMetadataManagerImpl) OzoneManager(org.apache.hadoop.ozone.om.OzoneManager) SecurityConfig(org.apache.hadoop.hdds.security.x509.SecurityConfig) InetSocketAddress(java.net.InetSocketAddress) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) OMCertificateClient(org.apache.hadoop.hdds.security.x509.certificate.client.OMCertificateClient) RatisSnapshotInfo(org.apache.hadoop.ozone.common.ha.ratis.RatisSnapshotInfo) Before(org.junit.Before)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)1 Path (java.nio.file.Path)1 OzoneConfiguration (org.apache.hadoop.hdds.conf.OzoneConfiguration)1 SecurityConfig (org.apache.hadoop.hdds.security.x509.SecurityConfig)1 OMCertificateClient (org.apache.hadoop.hdds.security.x509.certificate.client.OMCertificateClient)1 RatisSnapshotInfo (org.apache.hadoop.ozone.common.ha.ratis.RatisSnapshotInfo)1 OmMetadataManagerImpl (org.apache.hadoop.ozone.om.OmMetadataManagerImpl)1 OzoneManager (org.apache.hadoop.ozone.om.OzoneManager)1 Before (org.junit.Before)1