Search in sources :

Example 1 with CommitInfos

use of com.b2international.snowowl.core.commit.CommitInfos in project snow-owl by b2ihealthcare.

the class CommitInfoRequestTest method getCommitInfoByComment.

private CommitInfo getCommitInfoByComment(final String comment) {
    Request<RepositoryContext, CommitInfos> req = RepositoryRequests.commitInfos().prepareSearchCommitInfo().filterByComment(comment).build();
    final CommitInfos commitInfos = new ResourceRepositoryRequestBuilder<CommitInfos>() {

        @Override
        public Request<RepositoryContext, CommitInfos> build() {
            return req;
        }
    }.buildAsync().execute(bus).getSync();
    assertEquals(commitInfos.getTotal(), 1);
    return Iterables.getOnlyElement(commitInfos);
}
Also used : CommitInfos(com.b2international.snowowl.core.commit.CommitInfos) RepositoryContext(com.b2international.snowowl.core.domain.RepositoryContext) Request(com.b2international.snowowl.core.events.Request) AuthorizedRequest(com.b2international.snowowl.core.authorization.AuthorizedRequest)

Example 2 with CommitInfos

use of com.b2international.snowowl.core.commit.CommitInfos in project snow-owl by b2ihealthcare.

the class CommitInfoRequestTest method searchCommitInfoByTimestamp.

@Test
public void searchCommitInfoByTimestamp() {
    final String oid = UUID.randomUUID().toString();
    final String shortName = UUID.randomUUID().toString();
    final String comment = "Code system for commit info 5";
    createCodeSystem(shortName, oid, comment);
    final CommitInfo commitInfo = getCommitInfoByComment(comment);
    Request<RepositoryContext, CommitInfos> req = RepositoryRequests.commitInfos().prepareSearchCommitInfo().filterByTimestamp(commitInfo.getTimestamp()).build();
    final CommitInfos commitInfos = new ResourceRepositoryRequestBuilder<CommitInfos>() {

        @Override
        public Request<RepositoryContext, CommitInfos> build() {
            return req;
        }
    }.buildAsync().execute(bus).getSync();
    assertTrue(commitInfos.getTotal() == 1);
    assertEquals(commitInfo.getTimestamp(), Iterables.getOnlyElement(commitInfos.getItems()).getTimestamp());
}
Also used : CommitInfos(com.b2international.snowowl.core.commit.CommitInfos) RepositoryContext(com.b2international.snowowl.core.domain.RepositoryContext) Request(com.b2international.snowowl.core.events.Request) AuthorizedRequest(com.b2international.snowowl.core.authorization.AuthorizedRequest) CommitInfo(com.b2international.snowowl.core.commit.CommitInfo) Test(org.junit.Test)

Example 3 with CommitInfos

use of com.b2international.snowowl.core.commit.CommitInfos in project snow-owl by b2ihealthcare.

the class CommitInfoRequestTest method searchCommitInfoByUserId.

@Test
public void searchCommitInfoByUserId() {
    final String oid = UUID.randomUUID().toString();
    final String shortName = UUID.randomUUID().toString();
    final String comment = "Code system for commit info 3";
    final String userId = "commitInfo";
    createCodeSystem(oid, shortName, comment, userId);
    Request<RepositoryContext, CommitInfos> req = RepositoryRequests.commitInfos().prepareSearchCommitInfo().filterByAuthor(userId).build();
    final CommitInfos commitInfos = new ResourceRepositoryRequestBuilder<CommitInfos>() {

        @Override
        public Request<RepositoryContext, CommitInfos> build() {
            return req;
        }
    }.buildAsync().execute(bus).getSync();
    assertEquals(commitInfos.getTotal(), 1);
    final CommitInfo commitInfo = Iterables.getOnlyElement(commitInfos);
    assertEquals(userId, commitInfo.getAuthor());
}
Also used : CommitInfos(com.b2international.snowowl.core.commit.CommitInfos) RepositoryContext(com.b2international.snowowl.core.domain.RepositoryContext) Request(com.b2international.snowowl.core.events.Request) AuthorizedRequest(com.b2international.snowowl.core.authorization.AuthorizedRequest) CommitInfo(com.b2international.snowowl.core.commit.CommitInfo) Test(org.junit.Test)

Aggregations

AuthorizedRequest (com.b2international.snowowl.core.authorization.AuthorizedRequest)3 CommitInfos (com.b2international.snowowl.core.commit.CommitInfos)3 RepositoryContext (com.b2international.snowowl.core.domain.RepositoryContext)3 Request (com.b2international.snowowl.core.events.Request)3 CommitInfo (com.b2international.snowowl.core.commit.CommitInfo)2 Test (org.junit.Test)2