Bug 1005131 - read-resource() call returns Incorrect 'udefined' result for datasources
Summary: read-resource() call returns Incorrect 'udefined' result for datasources
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Domain Management
Version: 6.1.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: EAP 6.2.0
Assignee: Brian Stansberry
QA Contact: Petr Kremensky
Russell Dickenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-06 09:31 UTC by Ondrej Chaloupka
Modified: 2013-12-15 12:28 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2013-09-06 13:05:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ondrej Chaloupka 2013-09-06 09:31:57 UTC
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 10:07:49 UTC
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 10:25:14 UTC
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.