use of org.molgenis.data.meta.model.Package in project molgenis by molgenis.
the class RestControllerV2Test method testCopyEntity.
@Test
public void testCopyEntity() throws Exception {
@SuppressWarnings("unchecked") Repository<Entity> repositoryToCopy = mock(Repository.class);
Package pack = mocksForCopyEntitySuccess(repositoryToCopy);
String content = "{newEntityName: 'newEntity'}";
mockMvc.perform(post(HREF_COPY_ENTITY).content(content).contentType(APPLICATION_JSON)).andExpect(status().isCreated()).andExpect(content().contentType(APPLICATION_JSON_UTF8)).andExpect(content().string("\"org_molgenis_blah_newEntity\"")).andExpect(header().string("Location", "/api/v2/org_molgenis_blah_newEntity"));
verify(repoCopier).copyRepository(repositoryToCopy, "newEntity", pack, "newEntity");
}
use of org.molgenis.data.meta.model.Package in project molgenis by molgenis.
the class MappingServiceControllerTest method testScheduleMappingJobSystemPackage.
@Test
public void testScheduleMappingJobSystemPackage() throws Exception {
when(mappingService.getMappingProject("mappingProjectId")).thenReturn(mappingProject);
Package systemPackage = mock(Package.class);
when(systemPackage.getId()).thenReturn("sys");
when(metaDataService.getPackage("sys")).thenReturn(systemPackage);
mockMvc.perform(post(URI + "/map").param("mappingProjectId", "mappingProjectId").param("targetEntityTypeId", "targetEntityTypeId").param("label", "label").param("package", "sys").accept("text/plain")).andExpect(status().isBadRequest()).andExpect(content().contentType("text/plain")).andExpect(content().string("Package [sys] is a system package."));
}
use of org.molgenis.data.meta.model.Package in project molgenis by molgenis.
the class OntologyTagServiceTest method testGetTagsForPackage.
@Test
public void testGetTagsForPackage() {
Package p = packageFactory.create("test", "desc");
Package pack = packageFactory.create();
pack.setTags(singletonList(chromosomeNameTagEntity));
when(ontologyService.getOntology("http://edamontology.org")).thenReturn(EDAM_ONTOLOGY);
when(ontologyService.getOntologyTerm("http://edamontology.org/data_0987")).thenReturn(CHROMOSOME_NAME_ONTOLOGY_TERM);
when(dataService.findOneById(PACKAGE, "test")).thenReturn(pack);
assertEquals(ontologyTagService.getTagsForPackage(p), singletonList(new SemanticTag<>("1234", p, Relation.forIRI("http://molgenis.org/biobankconnect/instanceOf"), OntologyTerm.create("http://edamontology.org/data_0987", "Chromosome name", "Name of a chromosome."), Ontology.create("EDAM", "http://edamontology.org", "The EDAM ontology."))));
}
Aggregations