use of org.apache.hadoop.ozone.MiniOzoneCluster in project ozone by apache.
the class TestOzoneContainer method testOzoneContainerViaDataNode.
@Test
public void testOzoneContainerViaDataNode() throws Exception {
MiniOzoneCluster cluster = null;
try {
long containerID = ContainerTestHelper.getTestContainerID();
OzoneConfiguration conf = newOzoneConfiguration();
// Start ozone container Via Datanode create.
cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(1).build();
cluster.waitForClusterToBeReady();
// This client talks to ozone container via datanode.
XceiverClientGrpc client = createClientForTesting(cluster);
runTestOzoneContainerViaDataNode(containerID, client);
} finally {
if (cluster != null) {
cluster.shutdown();
}
}
}
use of org.apache.hadoop.ozone.MiniOzoneCluster in project ozone by apache.
the class TestOzoneClientFactory method testRemoteException.
@Test
public void testRemoteException() {
OzoneConfiguration conf = new OzoneConfiguration();
try {
MiniOzoneCluster cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(3).setTotalPipelineNumLimit(10).setScmId(scmId).setClusterId(clusterId).build();
String omPort = cluster.getOzoneManager().getRpcPort();
UserGroupInformation realUser = UserGroupInformation.createRemoteUser("realUser");
UserGroupInformation proxyUser = UserGroupInformation.createProxyUser("user", realUser);
proxyUser.doAs(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws IOException {
conf.set("ozone.security.enabled", "true");
OzoneClient ozoneClient = OzoneClientFactory.getRpcClient("localhost", Integer.parseInt(omPort), conf);
ozoneClient.getObjectStore().listVolumes("/");
return null;
}
});
Assert.fail("Should throw exception here");
} catch (IOException | InterruptedException e) {
assert e instanceof AccessControlException;
}
}
Aggregations