Code coverage report for app/data/db_properties_info.js

Statements: 100% (3 / 3)      Branches: 100% (0 / 0)      Functions: 100% (1 / 1)      Lines: 100% (3 / 3)      Ignored: none     

All files » app/data/ » db_properties_info.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129    1                                     1   1                                                                                                                                                                                                                  
'use strict';
 
;require.register("data/db_properties_info", function (exports, require, module) {
  /**
   * 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.
   */
 
  var App = require('app');
 
  module.exports = {
    /**
     * object that shows property names for different kind of config properties
     * - radio button property (db_selector) - main config on which can depend other core properties
     * - properties used to generate connection url (host_name, db_name)
     * - properties that should be updated on radio buttons change (connection_url, driver, db_type, sql_jar_connector)
     * @see <code>setConnectionUrl<code> for details for connection_url
     * - properties that should be hidden in special case (user_name, password)
     * @see <code>handleSpecialUserPassProperties<code> method
     * @type {object}
     */
    dpPropertiesByServiceMap: {
      'HIVE': {
        db_selector: 'hive_database',
        db_name: 'ambari.hive.db.schema.name',
 
        connection_url: 'javax.jdo.option.ConnectionURL',
        db_type: 'hive_database_type',
        driver: 'javax.jdo.option.ConnectionDriverName',
 
        user_name: 'javax.jdo.option.ConnectionUserName',
        password: 'javax.jdo.option.ConnectionPassword'
      },
      'OOZIE': {
        db_selector: 'oozie_database',
        db_name: 'oozie.db.schema.name',
 
        connection_url: 'oozie.service.JPAService.jdbc.url',
        driver: 'oozie.service.JPAService.jdbc.driver',
 
        user_name: 'oozie.service.JPAService.jdbc.username',
        password: 'oozie.service.JPAService.jdbc.password'
      }
    },
 
    /**
     * object that shows default(recommended) values for different db type;
     * properties that should have default value ['connection_url', 'driver', 'sql_jar_connector', 'db_type']
     * some properties can be skipped but be sure they are not used.
     * @type {object}
     */
    dpPropertiesMap: {
      'MYSQL': {
        'connection_url': 'jdbc:mysql://{0}/{1}',
        /** in case property has different default value for specific service it can be overriden in such way **/
        'HIVE': {
          'connection_url': 'jdbc:mysql://{0}/{1}?createDatabaseIfNotExist=true'
        },
        'driver': 'mysql-connector-java.jar',
        'sql_jar_connector': '/usr/share/java/mysql-connector-java.jar',
        'db_type': 'mysql',
        'db_name': 'MySQL',
        'driver_download_url': 'https://dev.mysql.com/downloads/connector/j/',
        'driver_name': 'MySQL Connector/J JDBC Driver'
      },
      'POSTGRES': {
        'connection_url': 'jdbc:postgresql://{0}:5432/{1}',
        'driver': 'org.postgresql.Driver',
        'sql_jar_connector': '/usr/share/java/postgresql.jar',
        'db_type': 'postgres',
        'db_name': 'PostgreSQL',
        'driver_download_url': 'https://jdbc.postgresql.org/',
        'driver_name': 'PostgreSQL JDBC Driver'
      },
      'ORACLE': {
        'connection_url': 'jdbc:oracle:thin:@//{0}:1521/{1}',
        'driver': 'oracle.jdbc.driver.OracleDriver',
        'sql_jar_connector': '/usr/share/java/ojdbc6.jar',
        'db_type': 'oracle',
        'db_name': 'Oracle',
        'driver_download_url': 'http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html',
        'driver_name': 'Oracle JDBC Driver'
      },
      'MSSQL': {
        'connection_url': 'jdbc:sqlserver://{0};databaseName={1}',
        'driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
        'sql_jar_connector': '/usr/share/java/sqljdbc4.jar',
        'db_type': 'mssql'
      },
      'MSSQL2': {
        'connection_url': 'jdbc:sqlserver://{0};databaseName={1};integratedSecurity=true',
        'driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
        'sql_jar_connector': '/usr/share/java/sqljdbc4.jar',
        'db_type': 'mssql'
      },
      /** TODO: Remove SQLA from the list of databases once Ranger DB_FLAVOR=SQLA is replaced with SQL Anywhere */
      'SQLA': {
        'connection_url': 'jdbc:sqlanywhere:host={0};database={1}',
        'driver': 'sap.jdbc4.sqlanywhere.IDriver',
        'sql_jar_connector': '/path_to_driver/sqla-client-jdbc.tar.gz',
        'db_type': 'sqlanywhere'
      },
      'ANYWHERE': {
        'connection_url': 'jdbc:sqlanywhere:host={0};database={1}',
        'driver': 'sap.jdbc4.sqlanywhere.IDriver',
        'sql_jar_connector': '/path_to_driver/sqla-client-jdbc.tar.gz',
        'db_type': 'sqlanywhere'
      },
      'DERBY': {
        'connection_url': 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true',
        'driver': 'org.apache.derby.jdbc.EmbeddedDriver',
        'db_type': 'derby'
      }
    }
  };
});