Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1107992

Summary: [RFE] Overload methods for watchdog models and actions for consistency with rest of JAVA-SDK
Product: [oVirt] ovirt-engine-sdk-java Reporter: Lukas Svaty <lsvaty>
Component: RFEsAssignee: Ondra Machacek <omachace>
Status: CLOSED CURRENTRELEASE QA Contact: Lukas Svaty <lsvaty>
Severity: high Docs Contact:
Priority: medium    
Version: ---CC: bugs, gcheresh, gklein, grafuls, iheim, juan.hernandez, mgoldboi, mperina, pstehlik, srevivo
Target Milestone: ovirt-4.0.0-betaKeywords: AutomationBlocker, FutureFeature
Target Release: 4.0.0.0Flags: rule-engine: ovirt-4.0.0+
sherold: Triaged+
pnovotny: testing_plan_complete-
mgoldboi: planning_ack+
juan.hernandez: devel_ack+
pstehlik: testing_ack+
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-26 10:50:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukas Svaty 2014-06-11 08:59:08 UTC
Description of problem:
At the moment current Java SDK have getters and setters in watchdogModels and watchdogActions as getWatchdogModel / getWatchdogAction as it is marked in xml as model / action and not as watchdogModel / watchdogAction this is incosistent with rest of JAVA SDK. However this methods can't be change as it would not be compatible with 3.3 version. I propose overloading getWatchdogActions, isSetWatchdogActions, unsetWatchdogActions as getActions, isSetActions and unsetActions in WatchdogActions.java and the same for WatchdogModels.java

This workaround is needed to be watchdog action and model consistent with rest of the JAVA-SDK for the automated verification process of QA.

Version-Release number of selected component (if applicable):
av9.5

How reproducible:
100%

Actual results:
ovirt-java-sdk/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/WatchdogModels.java

ovirt-java-sdk/ovirt-engine-sdk-java/src/main/java/org/ovirt/engine/sdk/entities/WatchdogActions.java

are incosistent with rest of the JAVA-SDK api

Expected results:
overloading current functions for the 

Additional info:
already consulted with Juan Hernandez

Comment 1 Juan Hernández 2014-06-11 09:11:13 UTC
The reason for this is that in the XML schema we explicitly set the Java names to WatchdogActions and WathdogModels. For example:

  <xs:complexType name="WatchdogActions">
    <xs:sequence>
      <xs:element name="action" type="xs:string" minOccurs="0" maxOccurs="unbounded">
        <xs:annotation>
          <xs:appinfo>
            <jaxb:property name="WatchdogActions"/>
          </xs:appinfo>
        </xs:annotation>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

I don't know what was the reason to use this annotation to change the name of the property from "Actions" to "WatchdogActions", but now that we already have a released Java SDK we can't change it.

We can overload the methods, as proposed by Lukas, that won't break backwards compatibility. But as the code is automatically generated, doing so isn't trivial at all, and currently we don't have any mechanism to do it.

Comment 3 GenadiC 2014-09-03 12:57:07 UTC
There is the same issue of inconsistency between Java and python for the Properties.
In java it is called getProperties and in python it is get_property
I am sure there are additional inconsistency between Java and python getters.

Comment 4 Juan Hernández 2014-09-03 13:09:19 UTC
Those additional inconsistencies are by design, and they won't be fixed.

Comment 5 Shira Maximov 2015-03-08 13:54:36 UTC
This problem also happens in 3.5

Comment 6 Yaniv Kaul 2015-11-17 13:08:05 UTC
Juan - should we fix it for 4.0? If so, please set target milestone accordingly.

Comment 7 Juan Hernández 2016-03-07 11:02:38 UTC
The SDKs for version 4 of the API will be generated from the API specification, so these inconsistencies won't exist, to the extent permitted by the different languages. In the particular case of listing watchdogs, the method is defined as follows in the API specification:

  interface List {
    @Out Watchdog[] watchdogs();
    ...
  }

This will result in the following usage in the Python SDK:

  watchdogs_service = ...
  watchdogs = watchdogs_service.list()
  for watchdog in watchdogs:
     ...

And in the Java SDK:

  VmWatchdogsService watchdogsService = ...;
  List<Watchdog> watchdogs = watchdogsService.list().run().watchdogs();
  for (Watchdog watchdog : watchdogs) {
    ...
  }

Note this particular bug was about the "getWatchdogAction" method. This method was used for the capabilities resource, which doesn't make sense in version 4 of the API, as the set of valid watchdog actions will be represented by an enumerated type.

So, all in all, this category of inconsistencies will be fixed in version 4 of the SDK.

Comment 8 Ondra Machacek 2016-04-13 14:36:00 UTC
Final syntax of new Java SDK 4.0 will be as follows:

        Connection connection = ...
        VmService vmService = connection.systemService().vmsService().vmService("{vm_id}");
        VmWatchdogsService watchdogsService =  vmService.watchdogsService();
        List<Watchdog> watchdogs = watchdogsService.list().send().watchdogs();
        for (Watchdog watchdog : watchdogs) {
            // ...
        }

Comment 9 Lukas Svaty 2016-07-26 10:50:00 UTC
This bug was fixed and is slated to be in the upcoming version. As we
are focusing our testing at this phase on severe bugs, this bug was
closed without going through its verification step. If you think this
bug should be verified by QE, please set its severity to high and move
it back to ON_QA