Skip to content

Commit

Permalink
convert instrument jdbc test from groovy to java (#12132)
Browse files Browse the repository at this point in the history
Co-authored-by: Jay DeLuca <jaydeluca4@gmail.com>
  • Loading branch information
shalk and jaydeluca authored Sep 26, 2024
1 parent 201f7c7 commit 72b6e2c
Show file tree
Hide file tree
Showing 17 changed files with 3,643 additions and 3,366 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.javaagent.instrumentation.jdbc.test;

import io.opentelemetry.instrumentation.jdbc.TestConnection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;

class DbCallingConnection extends TestConnection {
final boolean usePreparedStatement;

DbCallingConnection(boolean usePreparedStatement) {
super(false);
this.usePreparedStatement = usePreparedStatement;
}

@Override
public DatabaseMetaData getMetaData() throws SQLException {
// simulate retrieving DB metadata from the DB itself
if (usePreparedStatement) {
prepareStatement("SELECT * from DB_METADATA").executeQuery();
} else {
createStatement().executeQuery("SELECT * from DB_METADATA");
}
return super.getMetaData();
}
}
Loading

0 comments on commit 72b6e2c

Please sign in to comment.