You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/04/30 06:09:59 UTC

[GitHub] [hadoop-ozone] cxorm commented on a change in pull request #770: HDDS-3178. Add unit tests for OMGetDelegationToken Request and Response

cxorm commented on a change in pull request #770:
URL: https://github.com/apache/hadoop-ozone/pull/770#discussion_r417775797



##########
File path: hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/security/TestOMGetDelegationTokenRequest.java
##########
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om.request.security;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Optional;
+import java.util.UUID;
+import org.apache.hadoop.ozone.om.response.OMClientResponse;
+import org.apache.hadoop.ozone.security.OzoneDelegationTokenSecretManager;
+import org.apache.hadoop.ozone.security.OzoneTokenIdentifier;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
+    .OMRequest;
+import static org.apache.hadoop.ozone.security.OzoneTokenIdentifier.KIND_NAME;
+import org.apache.hadoop.security.token.Token;
+import org.apache.hadoop.security.proto.SecurityProtos.GetDelegationTokenRequestProto;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.hadoop.io.Text;
+import org.mockito.Mockito;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.when;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * The class tests OMGetDelegationTokenRequest.
+ */
+public class TestOMGetDelegationTokenRequest extends
+    TestOMDelegationTokenRequest {
+
+  private OzoneDelegationTokenSecretManager secretManager;
+  private OzoneTokenIdentifier identifier;
+  private Token<OzoneTokenIdentifier> token;
+  private Text tester;
+  private OMRequest originalRequest;
+  private OMRequest modifiedRequest;
+  private OMGetDelegationTokenRequest omGetDelegationTokenRequest;
+  final private String checkResponse = "";
+
+  @Before
+  public void setupGetDelegationToken() {
+    secretManager = Mockito.mock(OzoneDelegationTokenSecretManager.class);
+    when(ozoneManager.getDelegationTokenMgr()).thenReturn(secretManager);
+    secretManager = ozoneManager.getDelegationTokenMgr();

Review comment:
       Thank you @hanishakoneru for the review.
   
   Yes, we don't need `secretManager` here.
   Updated.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org