Search in sources :

Example 1 with Deliverables

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();
}
Also used : HashMap(java.util.HashMap) PigConfig(org.jboss.pnc.bacon.config.PigConfig) DaConfig(org.jboss.pnc.bacon.config.DaConfig) Config(org.jboss.pnc.bacon.config.Config) PigConfiguration(org.jboss.pnc.bacon.pig.impl.config.PigConfiguration) PigContext(org.jboss.pnc.bacon.pig.impl.PigContext) ConfigProfile(org.jboss.pnc.bacon.config.ConfigProfile) RepositoryData(org.jboss.pnc.bacon.pig.impl.repo.RepositoryData) Flow(org.jboss.pnc.bacon.pig.impl.config.Flow) DaConfig(org.jboss.pnc.bacon.config.DaConfig) Deliverables(org.jboss.pnc.bacon.pig.impl.documents.Deliverables) PigConfig(org.jboss.pnc.bacon.config.PigConfig) RepoGenerationData(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData) File(java.io.File) HashMap(java.util.HashMap) Map(java.util.Map) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 2 with Deliverables

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);
}
Also used : Deliverables(org.jboss.pnc.bacon.pig.impl.documents.Deliverables)

Example 3 with Deliverables

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;
}
Also used : Deliverables(org.jboss.pnc.bacon.pig.impl.documents.Deliverables)

Example 4 with 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);
    });
}
Also used : Path(java.nio.file.Path) Deliverables(org.jboss.pnc.bacon.pig.impl.documents.Deliverables) BuildInfoCollector(org.jboss.pnc.bacon.pig.impl.pnc.BuildInfoCollector) PigConfiguration(org.jboss.pnc.bacon.pig.impl.config.PigConfiguration) RepoGenerationData(org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData) PncBuild(org.jboss.pnc.bacon.pig.impl.pnc.PncBuild) Test(org.junit.jupiter.api.Test)

Aggregations

Deliverables (org.jboss.pnc.bacon.pig.impl.documents.Deliverables)4 PigConfiguration (org.jboss.pnc.bacon.pig.impl.config.PigConfiguration)2 RepoGenerationData (org.jboss.pnc.bacon.pig.impl.config.RepoGenerationData)2 Test (org.junit.jupiter.api.Test)2 File (java.io.File)1 Path (java.nio.file.Path)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Config (org.jboss.pnc.bacon.config.Config)1 ConfigProfile (org.jboss.pnc.bacon.config.ConfigProfile)1 DaConfig (org.jboss.pnc.bacon.config.DaConfig)1 PigConfig (org.jboss.pnc.bacon.config.PigConfig)1 PigContext (org.jboss.pnc.bacon.pig.impl.PigContext)1 Flow (org.jboss.pnc.bacon.pig.impl.config.Flow)1 BuildInfoCollector (org.jboss.pnc.bacon.pig.impl.pnc.BuildInfoCollector)1 PncBuild (org.jboss.pnc.bacon.pig.impl.pnc.PncBuild)1 RepositoryData (org.jboss.pnc.bacon.pig.impl.repo.RepositoryData)1 Disabled (org.junit.jupiter.api.Disabled)1