Skip to end of metadata
Go to start of metadata

Debug log

The plugin can output verbose debugging of the connection data with the AS7.
To enable this you can use the following at the agent prompt.

The messages then go to the agent log.

Datasources

JDBC drivers must (in domain mode) be deployed to all server groups that are used by the profile where a data source is to be added to.

Module loaded JDBC drivers are not supported yet.

Configuration

The management tree of AS7 is very rich in the sense of number of resources. As RHQ resources are "fat", it makes sense to not use a RHQ resource for AS7-resources that only serve as configuration entities. One example are socket bindings, where the socket-binding-group has a number of individual socket-binding resources as children (for each binding one child). In RHQ-land this would map to a list of maps.

As the individual bindings are individual resources in AS7, there needs to be a way to tell the RHQ config subsystem where to pull the data from. This is done by the mechanism of <c:group name=X> where X conveys the information where to search.

In addition while reading that list of maps via recursive :read-resource is easy, writing back is not, as the configuration does not know that the list of map needs to go to children and how to identify the children.

Identifying a single child resource

Sometimes the AS7 code is organized in a way that only a single child resource is applicable. This can be achieved via

or

This assumes that the child already exists.

Child is a display only runtime resource

If the child consists of runtime information, you can add a star * to the end of the group name like

In this case all embedded properties should be read-only.

Child not existing by default

In the case of e.g. subsystem=web,virtual-host=*,sso=configuration the sso=configuration node does not exist by default. In this case the
map-construct must be used:

  • The map-property itself must be marked as non-requied so that reading a non-existing sso=configuration child does not harm
  • The map-property name must start with an asterisk (*)
  • The map-property name must end with a plus sign (+) to indicate that the sso=configuration child may be created

Child should only exist if a different property has some value

The ssl=configuration child is only valid if the value of the property secure is set to true - otherwise the child must not
exist. So the group name child:ssl=configuration:enabled=secure=true not only encodes the name of the node (as in the previous section), but
also a condition expression in the form of result=property=value so meaning that enabled=secure=true the group is enabled if the simple property (at configuration level) with the name secure has a value of true.

In conjunction with the '+' sign on the map name (this map is the only content of the group), it also means that the path of sso=configuration is created when the group is enabled and will be removed when the group is not enabled.

Naming the as7-children: group name=children:yada

For this purpose there is a c:group with a special name 'children:socket-binding' meaning that the properties contained
are child (AS7)resources of type socket-binding

The embedded list element uses a name of '*' to indicate that the return value of the :read-children is actually the contained map and not a list. See also below.

IF there are more groups that contain such lists, each list name needs to be different, so it is possible to use multiple names by adding a suffix as in "*2" as seen in the next example:

Special case for children that do not have the name encoded as attribute: map-property name=*:hula

Above example has another special. As the resource object on AS7 for ( this may become the default ) has no attribute for the name of the property - as this can be inferred from the address - the name of the property is added as a map element with name 'pname'. The special expression "*:pname" on the name of the embedded map tells us that the attribute 'pname' should be filled with the name of the AS7-resource as deducted from the address.

Naming the attribute for the name for write-back: group name=children:resource:attribute

This is an extension of the earlier 'group' case

Here the properties are not on the AS7-resource itself, but on the children with type 'childType'. In order to modify and write back the entries, the value of the sub-address (childType=value) needs to be determined. This is taken from the property with the name that matches the third component of children:childType:name, in this case from the attribute name.

Special case where the children need to be added: group name=children:resource:attribute+

System properties are child resources of / in AS7 and need to be added as such. This is indicated with the + sing in the group's name attribute. The property name is used in the path as key for the new resource's name. A map of (name=foo,value=bar) translates to /system-property=foo:add(value=bar). Updates of the property's value can then be done via a :write-attribtue operation.

Special case where a child needs to be removed and re-added for update: group name=children:resource:attribute+-

Here the xa-datasource-properties are child resources of the xa-datasource in AS7. In order to update them, it is needed that they are first removed and then re-added. This is indicated by the minus in "...key+-" in the name attribute of the group.

This is an even more special case of the previous one.

Naming of simple properties

AS7 now allows to supply properties in the form ${foo.bar:1234} be set for fields that would normally e.g. be integer fields (like port numbers). In addition simple integer values are accepted as well. read-resource-description shows the following in this case:

As the rhq plugin descriptor can only hold the "int" type, we need to signal the presence of expressions-allowed=true differently. This is done by appending :expr to the name of a simple property:

As the GUI needs to be told to allow for entering of expressions as well, the type needs to be string and can't be int. See also BZ 800070

When a map is just a map

Sometimes AS7 returns json in the form

where the property is "connector" and its value is a map. In RHQ Configuration, we need to model this as a map of simple properties. To tell the configuration code to map this map of simple to above json, we mark the map name with :collapsed :

You can see another special thing in this example: as the code may return the properties in the MropertyMap in arbitrary order, we need to determine what is key want what is value. This is done by appending ':0' and ':1:' to the property names.

Option source <c:option-source>

In many cases there is a link between resources. For example the interface in a SocketBindingGroup is one of the ones found with ResourceType=Network Interface. In the plugin descriptor, this can be expressed like this:

The expression is a search query like in the search bar in the UI. If a type has a space in its name, the name needs to be surrounded by single quotes as shown above.

The above expression line lists resources (their names) that match the expression.

The expressionScope attribute defines a scope for expression searches. Its value must be one of unlimited or baseResource (it defaults to unlimited). unlimited means that search results may include any resource in the inventory. baseResource narrows down results to the resources sharing the same top level server or service.

In the next example, the target are (resource)configuration entries:

The server first looks for resources of type 'SocketBindingGroup'. Within the results it takes the resource-configuration and then takes the list property with name '*' and in the resulting map with name 'socket-binding' it returns the value of the map property with name 'name'

Ignoring a map in a list of maps

It may be needed to exclude a map in a list of maps from update activity. For example <c:group name="children:path:name+" displayName="Path"> contains both entries that are computed on the AS7-server and may not be updated at all (server will complain) and others that are user defined and may be updated as usual. This means, that the list can not be made read-only on a global scale.

Ignoring the immutable entries can be done in code by

For example have a look at org.rhq.modules.plugins.jbossas7.StandaloneASComponent#updateResourceConfiguration

Marking a simple property to be ignored

you can add :ignore to the name:

Writing the property will ignore it, reading will not find it on the AS7-Server and it will thus not be filled.
It is the responsibility of the methods implementing ConfigurationFacet and CreateChildResourceFacet to provide
the appropriate data.

Generating rhq deployment descriptor snippets

The as7 plugin has a little tool Domain2Descriptor that is able to create snippets for the rhq plugin descriptor. A small wrapper shell script d2d.sh sets up the class path and calls the java tool - you probably need to tune d2d.sh for your need.

Example call looks like this:

or

To use the tool, as7 must be running.

With -U you pass in the user:pass for the as7 server. Next are the options (see below) and then either the full path the as7 tree to a certain resource (1st example) or the base path to its parent and the type of the children (2nd example). The 2nd case applies when no child exists yet.

Options are -p for resource-config, -m for metrics and -o for operations; Operations of course still need their code counterpart.

Integration Tests

Integration tests are defined in the 'itest' profile in modules/plugins/jboss-as-7/pom.xml. The profile is not active by default, since the tests take several minutes(varies with setup) or so to run (and longer on the initial run, since they have to download and unzip the AS7 or EAP6 dist zipfile).

Running the tests

To run the integration tests, enable the 'as7.itest' profile:

Specifying AS7/EAP versions

By default, the integration tests will run against the latest successful AS7 master build from Jenkins. To run the tests against a different version of AS7 or EAP6, specify the version via the 'as7.version' system property.

To run the integration tests against AS 7.1.1.Final, use:

To run the integration tests against EAP 6.0.0.Beta1, use:

Note, for EAP6, you also need to specify the URL of the EAP6 dist zipfile via the 'as7.url' system property.

The first time the tests are run against a particular version, the zipfile for that version will be saved under /tmp and will remain there after maven exits. On subsequent runs, if the saved zipfile is newer than the remote zipfile, it will be used, rather than downloading the zip file again.

Developing and Debugging tests

To speed up test runs during development i)run only the integration tests and ii) run only a specific batch of integration tests you should use the -DskipTests and -Dit.test options for example to only run the SecurityModuleOptionsTest.* operations. See more details on integration test granularity but be aware of 'priority' values with @Test, used to define dependencies between specific tests, when defining greater granularity. Additionally you may consider disabling 'post-integration-test' deletion temporarily in the pom during complex test creation to examine the affected AS7 instances before the next test run.

To remotely debug the integration tests, add -Ditest.debug to the mvn command line, e.g.:

Also check out this video on vimeo where Ian explains the setup of the modules and tests.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.