Search in sources :

Example 11 with Environment

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();
}
Also used : User(org.jboss.pnc.dto.User) BuildConfigurationRevisionRef(org.jboss.pnc.dto.BuildConfigurationRevisionRef) Environment(org.jboss.pnc.dto.Environment) ProjectRef(org.jboss.pnc.dto.ProjectRef) SCMRepository(org.jboss.pnc.dto.SCMRepository)

Example 12 with Environment

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());
}
Also used : Environment(org.jboss.pnc.dto.Environment) BuildEnvironment(org.jboss.pnc.model.BuildEnvironment) Test(org.junit.Test)

Example 13 with Environment

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);
}
Also used : Environment(org.jboss.pnc.dto.Environment) BuildEnvironment(org.jboss.pnc.model.BuildEnvironment) Test(org.junit.Test)

Example 14 with Environment

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());
}
Also used : Environment(org.jboss.pnc.dto.Environment) BuildEnvironment(org.jboss.pnc.model.BuildEnvironment) Environment(org.jboss.pnc.dto.Environment) Test(org.junit.Test)

Aggregations

Environment (org.jboss.pnc.dto.Environment)14 Test (org.junit.Test)8 SCMRepository (org.jboss.pnc.dto.SCMRepository)5 ContainerTest (org.jboss.pnc.test.category.ContainerTest)5 InSequence (org.jboss.arquillian.junit.InSequence)4 EnvironmentClient (org.jboss.pnc.client.EnvironmentClient)4 BuildConfiguration (org.jboss.pnc.dto.BuildConfiguration)4 ProjectRef (org.jboss.pnc.dto.ProjectRef)4 BuildEnvironment (org.jboss.pnc.model.BuildEnvironment)3 BuildConfigurationRevisionRef (org.jboss.pnc.dto.BuildConfigurationRevisionRef)2 Path (java.nio.file.Path)1 HashSet (java.util.HashSet)1 AbstractTest (org.jboss.pnc.bacon.test.AbstractTest)1 ExecutionResult (org.jboss.pnc.bacon.test.ExecutionResult)1 BuildConfigurationClient (org.jboss.pnc.client.BuildConfigurationClient)1 GroupConfiguration (org.jboss.pnc.dto.GroupConfiguration)1 Product (org.jboss.pnc.dto.Product)1 ProductMilestone (org.jboss.pnc.dto.ProductMilestone)1 ProductVersion (org.jboss.pnc.dto.ProductVersion)1 Project (org.jboss.pnc.dto.Project)1