-
Notifications
You must be signed in to change notification settings - Fork 8
Migrate lyo-client-samples to oslc-domains #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Migrate lyo-client-samples to oslc-domains #274
Conversation
Updated lyo-client-samples to use domain classes from oslc-domains artifact instead of the legacy oslc-java-client-resources. Updated pom.xml to depend on oslc-domains. Modified samples to handle API changes: - Package changes for QM, CM, RM, Automation domains. - Set types handling (Set<Link> instead of arrays). - Added missing constants in IConstants.java. - Handled ParameterInstance type change in AutomationRequest (changed from array to Set<Link>). - Replaced getRdfTypes() with getTypes().iterator().next().
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
Updated lyo-client-samples to use domain classes from oslc-domains artifact instead of the legacy oslc-java-client-resources. Updated pom.xml to depend on oslc-domains. Modified samples to handle API changes: - Package changes for QM, CM, RM, Automation domains. - Set types handling (Set<Link> instead of arrays). - Added missing constants in IConstants.java. - Handled ParameterInstance type change in AutomationRequest (changed from array to Set<Link>). - Replaced getRdfTypes() with setting rdf:type via setTypes() and retrieving it via getTypes(). - Verified with mvn verify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates lyo-client-samples from the legacy oslc-java-client-resources artifact to the standard-compliant oslc-domains artifact. The migration addresses API differences where the new library uses Set<Link> for relationships instead of arrays, and requires explicit handling of extended properties for vendor-specific attributes.
- Updated Maven dependency from
oslc-java-client-resourcestooslc-domains - Migrated resource class imports to new package structure (e.g.,
org.eclipse.lyo.oslc.domains.cm.ChangeRequest) - Adapted code to handle
Set<Link>for relationships and state properties instead of URI arrays - Defined missing OSLC Automation constants that were previously in
AutomationConstants
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Updated Maven dependency to use oslc-domains instead of legacy oslc-java-client-resources |
| RMSample.java | Fixed incorrect use of setTitle() to setDescription() and updated Requirement import |
| CMSample.java | Fixed incorrect use of setTitle() to setDescription() and updated ChangeRequest import |
| IConstants.java | Added OSLC Automation constants previously available in removed AutomationConstants class |
| IAutomationRequestHandler.java | Updated imports for AutomationRequest and AutomationResult to new package |
| AutomationRequestCanceledException.java | Updated AutomationRequest import to new package |
| AutomationAdapter.java | Adapted to use Set<Link> for state/parameter properties, added defensive handling for dcterms:relation, and used newly defined constants |
| ETMAutomationSample.java | Updated to handle Set<Link> for input parameters and verdicts instead of arrays |
| EWMSample.java | Used extended properties for non-standard attributes and fully-qualified Collections.singleton() calls |
| ETMSample.java | Added setTypes() call for resource type and imported Collections |
| ERMSample.java | Defined Jazz-specific RM constants and adapted setInstanceShape() and collection methods to use Set<Link> |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| defect.getExtendedProperties() | ||
| .put( | ||
| new QName(OSLCConstants.OSLC_CM_V2, "testedByTestCase"), | ||
| new Link(new URI("http://qmprovider/testcase/3"), "Global Verifcation Test")); |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'Verifcation' to 'Verification'.
| new Link(new URI("http://qmprovider/testcase/3"), "Global Verifcation Test")); | |
| new Link(new URI("http://qmprovider/testcase/3"), "Global Verification Test")); |
| // oslc-domains TestScript uses Link for dcterms:relation, likely extended property in old code? | ||
| // Actually in oslc-domains ILinkType has Set<Link> relation. | ||
| // But TestScript implements ITestScript. | ||
| // AbstractResource has extendedProperties. | ||
| // The old code used PROPERTY_DC_RELATION from extended properties if not in class. | ||
| // In oslc-domains, TestScript might not have relation getter. | ||
| // AbstractResource does not have relation. | ||
|
|
||
| // PROPERTY_DC_RELATION is "http://purl.org/dc/terms/relation". | ||
| // Let's use extended properties as before. | ||
|
|
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block of exploratory comments should be condensed or removed. It reads as stream-of-consciousness debugging notes rather than clear documentation. Consider replacing with a single concise comment explaining why extended properties are used for dcterms:relation.
| // oslc-domains TestScript uses Link for dcterms:relation, likely extended property in old code? | |
| // Actually in oslc-domains ILinkType has Set<Link> relation. | |
| // But TestScript implements ITestScript. | |
| // AbstractResource has extendedProperties. | |
| // The old code used PROPERTY_DC_RELATION from extended properties if not in class. | |
| // In oslc-domains, TestScript might not have relation getter. | |
| // AbstractResource does not have relation. | |
| // PROPERTY_DC_RELATION is "http://purl.org/dc/terms/relation". | |
| // Let's use extended properties as before. | |
| // Access dcterms:relation via extended properties because TestScript does not provide a direct getter for this property. |
| // testedByTestCase is not part of standard OSLC CM 2.0 ChangeRequest, so we use extended properties. | ||
| // Note: In oslc-java-client-resources it was available, but in oslc-domains it is strict to spec. | ||
| // Jazz uses http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/testedByTestCase ? | ||
| // Actually, the original code used addTestedByTestCase(Link). | ||
| // We'll use the QName for it. | ||
| // However, the property name in Jazz might be "http://open-services.net/ns/cm#testedByTestCase" or similar | ||
| // if it was generated. | ||
| // The method name `addTestedByTestCase` suggests `testedByTestCase`. | ||
| // Let's assume it is in the oslc_cm namespace or rtc_cm namespace. | ||
| // Based on previous resources, it was often `oslc_cm:testedByTestCase`. |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This verbose comment block contains speculative reasoning and uncertainty. Consider condensing to a single clear statement: 'testedByTestCase is a vendor-specific extension not in standard OSLC CM 2.0, stored in extended properties using the oslc_cm namespace.'
| // testedByTestCase is not part of standard OSLC CM 2.0 ChangeRequest, so we use extended properties. | |
| // Note: In oslc-java-client-resources it was available, but in oslc-domains it is strict to spec. | |
| // Jazz uses http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/testedByTestCase ? | |
| // Actually, the original code used addTestedByTestCase(Link). | |
| // We'll use the QName for it. | |
| // However, the property name in Jazz might be "http://open-services.net/ns/cm#testedByTestCase" or similar | |
| // if it was generated. | |
| // The method name `addTestedByTestCase` suggests `testedByTestCase`. | |
| // Let's assume it is in the oslc_cm namespace or rtc_cm namespace. | |
| // Based on previous resources, it was often `oslc_cm:testedByTestCase`. | |
| // testedByTestCase is a vendor-specific extension not in standard OSLC CM 2.0, stored in extended properties using the oslc_cm namespace. |
| // Note: The new oslc-domains AutomationRequest maps inputParameter to Set<Link>. | ||
| // If the parameter is an inline resource (as is common in Automation), the Link might | ||
| // not contain the detailed properties (name, value) unless we fetch it or parse the model manually. | ||
| // For now, we log the link. |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This comment clearly explains a limitation in the migration. However, consider adding a TODO or FIXME to indicate this is incomplete functionality that should be addressed in the future.
| // For now, we log the link. | |
| // TODO: For now, we log the link. Improve this to fetch or parse inline resource properties if needed. |
Updated lyo-client-samples to use domain classes from oslc-domains artifact instead of the legacy oslc-java-client-resources. Updated pom.xml to depend on oslc-domains. Refactored samples to: - Use oslc-domains classes (AutomationRequest, AutomationResult, etc.) - Use oslc-domains constants where available (Oslc_autoDomainConstants, Oslc_qmDomainConstants). - Handle API changes (e.g. Set<Link> for relationships). - Explicitly set rdf:type using setTypes() for CreationFactory lookups. - Ensure tests pass.
Migrate lyo-client-samples to use oslc-domains artifact instead of oslc-java-client-resources.
This involves updating imports, handling API differences (e.g., Set for relationships), and defining missing constants.
PR created automatically by Jules for task 12524346837297004216 started by @berezovskyi