Search in sources :

Example 1 with UploadDao

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);
}
Also used : App(org.sagebionetworks.bridge.models.apps.App) FileHelper(org.sagebionetworks.bridge.file.FileHelper) Upload(org.sagebionetworks.bridge.models.upload.Upload) HealthDataService(org.sagebionetworks.bridge.services.HealthDataService) UploadDao(org.sagebionetworks.bridge.dao.UploadDao) Test(org.testng.annotations.Test)

Aggregations

UploadDao (org.sagebionetworks.bridge.dao.UploadDao)1 FileHelper (org.sagebionetworks.bridge.file.FileHelper)1 App (org.sagebionetworks.bridge.models.apps.App)1 Upload (org.sagebionetworks.bridge.models.upload.Upload)1 HealthDataService (org.sagebionetworks.bridge.services.HealthDataService)1 Test (org.testng.annotations.Test)1