### Question:
RdsView { public String getConnectionString() { return connectionString; } RdsView(RDSConfig rdsConfig); String getConnectionURL(); String getConnectionUserName(); String getConnectionPassword(); String getDatabaseName(); String getDatabaseType(); String getHost(); String getConnectionDriver(); String getLowerCaseDatabaseEngine(); String getDatabaseEngine(); String getSubprotocol(); String getPort(); DatabaseVendor getDatabaseVendor(); String getFancyName(); String getDisplayName(); String getClusterManagerVendor(); String getVendor(); String getUserName(); String getPassword(); String getName(); String getUpperCaseDatabaseEngine(); String getHostWithPortWithJdbc(); String getWithoutJDBCPrefix(); String getConnectionString(); static final String WITHOUT_JDBC_PREFIX_REGEX; }### Answer:
@Test public void testCreateRdsViewWhenRDSConfigContainsDoublePortInUrl() { String connectionUrl = "some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com:5432:5432/ranger"; RDSConfig rdsConfig = createRdsConfig(connectionUrl); RdsView underTest = new RdsView(rdsConfig); Assert.assertEquals(ASSERT_ERROR_MSG, "some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com:5432:5432/ranger", underTest.getConnectionString()); }
@Test public void testCreateRdsViewConnectionStringWhenRangerAndPostgreSQL() { String connectionUrl = "jdbc:postgresql: RDSConfig rdsConfig = createRdsConfig(connectionUrl, DatabaseVendor.POSTGRES, DatabaseType.RANGER); RdsView underTest = new RdsView(rdsConfig); Assert.assertEquals(ASSERT_ERROR_MSG, "ranger.cmseikcocinw.us-east-1.rds.amazonaws.com:5432", underTest.getConnectionString()); }
@Test public void testCreateRdsViewConnectionStringWhenHiveAndPostgreSQL() { String connectionUrl = "jdbc:postgresql: RDSConfig rdsConfig = createRdsConfig(connectionUrl, DatabaseVendor.POSTGRES, DatabaseType.HIVE); RdsView underTest = new RdsView(rdsConfig); Assert.assertEquals(ASSERT_ERROR_MSG, "jdbc:postgresql: }
@Test public void testCreateRdsViewConnectionStringWhenRangerAndOracle() { String connectionUrl = "jdbc:oracle:@ranger.cmseikcocinw.us-east-1.rds.amazonaws.com:1521/orcl"; RDSConfig rdsConfig = createRdsConfig(connectionUrl, DatabaseVendor.ORACLE12, DatabaseType.RANGER); RdsView underTest = new RdsView(rdsConfig); Assert.assertEquals(ASSERT_ERROR_MSG, "ranger.cmseikcocinw.us-east-1.rds.amazonaws.com:1521/orcl", underTest.getConnectionString()); }
@Test public void testCreateRdsViewConnectionStringWhenHiveAndOracle() { String connectionUrl = "jdbc:oracle:@ranger.cmseikcocinw.us-east-1.rds.amazonaws.com:1521:orcl"; RDSConfig rdsConfig = createRdsConfig(connectionUrl, DatabaseVendor.ORACLE12, DatabaseType.HIVE); RdsView underTest = new RdsView(rdsConfig); Assert.assertEquals(ASSERT_ERROR_MSG, "jdbc:oracle:@ranger.cmseikcocinw.us-east-1.rds.amazonaws.com:1521:orcl", underTest.getConnectionString()); }