use of uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer in project miso-lims by miso-lims.
the class DefaultTransferServiceTest method validateSenderTypeChangeTwo.
@Test
public void validateSenderTypeChangeTwo() throws Exception {
Transfer before = makeTransfer(makeGroup(1L), makeGroup(2L));
Transfer updated = copyTransfer(before);
updated.setSenderGroup(null);
updated.setSenderLab(makeLab(1L));
List<ValidationError> errors = validate(updated, before);
assertError(errors, "Cannot change sender between internal (group) and external (lab)");
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer in project miso-lims by miso-lims.
the class DefaultTransferServiceTest method testValidateFirstReceipt.
@Test
public void testValidateFirstReceipt() throws Exception {
Transfer transfer = makeTransfer(makeLab(1L), makeGroup(1L));
addTransferSample(transfer, makeSample(1L));
List<ValidationError> errors = validate(transfer, null);
assertTrue(errors.isEmpty());
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer in project miso-lims by miso-lims.
the class DefaultTransferServiceTest method validateRecipientTypeChangeOne.
@Test
public void validateRecipientTypeChangeOne() throws Exception {
Transfer before = makeTransfer(makeGroup(1L), makeGroup(2L));
Transfer updated = copyTransfer(before);
updated.setRecipientGroup(null);
updated.setRecipient("Recipient");
List<ValidationError> errors = validate(updated, before);
assertError(errors, "Cannot change recipient between internal (group) and external (named)");
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer in project miso-lims by miso-lims.
the class DefaultTransferServiceTest method validateRecipientGroupChangeNotAllowed.
@Test
public void validateRecipientGroupChangeNotAllowed() throws Exception {
setUser(false);
Transfer before = makeTransfer(makeGroup(1L), makeGroup(2L));
Transfer updated = copyTransfer(before);
updated.setRecipientGroup(makeGroup(3L));
List<ValidationError> errors = validate(updated, before);
assertError(errors, "Only administrators and members of the sender group can change recipient group");
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer in project miso-lims by miso-lims.
the class DefaultTransferServiceTest method testValidateExternalToExternal.
@Test
public void testValidateExternalToExternal() throws Exception {
Transfer transfer = new Transfer();
transfer.setSenderLab(makeLab(1L));
transfer.setRecipient("Recipient");
List<ValidationError> errors = validate(transfer, null);
assertError(errors, "A transfer cannot be external (lab) to external (named recipient)");
}
Aggregations