Example usage for org.apache.hadoop.mapreduce QueueAclsInfo QueueAclsInfo

List of usage examples for org.apache.hadoop.mapreduce QueueAclsInfo QueueAclsInfo

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce QueueAclsInfo QueueAclsInfo.

Prototype

public QueueAclsInfo(String queueName, String[] operations) 

Source Link

Document

Construct a new QueueAclsInfo object using the queue name and the queue operations array

Usage

From source file:org.pentaho.hadoop.mapreduce.YarnQueueAclsVerifierTest.java

License:Apache License

@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[] {}) }));
}

From source file:org.pentaho.hadoop.mapreduce.YarnQueueAclsVerifierTest.java

License:Apache License

@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[] {}) }));
}

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  ww  .j av  a  2s .  c o 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);//from w  ww.  j av a 2  s .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());
}