Cluster { ClientProtocol getClient() { return client; } Cluster(Configuration conf);  Cluster(InetSocketAddress jobTrackAddr, Configuration conf); synchronized void close(); synchronized FileSystem getFileSystem(); Job getJob(JobID jobId); QueueInfo[] getQueues(); QueueInfo getQueue(String name); LogParams getLogParams(JobID jobID, TaskAttemptID taskAttemptID); ClusterMetrics getClusterStatus(); TaskTrackerInfo[] getActiveTaskTrackers(); TaskTrackerInfo[] getBlackListedTaskTrackers(); @Deprecated Job[] getAllJobs(); JobStatus[] getAllJobStatuses(); Path getSystemDir(); Path getStagingAreaDir(); String getJobHistoryUrl(JobID jobId); QueueAclsInfo[] getQueueAclsForCurrentUser(); QueueInfo[] getRootQueues(); QueueInfo[] getChildQueues(String queueName); JobTrackerStatus getJobTrackerStatus(); long getTaskTrackerExpiryInterval(); Token<DelegationTokenIdentifier> getDelegationToken(Text renewer); long renewDelegationToken(Token<DelegationTokenIdentifier> token
                                   ); void cancelDelegationToken(Token<DelegationTokenIdentifier> token
                                    );  }
@Test @SuppressWarnings("unchecked") public void testProtocolProviderCreation() throws Exception { Iterator iterator = mock(Iterator.class); when(iterator.hasNext()).thenReturn(true, true, true, true); when(iterator.next()).thenReturn(getClientProtocolProvider()) .thenThrow(new ServiceConfigurationError("Test error")) .thenReturn(getClientProtocolProvider()); Iterable frameworkLoader = mock(Iterable.class); when(frameworkLoader.iterator()).thenReturn(iterator); Cluster.frameworkLoader = frameworkLoader; Cluster testCluster = new Cluster(new Configuration()); assertNotNull("ClientProtocol is expected", testCluster.getClient()); verify(iterator, times(2)).next(); }