File tree Expand file tree Collapse file tree
vcell-rest/src/test/java/org/vcell/restq/apiclient Expand file tree Collapse file tree Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments