sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szvasas <...@git.apache.org>
Subject [GitHub] sqoop pull request #38: Metastore
Date Fri, 28 Jul 2017 13:09:44 GMT
Github user szvasas commented on a diff in the pull request:

    https://github.com/apache/sqoop/pull/38#discussion_r130063002
  
    --- Diff: src/test/com/cloudera/sqoop/metastore/SavedJobsTest.java ---
    @@ -0,0 +1,379 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package com.cloudera.sqoop.metastore;
    +
    +import java.sql.SQLException;
    +import java.sql.Statement;
    +
    +import java.util.*;
    +
    +import com.cloudera.sqoop.manager.ConnManager;
    +import com.cloudera.sqoop.manager.MySQLTestUtils;
    +import com.cloudera.sqoop.manager.OracleUtils;
    +import org.apache.hadoop.conf.Configuration;
    +
    +import com.cloudera.sqoop.SqoopOptions;
    +import com.cloudera.sqoop.tool.VersionTool;
    +import org.apache.sqoop.manager.*;
    +import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils;
    +import org.apache.sqoop.tool.ImportTool;
    +import org.junit.*;
    +import org.junit.rules.ExpectedException;
    +import org.junit.runner.RunWith;
    +import org.junit.runners.Parameterized;
    +
    +import java.io.IOException;
    +import java.sql.Connection;
    +
    +import static org.apache.sqoop.metastore.GenericJobStorage.*;
    +import static org.hamcrest.core.IsCollectionContaining.hasItems;
    +import static org.junit.Assert.assertEquals;
    +import static org.junit.Assert.assertThat;
    +
    +/**
    + * Test the metastore and job-handling features.
    + *
    + * These all make use of the auto-connect hsqldb-based metastore.
    + * The metastore URL is configured to be in-memory, and drop all
    + * state between individual tests.
    + */
    +@RunWith(Parameterized.class)
    +public class SavedJobsTest {
    +
    +  private static MySQLTestUtils mySQLTestUtils = new MySQLTestUtils();
    +  private static MSSQLTestUtils msSQLTestUtils = new MSSQLTestUtils();
    +
    +  @Parameterized.Parameters(name = "metaConnect = {0}, metaUser = {1}, metaPassword =
{2}, driverClass = {3}")
    +  public static Iterable<? extends Object> dbConnectParameters() {
    +    return Arrays.asList(
    +            new Object[] {
    +                    mySQLTestUtils.getHostUrl(), mySQLTestUtils.getUserName(),
    +                    mySQLTestUtils.getUserPass(), MySQLManager.DRIVER_CLASS
    +            },
    +            new Object[] {
    +                   OracleUtils.CONNECT_STRING, OracleUtils.ORACLE_USER_NAME,
    +                    OracleUtils.ORACLE_USER_PASS, OracleManager.DRIVER_CLASS
    +            },
    +            new Object[] {
    +                   msSQLTestUtils.getDBConnectString(), msSQLTestUtils.getDBUserName(),
    +                    msSQLTestUtils.getDBPassWord(), SQLServerManager.DRIVER_CLASS
    +            },
    +            new Object[] {
    +                    System.getProperty(
    +                            "sqoop.test.postgresql.connectstring.host_url",
    +                            "jdbc:postgresql://localhost/"),
    +                    System.getProperty(
    +                            "sqoop.test.postgresql.connectstring.username",
    +                            "sqooptest"),
    +                    System.getProperty(
    +                            "sqoop.test.postgresql.connectstring.password"),
    +                    PostgresqlManager.DRIVER_CLASS
    +            },
    +            new Object[] {
    +                    System.getProperty(
    +                            "sqoop.test.db2.connectstring.host_url",
    +                            "jdbc:db2://db2host:50000"),
    +                    System.getProperty(
    +                            "sqoop.test.db2.connectstring.username",
    +                            "SQOOP"),
    +                    System.getProperty(
    +                            "sqoop.test.db2.connectstring.password",
    +                            "SQOOP"),
    +                    Db2Manager.DRIVER_CLASS
    +            },
    +            new Object[] { "jdbc:hsqldb:mem:sqoopmetastore", "SA" , "", HsqldbManager.DRIVER_CLASS
}
    +            );
    +  }
    +
    +  private String metaConnect;
    +  private String metaUser;
    +  private String metaPassword;
    +  private String driverClass;
    +  private JobStorage storage;
    +
    +  private Configuration conf;
    +  private Map<String, String> descriptor;
    +
    +  public String INVALID_KEY = "INVALID_KEY";
    +
    +
    +
    +  public SavedJobsTest(String metaConnect, String metaUser, String metaPassword, String
driverClass){
    +    this.metaConnect = metaConnect;
    +    this.metaUser = metaUser;
    +    this.metaPassword = metaPassword;
    +    this.driverClass = driverClass;
    +    descriptor = new TreeMap<String, String>();
    --- End diff --
    
    We could use the diamond operator here, String, String is redundant.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message