refactor(security_center): remove deprecated setReadTime and migrating security_center sample and deps to java-docs-sample#10285
Conversation
…nter snippets and integration tests to java docs sample
…ix minor documentation and license URL formatting
There was a problem hiding this comment.
Code Review
This pull request introduces a new Maven module securitycenter-snippets containing code snippets and integration tests for Google Cloud Security Command Center's Findings and Sources. The review feedback suggests several improvements to modernize and clean up the code, such as migrating from legacy JUnit 3 assertions to JUnit 4, replacing the ThreeTen backport library with standard Java 8 java.time classes, using assertEquals instead of assertTrue(equals(...)) for better null safety and failure messages, removing the unused com.google.truth dependency, and simplifying list creation with ImmutableList.of.
| ListFindingsRequest.Builder request = | ||
| ListFindingsRequest.newBuilder().setParent(sourceName.toString()).setFilter(filter); |
There was a problem hiding this comment.
Previously as
ListFindingsRequest.Builder request =
ListFindingsRequest.newBuilder()
.setParent(sourceName.toString())
.setReadTime(
Timestamp.newBuilder()
.setSeconds(fiveDaysAgo.getEpochSecond())
.setNanos(fiveDaysAgo.getNano()));
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds Java code snippets and integration tests for Google Security Command Center, covering both findings and sources. The review feedback identifies critical compilation errors in the integration tests, including a missing static import for assertEquals and a missing closing curly brace in ITSourceSnippets.java. Additionally, an unused variable stringValue was found in ITFindingSnippets.java that should be cleaned up.
|
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
setReadTime and migrating sample and deps to java-docs-samplesetReadTime and migrating security_center sample and deps to java-docs-sample
amcolin
left a comment
There was a problem hiding this comment.
We already have a folder security-command-center/snippets are they different products? or should we just include this migration on the security-command-center.
Indeed, at least on the GoogleCloudJava Readme links repo we have two differents and at least three more folder on the folders I will research on these products and check the folder organization |


Description
Fixes #
b/517939862
Link to original FindingSnippets.java
Refactor Security Center list findings sample to replace deprecated
SetReadTime.Main modified lines on
FindingSnippets.javaon line 320This PR migrates the list findings at time snippet to the java-docs-samples repository under a new
securitycenterdirectory, and updates its implementation to use event_time filter criteria instead.Added
ITSourceSnippets.javaas a requirement forITFindingSnippets.javadue it usesSourceSnippets.createSource(), thenSourceSnippets.javaalso migrated.Checklist
pom.xmlparent set to latestshared-configurationmvn clean verifyrequired (Compiles and verifies correctly; requires GCLOUD_ORGANIZATION to run integration tests against a live GCP project)mvn -P lint checkstyle:checkrequired (Passed with 0 violations)mvn -P lint clean compile pmd:cpd-check spotbugs:checkadvisory only