slfan1989 commented on code in PR #5169:
URL: https://github.com/apache/hadoop/pull/5169#discussion_r1038739739


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/java/org/apache/hadoop/yarn/server/federation/store/impl/TestSQLFederationStateStore.java:
##########
@@ -558,38 +562,134 @@ public void 
testDeleteReservationHomeSubClusterAbnormalSituation() throws Except
         () -> stateStore.deleteReservationHomeSubCluster(delRequest));
   }
 
-  @Test(expected = NotImplementedException.class)
+  @Test
   public void testStoreNewMasterKey() throws Exception {
     super.testStoreNewMasterKey();
   }
 
-  @Test(expected = NotImplementedException.class)
+  @Test
   public void testGetMasterKeyByDelegationKey() throws YarnException, 
IOException {
     super.testGetMasterKeyByDelegationKey();
   }
 
-  @Test(expected = NotImplementedException.class)
+  @Test
   public void testRemoveStoredMasterKey() throws YarnException, IOException {
     super.testRemoveStoredMasterKey();
   }
 
-  @Test(expected = NotImplementedException.class)
+  @Test
   public void testStoreNewToken() throws IOException, YarnException {
-    super.testStoreNewToken();
+    FederationStateStore stateStore = getStateStore();
+
+    // prepare parameters
+    RMDelegationTokenIdentifier identifier = new RMDelegationTokenIdentifier(
+        new Text("owner1"), new Text("renewer1"), new Text("realuser1"));
+    int sequenceNumber = 1;
+    identifier.setSequenceNumber(sequenceNumber);
+    Long renewDate = Time.now();
+    String tokenInfo = "tokenInfo";
+
+    // store new rm-token
+    RouterStoreToken storeToken = RouterStoreToken.newInstance(identifier, 
renewDate, tokenInfo);
+    RouterRMTokenRequest request = 
RouterRMTokenRequest.newInstance(storeToken);
+    RouterRMTokenResponse routerRMTokenResponse = 
stateStore.storeNewToken(request);
+
+    // Verify the returned result to ensure that the returned Response is not 
empty
+    // and the returned result is consistent with the input parameters.
+    Assert.assertNotNull(routerRMTokenResponse);
+    RouterStoreToken storeTokenResp = 
routerRMTokenResponse.getRouterStoreToken();
+    Assert.assertNotNull(storeTokenResp);
+    Assert.assertEquals(storeToken.getRenewDate(), 
storeTokenResp.getRenewDate());
+    Assert.assertEquals(storeToken.getTokenIdentifier(), 
storeTokenResp.getTokenIdentifier());
+    Assert.assertEquals(storeToken.getTokenInfo(), 
storeTokenResp.getTokenInfo());
   }
 
-  @Test(expected = NotImplementedException.class)
+  @Test
   public void testUpdateStoredToken() throws IOException, YarnException {
-    super.testUpdateStoredToken();
+    FederationStateStore stateStore = getStateStore();

Review Comment:
   We will use the super test directly, the super test can cover this part, I 
will modify the code.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to