Search in sources :

Example 6 with SqoopClient

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

the class SqoopSentryTest method setup.

@org.junit.BeforeClass
public static void setup() throws Exception {
    tempDir = Files.createTempDirectory("sqoop");
    String sentrySitePath = "file:" + SqoopSentryTest.class.getResource("/sentry-site.xml").getPath();
    jettySqoopRunner = new JettySqoopRunner(tempDir.toString(), "sqoopServer1", sentrySitePath, false);
    jettySqoopRunner.start();
    // Create some links, jobs via the admin
    SqoopClient client = jettySqoopRunner.getSqoopClient("admin");
    MLink rdbmsLink = client.createLink("generic-jdbc-connector");
    jettySqoopRunner.fillRdbmsLinkConfig(rdbmsLink);
    rdbmsLink.setName("JDBC_link1");
    jettySqoopRunner.saveLink(client, rdbmsLink);
    MLink hdfsLink = client.createLink("hdfs-connector");
    jettySqoopRunner.fillHdfsLink(hdfsLink);
    hdfsLink.setName("HDFS_link1");
    jettySqoopRunner.saveLink(client, hdfsLink);
    MJob job1 = client.createJob(hdfsLink.getName(), rdbmsLink.getName());
    jettySqoopRunner.fillHdfsFromConfig(job1);
    jettySqoopRunner.fillRdbmsToConfig(job1);
    // create job
    job1.setName("HDFS_JDBS_job1");
    jettySqoopRunner.saveJob(client, job1);
}
Also used : MJob(org.apache.sqoop.model.MJob) MLink(org.apache.sqoop.model.MLink) SqoopClient(org.apache.sqoop.client.SqoopClient)

Example 7 with SqoopClient

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

the class SqoopRangerTest 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 8 with SqoopClient

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

the class SqoopRangerTest method setup.

@org.junit.BeforeClass
public static void setup() throws Exception {
    tempDir = Files.createTempDirectory("sqoop");
    jettySqoopRunner = new JettySqoopRunner(tempDir.toString(), "sqoopServer1", null, true);
    jettySqoopRunner.start();
    // Create some links, jobs via the admin
    SqoopClient client = jettySqoopRunner.getSqoopClient("admin");
    MLink rdbmsLink = client.createLink("generic-jdbc-connector");
    jettySqoopRunner.fillRdbmsLinkConfig(rdbmsLink);
    rdbmsLink.setName("JDBC_link1");
    jettySqoopRunner.saveLink(client, rdbmsLink);
    MLink hdfsLink = client.createLink("hdfs-connector");
    jettySqoopRunner.fillHdfsLink(hdfsLink);
    hdfsLink.setName("HDFS_link1");
    jettySqoopRunner.saveLink(client, hdfsLink);
    MJob job1 = client.createJob(hdfsLink.getName(), rdbmsLink.getName());
    jettySqoopRunner.fillHdfsFromConfig(job1);
    jettySqoopRunner.fillRdbmsToConfig(job1);
    // create job
    job1.setName("HDFS_JDBS_job1");
    jettySqoopRunner.saveJob(client, job1);
}
Also used : MJob(org.apache.sqoop.model.MJob) MLink(org.apache.sqoop.model.MLink) SqoopClient(org.apache.sqoop.client.SqoopClient)

Example 9 with SqoopClient

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

the class SqoopTest method testCreateLinksAndJob.

@org.junit.Test
public void testCreateLinksAndJob() throws Exception {
    SqoopClient client = jettySqoopRunner.getSqoopClient("admin");
    assertFalse(client.getConnectors().isEmpty());
    MLink rdbmsLink = client.createLink("generic-jdbc-connector");
    jettySqoopRunner.fillRdbmsLinkConfig(rdbmsLink);
    rdbmsLink.setName("JDBC_link1");
    jettySqoopRunner.saveLink(client, rdbmsLink);
    MLink hdfsLink = client.createLink("hdfs-connector");
    jettySqoopRunner.fillHdfsLink(hdfsLink);
    hdfsLink.setName("HDFS_link1");
    jettySqoopRunner.saveLink(client, hdfsLink);
    MJob job1 = client.createJob(hdfsLink.getName(), rdbmsLink.getName());
    jettySqoopRunner.fillHdfsFromConfig(job1);
    jettySqoopRunner.fillRdbmsToConfig(job1);
    // create job
    job1.setName("HDFS_JDBS_job1");
    jettySqoopRunner.saveJob(client, job1);
}
Also used : MJob(org.apache.sqoop.model.MJob) MLink(org.apache.sqoop.model.MLink) 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