Skip to content

Commit

Permalink
Merge pull request #255 from neicnordic/refactor/query-execution-in-test
Browse files Browse the repository at this point in the history
replace executeQuery() with executeUpdate() to stop throwing exceptio…
  • Loading branch information
Parisa68 authored Feb 9, 2024
2 parents 4beb31f + e013402 commit 40d40fb
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,15 @@ public static void setup() {
PreparedStatement file = connection.prepareStatement("SELECT local_ega.insert_file('body.enc','[email protected]');");
file.executeQuery();
PreparedStatement header = connection.prepareStatement("UPDATE local_ega.files SET header = '637279707434676801000000010000006c00000000000000aa7ad1bb4f93bf5e4fb3bc28a95bc4d80bf2fd8075e69eb2ee15e0a4f08f1d78ab98c8fd9b50e675f71311936e8d0c6f73538962b836355d5d4371a12eae46addb43518b5236fb9554249710a473026f34b264a61d2ba52ed11abc1efa1d3478fa40a710' WHERE id = 1;");
try {
header.executeQuery();
} catch (Exception e) {
log.info(e.getMessage());
}
header.executeUpdate();
PreparedStatement finalize = connection.prepareStatement("UPDATE local_ega.files SET archive_path = 'test/body.enc', status = 'READY', stable_id = 'EGAF00000000014' WHERE id = 1;");
try {
finalize.executeQuery();
} catch (Exception e) {
log.info(e.getMessage());
}
finalize.executeUpdate();
connection.close();

props.setProperty("user", "lega_out");
connection = DriverManager.getConnection(url, props);
PreparedStatement dataset = connection.prepareStatement("INSERT INTO local_ega_ebi.filedataset(file_id, dataset_stable_id) values(1, 'EGAD00010000919');");
try {
dataset.executeQuery();
} catch (Exception e) {
log.info(e.getMessage());
}
dataset.executeUpdate();
connection.close();

JSONArray tokens = Unirest.get("http://localhost:8000/tokens").asJson().getBody().getArray();
Expand Down

0 comments on commit 40d40fb

Please sign in to comment.