use of org.kie.util.maven.support.ReleaseIdImpl in project drools by kiegroup.
the class KieModuleRepoTest method storingNewProjectsCausesOldProjectEvictionFromKieModuleRepoTest.
@Test
public void storingNewProjectsCausesOldProjectEvictionFromKieModuleRepoTest() throws Exception {
// setup
setCacheSize(maxSizeGaCacheField, null, 3);
// to test oldKieModules caching
setCacheSize(maxSizeGaVersionsCacheField, null, 2);
final ReleaseIdImpl[] releaseIds = new ReleaseIdImpl[7];
for (int i = 0; i < releaseIds.length; ++i) {
final String artifactId = Character.toString((char) ('A' + i));
releaseIds[i] = new ReleaseIdImpl("org", artifactId, "1.0");
}
// store
for (int i = 0; i < releaseIds.length; ++i) {
final InternalKieModule kieModule = mock(InternalKieModule.class);
when(kieModule.getReleaseId()).thenReturn(releaseIds[i]);
when(kieModule.getCreationTimestamp()).thenReturn(10l);
kieModuleRepo.store(kieModule);
// store module 2 times to trigger storage to oldKieModules
kieModuleRepo.store(kieModule);
}
final int numKieModules = countKieModules(kieModuleRepo.kieModules);
assertEquals("KieModuleRepo cache should not grow past " + KieModuleRepo.MAX_SIZE_GA_CACHE + ": ", KieModuleRepo.MAX_SIZE_GA_CACHE, numKieModules);
final int oldKieModulesSize = kieModuleRepo.oldKieModules.size();
final int max = KieModuleRepo.MAX_SIZE_GA_CACHE * KieModuleRepo.MAX_SIZE_GA_VERSIONS_CACHE;
assertTrue("KieModuleRepot old KieModules map is not limited in it's growth: " + oldKieModulesSize + " > " + max, oldKieModulesSize <= max);
}
use of org.kie.util.maven.support.ReleaseIdImpl in project drools by kiegroup.
the class ReleaseIdTest method testResolveVersionPomModelNull.
@Test
public void testResolveVersionPomModelNull() {
final ReleaseIdImpl releaseId = new ReleaseIdImpl("groupId", "artifactId", "${project.version}");
Assertions.assertThat(releaseId.getVersion()).isEqualTo("${project.version}");
}
use of org.kie.util.maven.support.ReleaseIdImpl in project drools by kiegroup.
the class ReleaseIdTest method testResolveVersionNoProperty.
@Test
public void testResolveVersionNoProperty() {
final ReleaseIdImpl releaseId = new ReleaseIdImpl("groupId", "artifactId", "1.0.0");
Assertions.assertThat(releaseId.getVersion()).isEqualTo("1.0.0");
}
use of org.kie.util.maven.support.ReleaseIdImpl in project drools by kiegroup.
the class KieBuilderImpl method writePomAndKModule.
public void writePomAndKModule() {
addMetaInfBuilder();
if (pomXml != null) {
ReleaseIdImpl g = (ReleaseIdImpl) releaseId;
trgMfs.write(g.getPomXmlPath(), pomXml, true);
trgMfs.write(g.getPomPropertiesPath(), generatePomProperties(releaseId).getBytes(IoUtils.UTF8_CHARSET), true);
}
if (kModuleModel != null && hasXmlSupport()) {
trgMfs.write(KieModuleModelImpl.KMODULE_JAR_PATH, kModuleModel.toXML().getBytes(IoUtils.UTF8_CHARSET), true);
}
}
use of org.kie.util.maven.support.ReleaseIdImpl in project drools by kiegroup.
the class InJarArtifactResolver method getArtifactDependecies.
@Override
public List<DependencyDescriptor> getArtifactDependecies(String artifactName) {
ReleaseId releaseId = new ReleaseIdImpl(artifactName);
PomParser pomParser = buildPomParser(releaseId);
return pomParser != null ? pomParser.getPomDirectDependencies(DependencyFilter.COMPILE_FILTER) : emptyList();
}
Aggregations