Here are the examples of the java api org.apache.hadoop.hdds.conf.OzoneConfiguration.set() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
248 Examples
19
Source : TestOmMetadataManager.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setup() throws Exception {
ozoneConfiguration = new OzoneConfiguration();
ozoneConfiguration.set(OZONE_OM_DB_DIRS, folder.getRoot().getAbsolutePath());
omMetadataManager = new OmMetadataManagerImpl(ozoneConfiguration);
}
19
Source : TestSCMNodeManagerMXBean.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@BeforeClreplaced
public static void init() throws IOException, TimeoutException, InterruptedException {
conf = new OzoneConfiguration();
conf.set(OZONE_SCM_STALENODE_INTERVAL, "60000ms");
cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(numOfDatanodes).build();
cluster.waitForClusterToBeReady();
scm = cluster.getStorageContainerManager();
mbs = ManagementFactory.getPlatformMBeanServer();
}
19
Source : TestReconTasks.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void init() throws Exception {
conf = new OzoneConfiguration();
conf.set(HDDS_CONTAINER_REPORT_INTERVAL, "5s");
conf.set(HDDS_PIPELINE_REPORT_INTERVAL, "5s");
ReconTaskConfig taskConfig = conf.getObject(ReconTaskConfig.clreplaced);
taskConfig.setMissingContainerTaskInterval(Duration.ofSeconds(15));
conf.setFromObject(taskConfig);
conf.set("ozone.scm.stale.node.interval", "10s");
conf.set("ozone.scm.dead.node.interval", "20s");
cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(1).includeRecon(true).build();
cluster.waitForClusterToBeReady();
}
19
Source : TestCloseContainerHandler.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setup() throws Exception {
// setup a cluster (1G free space is enough for a unit test)
conf = new OzoneConfiguration();
conf.set(OZONE_SCM_CONTAINER_SIZE, "1GB");
conf.setBoolean(HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);
cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(1).build();
}
19
Source : TestLeaderChoosePolicy.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test(timeout = 60000)
public void testDefaultLeaderChoosePolicy() throws Exception {
conf.setBoolean(OZONE_SCM_PIPELINE_AUTO_CREATE_FACTOR_ONE, false);
conf.set(OZONE_SCM_PIPELINE_LEADER_CHOOSING_POLICY, "org.apache.hadoop.hdds.scm.pipeline.leader.choose.algorithms" + ".DefaultLeaderChoosePolicy");
int dnNum = 3;
int dnPipelineLimit = 3;
int pipelineNum = 3;
init(dnNum, dnPipelineLimit);
// make sure pipelines are created
waitForPipelines(pipelineNum);
}
19
Source : TestSCMSecurityProtocolServer.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setUp() throws Exception {
config = new OzoneConfiguration();
config.set(OZONE_SCM_SECURITY_SERVICE_ADDRESS_KEY, OZONE_SCM_SECURITY_SERVICE_BIND_HOST_DEFAULT + ":0");
securityProtocolServer = new SCMSecurityProtocolServer(config, null);
}
19
Source : TestLeaderChoosePolicy.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test(expected = RuntimeException.clreplaced)
public void testClreplacedNotImplemented() {
// set a clreplaced not implemented
conf.set(ScmConfigKeys.OZONE_SCM_PIPELINE_LEADER_CHOOSING_POLICY, "org.apache.hadoop.hdds.scm.pipeline.leader.choose.algorithms" + ".HelloWorld");
new RatisPipelineProvider(mock(NodeManager.clreplaced), mock(PipelineStateManager.clreplaced), conf, mock(EventPublisher.clreplaced));
// expecting exception
}
19
Source : TestKeyCodec.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void init() throws IOException {
configuration = new OzoneConfiguration();
prefix = temporaryFolder.newFolder().toString();
configuration.set(HDDS_METADATA_DIR_NAME, prefix);
keyGenerator = new HDDSKeyGenerator(configuration);
securityConfig = new SecurityConfig(configuration);
component = "test_component";
}
19
Source : TestKeyValueBlockIterator.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setUp() throws Exception {
testRoot = GenericTestUtils.getRandomizedTestDir();
conf = new OzoneConfiguration();
conf.set(HDDS_DATANODE_DIR_KEY, testRoot.getAbsolutePath());
volumeSet = new MutableVolumeSet(UUID.randomUUID().toString(), conf);
containerData = new KeyValueContainerData(105L, layout, (long) StorageUnit.GB.toBytes(1), UUID.randomUUID().toString(), UUID.randomUUID().toString());
// Init the container.
container = new KeyValueContainer(containerData, conf);
container.create(volumeSet, new RoundRobinVolumeChoosingPolicy(), UUID.randomUUID().toString());
db = BlockUtils.getDB(containerData, conf);
}
19
Source : TestVolumeSet.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setup() throws Exception {
conf = new OzoneConfiguration();
String dataDirKey = volume1 + "," + volume2;
volumes.add(volume1);
volumes.add(volume2);
conf.set(DFSConfigKeysLegacy.DFS_DATANODE_DATA_DIR_KEY, dataDirKey);
initializeVolumeSet();
}
19
Source : TestNodeSchemaManager.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test
public void testInitFailure() {
String filePath = clreplacedLoader.getResource("./networkTopologyTestFiles/good.xml").getPath() + ".backup";
conf.set(ScmConfigKeys.OZONE_SCM_NETWORK_TOPOLOGY_SCHEMA_FILE, filePath);
try {
manager.init(conf);
fail("should fail");
} catch (Throwable e) {
replacedertTrue(e.getMessage().contains("Failed to load schema file:" + filePath));
}
}
18
Source : TestReconUtils.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test
public void testGetReconDbDir() throws Exception {
String filePath = folder.getRoot().getAbsolutePath();
OzoneConfiguration configuration = new OzoneConfiguration();
configuration.set("TEST_DB_DIR", filePath);
File file = new ReconUtils().getReconDbDir(configuration, "TEST_DB_DIR");
replacedert.replacedertEquals(filePath, file.getAbsolutePath());
}
18
Source : OMMetadataManagerTestUtils.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Create an empty OM Metadata manager instance.
* @throws IOException ioEx
*/
public static OMMetadataManager initializeEmptyOmMetadataManager(File omDbDir) throws IOException {
OzoneConfiguration omConfiguration = new OzoneConfiguration();
omConfiguration.set(OZONE_OM_DB_DIRS, omDbDir.getAbsolutePath());
return new OmMetadataManagerImpl(omConfiguration);
}
18
Source : TestVolumeOwner.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@BeforeClreplaced
public static void setup() throws IOException {
ozoneConfig = new OzoneConfiguration();
ozoneConfig.set(OZONE_ACL_AUTHORIZER_CLreplaced, OZONE_ACL_AUTHORIZER_CLreplaced_NATIVE);
File dir = GenericTestUtils.getRandomizedTestDir();
ozoneConfig.set(OZONE_METADATA_DIRS, dir.toString());
metadataManager = new OmMetadataManagerImpl(ozoneConfig);
volumeManager = new VolumeManagerImpl(metadataManager, ozoneConfig);
bucketManager = new BucketManagerImpl(metadataManager);
keyManager = new KeyManagerImpl(mock(ScmBlockLocationProtocol.clreplaced), metadataManager, ozoneConfig, "om1", null);
prefixManager = new PrefixManagerImpl(metadataManager, false);
nativeAuthorizer = new OzoneNativeAuthorizer(volumeManager, bucketManager, keyManager, prefixManager, Collections.singletonList("om"));
testUgi = UserGroupInformation.createUserForTesting("testuser", new String[] { "test" });
prepareTestVols();
prepareTestBuckets();
prepareTestKeys();
}
18
Source : TestSecureOzoneCluster.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
private void setSecureConfig() throws IOException {
conf.setBoolean(OZONE_SECURITY_ENABLED_KEY, true);
host = InetAddress.getLocalHost().getCanonicalHostName().toLowerCase();
conf.set(HADOOP_SECURITY_AUTHENTICATION, "kerberos");
String curUser = UserGroupInformation.getCurrentUser().getUserName();
conf.set(OZONE_ADMINISTRATORS, curUser);
String realm = miniKdc.getRealm();
String hostAndRealm = host + "@" + realm;
conf.set(HDDS_SCM_KERBEROS_PRINCIPAL_KEY, "scm/" + hostAndRealm);
conf.set(HDDS_SCM_HTTP_KERBEROS_PRINCIPAL_KEY, "HTTP_SCM/" + hostAndRealm);
conf.set(OZONE_OM_KERBEROS_PRINCIPAL_KEY, "om/" + hostAndRealm);
conf.set(OZONE_OM_HTTP_KERBEROS_PRINCIPAL_KEY, "HTTP_OM/" + hostAndRealm);
scmKeytab = new File(workDir, "scm.keytab");
spnegoKeytab = new File(workDir, "http.keytab");
omKeyTab = new File(workDir, "om.keytab");
testUserKeytab = new File(workDir, "testuser.keytab");
testUserPrincipal = "test@" + realm;
conf.set(HDDS_SCM_KERBEROS_KEYTAB_FILE_KEY, scmKeytab.getAbsolutePath());
conf.set(HDDS_SCM_HTTP_KERBEROS_KEYTAB_FILE_KEY, spnegoKeytab.getAbsolutePath());
conf.set(OZONE_OM_KERBEROS_KEYTAB_FILE_KEY, omKeyTab.getAbsolutePath());
conf.set(OZONE_OM_HTTP_KERBEROS_KEYTAB_FILE, spnegoKeytab.getAbsolutePath());
}
18
Source : TestSecureOzoneCluster.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Tests the secure om Initialization Failure.
*/
@Test
public void testSecureOMInitializationFailure() throws Exception {
initSCM();
// Create a secure SCM instance as om client will connect to it
scm = StorageContainerManager.createSCM(conf);
setupOm(conf);
conf.set(OZONE_OM_KERBEROS_PRINCIPAL_KEY, "[email protected]");
testCommonKerberosFailures(() -> OzoneManager.createOm(conf));
}
18
Source : TestSecureOzoneCluster.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
private void testCommonKerberosFailures(Callable<?> test) throws Exception {
LambdaTestUtils.intercept(KerberosAuthException.clreplaced, "failure to login: for principal:", test);
String invalidValue = "OAuth2";
conf.set(HADOOP_SECURITY_AUTHENTICATION, invalidValue);
LambdaTestUtils.intercept(IllegalArgumentException.clreplaced, "Invalid attribute value for " + HADOOP_SECURITY_AUTHENTICATION + " of " + invalidValue, test);
conf.set(HADOOP_SECURITY_AUTHENTICATION, "KERBEROS_SSL");
LambdaTestUtils.intercept(AuthenticationException.clreplaced, "KERBEROS_SSL authentication method not", test);
}
18
Source : TestReconAsPassiveScm.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void init() throws Exception {
conf = new OzoneConfiguration();
conf.set(HDDS_CONTAINER_REPORT_INTERVAL, "5s");
conf.set(HDDS_PIPELINE_REPORT_INTERVAL, "5s");
cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(3).includeRecon(true).build();
cluster.waitForClusterToBeReady();
}
18
Source : TestSecureOzoneManager.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Create a MiniDFSCluster for testing.
* <p>
* Ozone is made active by setting OZONE_ENABLED = true
*/
@Before
public void init() throws Exception {
conf = new OzoneConfiguration();
clusterId = UUID.randomUUID().toString();
scmId = UUID.randomUUID().toString();
omId = UUID.randomUUID().toString();
conf.setBoolean(OZONE_ACL_ENABLED, true);
conf.setBoolean(OZONE_SECURITY_ENABLED_KEY, true);
conf.setInt(OZONE_OPEN_KEY_EXPIRE_THRESHOLD_SECONDS, 2);
conf.set(HADOOP_SECURITY_AUTHENTICATION, KERBEROS.toString());
conf.setInt(IPC_CLIENT_CONNECT_MAX_RETRIES_KEY, 2);
conf.set(OZONE_SCM_NAMES, "localhost");
final String path = getTempPath(UUID.randomUUID().toString());
metaDir = Paths.get(path, "om-meta");
conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, metaDir.toString());
OzoneManager.setTestSecureOmFlag(true);
}
18
Source : TestOzoneManagerRestart.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Create a MiniDFSCluster for testing.
* <p>
* Ozone is made active by setting OZONE_ENABLED = true
*
* @throws IOException
*/
@BeforeClreplaced
public static void init() throws Exception {
conf = new OzoneConfiguration();
clusterId = UUID.randomUUID().toString();
scmId = UUID.randomUUID().toString();
omId = UUID.randomUUID().toString();
conf.setBoolean(OZONE_ACL_ENABLED, true);
conf.setInt(OZONE_OPEN_KEY_EXPIRE_THRESHOLD_SECONDS, 2);
conf.set(OZONE_ADMINISTRATORS, OZONE_ADMINISTRATORS_WILDCARD);
conf.setInt(OZONE_SCM_RATIS_PIPELINE_LIMIT, 10);
cluster = MiniOzoneCluster.newBuilder(conf).setClusterId(clusterId).setScmId(scmId).setOmId(omId).build();
cluster.waitForClusterToBeReady();
}
18
Source : TestOzoneManagerConfiguration.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* A configuration with an empty node list while service ID is configured.
* Cluster should fail to start during config check.
* @throws Exception
*/
@Test
public void testNoOMNodes() throws Exception {
String omServiceId = "service1";
conf.set(OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY, omServiceId);
// Deliberately skip OZONE_OM_NODES_KEY and OZONE_OM_ADDRESS_KEY config
try {
startCluster();
replacedert.fail("Should have failed to start the cluster!");
} catch (OzoneIllegalArgumentException e) {
// Expect error message
replacedert.replacedertTrue(e.getMessage().contains("List of OM Node ID's should be specified"));
}
}
18
Source : TestOMDbCheckpointServlet.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Create a MiniDFSCluster for testing.
* <p>
* Ozone is made active by setting OZONE_ENABLED = true
*
* @throws IOException
*/
@BeforeClreplaced
public static void init() throws Exception {
conf = new OzoneConfiguration();
clusterId = UUID.randomUUID().toString();
scmId = UUID.randomUUID().toString();
omId = UUID.randomUUID().toString();
conf.setBoolean(OZONE_ACL_ENABLED, false);
conf.set(OZONE_ADMINISTRATORS, OZONE_ADMINISTRATORS_WILDCARD);
conf.setInt(OZONE_OPEN_KEY_EXPIRE_THRESHOLD_SECONDS, 2);
cluster = MiniOzoneCluster.newBuilder(conf).setClusterId(clusterId).setScmId(scmId).setOmId(omId).setNumDatanodes(1).build();
cluster.waitForClusterToBeReady();
omMetrics = cluster.getOzoneManager().getMetrics();
}
18
Source : TestContainerServer.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@BeforeClreplaced
public static void setup() {
CONF.set(HddsConfigKeys.HDDS_METADATA_DIR_NAME, TEST_DIR);
caClient = new DNCertificateClient(new SecurityConfig(CONF));
}
18
Source : TestDeleteContainerHandler.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@BeforeClreplaced
public static void setup() throws Exception {
conf = new OzoneConfiguration();
conf.set(OZONE_SCM_CONTAINER_SIZE, "1GB");
conf.setBoolean(HddsConfigKeys.HDDS_SCM_SAFEMODE_PIPELINE_CREATION, false);
cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(1).build();
cluster.waitForClusterToBeReady();
OzoneClient client = OzoneClientFactory.getRpcClient(conf);
objectStore = client.getObjectStore();
objectStore.createVolume(volumeName);
objectStore.getVolume(volumeName).createBucket(bucketName);
}
18
Source : TestOzoneRpcClientForAclAuditLog.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
/**
* Create a MiniOzoneCluster for testing.
*
* Ozone is made active by setting OZONE_ENABLED = true
*
* @throws IOException
*/
@BeforeClreplaced
public static void init() throws Exception {
System.setProperty("log4j.configurationFile", "auditlog.properties");
ugi = UserGroupInformation.getCurrentUser();
OzoneConfiguration conf = new OzoneConfiguration();
conf.setBoolean(OZONE_ACL_ENABLED, true);
conf.set(OZONE_ADMINISTRATORS, OZONE_ADMINISTRATORS_WILDCARD);
conf.set(OZONE_ACL_AUTHORIZER_CLreplaced, OZONE_ACL_AUTHORIZER_CLreplaced_NATIVE);
startCluster(conf);
aclListToAdd.add(USER_ACL);
aclListToAdd.add(USER_ACL_2);
emptyAuditLog();
}
18
Source : TestRatisPipelineLeader.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@BeforeClreplaced
public static void setup() throws Exception {
conf = new OzoneConfiguration();
conf.set(HddsConfigKeys.HDDS_HEARTBEAT_INTERVAL, "100ms");
cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(3).build();
cluster.waitForClusterToBeReady();
}
18
Source : TestConfigurationSubCommand.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test
public void testPrintConfig() throws UnsupportedEncodingException {
OzoneConfiguration conf = new OzoneConfiguration();
conf.set("ozone.scm.client.address", "omclient");
ConfigurationSubCommand subCommand = new ConfigurationSubCommand();
subCommand.printConfig(CustomConfig.clreplaced, conf);
final String output = out.toString(StandardCharsets.UTF_8.name());
replacedert.replacedertTrue(output.contains(">>> ozone.scm.client.address"));
replacedert.replacedertTrue(output.contains("default: localhost"));
replacedert.replacedertTrue(output.contains("current: omclient"));
replacedert.replacedertTrue(output.contains(">>> ozone.scm.client.secure"));
replacedert.replacedertTrue(output.contains("default: true"));
replacedert.replacedertTrue(output.contains("current: true"));
}
18
Source : TestSCMCertStore.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setUp() throws Exception {
config = new OzoneConfiguration();
config.set(HddsConfigKeys.OZONE_METADATA_DIRS, tempDir.newFolder().getAbsolutePath());
securityConfig = new SecurityConfig(config);
keyPair = KeyStoreTestUtil.generateKeyPair("RSA");
}
18
Source : TestContainerPlacementFactory.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test
public void testRackAwarePolicy() throws IOException {
conf.set(ScmConfigKeys.OZONE_SCM_CONTAINER_PLACEMENT_IMPL_KEY, SCMContainerPlacementRackAware.clreplaced.getName());
NodeSchema[] schemas = new NodeSchema[] { ROOT_SCHEMA, RACK_SCHEMA, LEAF_SCHEMA };
NodeSchemaManager.getInstance().init(schemas, true);
cluster = new NetworkTopologyImpl(NodeSchemaManager.getInstance());
// build datanodes, and network topology
String rack = "/rack";
String hostname = "node";
for (int i = 0; i < 15; i++) {
// Totally 3 racks, each has 5 datanodes
DatanodeDetails node = MockDatanodeDetails.createDatanodeDetails(hostname + i, rack + (i / 5));
datanodes.add(node);
cluster.add(node);
}
// create mock node manager
nodeManager = Mockito.mock(NodeManager.clreplaced);
when(nodeManager.getNodes(NodeStatus.inServiceHealthy())).thenReturn(new ArrayList<>(datanodes));
when(nodeManager.getNodeStat(anyObject())).thenReturn(new SCMNodeMetric(STORAGE_CAPACITY, 0L, 100L));
when(nodeManager.getNodeStat(datanodes.get(2))).thenReturn(new SCMNodeMetric(STORAGE_CAPACITY, 90L, 10L));
when(nodeManager.getNodeStat(datanodes.get(3))).thenReturn(new SCMNodeMetric(STORAGE_CAPACITY, 80L, 20L));
when(nodeManager.getNodeStat(datanodes.get(4))).thenReturn(new SCMNodeMetric(STORAGE_CAPACITY, 70L, 30L));
PlacementPolicy policy = ContainerPlacementPolicyFactory.getPolicy(conf, nodeManager, cluster, true, SCMContainerPlacementMetrics.create());
int nodeNum = 3;
List<DatanodeDetails> datanodeDetails = policy.chooseDatanodes(null, null, nodeNum, 15);
replacedert.replacedertEquals(nodeNum, datanodeDetails.size());
replacedert.replacedertTrue(cluster.isSameParent(datanodeDetails.get(0), datanodeDetails.get(1)));
replacedert.replacedertFalse(cluster.isSameParent(datanodeDetails.get(0), datanodeDetails.get(2)));
replacedert.replacedertFalse(cluster.isSameParent(datanodeDetails.get(1), datanodeDetails.get(2)));
}
18
Source : TestContainerPlacementFactory.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test(expected = RuntimeException.clreplaced)
public void testClreplacedNotImplemented() throws SCMException {
// set a placement clreplaced not implemented
conf.set(ScmConfigKeys.OZONE_SCM_CONTAINER_PLACEMENT_IMPL_KEY, "org.apache.hadoop.hdds.scm.container.placement.algorithm.HelloWorld");
ContainerPlacementPolicyFactory.getPolicy(conf, null, null, true, null);
}
18
Source : TestContainerPlacementFactory.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test(expected = SCMException.clreplaced)
public void testConstuctorNotFound() throws SCMException {
// set a placement clreplaced which does't have the right constructor implemented
conf.set(ScmConfigKeys.OZONE_SCM_CONTAINER_PLACEMENT_IMPL_KEY, DummyImpl.clreplaced.getName());
ContainerPlacementPolicyFactory.getPolicy(conf, null, null, true, null);
}
18
Source : TestBaseHttpServer.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test
public void getBindAddress() throws Exception {
OzoneConfiguration conf = new OzoneConfiguration();
conf.set("enabled", "false");
BaseHttpServer baseHttpServer = new BaseHttpServer(conf, "test") {
@Override
protected String getHttpAddressKey() {
return null;
}
@Override
protected String getHttpsAddressKey() {
return null;
}
@Override
protected String getHttpBindHostKey() {
return null;
}
@Override
protected String getHttpsBindHostKey() {
return null;
}
@Override
protected String getBindHostDefault() {
return null;
}
@Override
protected int getHttpBindPortDefault() {
return 0;
}
@Override
protected int getHttpsBindPortDefault() {
return 0;
}
@Override
protected String getKeytabFile() {
return null;
}
@Override
protected String getSpnegoPrincipal() {
return null;
}
@Override
protected String getEnabledKey() {
return "enabled";
}
@Override
protected String getHttpAuthType() {
return "simple";
}
@Override
protected String getHttpAuthConfigPrefix() {
return null;
}
};
conf.set("addresskey", "0.0.0.0:1234");
replacedert.replacedertEquals("/0.0.0.0:1234", baseHttpServer.getBindAddress("bindhostkey", "addresskey", "default", 65).toString());
conf.set("bindhostkey", "1.2.3.4");
replacedert.replacedertEquals("/1.2.3.4:1234", baseHttpServer.getBindAddress("bindhostkey", "addresskey", "default", 65).toString());
}
18
Source : TestRootCertificate.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void init() throws IOException {
conf.set(OZONE_METADATA_DIRS, temporaryFolder.newFolder().toString());
securityConfig = new SecurityConfig(conf);
}
18
Source : TestCRLCodec.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void init() throws NoSuchProviderException, NoSuchAlgorithmException, IOException, CertificateException, OperatorCreationException {
conf.set(OZONE_METADATA_DIRS, temporaryFolder.newFolder().toString());
securityConfig = new SecurityConfig(conf);
writeTempCert();
x509CertificateHolder = readTempCert();
}
18
Source : TestDefaultProfile.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setUp() throws Exception {
configuration = new OzoneConfiguration();
configuration.set(OZONE_METADATA_DIRS, temporaryFolder.newFolder().toString());
securityConfig = new SecurityConfig(configuration);
defaultProfile = new DefaultProfile();
testApprover = new MockApprover(defaultProfile, securityConfig);
keyPair = new HDDSKeyGenerator(securityConfig).generateKey();
}
18
Source : TestKeyValueContainerCheck.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setUp() throws Exception {
LOG.info("Testing layout:{}", chunkManagerTestInfo.getLayout());
this.testRoot = GenericTestUtils.getRandomizedTestDir();
conf = new OzoneConfiguration();
conf.set(HDDS_DATANODE_DIR_KEY, testRoot.getAbsolutePath());
chunkManagerTestInfo.updateConfig(conf);
volumeSet = new MutableVolumeSet(UUID.randomUUID().toString(), conf);
chunkManager = chunkManagerTestInfo.createChunkManager(true, null);
}
18
Source : TestHddsVolumeChecker.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setup() throws IOException {
conf = new OzoneConfiguration();
conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY, folder.getRoot().getAbsolutePath());
conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, folder.newFolder().getAbsolutePath());
}
18
Source : TestContainerPersistence.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@BeforeClreplaced
public static void init() {
conf = new OzoneConfiguration();
hddsPath = GenericTestUtils.getTempPath(TestContainerPersistence.clreplaced.getSimpleName());
conf.set(ScmConfigKeys.HDDS_DATANODE_DIR_KEY, hddsPath);
volumeChoosingPolicy = new RoundRobinVolumeChoosingPolicy();
}
18
Source : TestRatisHelper.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test
public void testCreateRaftGrpcPropertiesForServer() {
OzoneConfiguration ozoneConfiguration = new OzoneConfiguration();
ozoneConfiguration.set("hdds.ratis.raft.grpc.message.size.max", "30MB");
ozoneConfiguration.set("hdds.ratis.raft.grpc.flow.control" + ".window", "1MB");
ozoneConfiguration.set("hdds.ratis.raft.grpc.tls.enabled", "true");
ozoneConfiguration.set("hdds.ratis.raft.grpc.tls.mutual_authn" + ".enabled", "true");
ozoneConfiguration.set("hdds.ratis.raft.grpc.server.port", "100");
RaftProperties raftProperties = new RaftProperties();
RatisHelper.createRaftServerProperties(ozoneConfiguration, raftProperties);
replacedert.replacedertEquals("30MB", raftProperties.get("raft.grpc.message.size.max"));
replacedert.replacedertEquals("1MB", raftProperties.get("raft.grpc.flow.control.window"));
replacedert.replacedertEquals("true", raftProperties.get("raft.grpc.tls.enabled"));
replacedert.replacedertEquals("true", raftProperties.get("raft.grpc.tls.mutual_authn.enabled"));
replacedert.replacedertEquals("100", raftProperties.get("raft.grpc.server.port"));
}
18
Source : TestSpaceUsageFactory.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
private void testDefaultFactoryForWrongConfig(String value) {
OzoneConfiguration conf = new OzoneConfiguration();
conf.set(configKeyForClreplacedName(), value);
replacedertCreatesDefaultImplementation(conf);
if (value == null || value.isEmpty()) {
replacedertNoLog();
} else {
replacedertLogged(value);
}
}
18
Source : TestDedicatedDiskSpaceUsageFactory.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test
public void testParams() {
OzoneConfiguration conf = new OzoneConfiguration();
conf.set(configKeyForRefreshPeriod(), "2m");
File dir = getTestDir(getClreplaced().getSimpleName());
SpaceUsageCheckParams params = new DedicatedDiskSpaceUsageFactory().setConfiguration(conf).paramsFor(dir);
replacedertSame(dir, params.getDir());
replacedertEquals(Duration.ofMinutes(2), params.getRefresh());
replacedertSame(DedicatedDiskSpaceUsage.clreplaced, params.getSource().getClreplaced());
}
17
Source : TestGetConfOptions.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@BeforeClreplaced
public static void init() throws UnsupportedEncodingException {
conf = new OzoneConfiguration();
conf.set(OMConfigKeys.OZONE_OM_NODE_ID_KEY, "1");
conf.set(OMConfigKeys.OZONE_OM_SERVICE_IDS_KEY, "service1");
conf.set(ScmConfigKeys.OZONE_SCM_NAMES, "localhost");
psBackup = System.out;
bout = new ByteArrayOutputStream();
PrintStream psOut = new PrintStream(bout, false, DEFAULT_ENCODING);
System.setOut(psOut);
}
17
Source : GenesisUtil.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
static void configureOM(OzoneConfiguration conf, int numHandlers) {
conf.set(OMConfigKeys.OZONE_OM_HTTP_ADDRESS_KEY, RANDOM_LOCAL_ADDRESS);
conf.setInt(OMConfigKeys.OZONE_OM_HANDLER_COUNT_KEY, numHandlers);
}
17
Source : ContainerMapper.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static void main(String[] args) throws IOException {
String path = args[0];
if (path == null) {
throw new IOException("Path cannot be null");
}
OzoneConfiguration configuration = new OzoneConfiguration();
configuration.set(OZONE_OM_DB_DIRS, path);
ContainerMapper containerMapper = new ContainerMapper();
Map<Long, List<Map<Long, BlockIdDetails>>> dataMap = containerMapper.parseOmDB(configuration);
ObjectMapper mapper = new ObjectMapper();
System.out.println(mapper.writeValuereplacedtring(dataMap));
}
17
Source : TestOzoneManagerServiceProviderImpl.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setUp() throws Exception {
configuration = new OzoneConfiguration();
configuration.set(OZONE_RECON_OM_SNAPSHOT_DB_DIR, temporaryFolder.newFolder().getAbsolutePath());
configuration.set(OZONE_RECON_DB_DIR, temporaryFolder.newFolder().getAbsolutePath());
configuration.set("ozone.om.address", "localhost:9862");
ozoneManagerProtocol = getMockOzoneManagerClient(new DBUpdates());
}
17
Source : TestReconPipelineManager.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setup() throws IOException {
conf = new OzoneConfiguration();
conf.set(OZONE_METADATA_DIRS, temporaryFolder.newFolder().getAbsolutePath());
conf.set(OZONE_SCM_NAMES, "localhost");
scmStorageConfig = new ReconStorageConfig(conf);
store = DBStoreBuilder.createDBStore(conf, new ReconSCMDBDefinition());
}
17
Source : TestReconNodeManager.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Before
public void setUp() throws Exception {
conf = new OzoneConfiguration();
conf.set(OZONE_METADATA_DIRS, temporaryFolder.newFolder().getAbsolutePath());
conf.set(OZONE_SCM_NAMES, "localhost");
store = DBStoreBuilder.createDBStore(conf, new ReconSCMDBDefinition());
}
17
Source : TestOzoneNativeAuthorizer.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@BeforeClreplaced
public static void setup() throws Exception {
ozConfig = new OzoneConfiguration();
ozConfig.set(OZONE_ACL_AUTHORIZER_CLreplaced, OZONE_ACL_AUTHORIZER_CLreplaced_NATIVE);
File dir = GenericTestUtils.getRandomizedTestDir();
ozConfig.set(OZONE_METADATA_DIRS, dir.toString());
ozConfig.set(OZONE_ADMINISTRATORS, "om");
metadataManager = new OmMetadataManagerImpl(ozConfig);
volumeManager = new VolumeManagerImpl(metadataManager, ozConfig);
bucketManager = new BucketManagerImpl(metadataManager);
prefixManager = new PrefixManagerImpl(metadataManager, false);
keyManager = new KeyManagerImpl(mock(ScmBlockLocationProtocol.clreplaced), metadataManager, ozConfig, "om1", null);
nativeAuthorizer = new OzoneNativeAuthorizer(volumeManager, bucketManager, keyManager, prefixManager, Collections.singletonList("om"));
adminUgi = UserGroupInformation.createUserForTesting("om", new String[] { "ozone" });
testUgi = UserGroupInformation.createUserForTesting("testuser", new String[] { "test" });
}
17
Source : TestOzoneManagerHttpServer.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Test
public void testHttpPolicy() throws Exception {
conf.set(OzoneConfigKeys.OZONE_HTTP_POLICY_KEY, policy.name());
conf.set(OMConfigKeys.OZONE_OM_HTTP_ADDRESS_KEY, "localhost:0");
conf.set(OMConfigKeys.OZONE_OM_HTTPS_ADDRESS_KEY, "localhost:0");
OzoneManagerHttpServer server = null;
try {
server = new OzoneManagerHttpServer(conf, null);
DefaultMetricsSystem.initialize("TestOzoneManagerHttpServer");
server.start();
replacedert.replacedertTrue(implies(policy.isHttpEnabled(), canAccess("http", server.getHttpAddress())));
replacedert.replacedertTrue(implies(policy.isHttpEnabled() && !policy.isHttpsEnabled(), !canAccess("https", server.getHttpsAddress())));
replacedert.replacedertTrue(implies(policy.isHttpsEnabled(), canAccess("https", server.getHttpsAddress())));
replacedert.replacedertTrue(implies(policy.isHttpsEnabled(), !canAccess("http", server.getHttpsAddress())));
} finally {
if (server != null) {
server.stop();
}
}
}
17
Source : TestSecureOzoneCluster.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
private void initSCM() throws IOException {
clusterId = UUID.randomUUID().toString();
scmId = UUID.randomUUID().toString();
omId = UUID.randomUUID().toString();
final String path = folder.newFolder().toString();
Path scmPath = Paths.get(path, "scm-meta");
Files.createDirectories(scmPath);
conf.set(OZONE_METADATA_DIRS, scmPath.toString());
SCMStorageConfig scmStore = new SCMStorageConfig(conf);
scmStore.setClusterId(clusterId);
scmStore.setScmId(scmId);
// writes the version file properties
scmStore.initialize();
}
See More Examples