.map(conceptOrAncestor -> { try { ontologyRepository.publishConcept(conceptOrAncestor, user, workspaceId); } catch (Exception ex) { LOGGER.error("Error publishing concept %s", concept.getIRI(), ex);
@Test(expected = VisalloAccessDeniedException.class) public void testPublishingConceptsWithoutPublishPrivilege() { setPrivileges(user, Collections.singleton(Privilege.ONTOLOGY_ADD)); Concept thing = getOntologyRepository().getEntityConcept(workspaceId); Concept sandboxedConcept = getOntologyRepository().getOrCreateConcept(thing, SANDBOX_CONCEPT_IRI, SANDBOX_DISPLAY_NAME, null, user, workspaceId); getOntologyRepository().clearCache(); getOntologyRepository().publishConcept(sandboxedConcept, user, workspaceId); }
@Test public void testPublishingConcepts() { setPrivileges(user, Sets.newHashSet(Privilege.ONTOLOGY_ADD, Privilege.ONTOLOGY_PUBLISH)); Concept thing = getOntologyRepository().getEntityConcept(workspaceId); Concept sandboxedConcept = getOntologyRepository().getOrCreateConcept(thing, SANDBOX_CONCEPT_IRI, SANDBOX_DISPLAY_NAME, null, user, workspaceId); getOntologyRepository().publishConcept(sandboxedConcept, user, workspaceId); getOntologyRepository().clearCache(); Concept publicConcept = getOntologyRepository().getConceptByIRI(SANDBOX_CONCEPT_IRI, PUBLIC); assertEquals(SANDBOX_DISPLAY_NAME, publicConcept.getDisplayName()); }