/** * Construct and return a map record for a user and status. * * @param user the user * @param status the status * @return the map record */ private MapRecord createRecord(MapUser user, WorkflowStatus status) { MapRecord record = new MapRecordJpa(); record.setConceptId(concept.getTerminologyId()); record.setConceptName(concept.getDefaultPreferredName()); record.setLastModified(new Date().getTime()); record.setLastModifiedBy(user); record.setMapProjectId(mapProject.getId()); record.setOwner(user); record.setTimestamp(new Date().getTime()); record.setWorkflowStatus(status); return record; }
/** * Cleanup. * * @throws Exception the exception */ @AfterClass public static void cleanup() throws Exception { Logger.getLogger(WorkflowPathStatesQAPathTest.class).info("Clean-up"); resetRecords(); mappingService.removeMapProject(mapProject.getId()); mappingService.removeMapUser(specialist.getId()); mappingService.removeMapUser(lead.getId()); mappingService.close(); workflowService.close(); }
/** * Inits the. * * @throws Exception the exception */ @BeforeClass public static void init() throws Exception { System.out.println("Initialization"); // instantiate the services contentService = new ContentServiceJpa(); mappingService = new MappingServiceJpa(); workflowService = new WorkflowServiceJpa(); // instantiate the workflow handler handler = new WorkflowQaPathHandler(); // ensure database is clean for (Concept c : contentService.getConcepts().getIterable()) contentService.removeConcept(c.getId()); for (MapProject mp : mappingService.getMapProjects().getIterable()) mappingService.removeMapProject(mp.getId()); for (MapUser mu : mappingService.getMapUsers().getIterable()) if (!mu.getUserName().equals("guest") && !mu.getUserName().equals("loader") && !mu.getUserName().equals("qa")) { mappingService.removeMapUser(mu.getId()); } for (TrackingRecord tr : workflowService.getTrackingRecords().getIterable()) workflowService.removeTrackingRecord(tr.getId()); concept = new ConceptJpa(); concept.setActive(true); concept.setDefaultPreferredName("Test Concept"); concept.setDefinitionStatusId(0L); concept.setEffectiveTime(new Date()); concept.setModuleId(0L); concept.setTerminology("sourceTerminology"); concept.setTerminologyVersion("sourceTerminologyVersion"); concept.setTerminologyId("1"); contentService.addConcept(concept); specialist = new MapUserJpa(); specialist.setApplicationRole(MapUserRole.VIEWER); specialist.setEmail("none"); specialist.setName("Specialist"); specialist.setUserName("spec"); mappingService.addMapUser(specialist); lead = new MapUserJpa(); lead.setApplicationRole(MapUserRole.VIEWER); lead.setEmail("none"); lead.setName("Lead"); lead.setUserName("lead"); mappingService.addMapUser(lead); // instantiate the project mapProject = new MapProjectJpa(); mapProject.setSourceTerminology("sourceTerminology"); mapProject.setSourceTerminologyVersion("sourceTerminologyVersion"); mapProject.setDestinationTerminology("destinationTerminology"); mapProject.setDestinationTerminologyVersion("destinationTerminologyVersion"); mapProject.setGroupStructure(false); mapProject.setMapRefsetPattern(MapRefsetPattern.ExtendedMap); mapProject.setMapRelationStyle(RelationStyle.MAP_CATEGORY_STYLE); mapProject.setName("Test Project"); mapProject.setPropagatedFlag(false); mapProject.setProjectSpecificAlgorithmHandlerClass( "org.ihtsdo.otf.mapping.jpa.handlers.ICD10ProjectSpecificAlgorithmHandler"); mapProject.setPublic(true); mapProject.setRefSetId("refsetId"); mapProject.setRuleBased(true); mapProject.setWorkflowType(WorkflowType.REVIEW_PROJECT); mapProject.addMapSpecialist(specialist); mapProject.addMapLead(lead); mapProject.addScopeConcept("1"); mappingService.addMapProject(mapProject); }