use of org.jbei.ice.storage.model.Plasmid in project ice by JBEI.
the class RemoteTransferTest method testGetPartsForTransfer.
@Test
public void testGetPartsForTransfer() throws Exception {
EntryDAO dao = DAOFactory.getEntryDAO();
Account account = AccountCreator.createTestAccount("testGetPartsForTransfer", false);
Strain strain = TestEntryCreator.createTestStrain(account);
Plasmid plasmid = TestEntryCreator.createTestPlasmid(account);
strain.getLinkedEntries().add(plasmid);
DAOFactory.getEntryDAO().update(strain);
strain = (Strain) DAOFactory.getEntryDAO().get(strain.getId());
Assert.assertTrue(strain.getLinkedEntries().size() == 1);
Plasmid plasmid2 = TestEntryCreator.createTestPlasmid(account);
strain.getLinkedEntries().add(plasmid2);
dao.update(strain);
Plasmid plasmid3 = TestEntryCreator.createTestPlasmid(account);
Strain strain2 = TestEntryCreator.createTestStrain(account);
strain2.getLinkedEntries().add(plasmid2);
strain2.getLinkedEntries().add(plasmid3);
dao.update(strain2);
ArrayList<Long> ids = new ArrayList<>();
ids.add(plasmid.getId());
ids.add(plasmid2.getId());
ids.add(plasmid3.getId());
ids.add(strain.getId());
ids.add(strain2.getId());
List<PartData> data = transfer.getPartsForTransfer(ids);
TransferredParts parts = new TransferredParts();
Assert.assertEquals(data.size(), 2);
for (PartData datum : data) {
// both should have 2 linked entries with 1 in common
Assert.assertEquals(datum.getLinkedParts().size(), 2);
// transfer
datum.setRecordId("");
PartData transferred = parts.receiveTransferredEntry(datum);
Assert.assertNotNull(transferred);
}
}
use of org.jbei.ice.storage.model.Plasmid in project ice by JBEI.
the class TransferredPartsTest method createPlasmidObject.
private Plasmid createPlasmidObject(Account owner) {
Plasmid plasmid = new Plasmid();
plasmid.setBackbone("plasmid backone");
plasmid.setOriginOfReplication("None");
plasmid.setBioSafetyLevel(1);
plasmid.setShortDescription("plasmid description");
plasmid.setName("pLasmid");
plasmid.setOwner(owner.getFullName());
plasmid.setOwnerEmail(owner.getEmail());
plasmid.setCreator(plasmid.getOwner());
plasmid.setCreatorEmail(plasmid.getOwnerEmail());
plasmid.setCreationTime(new Date());
return plasmid;
}
Aggregations