The example requires these preconditions to succeed:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
Pineapple includes a prefabricated version of this example in the default configuration. The example is named infrastructure-test-004-host-listens-on-ports. The default configuration is created by starting Pineapple. The default configuration will also create the required resource in the local environment which is used to execute the test operation on the model.
Three steps are needed to configure the plugin to work:
This example extends the last step of the basic example by adding some new test cases.
For information about how to define resource, credentials and modules refer to the plugin usage page.
Open the model file for the target environment and add the test case:
<?xml version="1.0" encoding="UTF-8"?> <mmd:models xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xmlns:mmd="http://pineapple.dev.java.net/ns/module_model_1_0" xmlns:ifp="http://pineapple.dev.java.net/ns/plugin/infrastructure_1_0" > <mmd:model target-resource="infrastructure-test"> <mmd:content> <itp:infrastructure> <itp:tcp-connection-test host="localhost" description="localhost:7001" > <itp:port value="7001" /> </itp:tcp-connection-test> </itp:infrastructure> </mmd:content> </mmd:model> </mmd:models>
Add a another test-host-listen-port test with the host value localhost and the port value 7091:
<?xml version="1.0" encoding="UTF-8"?> <mmd:models xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xmlns:mmd="http://pineapple.dev.java.net/ns/module_model_1_0" xmlns:ifp="http://pineapple.dev.java.net/ns/plugin/infrastructure_1_0" > <mmd:model target-resource="infrastructure-test"> <mmd:content> <itp:infrastructure> <itp:tcp-connection-test host="localhost" description="localhost:7001" > <itp:port value="7001" /> </itp:tcp-connection-test> <itp:tcp-connection-test host="localhost" description="localhost:7001" > <itp:port value="7091" /> </itp:tcp-connection-test> </itp:infrastructure> </mmd:content> </mmd:model> </mmd:models>
An alternative to defining two separate test cases is to define a single test case which asserts multiple ports:
<?xml version="1.0" encoding="UTF-8"?> <mmd:models xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xmlns:mmd="http://pineapple.dev.java.net/ns/module_model_1_0" xmlns:ifp="http://pineapple.dev.java.net/ns/plugin/infrastructure_1_0" > <mmd:model target-resource="infrastructure-test"> <mmd:content> <itp:infrastructure> <itp:tcp-connection-test host="localhost" description="localhost:7001" > <itp:port value="7001" /> <itp:port value="7091" /> </itp:tcp-connection-test> </itp:infrastructure> </mmd:content> </mmd:model> </mmd:models>