use of org.jboss.pnc.bacon.pig.impl.documents.Deliverables in project bacon by project-ncl.
the class QuarkusCommunityDepAnalyzerTest method test.
@Test
@Disabled
void test() {
File tempFolder = Files.newTemporaryFolder();
System.out.println(tempFolder.getAbsolutePath());
File extras = new File(tempFolder, "extras");
extras.mkdir();
RepositoryData repositoryData = new RepositoryData();
repositoryData.setRepositoryPath(Paths.get(REPO_ZIP_PATH));
PigContext context = new PigContext();
PigConfiguration pigConfig = new PigConfiguration();
Flow flow = new Flow();
RepoGenerationData repositoryGeneration = new RepoGenerationData();
repositoryGeneration.setBomArtifactId("quarkus-bom");
flow.setRepositoryGeneration(repositoryGeneration);
pigConfig.setFlow(flow);
Map<String, Map<String, ?>> addons = new HashMap<>();
Map<String, Object> depAnalyzerConfig = new HashMap<>();
depAnalyzerConfig.put("skippedExtensions", asList("quarkus-resteasy-reactive-kotlin", "quarkus-mongodb-client"));
addons.put(QuarkusCommunityDepAnalyzer.NAME, depAnalyzerConfig);
pigConfig.setAddons(addons);
context.setPigConfiguration(pigConfig);
context.setRepositoryData(repositoryData);
PigContext.setInstance(context);
Config instance = new Config();
ConfigProfile configProfile = new ConfigProfile();
PigConfig pig = new PigConfig();
pig.setIndyUrl(INDY_URL);
configProfile.setPig(pig);
DaConfig da = new DaConfig();
da.setUrl(DA_URL);
configProfile.setDa(da);
instance.setActiveProfile(configProfile);
Config.setInstance(instance);
QuarkusCommunityDepAnalyzer analyzer = new QuarkusCommunityDepAnalyzer(pigConfig, Collections.emptyMap(), tempFolder.getAbsolutePath(), extras.getAbsolutePath(), new Deliverables());
analyzer.trigger();
}
use of org.jboss.pnc.bacon.pig.impl.documents.Deliverables in project bacon by project-ncl.
the class PigContext method setPigConfiguration.
private void setPigConfiguration(PigConfiguration pigConfiguration, String targetPath, Optional<String> releaseStorageUrl) {
this.pigConfiguration = pigConfiguration;
initFullVersion(pigConfiguration, releaseStorageUrl);
if (deliverables == null) {
String suffix = "";
// for e.g, zip will become <releaseFile>-<fullVersion>-<suffix>-maven-repository.zip
if (pigConfiguration.getOutputSuffix() != null && !pigConfiguration.getOutputSuffix().isBlank()) {
suffix = "-" + pigConfiguration.getOutputSuffix();
}
prefix = String.format("%s-%s%s", pigConfiguration.getOutputPrefixes().getReleaseFile(), fullVersion, suffix);
deliverables = new Deliverables();
deliverables.setRepositoryZipName(prefix + "-maven-repository.zip");
deliverables.setNvrListName(prefix + "-nvr-list.txt");
}
configureTargetDirectories(pigConfiguration, targetPath);
}
use of org.jboss.pnc.bacon.pig.impl.documents.Deliverables in project bacon by project-ncl.
the class ResolveOnlyRepositoryTest method mockDeliverables.
private Deliverables mockDeliverables(PigConfiguration pigConfiguration) {
Deliverables deliverables = Mockito.mock(Deliverables.class);
doReturn("rh-sample-maven-repository.zip").when(deliverables).getRepositoryZipName();
doReturn("rh-sample-").when(pigConfiguration).getTopLevelDirectoryPrefix();
return deliverables;
}
use of org.jboss.pnc.bacon.pig.impl.documents.Deliverables in project bacon by project-ncl.
the class ResolveOnlyRepositoryTest method resolveAndRepackageShouldGenerateRepository.
@Test
void resolveAndRepackageShouldGenerateRepository() {
mockPigContextAndMethods();
mockIndySettingsFile();
PigConfiguration pigConfiguration = mockPigConfigurationAndMethods();
RepoGenerationData generationDataSpy = mockRepoGenerationDataAndMethods();
mockParamsAndMethods(generationDataSpy);
mockFlowAndMethods(pigConfiguration, generationDataSpy);
Map<String, PncBuild> buildsSpy = mockBuildsAndMethods(generationDataSpy);
Path configurationDirectory = Mockito.mock(Path.class);
mockResourceUtilsMethods(configurationDirectory);
Deliverables deliverables = mockDeliverables(pigConfiguration);
String releasePath = createReleasePath();
BuildInfoCollector buildInfoCollectorMock = Mockito.mock(BuildInfoCollector.class);
RepoManager repoManager = new RepoManager(pigConfiguration, releasePath, deliverables, buildsSpy, configurationDirectory, false, false, false, buildInfoCollectorMock, true);
RepoManager repoManagerSpy = Mockito.spy(repoManager);
prepareFakeExtensionArtifactList(repoManagerSpy);
RepositoryData repoData = repoManagerSpy.prepare();
assert repoData.getRepositoryPath().toString().equals("/tmp/resolveRepoTest/rh-sample-maven-repository.zip");
Set<String> repoZipContents = repoZipContentList();
repoData.getFiles().forEach((file) -> {
String filePath = file.getAbsolutePath().replaceAll(".+/deliverable-generation\\d+/", "");
if (!repoZipContents.contains(filePath)) {
System.out.println("File not included " + filePath);
}
assert repoZipContents.contains(filePath);
});
}
Aggregations