use of org.sagebionetworks.bridge.dao.UploadDao in project BridgeServer2 by Sage-Bionetworks.
the class UploadValidationTaskFactoryTest method test.
@Test
public void test() {
// test dao and handlers
List<UploadValidationHandler> handlerList = Collections.emptyList();
UploadDao dao = mock(UploadDao.class);
FileHelper fileHelper = new FileHelper();
HealthDataService healthDataService = new HealthDataService();
// set up task factory
UploadValidationTaskFactory taskFactory = new UploadValidationTaskFactory();
taskFactory.setFileHelper(fileHelper);
taskFactory.setHandlerList(handlerList);
taskFactory.setUploadDao(dao);
taskFactory.setHealthDataService(healthDataService);
// inputs
App app = TestUtils.getValidApp(UploadValidationTaskFactoryTest.class);
Upload upload = Upload.create();
upload.setHealthCode(HEALTH_CODE);
// execute and validate
UploadValidationTask task = taskFactory.newTask(app.getIdentifier(), upload);
assertEquals(task.getContext().getHealthCode(), HEALTH_CODE);
assertSame(task.getContext().getAppId(), app.getIdentifier());
assertSame(task.getContext().getUpload(), upload);
assertSame(task.getFileHelper(), fileHelper);
assertSame(task.getHandlerList(), handlerList);
assertSame(task.getUploadDao(), dao);
assertSame(task.getHealthDataService(), healthDataService);
}
Aggregations