Search in sources :

Example 6 with ProductVersion

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

the class ProductMilestoneProviderTest method testGetProductMilestonesForProductVersion.

@Test
public void testGetProductMilestonesForProductVersion() {
    // when
    ProductVersion pv = mock.getProductVersion();
    Page<org.jboss.pnc.dto.ProductMilestone> page = provider.getProductMilestonesForProductVersion(0, 10, null, null, pv.getId().toString());
    // then
    assertThat(page.getContent().size()).isGreaterThanOrEqualTo(1);
}
Also used : ProductMilestone(org.jboss.pnc.model.ProductMilestone) ProductVersion(org.jboss.pnc.model.ProductVersion) Test(org.junit.Test)

Example 7 with ProductVersion

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

the class ProductVersionProviderTest method testStoreDuplicateShouldThrowException.

@Test
public void testStoreDuplicateShouldThrowException() {
    Set<ProductVersion> productVersionSet = new HashSet<>();
    productVersionSet.add(pv);
    final Product productDB = prepareProduct(pv.getProduct().getId(), pv.getProduct().getAbbreviation());
    productDB.setProductVersions(productVersionSet);
    when(productRepository.queryById(pv.getProduct().getId())).thenReturn(productDB);
    org.jboss.pnc.dto.ProductVersion duplicate = org.jboss.pnc.dto.ProductVersion.builder().version(pv.getVersion()).product(ProductRef.refBuilder().id(pv.getProduct().getId().toString()).build()).productMilestones(Collections.emptyMap()).build();
    assertThatThrownBy(() -> provider.store(duplicate)).isInstanceOf(ConflictedEntryException.class);
}
Also used : Product(org.jboss.pnc.model.Product) ProductVersion(org.jboss.pnc.model.ProductVersion) Test(org.junit.Test)

Example 8 with ProductVersion

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

the class HibernateLazyInitializer method initializeBuildConfigurationBeforeTriggeringIt.

@TransactionAttribute(TransactionAttributeType.MANDATORY)
public BuildConfiguration initializeBuildConfigurationBeforeTriggeringIt(BuildConfiguration buildConfiguration) {
    log.trace("Initializing BC {}.", buildConfiguration.getId());
    buildConfiguration.getDependencies();
    buildConfiguration.getIndirectDependencies();
    ProductVersion productVersion = buildConfiguration.getProductVersion();
    if (productVersion != null) {
        productVersion.getProduct();
        productVersion.getCurrentProductMilestone();
    }
    return buildConfiguration;
}
Also used : ProductVersion(org.jboss.pnc.model.ProductVersion) TransactionAttribute(javax.ejb.TransactionAttribute)

Example 9 with ProductVersion

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

the class ProductMilestoneReleaseManager method removeCurrentFlagFromMilestone.

/**
 * [NCL-3112] Mark the milestone provided as not current
 *
 * @param milestone ProductMilestone to not be current anymore
 */
private void removeCurrentFlagFromMilestone(ProductMilestone milestone) {
    ProductVersion productVersion = milestone.getProductVersion();
    if (productVersion.getCurrentProductMilestone() != null && productVersion.getCurrentProductMilestone().getId().equals(milestone.getId())) {
        productVersion.setCurrentProductMilestone(null);
        productVersionRepository.save(productVersion);
    }
}
Also used : ProductVersion(org.jboss.pnc.model.ProductVersion)

Aggregations

ProductVersion (org.jboss.pnc.model.ProductVersion)9 Product (org.jboss.pnc.model.Product)6 Test (org.junit.Test)3 TransactionAttribute (javax.ejb.TransactionAttribute)2 BuildConfigurationSet (org.jboss.pnc.model.BuildConfigurationSet)2 ProductMilestone (org.jboss.pnc.model.ProductMilestone)2 Instant (java.time.Instant)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Transactional (org.jboss.arquillian.transaction.api.annotation.Transactional)1 BuildConfiguration (org.jboss.pnc.model.BuildConfiguration)1 BuildEnvironment (org.jboss.pnc.model.BuildEnvironment)1 ProductMilestoneRelease (org.jboss.pnc.model.ProductMilestoneRelease)1 ProductRelease (org.jboss.pnc.model.ProductRelease)1 Project (org.jboss.pnc.model.Project)1 RepositoryConfiguration (org.jboss.pnc.model.RepositoryConfiguration)1 ContainerTest (org.jboss.pnc.test.category.ContainerTest)1