@Test
public void testRouterRpcWithNoSubclusters() throws IOException {

  Router router = new Router();
  router.init(new RouterConfigBuilder(conf).rpc().build());
  router.start();
  InetSocketAddress serverAddress = router.getRpcServerAddress();
  DFSClient dfsClient = new DFSClient(serverAddress, conf);
  try {
    dfsClient.create("/test.txt", false);
    fail("Create with no subclusters should fail");
  } catch (RemoteException e) {
    assertExceptionContains("Cannot find locations for /test.txt", e);
  }
  try {
    dfsClient.datanodeReport(DatanodeReportType.LIVE);
    fail("Get datanode reports with no subclusters should fail");
  } catch (IOException e) {
    assertExceptionContains("No remote locations available", e);
  }
  dfsClient.close();
  router.stop();
  router.close();
}