Uh oh!
There was an error while loading. Please reload this page.
Issue 100 capture database entries - #110
Merged
Merged
Conversation
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
… test and/or resources folder only within project directory. Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
…avaEE and Jakarta Persistence API. Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
… the crud operations that occur in it as an array list. Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
… the crud operations and queries that occur in it as an array list. Also updated the test case to capture this. Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
… the crud operations and queries that occur in it as an array list. Also updated the test case to capture this. Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
rahlk
commented
Feb 8, 2025
CollaboratorAuthor
I have also made it so that we can get the crud operations easily directly form packagecom.ibm.cldk;
importorg.junit.jupiter.api.BeforeAll;
importorg.junit.jupiter.api.Test;
importorg.junit.jupiter.api.Assertions;
importorg.testcontainers.containers.BindMode;
importorg.testcontainers.containers.GenericContainer;
importorg.testcontainers.junit.jupiter.Container;
importorg.testcontainers.junit.jupiter.Testcontainers;
importorg.testcontainers.utility.MountableFile;
importjava.io.File;
importjava.io.FileInputStream;
importjava.io.IOException;
importjava.nio.file.Paths;
importjava.util.Properties;
@Testcontainers@SuppressWarnings("resource")
publicclassCodeAnalyzerIntegrationTest {
// ...@TestvoidshouldBeAbleToDetectCRUDOperationsAndQueriesForPlantByWebsphere() throwsException {
varrunCodeAnalyzerOnPlantsByWebsphere = container.execInContainer(
"java",
"-jar",
String.format("/opt/jars/codeanalyzer-%s.jar", codeanalyzerVersion),
"--input=/test-applications/plantsbywebsphere",
"--analysis-level=1", "--verbose"
);
Assertions.assertTrue(runCodeAnalyzerOnPlantsByWebsphere.getStdout().contains("\"query_type\": \"NAMED\""), "No entry point classes found");
Assertions.assertTrue(runCodeAnalyzerOnPlantsByWebsphere.getStdout().contains("\"operation_type\": \"READ\""), "No entry point methods found");
Assertions.assertTrue(runCodeAnalyzerOnPlantsByWebsphere.getStdout().contains("\"operation_type\": \"UPDATE\""), "No entry point methods found");
Assertions.assertTrue(runCodeAnalyzerOnPlantsByWebsphere.getStdout().contains("\"operation_type\": \"CREATE\""), "No entry point methods found");
// Convert the expected JSON structure into a stringStringexpectedCrudOperation =
"\"crud_operations\": [" +
"{" +
"\"line_number\": 115," +
"\"operation_type\": \"READ\"," +
"\"target_table\": null," +
"\"involved_fields\": null," +
"\"condition\": null," +
"\"joined_tables\": null," +
"\"technology\": null," +
"\"is_batch_operation\": false" +
"}]";
// Expected JSON for CRUD QueriesStringexpectedCrudQuery =
"\"crud_queries\": [" +
"{" +
"\"line_number\": 141,";
// Normalize the output and expected strings to ignore formatting differencesStringnormalizedOutput = output.replaceAll("\\s+", "");
StringnormalizedExpectedCrudOperation = expectedCrudOperation.replaceAll("\\s+", "");
StringnormalizedExpectedCrudQuery = expectedCrudQuery.replaceAll("\\s+", "");
// Assertions for both CRUD operations and queriesAssertions.assertTrue(normalizedOutput.contains(normalizedExpectedCrudOperation), "Expected CRUD operation JSON structure not found");
Assertions.assertTrue(normalizedOutput.contains(normalizedExpectedCrudQuery), "Expected CRUD query JSON structure not found");
}
} |
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
sinha108
approved these changes
Feb 11, 2025
This file contains hidden or 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
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
We now support the following frameworks
How Has This Been Tested?
We have added a new test case to our integration testing suite and we have verified that it runs on plantsbywebsphere
Breaking Changes
Yes.
analysis.jsonhas new fields, so cldk'spython-sdkwill break if this new version of codeanalyzer-2.2.0-dev is used.Types of changes
Checklist
Additional context
A number of new interfaces and enums were added, some of them will be backported to refactor the entrypoint detection offered in v2.1.0 of codeanalyzer.