TieredStorageAssetManagerJobProducer extends AbstractJobProducer { protected String internalMoveByIdAndDate(final String mpId, final Date start, final Date end, final String targetStorage) { RichAResult results = tsam.getSnapshotsByIdAndDate(mpId, start, end); List<Job> subjobs = spawnSubjobs(results, targetStorage); return Integer.toString(subjobs.size()); } 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 testInternalByIdAndDate() throws NotFoundException, ServiceRegistryException { Date start = new Date(); Date before = new Date(); String[] mp = createAndAddMediaPackagesSimple(2, 2, 2, Opt.<String>none()); Date after = new Date(); createIdAndVersionExpectation(mp[1], 0, 2); EasyMock.replay(sr); Assert.assertEquals("No versions exist between the start and before test values", "0", tsamjp.internalMoveByIdAndDate("fake", start, before, REMOTE_STORE_1_ID)); Assert.assertEquals("Both versions of " + mp[1] + " should move", "2", tsamjp.internalMoveByIdAndDate(mp[1], before, after, REMOTE_STORE_1_ID)); Assert.assertEquals("No versions of " + mp[1] + " should move", "0", tsamjp.internalMoveByIdAndDate(mp[1], after, new Date(), REMOTE_STORE_1_ID)); EasyMock.verify(sr); }