Skip to content

Commit 9419be4

Browse files
committed
unit test; javadocs
1 parent e45d62c commit 9419be4

File tree

2 files changed

+15
-30
lines changed

2 files changed

+15
-30
lines changed

src/main/java/org/jbei/ice/lib/bulkupload/BulkUploadController.java

+3-30
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public BulkUploadInfo create(String userId, BulkUploadInfo info) {
9292
if (info.getEntryList() != null) {
9393
for (PartData data : info.getEntryList()) {
9494
Entry entry = entryDAO.get(data.getId());
95-
// todo if entry is in another bulk upload, then update (line 95) will fail
95+
// todo if entry is in another bulk upload, then update will fail
9696
if (entry == null)
9797
continue;
9898

@@ -159,6 +159,8 @@ public HashMap<String, ArrayList<BulkUploadInfo>> getPendingImports(String userI
159159
*
160160
* @param userId identifier for account of user requesting
161161
* @param id unique identifier for bulk import
162+
* @param offset offset for upload entries (start)
163+
* @param limit maximum number of entries to return with the upload
162164
* @return data transfer object with the retrieved bulk import data and associated entries
163165
* @throws PermissionException
164166
*/
@@ -212,35 +214,6 @@ protected PartData setFileData(String userId, Entry entry, PartData partData) {
212214
return partData;
213215
}
214216

215-
protected ArrayList<PartData> convertParts(Account account, List<Entry> contents) {
216-
ArrayList<PartData> addList = new ArrayList<>();
217-
SequenceDAO sequenceDAO = DAOFactory.getSequenceDAO();
218-
219-
for (Entry entry : contents) {
220-
ArrayList<Attachment> attachments = attachmentController.getByEntry(account.getEmail(), entry);
221-
boolean hasSequence = sequenceDAO.hasSequence(entry.getId());
222-
boolean hasOriginalSequence = sequenceDAO.hasOriginalSequence(entry.getId());
223-
PartData info = ModelToInfoFactory.getInfo(entry);
224-
ArrayList<AttachmentInfo> attachmentInfos = ModelToInfoFactory.getAttachments(attachments);
225-
info.setAttachments(attachmentInfos);
226-
info.setHasAttachment(!attachmentInfos.isEmpty());
227-
info.setHasSequence(hasSequence);
228-
info.setHasOriginalSequence(hasOriginalSequence);
229-
230-
// retrieve permission
231-
Set<Permission> entryPermissions = entry.getPermissions();
232-
if (entryPermissions != null && !entryPermissions.isEmpty()) {
233-
for (Permission permission : entryPermissions) {
234-
info.getAccessPermissions().add(permission.toDataTransferObject());
235-
}
236-
}
237-
238-
addList.add(info);
239-
}
240-
241-
return addList;
242-
}
243-
244217
/**
245218
* Retrieves list of user saved bulk imports. Only the owner or an administrator can retrieve it
246219
*

src/test/java/org/jbei/ice/lib/bulkupload/BulkUploadControllerTest.java

+12
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ public void tearDown() throws Exception {
3939
HibernateUtil.commitTransaction();
4040
}
4141

42+
@Test
43+
public void testCreate() throws Exception {
44+
Account account = AccountCreator.createTestAccount("testBulkUploadCreate", false);
45+
46+
BulkUploadInfo info = new BulkUploadInfo();
47+
info.setName("testCreateName");
48+
info.setType(EntryType.PLASMID.getName());
49+
info.setAccount(account.toDataTransferObject());
50+
info = controller.create(account.getEmail(), info);
51+
Assert.assertNotNull(info);
52+
}
53+
4254
@Test
4355
public void testGetBulkImport() throws Exception {
4456
Account account = AccountCreator.createTestAccount("testGetBulkImport", false);

0 commit comments

Comments
 (0)