This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1005131 - read-resource() call returns Incorrect 'udefined' result for datasources
read-resource() call returns Incorrect 'udefined' result for datasources
Status: CLOSED NOTABUG
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Domain Management (Show other bugs)
6.1.1
Unspecified Unspecified
unspecified Severity medium
: ---
: EAP 6.2.0
Assigned To: Brian Stansberry
Petr Kremensky
Russell Dickenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-06 05:31 EDT by Ondrej Chaloupka
Modified: 2013-12-15 07:28 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-06 09:05:22 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ondrej Chaloupka 2013-09-06 05:31:57 EDT
In case that you call in jboss-cli read-resource() on datasource subsystem you will get datasource as undefined:
/subsystem=datasources:read-resource()                                 
{
    "outcome" => "success",
    "result" => {
        "xa-data-source" => undefined,
        "data-source" => {"ExampleDS" => undefined},
        "jdbc-driver" => {"h2" => undefined}
    }
}


This makes problem in case of using DMR api and commands. When you call the same command in your app and you want to check existence of the data source in this way:
modelNodeReturn.get("result").get("data-source").get("ExampleDS").isDefined();
you will get "false". But the datasource exists and it's quite nicely defined.
Command should return true.

Workaround:
The isDefined() starts to work when the command is called with recursive=true.

As sort of reproducer could be used my testing class
https://github.com/ochaloup/jboss-dmr-test/blob/4446a1ce387126e9ba2b5dea93c83c36bbfea5e4/src/main/java/ochaloup/OperationsMain.java
Comment 1 Alexey Loubyansky 2013-09-06 06:07:49 EDT
This is not going to change. ModelNode.isDefined() has a different meaning. You are supposed to use recursive=true.

BTW, in case of data-source's, if there is data-source=XXX, it means XXX is actually there. The management won't allow XXX to be undefined.
Comment 2 Ondrej Chaloupka 2013-09-06 06:25:14 EDT
Hi Alex,

ok, I see. Just it isn't much intuitive. I would expect that isDefined() returns true in any case that a node is 'somelike' defined.

I understand that I can visually see that data-source=XXX is defined in cli. But when I want to check this in code then I can't check anything visually.

In case that it's supposed behavior and you think that it's ok for users then please close this bugzilla.

Thanks

Note You need to log in before you can comment on or make changes to this bug.