use of org.jboss.pnc.dto.Environment in project pnc by project-ncl.
the class BuildStatusChangedTest method getBuild.
private Build getBuild() {
ProjectRef projectRef = ProjectRef.refBuilder().id("1").name("A").description("desc").projectUrl("url1").issueTrackerUrl("url2").build();
SCMRepository scmRepository = SCMRepository.builder().id("1").internalUrl("url1").externalUrl("url2").preBuildSyncEnabled(true).build();
Environment buildEnvironment = Environment.builder().id("1").name("jdk8").description("desc").systemImageRepositoryUrl("url").systemImageId("11").systemImageType(SystemImageType.DOCKER_IMAGE).deprecated(true).build();
User user = User.builder().id("1").username("user").build();
BuildConfigurationRevisionRef buildConfigurationRevisionRef = BuildConfigurationRevisionRef.refBuilder().id("1").rev(1).name("name").buildScript("true").scmRevision("awqs21").build();
return Build.builder().project(projectRef).scmRepository(scmRepository).environment(buildEnvironment).user(user).buildConfigRevision(buildConfigurationRevisionRef).status(BuildStatus.BUILDING).buildContentId("build-42").temporaryBuild(true).build();
}
use of org.jboss.pnc.dto.Environment in project pnc by project-ncl.
the class EnvironmentProviderTest method testGetSpecific.
@Test
public void testGetSpecific() {
Environment environment = provider.getSpecific(env.getId().toString());
assertThat(environment.getId()).isEqualTo(env.getId().toString());
assertThat(environment.getName()).isEqualTo(env.getName());
}
use of org.jboss.pnc.dto.Environment in project pnc by project-ncl.
the class EnvironmentProviderTest method testUpdate.
@Test
public void testUpdate() {
final String newName = "newName";
Environment environment = Environment.builder().id(env.getId().toString()).name(newName).systemImageId(env.getSystemImageId()).deprecated(env.isDeprecated()).systemImageType(env.getSystemImageType()).description(env.getDescription()).systemImageRepositoryUrl(env.getSystemImageRepositoryUrl()).attributes(env.getAttributes()).build();
assertThat(env.getName()).isNotEqualTo(environment.getName());
assertThatThrownBy(() -> provider.update(env.getId().toString(), environment)).isInstanceOf(UnsupportedOperationException.class);
}
use of org.jboss.pnc.dto.Environment in project pnc by project-ncl.
the class EnvironmentProviderTest method testStore.
@Test
public void testStore() {
final String name = "Hello";
final String sysImageId = "NewID";
final String sysRepoUrl = "quay.io/rh-newcastle";
// when
Environment environment = Environment.builder().name(name).systemImageId(sysImageId).systemImageRepositoryUrl(sysRepoUrl).systemImageType(SystemImageType.DOCKER_IMAGE).build();
org.jboss.pnc.dto.Environment envDTOSaved = provider.store(environment);
// then
assertThat(envDTOSaved.getId()).isNotNull().isNotBlank();
// check if DTO pre-save is the same as DTO post-save
assertThat(envDTOSaved.getName()).isEqualTo(environment.getName());
assertThat(envDTOSaved.getSystemImageId()).isEqualTo(environment.getSystemImageId());
assertThat(envDTOSaved.getSystemImageRepositoryUrl()).isEqualTo(environment.getSystemImageRepositoryUrl());
}
Aggregations