Skip to content

Commit

Permalink
Remove EntityManager from StatusCheckTest and re-enable #38
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-austin committed Nov 27, 2024
1 parent 25b68c7 commit 0c3ad3e
Show file tree
Hide file tree
Showing 3 changed files with 726 additions and 707 deletions.
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<excludes>
<!-- Requires an arquillian-persistence implementation compatible with the jakarta namespace. -->
<exclude>**/StatusCheckTest.java</exclude>
</excludes>
<!-- TODO remove next line -->
<!-- <skipTests>true</skipTests> -->
<argLine>-Xmx768m -XX:MaxMetaspaceSize=256m</argLine>
<systemPropertyVariables>
<java.util.logging.config.file>
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/org/icatproject/topcat/StatusCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,11 @@ private void prepareDownload(Download download, IdsClient injectedIdsClient) thr
* @param maxActiveDownloads Limit on the number of concurrent jobs with RESTORING status
* @throws Exception
*/
private void startQueuedDownloads(int maxActiveDownloads) throws Exception {
if (maxActiveDownloads == 0) { return; }
public void startQueuedDownloads(int maxActiveDownloads) throws Exception {
if (maxActiveDownloads == 0) {
return;
}

String selectString = "select download from Download download where download.isDeleted != true";
String restoringCondition = "download.status = org.icatproject.topcat.domain.DownloadStatus.RESTORING";
String pausedCondition = "download.status = org.icatproject.topcat.domain.DownloadStatus.PAUSED";
Expand All @@ -288,7 +291,7 @@ private void startQueuedDownloads(int maxActiveDownloads) throws Exception {
TypedQuery<Download> activeDownloadsQuery = em.createQuery(activeQueryString, Download.class);
List<Download> activeDownloads = activeDownloadsQuery.getResultList();

String queuedQueryString = selectString + " and " + pausedCondition + " and download.preparedId == null";
String queuedQueryString = selectString + " and " + pausedCondition + " and download.preparedId = null";
if (maxActiveDownloads > 0) {
int freeActiveDownloads = maxActiveDownloads - activeDownloads.size();
if (freeActiveDownloads <= 0) {
Expand Down
Loading

0 comments on commit 0c3ad3e

Please sign in to comment.