Search in sources :

Example 1 with Transfer

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)");
}
Also used : Transfer(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer) ValidationError(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError) Test(org.junit.Test)

Example 2 with Transfer

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());
}
Also used : Transfer(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer) ValidationError(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError) Test(org.junit.Test)

Example 3 with Transfer

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)");
}
Also used : Transfer(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer) ValidationError(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError) Test(org.junit.Test)

Example 4 with Transfer

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");
}
Also used : Transfer(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer) ValidationError(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError) Test(org.junit.Test)

Example 5 with Transfer

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)");
}
Also used : Transfer(uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer) ValidationError(uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError) Test(org.junit.Test)

Aggregations

Transfer (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.Transfer)47 Test (org.junit.Test)30 ValidationError (uk.ac.bbsrc.tgac.miso.core.service.exception.ValidationError)24 Group (com.eaglegenomics.simlims.core.Group)12 TransferSample (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferSample)10 User (com.eaglegenomics.simlims.core.User)8 Date (java.util.Date)8 AbstractDAOTest (uk.ac.bbsrc.tgac.miso.AbstractDAOTest)7 Sample (uk.ac.bbsrc.tgac.miso.core.data.Sample)7 LabImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.LabImpl)7 Lab (uk.ac.bbsrc.tgac.miso.core.data.Lab)6 Project (uk.ac.bbsrc.tgac.miso.core.data.Project)4 TransferLibrary (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferLibrary)4 TransferNotification (uk.ac.bbsrc.tgac.miso.core.data.impl.transfer.TransferNotification)4 SimpleDateFormat (java.text.SimpleDateFormat)3 List (java.util.List)3 Library (uk.ac.bbsrc.tgac.miso.core.data.Library)3 ProjectImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectImpl)3 SampleImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl)3 UserImpl (uk.ac.bbsrc.tgac.miso.core.data.impl.UserImpl)3