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);
}
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);
}
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;
}
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);
}
}
Aggregations