-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix loading of Red Hat artifacts for catalog
io.kaoto.camelcatalog.maven.CamelCatalogVersionLoader.configureRepositories(String) is called too late for Camel Yaml DSL loading. it is called when loading Camel Catalogs. Quickfix provided: calling the CamelCatalog which is configuring the repositories at first not perfect as note all versions are aligned and some others might need it but should be enough to unblock current situation note that the provided is not efficient because the camel-yaml-dsl test dependency is leaking in the other tests, thus even without the fix the test is passing... I guess it would require to create a separate module for the test or to ensure a specific version is picked (see also next paragraph) Another note: when several catalog are generated at same time, I'm not sure that we can ensure that it picks the exact correct version of the camel-yaml-dsl, it might be the first one found, whatever version it is; To be checked. In practice I think that most of the time there are no differences. fixes #1597 Signed-off-by: Aurélien Pupier <[email protected]>
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...or/src/test/java/io/kaoto/camelcatalog/commands/GenerateCatalogWithRedHatVersionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.kaoto.camelcatalog.commands; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.mockito.Mockito.times; | ||
import static org.mockito.Mockito.verify; | ||
|
||
import java.io.File; | ||
import java.nio.file.Path; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.io.TempDir; | ||
|
||
import io.kaoto.camelcatalog.beans.ConfigBean; | ||
import io.kaoto.camelcatalog.model.CatalogCliArgument; | ||
import io.kaoto.camelcatalog.model.CatalogDefinition; | ||
import io.kaoto.camelcatalog.model.CatalogRuntime; | ||
|
||
class GenerateCatalogWithRedHatVersionTest { | ||
|
||
@TempDir | ||
File tempDir; | ||
|
||
@Test | ||
void testOK() throws Exception { | ||
CatalogDefinition catalogDefinition = new CatalogDefinition(); | ||
catalogDefinition.setFileName("index.json"); | ||
catalogDefinition.setName("test-camel-catalog"); | ||
catalogDefinition.setVersion("4.4.0.redhat-00045"); | ||
catalogDefinition.setRuntime(CatalogRuntime.Main); | ||
|
||
CatalogCliArgument catalogCliArg = new CatalogCliArgument(); | ||
catalogCliArg.setRuntime(CatalogRuntime.Main); | ||
catalogCliArg.setCatalogVersion("4.4.0.redhat-00045"); | ||
|
||
ConfigBean configBean = new ConfigBean(); | ||
configBean.setOutputFolder(tempDir.toString()); | ||
configBean.setCatalogsName("test-camel-catalog"); | ||
configBean.addCatalogVersion(catalogCliArg); | ||
configBean.setKameletsVersion("1.0.0"); | ||
|
||
GenerateCommand generateCommand = new GenerateCommand(configBean); | ||
|
||
generateCommand.run(); | ||
|
||
assertTrue(new File(tempDir, "camel-main/4.4.0.redhat-00045").exists(), "The folder for the catalog wasn't created"); | ||
assertEquals(34, new File(tempDir, "camel-main/4.4.0.redhat-00045").listFiles().length, "The folder for the catalog doesn't contain the correct number of files"); | ||
} | ||
|
||
} |