org.apache.hadoop.mapreduce.QueueAclsInfo Java Examples

The following examples show how to use org.apache.hadoop.mapreduce.QueueAclsInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigurationProxyV2Test.java    From pentaho-hadoop-shims with Apache License 2.0 6 votes vote down vote up
@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 );
  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();
}
 
Example #2
Source File: ConfigurationProxyV2Test.java    From pentaho-hadoop-shims with Apache License 2.0 6 votes vote down vote up
@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 );
  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() );
}
 
Example #3
Source File: ResourceMgrDelegate.java    From tez with Apache License 2.0 5 votes vote down vote up
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
    InterruptedException {
  try {
    return TypeConverter.fromYarnQueueUserAclsInfo(
        client.getQueueAclsInfo());
  } catch (YarnException e) {
    throw new IOException(e);
  }
}
 
Example #4
Source File: ResourceMgrDelegate.java    From big-c with Apache License 2.0 5 votes vote down vote up
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
    InterruptedException {
  try {
    return TypeConverter.fromYarnQueueUserAclsInfo(client
      .getQueueAclsInfo());
  } catch (YarnException e) {
    throw new IOException(e);
  }
}
 
Example #5
Source File: ResourceMgrDelegate.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
    InterruptedException {
  try {
    return TypeConverter.fromYarnQueueUserAclsInfo(
        client.getQueueAclsInfo());
  } catch (YarnException e) {
    throw new IOException(e);
  }
}
 
Example #6
Source File: YarnQueueAclsVerifierTest.java    From pentaho-hadoop-shims with Apache License 2.0 5 votes vote down vote up
@Test
public void testVerifyWhenUserHasPermissionsForSubmitInAnyQueueShouldReturnTrue() throws Exception {
  assertTrue( YarnQueueAclsVerifier.verify( new QueueAclsInfo[] {
    new QueueAclsInfo( StringUtils.EMPTY, new String[] {
      "SUBMIT_APPLICATIONS"
    } ),
    new QueueAclsInfo( StringUtils.EMPTY, new String[] {} )
  } ) );
}
 
Example #7
Source File: YarnQueueAclsVerifierTest.java    From pentaho-hadoop-shims with Apache License 2.0 5 votes vote down vote up
@Test
public void testVerifyWhenUserHasNoPermissionsForSubmitInAnyQueueShouldReturnFalse() throws Exception {
  assertFalse( YarnQueueAclsVerifier.verify( new QueueAclsInfo[] {
    new QueueAclsInfo( StringUtils.EMPTY, new String[] {
      "ANOTHER_RIGHTS"
    } ),
    new QueueAclsInfo( StringUtils.EMPTY, new String[] {} )
  } ) );
}
 
Example #8
Source File: ResourceMgrDelegate.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
    InterruptedException {
  try {
    return TypeConverter.fromYarnQueueUserAclsInfo(client
      .getQueueAclsInfo());
  } catch (YarnException e) {
    throw new IOException(e);
  }
}
 
Example #9
Source File: YarnQueueAclsVerifier.java    From pentaho-hadoop-shims with Apache License 2.0 4 votes vote down vote up
public static boolean verify( QueueAclsInfo[] queueAclsInfos ) throws IOException, InterruptedException {
  return queueAclsInfos != null && Arrays.stream( queueAclsInfos ).map( QueueAclsInfo::getOperations )
    .flatMap( Arrays::stream ).anyMatch( Predicate.isEqual( QueueACL.SUBMIT_APPLICATIONS.toString() ) );
}
 
Example #10
Source File: YARNRunner.java    From tez with Apache License 2.0 4 votes vote down vote up
@Override
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
    InterruptedException {
  return resMgrDelegate.getQueueAclsForCurrentUser();
}
 
Example #11
Source File: YARNRunner.java    From incubator-tez with Apache License 2.0 4 votes vote down vote up
@Override
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
    InterruptedException {
  return resMgrDelegate.getQueueAclsForCurrentUser();
}
 
Example #12
Source File: MockSimulatorJobTracker.java    From RDFS with Apache License 2.0 4 votes vote down vote up
@Override
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
    InterruptedException {
  throw new UnsupportedOperationException();

}
 
Example #13
Source File: HadoopClientProtocol.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException, InterruptedException {
    return new QueueAclsInfo[0];
}
 
Example #14
Source File: YARNRunner.java    From big-c with Apache License 2.0 4 votes vote down vote up
@Override
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
    InterruptedException {
  return resMgrDelegate.getQueueAclsForCurrentUser();
}
 
Example #15
Source File: YARNRunner.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
    InterruptedException {
  return resMgrDelegate.getQueueAclsForCurrentUser();
}
 
Example #16
Source File: ClientProtocol.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the Queue ACLs for current user
 * @return array of QueueAclsInfo object for current user.
 * @throws IOException
 */
public QueueAclsInfo[] getQueueAclsForCurrentUser() 
throws IOException, InterruptedException;
 
Example #17
Source File: ClientProtocol.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the Queue ACLs for current user
 * @return array of QueueAclsInfo object for current user.
 * @throws IOException
 */
public QueueAclsInfo[] getQueueAclsForCurrentUser() 
throws IOException, InterruptedException;