Search in sources :

Example 6 with BuildEnvironment

use of org.jboss.pnc.model.BuildEnvironment in project pnc by project-ncl.

the class Producers method buildEnv.

BuildEnvironment buildEnv() {
    final String name = randomAlphabetic(10);
    BuildEnvironment environment = BuildEnvironment.Builder.newBuilder().name(name).systemImageRepositoryUrl("https://example.com/" + name).systemImageType(SystemImageType.DOCKER_IMAGE).systemImageId(randomNumeric(10)).build();
    buildEnvironmentRepository.save(environment);
    return environment;
}
Also used : BuildEnvironment(org.jboss.pnc.model.BuildEnvironment)

Example 7 with BuildEnvironment

use of org.jboss.pnc.model.BuildEnvironment in project pnc by project-ncl.

the class RSQLPredicateProducerTest method testCriteriaPredicateEmbeded.

@Test
public void testCriteriaPredicateEmbeded() {
    org.jboss.pnc.spi.datastore.repositories.api.Predicate<BuildRecord> criteriaPredicate = producer.getCriteriaPredicate(BuildRecord.class, "environment.name==fooEnv");
    CriteriaBuilder cb = mock(CriteriaBuilder.class);
    Root<BuildRecord> root = mock(Root.class);
    Join<BuildRecord, BuildEnvironment> join = mock(Join.class);
    SingularAttributePath<String> namePath = mock(SingularAttributePath.class);
    when(root.join(BuildRecord_.buildEnvironment)).thenReturn(join);
    when(join.get(BuildEnvironment_.name)).thenReturn(namePath);
    Mockito.doReturn(String.class).when(namePath).getJavaType();
    SingularAttribute pathAttribute = mock(SingularAttribute.class);
    java.lang.reflect.Member javaMember = mock(java.lang.reflect.Member.class);
    Mockito.doReturn(BuildEnvironment.class).when(javaMember).getDeclaringClass();
    Mockito.doReturn(javaMember).when(pathAttribute).getJavaMember();
    Mockito.doReturn("name").when(pathAttribute).getName();
    Mockito.doReturn(pathAttribute).when(namePath).getAttribute();
    criteriaPredicate.apply(root, null, cb);
    Mockito.verify(cb).equal(namePath, "fooEnv");
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) BuildRecord(org.jboss.pnc.model.BuildRecord) SingularAttribute(javax.persistence.metamodel.SingularAttribute) BuildEnvironment(org.jboss.pnc.model.BuildEnvironment) Test(org.junit.Test)

Aggregations

BuildEnvironment (org.jboss.pnc.model.BuildEnvironment)7 Instant (java.time.Instant)1 HashMap (java.util.HashMap)1 TransactionAttribute (javax.ejb.TransactionAttribute)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 SingularAttribute (javax.persistence.metamodel.SingularAttribute)1 Build (org.jboss.pnc.api.causeway.dto.push.Build)1 BuildImportRequest (org.jboss.pnc.api.causeway.dto.push.BuildImportRequest)1 BuildRoot (org.jboss.pnc.api.causeway.dto.push.BuildRoot)1 BuiltArtifact (org.jboss.pnc.api.causeway.dto.push.BuiltArtifact)1 Dependency (org.jboss.pnc.api.causeway.dto.push.Dependency)1 MavenBuild (org.jboss.pnc.api.causeway.dto.push.MavenBuild)1 MavenBuiltArtifact (org.jboss.pnc.api.causeway.dto.push.MavenBuiltArtifact)1 NpmBuild (org.jboss.pnc.api.causeway.dto.push.NpmBuild)1 NpmBuiltArtifact (org.jboss.pnc.api.causeway.dto.push.NpmBuiltArtifact)1 Request (org.jboss.pnc.api.dto.Request)1 BuildType (org.jboss.pnc.enums.BuildType)1 EmptyEntityException (org.jboss.pnc.facade.validation.EmptyEntityException)1 Artifact (org.jboss.pnc.model.Artifact)1 BuildConfiguration (org.jboss.pnc.model.BuildConfiguration)1