Search in sources :

Example 1 with TagId

use of edu.stanford.bmir.protege.web.shared.tag.TagId in project webprotege by protegeproject.

the class EntityTagsRepository_TestCase method setUp.

@Before
public void setUp() throws Exception {
    Morphia morphia = createMorphia();
    mongoClient = createMongoClient();
    Datastore datastore = morphia.createDatastore(mongoClient, getTestDbName());
    repository = new EntityTagsRepository(datastore);
    repository.ensureIndexes();
    entity = new OWLClassImpl(IRI.create("http://stuff.com/entities/A"));
    tagIdA = TagId.getId("12345678-1234-1234-1234-123456789abc");
    tagIdB = TagId.getId("12345678-5678-5678-5678-123456789abc");
    projectId = ProjectId.get(UUID);
    List<TagId> tags = Arrays.asList(tagIdA, tagIdB);
    entityTags = new EntityTags(projectId, entity, tags);
}
Also used : MongoTestUtils.createMorphia(edu.stanford.bmir.protege.web.server.persistence.MongoTestUtils.createMorphia) Morphia(org.mongodb.morphia.Morphia) Datastore(org.mongodb.morphia.Datastore) OWLClassImpl(uk.ac.manchester.cs.owl.owlapi.OWLClassImpl) TagId(edu.stanford.bmir.protege.web.shared.tag.TagId) Before(org.junit.Before)

Example 2 with TagId

use of edu.stanford.bmir.protege.web.shared.tag.TagId in project webprotege by protegeproject.

the class TagRepository_IT method shouldNotSaveTagWithDuplicateLabel.

@Test(expected = DuplicateKeyException.class)
public void shouldNotSaveTagWithDuplicateLabel() {
    TagId otherTagId = TagId.getId("1234abcd-abcd-abcd-abcd-123456789abc");
    Tag otherTag = new Tag(otherTagId, projectId, THE_TAG_LABEL, THE_TAG_DESCRIPTION, COLOR, BG_COLOR);
    repository.saveTag(otherTag);
}
Also used : TagId(edu.stanford.bmir.protege.web.shared.tag.TagId) Tag(edu.stanford.bmir.protege.web.shared.tag.Tag) Test(org.junit.Test)

Example 3 with TagId

use of edu.stanford.bmir.protege.web.shared.tag.TagId in project webprotege by protegeproject.

the class EntityTagsRepository_TestCase method shouldAddTag.

@Test
public void shouldAddTag() {
    repository.save(entityTags);
    TagId theTagId = TagId.getId("12345678-abcd-abcd-abcd-123456789abc");
    repository.addTag(projectId, entity, theTagId);
    assertThat(repository.findByTagId(theTagId).size(), is(1));
}
Also used : TagId(edu.stanford.bmir.protege.web.shared.tag.TagId) Test(org.junit.Test)

Aggregations

TagId (edu.stanford.bmir.protege.web.shared.tag.TagId)3 Test (org.junit.Test)2 MongoTestUtils.createMorphia (edu.stanford.bmir.protege.web.server.persistence.MongoTestUtils.createMorphia)1 Tag (edu.stanford.bmir.protege.web.shared.tag.Tag)1 Before (org.junit.Before)1 Datastore (org.mongodb.morphia.Datastore)1 Morphia (org.mongodb.morphia.Morphia)1 OWLClassImpl (uk.ac.manchester.cs.owl.owlapi.OWLClassImpl)1