use of org.dcache.pinmanager.model.Pin in project dcache by dCache.
the class TestPoolManagerStub method testUnpinningByRequestId.
@Test
public void testUnpinningByRequestId() throws Exception {
TestDao dao = new TestDao();
Pin pin = dao.create(dao.set().subject(Subjects.ROOT).requestId(REQUEST_ID1).expirationTime(new Date(now() + 30)).pnfsId(PNFS_ID1).pool(POOL1.getName()).sticky(STICKY1).state(PINNED));
UnpinRequestProcessor processor = new UnpinRequestProcessor();
processor.setDao(dao);
processor.setAuthorizationPolicy(new DefaultAuthorizationPolicy());
PinManagerUnpinMessage message = new PinManagerUnpinMessage(PNFS_ID1);
message.setRequestId(pin.getRequestId());
message = processor.messageArrived(message);
assertEquals(0, message.getReturnCode());
assertEquals(pin.getPinId(), (long) message.getPinId());
assertEquals(pin.getRequestId(), message.getRequestId());
Pin newPin = dao.get(dao.where().id(pin.getPinId()));
assertEquals(PNFS_ID1, newPin.getPnfsId());
assertEquals(pin.getPool(), newPin.getPool());
assertEquals(READY_TO_UNPIN, newPin.getState());
assertEquals(pin.getSticky(), newPin.getSticky());
}
use of org.dcache.pinmanager.model.Pin in project dcache by dCache.
the class TestPoolManagerStub method delete.
@Override
public int delete(PinCriterion criterion) {
int cnt = 0;
Iterator<Pin> iterator = _pins.values().iterator();
while (iterator.hasNext()) {
Pin pin = iterator.next();
if (((TestCriterion) criterion).matches(pin)) {
iterator.remove();
cnt++;
}
}
return cnt;
}
Aggregations