hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestNodeManager.java
@Test
  public void testScmShutdown() throws IOException, InterruptedException,
      TimeoutException {
    OzoneConfiguration conf = getConf();
    conf.getTimeDuration(ScmConfigKeys.OZONE_SCM_HEARTBEAT_PROCESS_INTERVAL,
        100, TimeUnit.MILLISECONDS);
    SCMNodeManager nodeManager = createNodeManager(conf);
    DatanodeDetails datanodeDetails = TestUtils.getDatanodeDetails(nodeManager);
    nodeManager.close();

    // These should never be processed.
    nodeManager.sendHeartbeat(datanodeDetails.getProtoBufMessage(),
        null, reportState);

    // Let us just wait for 2 seconds to prove that HBs are not processed.
    Thread.sleep(2 * 1000);

    assertEquals("Assert new HBs were never processed", 0,
        nodeManager.getLastHBProcessedCount());
  }
/**
   * Asserts that adding heartbeats after shutdown does not work. This implies
   * that heartbeat thread has been shutdown safely by closing the node
   * manager.
   *
   * @throws IOException
   * @throws InterruptedException
   * @throws TimeoutException
   */
Asserts that adding heartbeats after shutdown does not work. This implies
that heartbeat thread has been shutdown safely by closing the node
manager.


Asserts that adding heartbeats after shutdown does not work . This implies that heartbeat thread has been shutdown safely by closing the node manager .
@Test
  public void testScmShutdown() throws IOException, InterruptedException,
      TimeoutException {
    OzoneConfiguration conf = getConf();
    conf.getTimeDuration(ScmConfigKeys.OZONE_SCM_HEARTBEAT_PROCESS_INTERVAL,
        100, TimeUnit.MILLISECONDS);
    SCMNodeManager nodeManager = createNodeManager(conf);
    DatanodeDetails datanodeDetails = TestUtils.getDatanodeDetails(nodeManager);
    nodeManager.close();
    nodeManager.sendHeartbeat(datanodeDetails.getProtoBufMessage(),
        null, reportState);
    Thread.sleep(2 * 1000);
    assertEquals("Assert new HBs were never processed", 0,
        nodeManager.getLastHBProcessedCount());
  }
@ Test public void testScmShutdown ( ) throws IOException , InterruptedException , TimeoutException { OzoneConfiguration conf = getConf ( ) ; conf . getTimeDuration ( ScmConfigKeys . OZONE_SCM_HEARTBEAT_PROCESS_INTERVAL , 100 , TimeUnit . MILLISECONDS ) ; SCMNodeManager nodeManager = createNodeManager ( conf ) ; DatanodeDetails datanodeDetails = TestUtils . getDatanodeDetails ( nodeManager ) ; nodeManager . close ( ) ; nodeManager . sendHeartbeat ( datanodeDetails . getProtoBufMessage ( ) , null , reportState ) ; Thread . sleep ( 2 * 1000 ) ; assertEquals ( "Assert new HBs were never processed" , 0 , nodeManager . getLastHBProcessedCount ( ) ) ; }
Asserts that adding heartbeats after shutdown does not work.
Asserts that adding heartbeats after shutdown does not work .
// These should never be processed. // Let us just wait for 2 seconds to prove that HBs are not processed.