Search in sources :

Example 6 with BuildPushParameters

use of org.jboss.pnc.dto.requests.BuildPushParameters in project pnc by project-ncl.

the class BuildPusherRejectionsTest method shouldRejectWithBlacklistedArtifacts.

@Test
public void shouldRejectWithBlacklistedArtifacts() throws ProcessException {
    // given
    BuildRecord record = new BuildRecord();
    record.setStatus(buildStatus);
    record.setExecutionRootName("FOO");
    BuildRecord savedBuildRecord = buildRecordRepository.save(record);
    Artifact artifact = Artifact.builder().build();
    artifact.setArtifactQuality(artifactQuality);
    artifact.setBuildRecord(savedBuildRecord);
    when(globalModuleGroup.getPncUrl()).thenReturn("http://localhost/");
    when(artifactRepository.queryWithPredicates(any())).thenReturn(Collections.singletonList(artifact));
    when(buildRecordRepository.getAnyLatestSuccessfulBuildRecordWithRevision(any(IdRev.class), any(Boolean.class))).thenReturn(null);
    // then
    thrown.expect(expected);
    // when
    BuildPushParameters buildPushParameters = BuildPushParameters.builder().build();
    brewPusher.pushBuild(BuildMapper.idMapper.toDto(savedBuildRecord.getId()), buildPushParameters);
}
Also used : BuildPushParameters(org.jboss.pnc.dto.requests.BuildPushParameters) IdRev(org.jboss.pnc.model.IdRev) BuildRecord(org.jboss.pnc.model.BuildRecord) Artifact(org.jboss.pnc.model.Artifact) Test(org.junit.Test)

Aggregations

BuildPushParameters (org.jboss.pnc.dto.requests.BuildPushParameters)6 Test (org.junit.Test)4 BuildPushResult (org.jboss.pnc.dto.BuildPushResult)3 BuildClient (org.jboss.pnc.client.BuildClient)2 Build (org.jboss.pnc.dto.Build)2 BuildRecord (org.jboss.pnc.model.BuildRecord)2 ContainerTest (org.jboss.pnc.test.category.ContainerTest)2 HashSet (java.util.HashSet)1 PncBuild (org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)1 RemoteResourceException (org.jboss.pnc.client.RemoteResourceException)1 AlreadyRunningException (org.jboss.pnc.facade.validation.AlreadyRunningException)1 OperationNotAllowedException (org.jboss.pnc.facade.validation.OperationNotAllowedException)1 Artifact (org.jboss.pnc.model.Artifact)1 IdRev (org.jboss.pnc.model.IdRev)1 AdvancedBuildClient (org.jboss.pnc.restclient.AdvancedBuildClient)1 ProcessException (org.jboss.pnc.spi.coordinator.ProcessException)1 InconsistentDataException (org.jboss.pnc.spi.datastore.InconsistentDataException)1