Skip to content

Commit

Permalink
Remove logging
Browse files Browse the repository at this point in the history
  • Loading branch information
vfraga committed Apr 20, 2022
1 parent e9cd6ed commit ab8f7b6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ private ArrowFlightConnection(final ArrowFlightJdbcDriver driver, final AvaticaF
final BufferAllocator allocator,
final ArrowFlightSqlClientHandler clientHandler) {
super(driver, factory, url, properties);
System.out.println("Connected to " + url + "\t" + properties);
this.config = Preconditions.checkNotNull(config, "Config cannot be null.");
this.allocator = Preconditions.checkNotNull(allocator, "Allocator cannot be null.");
this.clientHandler = Preconditions.checkNotNull(clientHandler, "Handler cannot be null.");
Expand All @@ -84,10 +83,8 @@ static ArrowFlightConnection createNewConnection(final ArrowFlightJdbcDriver dri
String url, final Properties properties,
final BufferAllocator allocator)
throws SQLException {
System.out.println("Clearing url: " + url + "\t" + properties);
url = replaceSemiColons(url);
final ArrowFlightConnectionConfigImpl config = new ArrowFlightConnectionConfigImpl(properties);
System.out.println("Connecting to " + url + "\t" + properties);
final ArrowFlightSqlClientHandler clientHandler = createNewClientHandler(config, allocator);
return new ArrowFlightConnection(driver, factory, url, properties, config, allocator, clientHandler);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ private void loadNewFlightStream() throws SQLException {

@Override
protected AvaticaResultSet execute() throws SQLException {
System.out.println("Executing using connection properties: " + connection.properties);
final FlightInfo flightInfo = ((ArrowFlightInfoStatement) statement).executeFlightInfoQuery();

if (flightInfo != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void testDriverUrlParsingMechanismShouldReturnTheDesiredArgsFromUrl() thr

@SuppressWarnings("unchecked")
@Test
public void testDriverUrlParsingMechanismShouldReturnTheDesiredArgsFromUrlWithSemicolon() throws Exception {
public void testDriverUrlParsingMechanismShouldReturnTheDesiredArgsFromUrlWithMultipleSemicolons() throws Exception {
final Driver driver = new ArrowFlightJdbcDriver();

final Method parseUrl = driver.getClass().getDeclaredMethod("getUrlsArgs", String.class);
Expand All @@ -239,6 +239,31 @@ public void testDriverUrlParsingMechanismShouldReturnTheDesiredArgsFromUrlWithSe
assertEquals(parsedArgs.get("a"), "b");
}

@SuppressWarnings("unchecked")
@Test
public void testDriverUrlParsingMechanismShouldReturnTheDesiredArgsFromUrlWithOneSemicolon() throws Exception {
final Driver driver = new ArrowFlightJdbcDriver();

final Method parseUrl = driver.getClass().getDeclaredMethod("getUrlsArgs", String.class);

parseUrl.setAccessible(true);

final Map<Object, Object> parsedArgs = (Map<Object, Object>) parseUrl.invoke(driver,
"jdbc:arrow-flight://localhost:2222/;key1=value1");

// Check size == the amount of args provided (prefix not included!)
assertEquals(5, parsedArgs.size());

// Check host == the provided host
assertEquals(parsedArgs.get(ArrowFlightConnectionProperty.HOST.camelName()), "localhost");

// Check port == the provided port
assertEquals(parsedArgs.get(ArrowFlightConnectionProperty.PORT.camelName()), 2222);

// Check all other non-default arguments
assertEquals(parsedArgs.get("key1"), "value1");
}

/**
* Tests whether an exception is thrown upon attempting to connect to a
* malformed URI.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ public List<Object> toList(ValueVector vector) throws Exception {
}

public <R> void assertAccessorGetter(ValueVector vector, CheckedFunction<T, R> getter,
MatcherGetter<T, R> matcherGetter)
throws Exception {
MatcherGetter<T, R> matcherGetter) throws Exception {
iterate(vector, (accessor, currentRow) -> {
R object = getter.apply(accessor);
boolean wasNull = accessor.wasNull();
Expand Down

0 comments on commit ab8f7b6

Please sign in to comment.