From: vasary.daniel Date: Mon, 16 Nov 2020 19:00:41 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=51f346d357680b5f3a69242d30e846816a31d236;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C32055 --- diff --git a/server/user.jobengine.executors/config/config-worker.xml b/server/user.jobengine.executors/config/config-worker.xml index 438def00..c02f332d 100644 --- a/server/user.jobengine.executors/config/config-worker.xml +++ b/server/user.jobengine.executors/config/config-worker.xml @@ -1,6 +1,7 @@ - + + diff --git a/server/user.jobengine.executors/jobtemplates/sync-subtitles.xml b/server/user.jobengine.executors/jobtemplates/sync-subtitles.xml index 37e26483..7fa2a023 100644 --- a/server/user.jobengine.executors/jobtemplates/sync-subtitles.xml +++ b/server/user.jobengine.executors/jobtemplates/sync-subtitles.xml @@ -7,7 +7,8 @@ - + + diff --git a/server/user.jobengine.osgi.server/test/user/jobengine/server/IT/AMCTests.java b/server/user.jobengine.osgi.server/test/user/jobengine/server/IT/AMCTests.java index 72726c4e..33b20dea 100644 --- a/server/user.jobengine.osgi.server/test/user/jobengine/server/IT/AMCTests.java +++ b/server/user.jobengine.osgi.server/test/user/jobengine/server/IT/AMCTests.java @@ -336,6 +336,36 @@ public class AMCTests { CountDownLatch finishLatch = new CountDownLatch(1); IJobRuntime jobRuntime = null; + jobRuntime = jobEngine.submit(null, e -> { + if (e.isRuntimeTerminated()) + finishLatch.countDown(); + }, "sync-subtitles.xml", "Sync subtitles", jobParams); + + if (jobRuntime != null) + finishLatch.await(); + + jobEngine.shutdown(); + assertEquals(JobStatus.FINISHED, jobRuntime.getStatus()); + } + + @Test + public void testSyncSubtitlesLocked() throws Exception { + jobEngine = new JobEngine(); + jobEngine.startup(); + jobEngine.bindItemManagerService(manager); + + String sourceStoreName = "SUB-IN"; + manager.ensureUri(sourceStoreName, "/SUB-IN", false, false, RemoteStoreProtocol.LOCAL); + String targetStoreName = "SUB-OUT"; + manager.ensureUri(targetStoreName, "/SUB-OUT", false, false, RemoteStoreProtocol.LOCAL); + + Map jobParams = new HashMap<>(); + jobParams.put("sourceStoreName", sourceStoreName); + jobParams.put("targetStoreName", targetStoreName); + + CountDownLatch finishLatch = new CountDownLatch(1); + IJobRuntime jobRuntime = null; + try (RandomAccessFile reader = new RandomAccessFile("/SUB-IN/BUL/CCEM100323-01.stl", "rw")) { FileLock lock = reader.getChannel().lock();