Search in sources :

Example 1 with SqoopClient

use of org.apache.sqoop.client.SqoopClient in project testcases by coheigea.

the class SqoopSentryTest method testAliceUser.

// "alice" can create links and read connectors and jobs
@org.junit.Test
public void testAliceUser() throws Exception {
    SqoopClient client = jettySqoopRunner.getSqoopClient("alice");
    assertFalse(client.getConnectors().isEmpty());
    assertEquals(client.getLinks().size(), 2);
    assertEquals(client.getJobs().size(), 1);
    // Update one of the links
    MLink rdbmsLink = client.getLink("JDBC_link1");
    assertNotNull(rdbmsLink);
    rdbmsLink.setName("JDBC_link2");
    client.updateLink(rdbmsLink, "JDBC_link1");
    // Try to read the job
    MJob job1 = client.getJob("HDFS_JDBS_job1");
    assertNotNull(job1);
    job1.setName("HDFS_JDBS_job2");
    try {
        client.updateJob(job1, "HDFS_JDBS_job1");
        fail("Authorization failure expected");
    } catch (SqoopException ex) {
    // expected
    }
}
Also used : MJob(org.apache.sqoop.model.MJob) MLink(org.apache.sqoop.model.MLink) SqoopClient(org.apache.sqoop.client.SqoopClient) SqoopException(org.apache.sqoop.common.SqoopException)

Example 2 with SqoopClient

use of org.apache.sqoop.client.SqoopClient in project testcases by coheigea.

the class SqoopSentryTest method testBobUser.

// "bob" can't do anything
@org.junit.Test
public void testBobUser() throws Exception {
    SqoopClient client = jettySqoopRunner.getSqoopClient("bob");
    assertTrue(client.getConnectors().isEmpty());
    assertTrue(client.getLinks().isEmpty());
    assertTrue(client.getJobs().isEmpty());
}
Also used : SqoopClient(org.apache.sqoop.client.SqoopClient)

Example 3 with SqoopClient

use of org.apache.sqoop.client.SqoopClient in project testcases by coheigea.

the class SqoopRangerTest method testAliceUser.

// "alice" can create links and read connectors and jobs
@org.junit.Test
public void testAliceUser() throws Exception {
    SqoopClient client = jettySqoopRunner.getSqoopClient("alice");
    assertFalse(client.getConnectors().isEmpty());
    assertEquals(client.getLinks().size(), 2);
    assertEquals(client.getJobs().size(), 1);
    // Update one of the links
    MLink rdbmsLink = client.getLink("JDBC_link1");
    assertNotNull(rdbmsLink);
    rdbmsLink.setName("JDBC_link2");
    client.updateLink(rdbmsLink, "JDBC_link1");
    // Try to read the job
    MJob job1 = client.getJob("HDFS_JDBS_job1");
    assertNotNull(job1);
    job1.setName("HDFS_JDBS_job2");
    try {
        client.updateJob(job1, "HDFS_JDBS_job1");
        fail("Authorization failure expected");
    } catch (SqoopException ex) {
    // expected
    }
}
Also used : MJob(org.apache.sqoop.model.MJob) MLink(org.apache.sqoop.model.MLink) SqoopClient(org.apache.sqoop.client.SqoopClient) SqoopException(org.apache.sqoop.common.SqoopException)

Example 4 with SqoopClient

use of org.apache.sqoop.client.SqoopClient in project testcases by coheigea.

the class SqoopRangerTest method testAdminUser.

// The admin user can do anything
@org.junit.Test
public void testAdminUser() throws Exception {
    SqoopClient client = jettySqoopRunner.getSqoopClient("admin");
    assertFalse(client.getConnectors().isEmpty());
    assertEquals(client.getLinks().size(), 2);
    assertEquals(client.getJobs().size(), 1);
}
Also used : SqoopClient(org.apache.sqoop.client.SqoopClient)

Example 5 with SqoopClient

use of org.apache.sqoop.client.SqoopClient in project testcases by coheigea.

the class SqoopSentryTest method testAdminUser.

// The admin user can do anything
@org.junit.Test
public void testAdminUser() throws Exception {
    SqoopClient client = jettySqoopRunner.getSqoopClient("admin");
    assertFalse(client.getConnectors().isEmpty());
    assertEquals(client.getLinks().size(), 2);
    assertEquals(client.getJobs().size(), 1);
}
Also used : SqoopClient(org.apache.sqoop.client.SqoopClient)

Aggregations

SqoopClient (org.apache.sqoop.client.SqoopClient)9 MJob (org.apache.sqoop.model.MJob)5 MLink (org.apache.sqoop.model.MLink)5 SqoopException (org.apache.sqoop.common.SqoopException)2