Search in sources :

Example 1 with PipelineSourceItemsVO

use of com.epam.pipeline.controller.vo.PipelineSourceItemsVO in project cloud-pipeline by epam.

the class GitManagerTest method shouldUpdateFiles.

@Test
public void shouldUpdateFiles() throws GitClientException {
    final Pipeline pipeline = testingPipeline();
    final String lastCommit = pipeline.getCurrentVersion().getCommitId();
    final PipelineSourceItemVO bla = new PipelineSourceItemVO();
    bla.setLastCommitId(lastCommit);
    bla.setContents(FILE_CONTENT);
    bla.setComment("Update some file");
    bla.setPath(DOCS + "/" + README_FILE);
    bla.setPreviousPath(DOCS + "/" + README_FILE);
    final PipelineSourceItemsVO sourceItemVOList = new PipelineSourceItemsVO();
    sourceItemVOList.setLastCommitId(lastCommit);
    sourceItemVOList.setItems(singletonList(bla));
    final GitCommitEntry expectedCommit = new GitCommitEntry();
    givenThat(post(urlPathEqualTo(api(REPOSITORY_COMMITS))).willReturn(okJson(with(expectedCommit))));
    final GitCommitEntry resultingCommit = gitManager.updateFiles(pipeline, sourceItemVOList);
    assertThat(resultingCommit, is(expectedCommit));
}
Also used : PipelineSourceItemVO(com.epam.pipeline.controller.vo.PipelineSourceItemVO) IsEmptyString.isEmptyString(org.hamcrest.text.IsEmptyString.isEmptyString) Matchers.anyString(org.mockito.Matchers.anyString) PipelineSourceItemsVO(com.epam.pipeline.controller.vo.PipelineSourceItemsVO) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline) GitCommitEntry(com.epam.pipeline.entity.git.GitCommitEntry) AbstractManagerTest(com.epam.pipeline.manager.AbstractManagerTest) Test(org.junit.Test)

Aggregations

PipelineSourceItemVO (com.epam.pipeline.controller.vo.PipelineSourceItemVO)1 PipelineSourceItemsVO (com.epam.pipeline.controller.vo.PipelineSourceItemsVO)1 GitCommitEntry (com.epam.pipeline.entity.git.GitCommitEntry)1 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)1 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)1 IsEmptyString.isEmptyString (org.hamcrest.text.IsEmptyString.isEmptyString)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1