@Test public void missing_directory() throws Exception { File lockDir = folder.newFolder("missing"); Assume.assumeThat(lockDir.delete(), is(true)); Map<String, String> conf = new HashMap<>(); conf.put(BasicLockProvider.KEY_DIRECTORY, lockDir.getAbsolutePath()); ServiceProfile<ExecutionLockProvider> profile = new ServiceProfile<>( "testing", BasicLockProvider.class, conf, ProfileContext.system(getClass().getClassLoader())); ExecutionLockProvider instance = profile.newInstance(); try (ExecutionLock lock = instance.newInstance("batch")) { lock.beginFlow("a", "b"); lock.endFlow("a", "b"); } }
@Override protected ExecutionLock newInstance(Scope lockScope, String batchId) throws IOException { if (lockScope == null) { throw new IllegalArgumentException("lockScope must not be null"); } if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); } return new FileExecutionLock(lockScope, batchId, directory); }
BasicLockProvider extends ExecutionLockProvider { @Override protected ExecutionLock newInstance(Scope lockScope, String batchId) throws IOException { if (lockScope == null) { throw new IllegalArgumentException("lockScope must not be null"); } if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); } return new FileExecutionLock(lockScope, batchId, directory); } }
BasicLockProvider extends ExecutionLockProvider { @Override protected ExecutionLock newInstance(Scope lockScope, String batchId) throws IOException { if (lockScope == null) { throw new IllegalArgumentException("lockScope must not be null"); } if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); } return new FileExecutionLock(lockScope, batchId, directory); }  }
BasicLockProvider extends ExecutionLockProvider { @Override protected ExecutionLock newInstance(Scope lockScope, String batchId) throws IOException { if (lockScope == null) { throw new IllegalArgumentException("lockScope must not be null"); } if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); } return new FileExecutionLock(lockScope, batchId, directory); }  @Override void doConfigure(ServiceProfile<?> profile); }
BasicLockProvider extends ExecutionLockProvider { @Override protected ExecutionLock newInstance(Scope lockScope, String batchId) throws IOException { if (lockScope == null) { throw new IllegalArgumentException("lockScope must not be null"); } if (batchId == null) { throw new IllegalArgumentException("batchId must not be null"); } return new FileExecutionLock(lockScope, batchId, directory); }  @Override void doConfigure(ServiceProfile<?> profile); static final String KEY_DIRECTORY; }