TieredStorageAssetManagerJobProducer extends AbstractJobProducer { public Job moveByDate(final Date start, final Date end, final String targetStorage) { RequireUtil.notNull(start, "start"); RequireUtil.notNull(end, "end"); RequireUtil.notNull(targetStorage, "targetStorage"); List<String> args = new LinkedList<String>(); args.add(targetStorage); args.add(Long.toString(start.getTime())); args.add(Long.toString(end.getTime())); try { return serviceRegistry.createJob(JOB_TYPE, Operation.MoveByDate.toString(), args, null, true, NONTERMINAL_JOB_LOAD); } catch (ServiceRegistryException e) { throw new AssetManagerException("Unable to create a job", e); } } TieredStorageAssetManagerJobProducer(); @Override void activate(ComponentContext cc); boolean datastoreExists(String storeId); Job moveByIdAndVersion(final Version version, final String mpId, final String targetStorage); Job moveById(final String mpId, final String targetStorage); Job moveByDate(final Date start, final Date end, final String targetStorage); Job moveByIdAndDate(final String mpId, final Date start, final Date end, final String targetStorage); static final String JOB_TYPE; static final Float JOB_LOAD; static final Float NONTERMINAL_JOB_LOAD; }
@Test public void testByDate() throws ServiceRegistryException { String[] mp = createAndAddMediaPackagesSimple(1, 2, 2, Opt.<String>none()); Date start = new Date(-10000L); Date end = new Date(new Date().getTime() + 10000L); createDateExpectation(start, end); EasyMock.replay(sr); tsamjp.moveByDate(start, end, REMOTE_STORE_1_ID); EasyMock.verify(sr); }