Skip to content

fix(asset): update BatchGetAssetsHistory sample and IT fixture - #10357

Merged
XrossFox merged 2 commits into
GoogleCloudPlatform:mainfrom
XrossFox:assets-get-assets-history
Oct 21, 2026
Merged

XrossFox merged 2 commits into
GoogleCloudPlatform:mainfrom
XrossFox:assets-get-assets-history

Conversation

@XrossFox

@XrossFox XrossFox commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Set ContentType.RESOURCE in BatchGetAssetsHistoryExample
  • Create and clean up a temporary GCS bucket in QuickStartIT for testBatchGetAssetsHistory

Fixes b/575851644

Checklist

Testing

  • I have tested this change on a live environment and verified it works as intended.
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only

Compliance & Style

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample

Post-Approval Actions

  • Please merge this PR for me once it is approved

- Set ContentType.RESOURCE in BatchGetAssetsHistoryExample
- Create and clean up a temporary GCS bucket in QuickStartIT for testBatchGetAssetsHistory
@XrossFox
XrossFox requested review from a team and yoshi-approver as code owners October 20, 2026 23:46
@product-auto-label product-auto-label Bot added api: cloudasset Issues related to the Cloud Asset Inventory API. samples Issues that are directly related to samples. labels Oct 20, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates BatchGetAssetsHistoryExample.java to use ContentType.RESOURCE instead of ContentType.CONTENT_TYPE_UNSPECIFIED. It also refactors QuickStartIT.java to use a dynamically created and deleted temporary bucket for the BatchGetAssetsHistory test. Feedback was provided on QuickStartIT.java to remove a redundant !got.isEmpty() check, as the output stream will always contain at least a newline character, making the conditional check unnecessary.

Comment thread asset/src/test/java/com/example/asset/QuickStartIT.java Outdated

@amcolin amcolin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix!
Since we're making these changes, here are two small things we can clean up/remove

Comment thread asset/src/test/java/com/example/asset/QuickStartIT.java Outdated
Comment thread asset/src/main/java/com/example/asset/BatchGetAssetsHistoryExample.java Outdated
@XrossFox
XrossFox merged commit ccae4f9 into GoogleCloudPlatform:main Oct 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: cloudasset Issues related to the Cloud Asset Inventory API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants