|
@@ -32,6 +32,8 @@ import org.apache.hadoop.hdds.scm.TestUtils;
|
|
import org.apache.hadoop.hdds.scm.XceiverClientGrpc;
|
|
import org.apache.hadoop.hdds.scm.XceiverClientGrpc;
|
|
import org.apache.hadoop.hdds.scm.XceiverClientSpi;
|
|
import org.apache.hadoop.hdds.scm.XceiverClientSpi;
|
|
import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
|
|
import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
|
|
|
|
+import org.apache.hadoop.ozone.container.common.statemachine.DatanodeStateMachine;
|
|
|
|
+import org.apache.hadoop.ozone.container.common.statemachine.StateContext;
|
|
import org.apache.hadoop.security.SecurityUtil;
|
|
import org.apache.hadoop.security.SecurityUtil;
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
import org.apache.hadoop.security.token.Token;
|
|
import org.apache.hadoop.security.token.Token;
|
|
@@ -45,6 +47,7 @@ import org.junit.rules.TemporaryFolder;
|
|
import org.junit.rules.Timeout;
|
|
import org.junit.rules.Timeout;
|
|
import org.junit.runner.RunWith;
|
|
import org.junit.runner.RunWith;
|
|
import org.junit.runners.Parameterized;
|
|
import org.junit.runners.Parameterized;
|
|
|
|
+import org.mockito.Mockito;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
@@ -133,7 +136,7 @@ public class TestSecureOzoneContainer {
|
|
OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT, false);
|
|
OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT, false);
|
|
|
|
|
|
DatanodeDetails dn = TestUtils.randomDatanodeDetails();
|
|
DatanodeDetails dn = TestUtils.randomDatanodeDetails();
|
|
- container = new OzoneContainer(dn, conf, null);
|
|
|
|
|
|
+ container = new OzoneContainer(dn, conf, getContext(dn));
|
|
//Setting scmId, as we start manually ozone container.
|
|
//Setting scmId, as we start manually ozone container.
|
|
container.getDispatcher().setScmId(UUID.randomUUID().toString());
|
|
container.getDispatcher().setScmId(UUID.randomUUID().toString());
|
|
container.start();
|
|
container.start();
|
|
@@ -206,4 +209,13 @@ public class TestSecureOzoneContainer {
|
|
Assert.assertNotNull(response);
|
|
Assert.assertNotNull(response);
|
|
Assert.assertTrue(request.getTraceID().equals(response.getTraceID()));
|
|
Assert.assertTrue(request.getTraceID().equals(response.getTraceID()));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private StateContext getContext(DatanodeDetails datanodeDetails) {
|
|
|
|
+ DatanodeStateMachine stateMachine = Mockito.mock(
|
|
|
|
+ DatanodeStateMachine.class);
|
|
|
|
+ StateContext context = Mockito.mock(StateContext.class);
|
|
|
|
+ Mockito.when(stateMachine.getDatanodeDetails()).thenReturn(datanodeDetails);
|
|
|
|
+ Mockito.when(context.getParent()).thenReturn(stateMachine);
|
|
|
|
+ return context;
|
|
|
|
+ }
|
|
}
|
|
}
|