Skip to content

Commit c78b8b0

Browse files
committed
clear publish flag before deleting test biomodel
1 parent 782cc2a commit c78b8b0

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

vcell-rest/src/test/java/org/vcell/restq/apiclient/PublicationApiTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,23 @@ public void testPublishBioModels() throws Exception {
173173
Publication rePub = pubAPI.getPublicationById(pubKey);
174174
Assertions.assertEquals(VersionFlag.Published.getIntValue(), rePub.getBiomodelRefs().get(0).getVersionFlag());
175175

176-
// Cleanup
176+
// Cleanup: unpublish before deleting (published models cannot be deleted)
177+
setVersionFlag(savedModelKey, VersionFlag.Current.getIntValue());
177178
pubAPI.deletePublication(pubKey);
178179
bioModelAPI.deleteBioModel(savedModelKey);
179180
}
180181

182+
private void setVersionFlag(String bioModelKey, int versionFlagValue) throws DataAccessException, SQLException {
183+
Object lock = new Object();
184+
java.sql.Connection connection = agroalConnectionFactory.getConnection(lock);
185+
connection.prepareStatement(
186+
"UPDATE vc_biomodel SET versionFlag = " + versionFlagValue +
187+
" WHERE id = " + bioModelKey
188+
).executeUpdate();
189+
connection.commit();
190+
connection.close();
191+
}
192+
181193
@Test
182194
public void testPublishBioModelsUnauthorized() throws Exception {
183195
PublicationResourceApi alicePubAPI = new PublicationResourceApi(aliceAPIClient);

0 commit comments

Comments
 (0)