Skip to content

Commit

Permalink
Performance tests improvement - use EmulatedDB (#2130)
Browse files Browse the repository at this point in the history
Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
  • Loading branch information
rfelcman committed May 17, 2024
1 parent 326d665 commit df24ebb
Show file tree
Hide file tree
Showing 6 changed files with 995 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,20 @@
public class EmulatedConnection implements Connection {
protected Map<String, List<DatabaseRecord>> rows;
protected Connection connection;
protected DatabaseMetaData databaseMetaData;
private String url;
private Properties info;

public EmulatedConnection() {
this.rows = new HashMap<>();
}

public EmulatedConnection(String url, Properties info) {
this();
this.url = url;
this.info = info;
}

public EmulatedConnection(Connection connection) {
this();
this.connection = connection;
Expand Down Expand Up @@ -330,7 +339,10 @@ public DatabaseMetaData getMetaData() throws SQLException {
if (connection != null) {
return connection.getMetaData();
}
return null;
if (this.databaseMetaData == null) {
this.databaseMetaData = new EmulatedDatabaseMetaData(this);
}
return this.databaseMetaData;
}

/**
Expand Down Expand Up @@ -1021,4 +1033,12 @@ public void abort(Executor executor) throws SQLException {}

@Override
public void setSchema(String schema) throws SQLException {}

public String getURL() {
return this.url;
}

public Properties getInfo() {
return this.info;
}
}

0 comments on commit df24ebb

Please sign in to comment.