use of org.jboss.pnc.dto.ProductRef in project pnc by project-ncl.
the class ProductVersionProviderTest method testStore.
@Test
public void testStore() {
final Integer prodId = 12;
final String version = "17.0";
final String abbreviation = "PNC";
final ProductRef product = ProductRef.refBuilder().id(prodId.toString()).abbreviation(abbreviation).build();
final Product productDB = prepareProduct(prodId, abbreviation);
when(productRepository.queryById(prodId)).thenReturn(productDB);
when(systemConfig.getBrewTagPattern()).thenReturn("${product_short_name}-${product_version}-HI");
org.jboss.pnc.dto.ProductVersion productVersion = org.jboss.pnc.dto.ProductVersion.builder().productMilestones(Collections.emptyMap()).product(product).version(version).build();
org.jboss.pnc.dto.ProductVersion stored = provider.store(productVersion);
assertThat(stored).isNotNull();
assertThat(stored.getId()).isNotNull();
assertThat(stored.getVersion()).isEqualTo(version);
assertThat(stored.getProduct().getId()).isEqualTo(prodId.toString());
assertThat(stored.getAttributes()).isNotNull();
assertThat(stored.getAttributes().get(Attributes.BREW_TAG_PREFIX)).isNotNull();
}
Aggregations