/** * Reset records. * * @throws Exception the exception */ private static void resetRecords() throws Exception { // remove tracking records for (TrackingRecord trackingRecord : workflowService.getTrackingRecords().getTrackingRecords()) workflowService.removeTrackingRecord(trackingRecord.getId()); // remove map records for (MapRecord mapRecord : mappingService.getMapRecords().getMapRecords()) mappingService.removeMapRecord(mapRecord.getId()); }
/** * 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); }