hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodePoolManager.java
@Test
  public void testDefaultNodePoolReload() throws IOException {
    OzoneConfiguration conf = new OzoneConfiguration();
    final String defaultPool = "DefaultPool";
    final int nodeCount = 4;
    final List<DatanodeDetails> nodes = TestUtils
        .getListOfDatanodeDetails(nodeCount);

    try {
      try {
        SCMNodePoolManager npMgr = createNodePoolManager(conf);
        assertEquals(0, npMgr.getNodePools().size());
        for (DatanodeDetails node : nodes) {
          npMgr.addNode(defaultPool, node);
        }
        List<DatanodeDetails> nodesRetrieved = npMgr.getNodes(defaultPool);
        assertEquals(nodeCount, nodesRetrieved.size());
        assertTwoDatanodeListsEqual(nodes, nodesRetrieved);
        npMgr.close();
      } finally {
        LOG.info("testDefaultNodePoolReload: Finish adding nodes to pool" +
            " and close.");
      }

      // try reload with a new NodePoolManager instance
      try {
        SCMNodePoolManager npMgr = createNodePoolManager(conf);
        List<DatanodeDetails> nodesRetrieved = npMgr.getNodes(defaultPool);
        assertEquals(nodeCount, nodesRetrieved.size());
        assertTwoDatanodeListsEqual(nodes, nodesRetrieved);
      } finally {
        LOG.info("testDefaultNodePoolReload: Finish reloading node pool.");
      }
    } finally {
      FileUtil.fullyDelete(testDir);
    }
  }
/**
   * Test default node pool reload.
   *
   * @throws IOException
   */
Test default node pool reload.
Test default node pool reload .
@Test
  public void testDefaultNodePoolReload() throws IOException {
    OzoneConfiguration conf = new OzoneConfiguration();
    final String defaultPool = "DefaultPool";
    final int nodeCount = 4;
    final List<DatanodeDetails> nodes = TestUtils
        .getListOfDatanodeDetails(nodeCount);
    try {
      try {
        SCMNodePoolManager npMgr = createNodePoolManager(conf);
        assertEquals(0, npMgr.getNodePools().size());
        for (DatanodeDetails node : nodes) {
          npMgr.addNode(defaultPool, node);
        }
        List<DatanodeDetails> nodesRetrieved = npMgr.getNodes(defaultPool);
        assertEquals(nodeCount, nodesRetrieved.size());
        assertTwoDatanodeListsEqual(nodes, nodesRetrieved);
        npMgr.close();
      } finally {
        LOG.info("testDefaultNodePoolReload: Finish adding nodes to pool" +
            " and close.");
      }
      try {
        SCMNodePoolManager npMgr = createNodePoolManager(conf);
        List<DatanodeDetails> nodesRetrieved = npMgr.getNodes(defaultPool);
        assertEquals(nodeCount, nodesRetrieved.size());
        assertTwoDatanodeListsEqual(nodes, nodesRetrieved);
      } finally {
        LOG.info("testDefaultNodePoolReload: Finish reloading node pool.");
      }
    } finally {
      FileUtil.fullyDelete(testDir);
    }
  }
@ Test public void testDefaultNodePoolReload ( ) throws IOException { OzoneConfiguration conf = new OzoneConfiguration ( ) ; final String defaultPool = "DefaultPool" ; final int nodeCount = 4 ; final List < DatanodeDetails > nodes = TestUtils . getListOfDatanodeDetails ( nodeCount ) ; try { try { SCMNodePoolManager npMgr = createNodePoolManager ( conf ) ; assertEquals ( 0 , npMgr . getNodePools ( ) . size ( ) ) ; for ( DatanodeDetails node : nodes ) { npMgr . addNode ( defaultPool , node ) ; } List < DatanodeDetails > nodesRetrieved = npMgr . getNodes ( defaultPool ) ; assertEquals ( nodeCount , nodesRetrieved . size ( ) ) ; assertTwoDatanodeListsEqual ( nodes , nodesRetrieved ) ; npMgr . close ( ) ; } finally { LOG . info ( "testDefaultNodePoolReload: Finish adding nodes to pool" + " and close." ) ; } try { SCMNodePoolManager npMgr = createNodePoolManager ( conf ) ; List < DatanodeDetails > nodesRetrieved = npMgr . getNodes ( defaultPool ) ; assertEquals ( nodeCount , nodesRetrieved . size ( ) ) ; assertTwoDatanodeListsEqual ( nodes , nodesRetrieved ) ; } finally { LOG . info ( "testDefaultNodePoolReload: Finish reloading node pool." ) ; } } finally { FileUtil . fullyDelete ( testDir ) ; } }
Test default node pool reload.
Test default node pool reload .
// try reload with a new NodePoolManager instance