Skip to content

Commit

Permalink
fix(catalog-generator): Fix Windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lordrip committed Oct 14, 2024
1 parent 605ddd4 commit 26963be
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import java.nio.file.Path;
import java.nio.file.Paths;

import org.apache.commons.io.FilenameUtils;

public class Util {
public static String generateHash(byte[] content) throws Exception {
if (content == null)
Expand All @@ -44,8 +42,7 @@ public static String getNormalizedFolder(String folder) {

// Resolve the relative path
Path absolutePath = currentDirectory.resolve(folder);
String normalizedfolder = FilenameUtils.separatorsToUnix(absolutePath.toString());

return normalizedfolder;
return absolutePath.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void testConfigureWithAllRequiredOptions() throws ParseException {
generateCommandOptions.configure(args);
String outputDir = Util.getNormalizedFolder("outputDir");

assertEquals(outputDir, configBean.getOutputFolder().toString());
assertEquals(outputDir, configBean.getOutputFolder().toPath().toString());
assertEquals("catalogName", configBean.getCatalogsName());
assertEquals("kameletsVersion", configBean.getKameletsVersion());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.junit.jupiter.api.io.TempDir;

import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -84,7 +85,8 @@ void testGeneratorCalledWithCorrectParameters() {
File expectedFolder = new File(tempDir, "camel-main/4.8.0");
verify(builder, times(1)).withOutputDirectory(expectedFolder);

assertEquals(catalogDefinition.getFileName(), "camel-main/4.8.0/index.json");
String expectedFile = Path.of("camel-main", "4.8.0", "index.json").toString();
assertEquals(catalogDefinition.getFileName(), expectedFile);
}
}

Expand Down Expand Up @@ -123,7 +125,9 @@ void testCatalogLibraryOutput() {
assertEquals(catalogLibraryEntry.name(), "test-camel-catalog");
assertEquals(catalogLibraryEntry.version(), "4.8.0");
assertEquals(catalogLibraryEntry.runtime(), "Main");
assertEquals(catalogLibraryEntry.fileName(), "camel-main/4.8.0/index.json");

String expectedFile = Path.of("camel-main", "4.8.0", "index.json").toString();
assertEquals(catalogLibraryEntry.fileName(), expectedFile);
}
}
}
}

0 comments on commit 26963be

Please sign in to comment.