-
Notifications
You must be signed in to change notification settings - Fork 845
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert instrument jdbc test from groovy to java (#12132)
Co-authored-by: Jay DeLuca <jaydeluca4@gmail.com>
- Loading branch information
Showing
17 changed files
with
3,643 additions
and
3,366 deletions.
There are no files selected for viewing
903 changes: 0 additions & 903 deletions
903
instrumentation/jdbc/javaagent/src/test/groovy/JdbcInstrumentationTest.groovy
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
...c/test/java/io/opentelemetry/javaagent/instrumentation/jdbc/test/DbCallingConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
Oops, something went wrong.