Skip to content

Commit

Permalink
Merge changes from 1.X.X to 2.0.0 as release 2.0.1
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Krishna <[email protected]>
  • Loading branch information
rahlk committed Feb 3, 2025
1 parent 2fa0cae commit edc2606
Show file tree
Hide file tree
Showing 188 changed files with 15 additions and 3,679 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=2.0.0
version=2.0.1
25 changes: 14 additions & 11 deletions src/test/java/com/ibm/cldk/CodeAnalyzerIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ public class CodeAnalyzerIntegrationTest {
"/opt/jars",
BindMode.READ_WRITE)
.withCopyFileToContainer(MountableFile.forHostPath(Paths.get(System.getProperty("user.dir")).resolve("build/libs")), "/opt/jars")
.withCopyFileToContainer(MountableFile.forHostPath(Paths.get(System.getProperty("user.dir")).resolve("src/test/resources/test-applications")), "/");
.withCopyFileToContainer(MountableFile.forHostPath(Paths.get(System.getProperty("user.dir")).resolve("src/test/resources/test-applications/mvnw-corrupt-test")), "/test-applications/mvnw-corrupt-test")
.withCopyFileToContainer(MountableFile.forHostPath(Paths.get(System.getProperty("user.dir")).resolve("src/test/resources/test-applications/mvnw-working-test")), "/test-applications/mvnw-working-test");

@Container
static final GenericContainer<?> mavenContainer = new GenericContainer<>("maven:3.8.3-openjdk-17")
.withCreateContainerCmdModifier(cmd -> cmd.withEntrypoint("sh"))
.withCommand("-c", "while true; do sleep 1; done")
.withCopyFileToContainer(MountableFile.forHostPath(Paths.get(System.getProperty("user.dir")).resolve("build/libs")), "/opt/jars")
.withCopyFileToContainer(MountableFile.forHostPath(Paths.get(System.getProperty("user.dir")).resolve("src/test/resources/test-applications")), "/");
.withCopyFileToContainer(MountableFile.forHostPath(Paths.get(System.getProperty("user.dir")).resolve("src/test/resources/test-applications/mvnw-corrupt-test")), "/test-applications/mvnw-corrupt-test")
.withCopyFileToContainer(MountableFile.forHostPath(Paths.get(System.getProperty("user.dir")).resolve("src/test/resources/test-applications/mvnw-working-test")), "/test-applications/mvnw-working-test");


@BeforeAll
Expand Down Expand Up @@ -100,7 +102,8 @@ void shouldBeAbleToRunCodeAnalyzer() throws Exception {

Assertions.assertEquals(0, runCodeAnalyzerJar.getExitCode(),
"Command should execute successfully");
Assertions.assertFalse(runCodeAnalyzerJar.getStdout().isEmpty(), "Should have some output");
Assertions.assertTrue(runCodeAnalyzerJar.getStdout().length() > 0,
"Should have some output");
}

@Test
Expand All @@ -126,19 +129,19 @@ void corruptMavenShouldProduceAnalysisArtifactsWhenMVNCommandIsInPath() throws I
Assertions.assertTrue(runCodeAnalyzer.getStdout().contains("[ERROR]\tCannot run program \"/test-applications/mvnw-corrupt-test/mvnw\"") && runCodeAnalyzer.getStdout().contains("/mvn."));
// We should correctly identify the build tool used in the mvn command from the system path.
Assertions.assertTrue(runCodeAnalyzer.getStdout().contains("[INFO]\tBuilding the project using /usr/bin/mvn."));
}
}

@Test
void corruptMavenShouldNotTerminateWithErrorWhenMavenIsNotPresentUnlessAnalysisLevel2() throws IOException, InterruptedException {
// When analysis level 2, we should get a Runtime Exception
var runCodeAnalyzer = container.execInContainer(
"java",
"-jar",
String.format("/opt/jars/codeanalyzer-%s.jar", codeanalyzerVersion),
"--input=/test-applications/mvnw-corrupt-test",
"--output=/tmp/",
"--analysis-level=2"
);
"java",
"-jar",
String.format("/opt/jars/codeanalyzer-%s.jar", codeanalyzerVersion),
"--input=/test-applications/mvnw-corrupt-test",
"--output=/tmp/",
"--analysis-level=2"
);
Assertions.assertEquals(1, runCodeAnalyzer.getExitCode());
Assertions.assertTrue(runCodeAnalyzer.getStderr().contains("java.lang.RuntimeException"));
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/test-applications copy/gradlew-corrupt-test/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions src/test/test-applications copy/gradlew-corrupt-test/Dockerfile

This file was deleted.

35 changes: 0 additions & 35 deletions src/test/test-applications copy/gradlew-corrupt-test/README.txt

This file was deleted.

37 changes: 0 additions & 37 deletions src/test/test-applications copy/gradlew-corrupt-test/build.gradle

This file was deleted.

This file was deleted.

Empty file.
89 changes: 0 additions & 89 deletions src/test/test-applications copy/gradlew-corrupt-test/gradlew.bat

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Empty file.

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/test-applications copy/gradlew-working-test/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions src/test/test-applications copy/gradlew-working-test/Dockerfile

This file was deleted.

Loading

0 comments on commit edc2606

Please sign in to comment.