Search in sources :

Example 6 with OmMetadataManagerImpl

use of org.apache.hadoop.ozone.om.OmMetadataManagerImpl in project ozone by apache.

the class TestS3MultipartRequest method setup.

@Before
public void setup() throws Exception {
    ozoneManager = Mockito.mock(OzoneManager.class);
    omMetrics = OMMetrics.create();
    OzoneConfiguration ozoneConfiguration = new OzoneConfiguration();
    ozoneConfiguration.set(OMConfigKeys.OZONE_OM_DB_DIRS, folder.newFolder().getAbsolutePath());
    omMetadataManager = new OmMetadataManagerImpl(ozoneConfiguration);
    when(ozoneManager.getMetrics()).thenReturn(omMetrics);
    when(ozoneManager.getMetadataManager()).thenReturn(omMetadataManager);
    auditLogger = Mockito.mock(AuditLogger.class);
    when(ozoneManager.getAuditLogger()).thenReturn(auditLogger);
    Mockito.doNothing().when(auditLogger).logWrite(any(AuditMessage.class));
    when(ozoneManager.resolveBucketLink(any(KeyArgs.class), any(OMClientRequest.class))).thenAnswer(inv -> {
        KeyArgs args = (KeyArgs) inv.getArguments()[0];
        return new ResolvedBucket(Pair.of(args.getVolumeName(), args.getBucketName()), Pair.of(args.getVolumeName(), args.getBucketName()));
    });
}
Also used : OmMetadataManagerImpl(org.apache.hadoop.ozone.om.OmMetadataManagerImpl) OMClientRequest(org.apache.hadoop.ozone.om.request.OMClientRequest) AuditMessage(org.apache.hadoop.ozone.audit.AuditMessage) AuditLogger(org.apache.hadoop.ozone.audit.AuditLogger) OzoneManager(org.apache.hadoop.ozone.om.OzoneManager) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs) ResolvedBucket(org.apache.hadoop.ozone.om.ResolvedBucket) Before(org.junit.Before)

Example 7 with OmMetadataManagerImpl

use of org.apache.hadoop.ozone.om.OmMetadataManagerImpl in project ozone by apache.

the class TestOMDelegationTokenRequest method setup.

@Before
public void setup() throws Exception {
    ozoneManager = Mockito.mock(OzoneManager.class);
    conf = new OzoneConfiguration();
    ((OzoneConfiguration) conf).set(OZONE_OM_DB_DIRS, folder.newFolder().getAbsolutePath());
    omMetadataManager = new OmMetadataManagerImpl((OzoneConfiguration) conf);
    when(ozoneManager.getMetadataManager()).thenReturn(omMetadataManager);
}
Also used : OmMetadataManagerImpl(org.apache.hadoop.ozone.om.OmMetadataManagerImpl) OzoneManager(org.apache.hadoop.ozone.om.OzoneManager) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) Before(org.junit.Before)

Example 8 with OmMetadataManagerImpl

use of org.apache.hadoop.ozone.om.OmMetadataManagerImpl in project ozone by apache.

the class TestOMClientRequestWithUserInfo method setup.

@Before
public void setup() throws Exception {
    ozoneManager = Mockito.mock(OzoneManager.class);
    omMetrics = OMMetrics.create();
    OzoneConfiguration ozoneConfiguration = new OzoneConfiguration();
    ozoneConfiguration.set(OMConfigKeys.OZONE_OM_DB_DIRS, folder.newFolder().getAbsolutePath());
    omMetadataManager = new OmMetadataManagerImpl(ozoneConfiguration);
    when(ozoneManager.getMetrics()).thenReturn(omMetrics);
    when(ozoneManager.getMetadataManager()).thenReturn(omMetadataManager);
    inetAddress = InetAddress.getByName("127.0.0.1");
    new MockUp<ProtobufRpcEngine.Server>() {

        @Mock
        public UserGroupInformation getRemoteUser() {
            return userGroupInformation;
        }

        @Mock
        public InetAddress getRemoteIp() {
            return inetAddress;
        }

        public InetAddress getRemoteAddress() {
            return inetAddress;
        }
    };
}
Also used : OmMetadataManagerImpl(org.apache.hadoop.ozone.om.OmMetadataManagerImpl) OzoneManager(org.apache.hadoop.ozone.om.OzoneManager) ProtobufRpcEngine(org.apache.hadoop.ipc.ProtobufRpcEngine) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) MockUp(mockit.MockUp) Before(org.junit.Before)

Example 9 with OmMetadataManagerImpl

use of org.apache.hadoop.ozone.om.OmMetadataManagerImpl in project ozone by apache.

the class TestOzoneManagerDoubleBufferWithDummyResponse method setup.

@Before
public void setup() throws IOException {
    OzoneConfiguration configuration = new OzoneConfiguration();
    configuration.set(OZONE_METADATA_DIRS, folder.newFolder().getAbsolutePath());
    omMetadataManager = new OmMetadataManagerImpl(configuration);
    OzoneManagerRatisSnapshot ozoneManagerRatisSnapshot = index -> {
        lastAppliedIndex = index.get(index.size() - 1);
    };
    doubleBuffer = new OzoneManagerDoubleBuffer.Builder().setOmMetadataManager(omMetadataManager).setOzoneManagerRatisSnapShot(ozoneManagerRatisSnapshot).enableRatis(true).setIndexToTerm((val) -> term).build();
}
Also used : OmMetadataManagerImpl(org.apache.hadoop.ozone.om.OmMetadataManagerImpl) TransactionInfo(org.apache.hadoop.hdds.utils.TransactionInfo) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) TRANSACTION_INFO_KEY(org.apache.hadoop.ozone.OzoneConsts.TRANSACTION_INFO_KEY) CleanupTableInfo(org.apache.hadoop.ozone.om.response.CleanupTableInfo) OMClientResponse(org.apache.hadoop.ozone.om.response.OMClientResponse) After(org.junit.After) OzoneManagerProtocolProtos(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos) BUCKET_TABLE(org.apache.hadoop.ozone.om.OmMetadataManagerImpl.BUCKET_TABLE) Before(org.junit.Before) OMResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse) BatchOperation(org.apache.hadoop.hdds.utils.db.BatchOperation) OZONE_METADATA_DIRS(org.apache.hadoop.hdds.HddsConfigKeys.OZONE_METADATA_DIRS) OmBucketInfo(org.apache.hadoop.ozone.om.helpers.OmBucketInfo) Assert.assertNotNull(org.junit.Assert.assertNotNull) CreateBucketResponse(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.CreateBucketResponse) Assert.assertTrue(org.junit.Assert.assertTrue) IOException(java.io.IOException) Test(org.junit.Test) UUID(java.util.UUID) AtomicLong(java.util.concurrent.atomic.AtomicLong) Rule(org.junit.Rule) OmMetadataManagerImpl(org.apache.hadoop.ozone.om.OmMetadataManagerImpl) Time(org.apache.hadoop.util.Time) Assert(org.junit.Assert) TemporaryFolder(org.junit.rules.TemporaryFolder) GenericTestUtils.waitFor(org.apache.ozone.test.GenericTestUtils.waitFor) Assert.assertEquals(org.junit.Assert.assertEquals) OzoneManagerDoubleBufferMetrics(org.apache.hadoop.ozone.om.ratis.metrics.OzoneManagerDoubleBufferMetrics) OMMetadataManager(org.apache.hadoop.ozone.om.OMMetadataManager) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) Before(org.junit.Before)

Example 10 with OmMetadataManagerImpl

use of org.apache.hadoop.ozone.om.OmMetadataManagerImpl in project ozone by apache.

the class TestOMDirectoryCreateRequest method setup.

@Before
public void setup() throws Exception {
    ozoneManager = Mockito.mock(OzoneManager.class);
    omMetrics = OMMetrics.create();
    OzoneConfiguration ozoneConfiguration = new OzoneConfiguration();
    ozoneConfiguration.set(OMConfigKeys.OZONE_OM_DB_DIRS, folder.newFolder().getAbsolutePath());
    omMetadataManager = new OmMetadataManagerImpl(ozoneConfiguration);
    when(ozoneManager.getMetrics()).thenReturn(omMetrics);
    when(ozoneManager.getMetadataManager()).thenReturn(omMetadataManager);
    auditLogger = Mockito.mock(AuditLogger.class);
    when(ozoneManager.getAuditLogger()).thenReturn(auditLogger);
    Mockito.doNothing().when(auditLogger).logWrite(any(AuditMessage.class));
    when(ozoneManager.resolveBucketLink(any(KeyArgs.class), any(OMClientRequest.class))).thenReturn(new ResolvedBucket(Pair.of("", ""), Pair.of("", "")));
}
Also used : OmMetadataManagerImpl(org.apache.hadoop.ozone.om.OmMetadataManagerImpl) OMClientRequest(org.apache.hadoop.ozone.om.request.OMClientRequest) AuditMessage(org.apache.hadoop.ozone.audit.AuditMessage) AuditLogger(org.apache.hadoop.ozone.audit.AuditLogger) OzoneManager(org.apache.hadoop.ozone.om.OzoneManager) OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) KeyArgs(org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs) ResolvedBucket(org.apache.hadoop.ozone.om.ResolvedBucket) Before(org.junit.Before)

Aggregations

OmMetadataManagerImpl (org.apache.hadoop.ozone.om.OmMetadataManagerImpl)36 OzoneConfiguration (org.apache.hadoop.hdds.conf.OzoneConfiguration)34 Before (org.junit.Before)25 OzoneManager (org.apache.hadoop.ozone.om.OzoneManager)12 AuditLogger (org.apache.hadoop.ozone.audit.AuditLogger)7 AuditMessage (org.apache.hadoop.ozone.audit.AuditMessage)7 OMMetadataManager (org.apache.hadoop.ozone.om.OMMetadataManager)6 Test (org.junit.Test)6 OmBucketInfo (org.apache.hadoop.ozone.om.helpers.OmBucketInfo)5 OmVolumeArgs (org.apache.hadoop.ozone.om.helpers.OmVolumeArgs)5 OMClientRequest (org.apache.hadoop.ozone.om.request.OMClientRequest)5 ResolvedBucket (org.apache.hadoop.ozone.om.ResolvedBucket)4 KeyArgs (org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs)4 ArrayList (java.util.ArrayList)3 OMLayoutVersionManager (org.apache.hadoop.ozone.om.upgrade.OMLayoutVersionManager)3 File (java.io.File)2 Path (java.nio.file.Path)2 Random (java.util.Random)2 SecurityConfig (org.apache.hadoop.hdds.security.x509.SecurityConfig)2 RDBStore (org.apache.hadoop.hdds.utils.db.RDBStore)2