Search in sources :

Example 1 with CommitInfo

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

the class CommitInfoRequestTest method getCommitInfo.

@Test
public void getCommitInfo() {
    final String oid = UUID.randomUUID().toString();
    final String shortName = UUID.randomUUID().toString();
    final String comment = "Code system for commit info 1";
    createCodeSystem(oid, shortName, comment);
    final String id = getCommitInfoByComment(comment).getId();
    Request<RepositoryContext, CommitInfo> req = RepositoryRequests.commitInfos().prepareGetCommitInfo(id).build();
    CommitInfo commitInfo = new ResourceRepositoryRequestBuilder<CommitInfo>() {

        @Override
        public Request<RepositoryContext, CommitInfo> build() {
            return req;
        }
    }.buildAsync().execute(bus).getSync();
    assertEquals(id, commitInfo.getId());
    assertEquals(comment, commitInfo.getComment());
    assertEquals(BRANCH, commitInfo.getBranch());
    assertEquals(USER_ID, commitInfo.getAuthor());
}
Also used : 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 2 with CommitInfo

use of com.b2international.snowowl.core.commit.CommitInfo 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 CommitInfo

use of com.b2international.snowowl.core.commit.CommitInfo 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)

Example 4 with CommitInfo

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

the class CommitInfoRequestTest method searchCommitInfoByComment.

@Test
public void searchCommitInfoByComment() {
    final String oid = UUID.randomUUID().toString();
    final String shortName = UUID.randomUUID().toString();
    final String comment = "Code system for commit info 2";
    createCodeSystem(oid, shortName, comment);
    final CommitInfo commitInfo = getCommitInfoByComment(comment);
    assertEquals(comment, commitInfo.getComment());
}
Also used : CommitInfo(com.b2international.snowowl.core.commit.CommitInfo) Test(org.junit.Test)

Aggregations

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