Skip to content

Commit

Permalink
fix: remove dependency on commons-lang (#494)
Browse files Browse the repository at this point in the history
* remove dependency on commons-lang
  • Loading branch information
elharo committed Oct 3, 2020
1 parent 2a95ef6 commit c99294b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
7 changes: 0 additions & 7 deletions google-cloud-spanner/pom.xml
Expand Up @@ -237,22 +237,15 @@
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-credentials</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>

<!-- Test dependencies -->
<dependency>
Expand Down
Expand Up @@ -34,12 +34,12 @@
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import org.apache.commons.lang3.ArrayUtils;

/**
* {@link UnitOfWork} that is used when a DDL batch is started. These batches only accept DDL
Expand Down Expand Up @@ -124,7 +124,10 @@ public ResultSet executeQuery(
// Queries marked with internal metadata queries are allowed during a DDL batch.
// These can only be generated by library internal methods and may be used to check
// whether a database object such as table or an index exists.
final QueryOption[] internalOptions = ArrayUtils.remove(options, i);
List<QueryOption> temp = new ArrayList<>();
Collections.addAll(temp, options);
temp.remove(i);
final QueryOption[] internalOptions = temp.toArray(new QueryOption[0]);
Callable<ResultSet> callable =
new Callable<ResultSet>() {
@Override
Expand Down
Expand Up @@ -156,11 +156,9 @@ public void testExecuteMetadataQuery() {
when(singleUse.executeQuery(statement)).thenReturn(resultSet);
when(dbClient.singleUse()).thenReturn(singleUse);
DdlBatch batch = createSubject(createDefaultMockDdlClient(), dbClient);
assertThat(
batch
.executeQuery(parsedStatement, AnalyzeMode.NONE, InternalMetadataQuery.INSTANCE)
.hashCode(),
is(equalTo(resultSet.hashCode())));
ResultSet result =
batch.executeQuery(parsedStatement, AnalyzeMode.NONE, InternalMetadataQuery.INSTANCE);
assertThat(result.hashCode(), is(equalTo(resultSet.hashCode())));
}

@Test
Expand Down

0 comments on commit c99294b

Please sign in to comment.