DFSHAAdmin extends HAAdmin { private int transitionToObserver(final CommandLine cmd) throws IOException, ServiceFailedException { String[] argv = cmd.getArgs(); if (argv.length != 1) { errOut.println("transitionToObserver: incorrect number of arguments"); printUsage(errOut, "-transitionToObserver", USAGE_DFS_MERGED); return -1; } HAServiceTarget target = resolveTarget(argv[0]); if (!checkSupportObserver(target)) { return -1; } if (!checkManualStateManagementOK(target)) { return -1; } HAServiceProtocol proto = target.getProxy(getConf(), 0); HAServiceProtocolHelper.transitionToObserver(proto, createReqInfo()); return 0; }  @Override void setConf(Configuration conf); static Configuration addSecurityConfiguration(Configuration conf); static void main(String[] argv);  }
@Test public void testTransitionToObserver() throws Exception { assertEquals(0, runTool("-transitionToObserver", "nn1")); Mockito.verify(mockProtocol).transitionToObserver(anyReqInfo()); }