@Test
public void testPublishingProperty() {
setPrivileges(user, Sets.newHashSet(Privilege.ONTOLOGY_ADD, Privilege.ONTOLOGY_PUBLISH));
Concept thing = getOntologyRepository().getEntityConcept(workspaceId);
List<Concept> things = Collections.singletonList(thing);
Relationship publicRelationship = getOntologyRepository().getOrCreateRelationshipType(null, things, things, PUBLIC_RELATIONSHIP_IRI, true, systemUser, PUBLIC);
OntologyPropertyDefinition ontologyPropertyDefinition = new OntologyPropertyDefinition(
things,
Collections.singletonList(publicRelationship),
SANDBOX_PROPERTY_IRI, SANDBOX_DISPLAY_NAME, PropertyType.DATE);
OntologyProperty sandboxedProperty = getOntologyRepository().getOrCreateProperty(ontologyPropertyDefinition, user, workspaceId);
getOntologyRepository().publishProperty(sandboxedProperty, user, workspaceId);
getOntologyRepository().clearCache();
OntologyProperty publicProperty = getOntologyRepository().getPropertyByIRI(SANDBOX_PROPERTY_IRI, PUBLIC);
assertEquals(SANDBOX_PROPERTY_IRI, publicProperty.getIri());
thing = getOntologyRepository().getEntityConcept(PUBLIC);
publicRelationship = getOntologyRepository().getRelationshipByIRI(PUBLIC_RELATIONSHIP_IRI, PUBLIC);
assertEquals(1, thing.getProperties().size());
assertEquals(SANDBOX_PROPERTY_IRI, thing.getProperties().iterator().next().getIri());
assertEquals(1, publicRelationship.getProperties().size());
assertEquals(SANDBOX_PROPERTY_IRI, publicRelationship.getProperties().iterator().next().getIri());
}