List of usage examples for org.apache.hadoop.mapreduce Cluster getQueueAclsForCurrentUser
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException, InterruptedException
From source file:org.pentaho.hadoop.shim.common.ConfigurationProxyV2Test.java
License:Apache License
@Test(expected = YarnQueueAclsException.class) public void testSubmitWhenUserHasNoPermissionsToSubmitJobInQueueShouldRaiseYarnQueueAclsException() throws IOException, InterruptedException, ClassNotFoundException { Mockito.spy(YarnQueueAclsVerifier.class); ConfigurationProxyV2 configurationProxyV2 = Mockito.mock(ConfigurationProxyV2.class); Cluster cluster = Mockito.mock(Cluster.class); Job job = Mockito.mock(Job.class); Mockito.when(configurationProxyV2.getJob()).thenReturn(job); Mockito.when(configurationProxyV2.createClusterDescription(Mockito.any(Configuration.class))) .thenReturn(cluster);/*w w w . ja v a 2 s.co m*/ Mockito.when(configurationProxyV2.submit()).thenCallRealMethod(); Mockito.when(cluster.getQueueAclsForCurrentUser()) .thenReturn(new QueueAclsInfo[] { new QueueAclsInfo(StringUtils.EMPTY, new String[] { "ANOTHER_RIGHTS" }), new QueueAclsInfo(StringUtils.EMPTY, new String[] {}) }); configurationProxyV2.submit(); }
From source file:org.pentaho.hadoop.shim.common.ConfigurationProxyV2Test.java
License:Apache License
@Test public void testSubmitWhenUserHasPermissionsToSubmitJobInQueueShouldExecuteSuccessfully() throws IOException, InterruptedException, ClassNotFoundException { Mockito.spy(YarnQueueAclsVerifier.class); ConfigurationProxyV2 configurationProxyV2 = Mockito.mock(ConfigurationProxyV2.class); Cluster cluster = Mockito.mock(Cluster.class); Job job = Mockito.mock(Job.class); Mockito.when(configurationProxyV2.getJob()).thenReturn(job); Mockito.when(configurationProxyV2.createClusterDescription(Mockito.any(Configuration.class))) .thenReturn(cluster);/* w ww . jav a 2s .co m*/ Mockito.when(configurationProxyV2.submit()).thenCallRealMethod(); Mockito.when(cluster.getQueueAclsForCurrentUser()) .thenReturn(new QueueAclsInfo[] { new QueueAclsInfo(StringUtils.EMPTY, new String[] { "SUBMIT_APPLICATIONS" }), new QueueAclsInfo(StringUtils.EMPTY, new String[] {}) }); Assert.assertNotNull(configurationProxyV2.submit()); }