@Test
public void testRemoveValidServer()
    throws Exception
{

    /*
     * THIS TEST MUST NOT BE RUN FROM IDE(STS). OTHERWISE, config/hms-inventory.json will be CORRUPTED. IF NEEDS TO
     * BE RUN FROM IDE, YOU MUST NEED TO SET BELOW JVM ARGUMENT.
     * -Dhms.config.file=src/test/resources/test-config.properties
     */
    final String serverId = "N" + getDateTimeStamp();
    // mock data - starts
    ServerNode serverNode = getServerNode( serverId );
    ServerNodeConnector.getInstance().setNodeMap( new ConcurrentHashMap<String, HmsNode>() );
    ServerNodeConnector.getInstance().getNodeMap().put( serverId, serverNode );
    BoardServiceProvider.addBoardServiceClass( serverNode.getServiceObject(), BoardService_TEST.class, true );
    // delete the backup file
    HmsGenericUtil.deleteLatestInventoryBackup();
    ServerItem serverItem = getServerItem( serverId );
    List<ServerItem> serverItemLst = new ArrayList<ServerItem>();
    serverItemLst.add( serverItem );
    HmsInventoryConfiguration hmsInventoryConfiguration = new HmsInventoryConfiguration();
    hmsInventoryConfiguration.setServers( serverItemLst );
    HmsConfigHolder.setHmsInventoryConfiguration( hmsInventoryConfiguration );
    // mock data - ends
    // delete the backup file
    HmsGenericUtil.deleteLatestInventoryBackup();
    ServerRestService serverRestService = new ServerRestService();
    Response response = serverRestService.removeServer( serverId );
    assertNotNull( response );
    assertTrue( response.getStatus() == Response.Status.OK.getStatusCode() );
    // delete the backup file
    HmsGenericUtil.deleteLatestInventoryBackup();
}