| 1 | // jademx - JADE management using JMX |
| 2 | // Copyright 2005-2006 Caboodle Networks, Inc. |
| 3 | // |
| 4 | // This library is free software; you can redistribute it and/or |
| 5 | // modify it under the terms of the GNU Lesser General Public |
| 6 | // License as published by the Free Software Foundation; either |
| 7 | // version 2.1 of the License, or (at your option) any later version. |
| 8 | // |
| 9 | // This library is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | // Lesser General Public License for more details. |
| 13 | // |
| 14 | // You should have received a copy of the GNU Lesser General Public |
| 15 | // License along with this library; if not, write to the Free Software |
| 16 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 17 | |
| 18 | package jade.jademx.agent; |
| 19 | |
| 20 | import jade.jademx.mbean.JademxException; |
| 21 | |
| 22 | import javax.management.Attribute; |
| 23 | import javax.management.MBeanServer; |
| 24 | import javax.management.ObjectName; |
| 25 | |
| 26 | /** |
| 27 | * proxy agent corresponding to JademxAgent. |
| 28 | * The purpose of this class is to have access to the dynamic JMX interface |
| 29 | * presented by a JademxAgent without having to use the cumbersome dynamic |
| 30 | * syntax for interacting with that interface. |
| 31 | * @author David Bernstein, <a href="http://www.caboodlenetworks.com" |
| 32 | * >Caboodle Networks, Inc.</a> |
| 33 | */ |
| 34 | public class JademxAgentProxy { |
| 35 | |
| 36 | /** agent's MBeanServer */ |
| 37 | protected MBeanServer mBeanServer; |
| 38 | /** agent's ObjectName */ |
| 39 | protected ObjectName objectName; |
| 40 | |
| 41 | /** |
| 42 | * make a JademxAgentProxy |
| 43 | * @param objectName agent's ObjectName |
| 44 | * @param mBeanServer agent's MBeanServer |
| 45 | */ |
| 46 | public JademxAgentProxy( ObjectName objectName, MBeanServer mBeanServer ) { |
| 47 | if ( null == objectName ) { |
| 48 | throw new IllegalArgumentException("null objectName"); |
| 49 | } |
| 50 | if ( null == mBeanServer ) { |
| 51 | throw new IllegalArgumentException("null mBeanServer"); |
| 52 | } |
| 53 | this.objectName = objectName; |
| 54 | this.mBeanServer = mBeanServer; |
| 55 | } |
| 56 | |
| 57 | // |
| 58 | // PROXIED METHODS |
| 59 | // |
| 60 | |
| 61 | /** |
| 62 | * implementation for proxying getting an attribute value |
| 63 | * @param attributeName name of attribute to get |
| 64 | * @return attribute value |
| 65 | * @throws JademxException |
| 66 | */ |
| 67 | public Object getAttribute( String attributeName ) throws JademxException { |
| 68 | try { |
| 69 | return mBeanServer.getAttribute(objectName,attributeName); |
| 70 | } |
| 71 | catch (Exception e) { |
| 72 | throw new JademxException("exception getting attribute " |
| 73 | + attributeName, e); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * implementation for proxying getting an attribute value |
| 79 | * @param attributeName name of attribute to set |
| 80 | * @param value value to set for attribute |
| 81 | * @throws JademxException on problem |
| 82 | */ |
| 83 | public void setAttribute( String attributeName, Object value ) |
| 84 | throws JademxException { |
| 85 | try { |
| 86 | Attribute attribute = |
| 87 | new Attribute( attributeName, value ); |
| 88 | mBeanServer.setAttribute( objectName, attribute ); |
| 89 | } |
| 90 | catch ( Exception e ) { |
| 91 | throw new JademxException("exception setting attribute " |
| 92 | + attributeName, e); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * implementation for proxying invoking an operation |
| 98 | * @param actionName name of action to invoke |
| 99 | * @param params action parameters |
| 100 | * @param signature action signature |
| 101 | * @return object result |
| 102 | * @throws JademxException on problem |
| 103 | */ |
| 104 | public Object invoke(String actionName, Object params[], String signature[]) |
| 105 | throws JademxException { |
| 106 | try { |
| 107 | return (String) mBeanServer.invoke(objectName, |
| 108 | actionName, params, signature ); |
| 109 | } |
| 110 | catch (Exception e) { |
| 111 | throw new JademxException("exception invoking operation " |
| 112 | + actionName, e); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | // attribute UnitTestTimeout |
| 117 | |
| 118 | /** |
| 119 | * proxy for @see JademxAgent#setUnitTestTimeout(String) |
| 120 | * @param timeoutStr timeout for test expressed as ISO 8601 duration |
| 121 | * @throws JademxException on problem |
| 122 | */ |
| 123 | public void setUnitTestTimeout( String timeoutStr ) throws JademxException { |
| 124 | setAttribute( JademxAgent.ATTR_UNIT_TEST_TIMEOUT_NAME, timeoutStr); |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * proxy for @see JademxAgent#getUnitTestTimeout() |
| 129 | * @return unit test timeout as an ISO8601 duration string |
| 130 | * @throws JademxException on problem |
| 131 | */ |
| 132 | public String getUnitTestTimeout() throws JademxException { |
| 133 | return (String)getAttribute(JademxAgent.ATTR_UNIT_TEST_TIMEOUT_NAME); |
| 134 | } |
| 135 | |
| 136 | // attribute UnitTestExpectedMessage |
| 137 | |
| 138 | /** |
| 139 | * proxy for @see JademxAgent#setUnitTestExpectedMessage(String) |
| 140 | * @param expectMsg message to expect to see as result of injecting msg |
| 141 | * @throws JademxException on problem |
| 142 | */ |
| 143 | public void setUnitTestExpectedMessage( String expectMsg ) throws JademxException { |
| 144 | setAttribute( JademxAgent.ATTR_UNIT_TEST_EXPECTED_MESSAGE_NAME, expectMsg ); |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * proxy for @see JademxAgent#getUnitTestExpectedMessage() |
| 149 | * @return string representation of expected message for unit testing |
| 150 | * @throws JademxException on problem |
| 151 | */ |
| 152 | public String getUnitTestExpectedMessage() throws JademxException { |
| 153 | return (String)getAttribute( JademxAgent.ATTR_UNIT_TEST_EXPECTED_MESSAGE_NAME ); |
| 154 | } |
| 155 | |
| 156 | // attribute UnitTestActualMessage |
| 157 | |
| 158 | /** |
| 159 | * proxy for @see JademxAgent#getUnitTestActualMessage() |
| 160 | * @return string representation of actual message for unit testing |
| 161 | * @throws JademxException on problem |
| 162 | */ |
| 163 | public String getUnitTestActualMessage() throws JademxException { |
| 164 | return (String)getAttribute(JademxAgent.ATTR_UNIT_TEST_ACTUAL_MESSAGE_NAME); |
| 165 | } |
| 166 | |
| 167 | // attribute UnitTestInjectMessage |
| 168 | |
| 169 | /** |
| 170 | * proxy for @see JademxAgent#setUnitTestInjectMessage(String) |
| 171 | * @param injectMsg message to inject |
| 172 | * @throws JademxException on problem |
| 173 | */ |
| 174 | public void setUnitTestInjectMessage( String injectMsg ) throws JademxException { |
| 175 | setAttribute( JademxAgent.ATTR_UNIT_TEST_INJECT_MESSAGE_NAME, injectMsg ); |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * proxy for @see JademxAgent#getUnitTestInjectMessage() |
| 180 | * @return string representation of message to inject for unit testing |
| 181 | * @throws JademxException on problem |
| 182 | */ |
| 183 | public String getUnitTestInjectMessage() throws JademxException { |
| 184 | return (String)getAttribute(JademxAgent.ATTR_UNIT_TEST_INJECT_MESSAGE_NAME); |
| 185 | } |
| 186 | |
| 187 | // attribute UnitTestCmpContent |
| 188 | |
| 189 | /** |
| 190 | * proxy for @see JademxAgent#setUnitTestCmpContent(boolean) |
| 191 | * @param b new value for UnitTestCmpContent attribute |
| 192 | * @throws JademxException on problem |
| 193 | */ |
| 194 | public void setUnitTestCmpContent( boolean b ) throws JademxException { |
| 195 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_CONTENT_NAME, |
| 196 | new Boolean( b ) ); |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * proxy for @see JademxAgent#isUnitTestCmpContent() |
| 201 | * @return current value for UnitTestCmpContent attribute |
| 202 | * @throws JademxException on problem |
| 203 | */ |
| 204 | public boolean isUnitTestCmpContent() throws JademxException { |
| 205 | return ((Boolean)getAttribute(JademxAgent.ATTR_UNIT_TEST_CMP_CONTENT_NAME)). |
| 206 | booleanValue(); |
| 207 | } |
| 208 | |
| 209 | |
| 210 | // attribute UnitTestCmpConversationId |
| 211 | |
| 212 | /** |
| 213 | * proxy for @see JademxAgent#setUnitTestCmpConversationId(boolean) |
| 214 | * @param b new value for UnitTestCmpConversationId attribute |
| 215 | * @throws JademxException on problem |
| 216 | */ |
| 217 | public void setUnitTestCmpConversationId( boolean b ) throws JademxException { |
| 218 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_CONVERSATION_ID_NAME, |
| 219 | new Boolean( b ) ); |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * proxy for @see JademxAgent#isUnitTestCmpConversationId() |
| 224 | * @return current value for UnitTestCmpConversationId attribute |
| 225 | * @throws JademxException on problem |
| 226 | */ |
| 227 | public boolean isUnitTestCmpConversationId() throws JademxException { |
| 228 | return ((Boolean)getAttribute(JademxAgent.ATTR_UNIT_TEST_CMP_CONVERSATION_ID_NAME)). |
| 229 | booleanValue(); |
| 230 | } |
| 231 | |
| 232 | // attribute UnitTestCmpEncoding |
| 233 | |
| 234 | /** |
| 235 | * proxy for @see JademxAgent#setUnitTestCmpEncoding(boolean) |
| 236 | * @param b new value for UnitTestCmpEncoding attribute |
| 237 | * @throws JademxException on problem |
| 238 | */ |
| 239 | public void setUnitTestCmpEncoding( boolean b ) throws JademxException { |
| 240 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_ENCODING_NAME, |
| 241 | new Boolean( b ) ); |
| 242 | |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * proxy for @see JademxAgent#isUnitTestCmpEncoding() |
| 247 | * @return current value for UnitTestCmpEncoding attribute |
| 248 | * @throws JademxException on problem |
| 249 | */ |
| 250 | public boolean isUnitTestCmpEncoding() throws JademxException { |
| 251 | return ((Boolean)getAttribute( |
| 252 | JademxAgent.ATTR_UNIT_TEST_CMP_ENCODING_NAME)). |
| 253 | booleanValue(); |
| 254 | } |
| 255 | |
| 256 | // attribute UnitTestCmpEnvelope |
| 257 | |
| 258 | /** |
| 259 | * proxy for @see JademxAgent#setUnitTestCmpEnvelope(boolean) |
| 260 | * @param b new value for UnitTestCmpEnvelope attribute |
| 261 | * @throws JademxException on problem |
| 262 | */ |
| 263 | public void setUnitTestCmpEnvelope( boolean b ) throws JademxException { |
| 264 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_ENVELOPE_NAME, |
| 265 | new Boolean( b ) ); |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * proxy for @see JademxAgent#isUnitTestCmpEnvelope() |
| 270 | * @return current value for UnitTestCmpEnvelope attribute |
| 271 | * @throws JademxException on problem |
| 272 | */ |
| 273 | public boolean isUnitTestCmpEnvelope() throws JademxException { |
| 274 | return ((Boolean)getAttribute( |
| 275 | JademxAgent.ATTR_UNIT_TEST_CMP_ENVELOPE_NAME)). |
| 276 | booleanValue(); |
| 277 | } |
| 278 | |
| 279 | // attribute UnitTestCmpInReplyTo |
| 280 | |
| 281 | /** |
| 282 | * proxy for @see JademxAgent#setUnitTestCmpInReplyTo(boolean) |
| 283 | * @param b new value for UnitTestCmpInReplyTo attribute |
| 284 | * @throws JademxException on problem |
| 285 | */ |
| 286 | public void setUnitTestCmpInReplyTo( boolean b ) throws JademxException { |
| 287 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_IN_REPLY_TO_NAME, |
| 288 | new Boolean( b ) ); |
| 289 | } |
| 290 | |
| 291 | /** |
| 292 | * proxy for @see JademxAgent#isUnitTestCmpInReplyTo() |
| 293 | * @return current value for UnitTestCmpInReplyTo attribute |
| 294 | * @throws JademxException on problem |
| 295 | */ |
| 296 | public boolean isUnitTestCmpInReplyTo() throws JademxException { |
| 297 | return ((Boolean)getAttribute( |
| 298 | JademxAgent.ATTR_UNIT_TEST_CMP_IN_REPLY_TO_NAME)). |
| 299 | booleanValue(); |
| 300 | } |
| 301 | |
| 302 | // attribute UnitTestCmpLanguage |
| 303 | |
| 304 | /** |
| 305 | * proxy for @see JademxAgent#setUnitTestCmpLanguage(boolean) |
| 306 | * @param b new value for UnitTestCmpLanguage attribute |
| 307 | * @throws JademxException on problem |
| 308 | */ |
| 309 | public void setUnitTestCmpLanguage( boolean b ) throws JademxException { |
| 310 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_LANGUAGE_NAME, |
| 311 | new Boolean( b ) ); |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * proxy for @see JademxAgent#isUnitTestCmpLanguage() |
| 316 | * @return current value for UnitTestCmpLanguage attribute |
| 317 | * @throws JademxException on problem |
| 318 | */ |
| 319 | public boolean isUnitTestCmpLanguage() throws JademxException { |
| 320 | return ((Boolean)getAttribute( |
| 321 | JademxAgent.ATTR_UNIT_TEST_CMP_LANGUAGE_NAME)). |
| 322 | booleanValue(); |
| 323 | } |
| 324 | |
| 325 | // attribute UnitTestCmpOntology |
| 326 | |
| 327 | /** |
| 328 | * proxy for @see JademxAgent#setUnitTestCmpOntology(boolean) |
| 329 | * @param b new value for UnitTestCmpOntology attribute |
| 330 | * @throws JademxException on problem |
| 331 | */ |
| 332 | public void setUnitTestCmpOntology( boolean b ) throws JademxException { |
| 333 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_ONTOLOGY_NAME, |
| 334 | new Boolean( b ) ); |
| 335 | } |
| 336 | |
| 337 | /** |
| 338 | * proxy for @see JademxAgent#isUnitTestCmpOntology() |
| 339 | * @return current value for UnitTestCmpOntology attribute |
| 340 | * @throws JademxException on problem |
| 341 | */ |
| 342 | public boolean isUnitTestCmpOntology() throws JademxException { |
| 343 | return ((Boolean)getAttribute( |
| 344 | JademxAgent.ATTR_UNIT_TEST_CMP_ONTOLOGY_NAME)). |
| 345 | booleanValue(); |
| 346 | } |
| 347 | |
| 348 | // attribute UnitTestCmpPerformative |
| 349 | |
| 350 | /** |
| 351 | * proxy for @see JademxAgent#setUnitTestCmpPerformative(boolean) |
| 352 | * @param b new value for UnitTestCmpPerformative attribute |
| 353 | * @throws JademxException on problem |
| 354 | */ |
| 355 | public void setUnitTestCmpPerformative( boolean b ) throws JademxException { |
| 356 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_PERFORMATIVE_NAME, |
| 357 | new Boolean( b ) ); |
| 358 | } |
| 359 | |
| 360 | /** |
| 361 | * proxy for @see JademxAgent#isUnitTestCmpPerformative() |
| 362 | * @return current value for UnitTestCmpPerformative attribute |
| 363 | * @throws JademxException on problem |
| 364 | */ |
| 365 | public boolean isUnitTestCmpPerformative() throws JademxException { |
| 366 | return ((Boolean)getAttribute( |
| 367 | JademxAgent.ATTR_UNIT_TEST_CMP_PERFORMATIVE_NAME)). |
| 368 | booleanValue(); |
| 369 | } |
| 370 | |
| 371 | // attribute UnitTestCmpProtocol |
| 372 | |
| 373 | /** |
| 374 | * proxy for @see JademxAgent#setUnitTestCmpProtocol(boolean) |
| 375 | * @param b new value for UnitTestCmpProtocol attribute |
| 376 | * @throws JademxException on problem |
| 377 | */ |
| 378 | public void setUnitTestCmpProtocol( boolean b ) throws JademxException { |
| 379 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_PROTOCOL_NAME, |
| 380 | new Boolean( b ) ); |
| 381 | } |
| 382 | |
| 383 | /** |
| 384 | * proxy for @see JademxAgent#isUnitTestCmpProtocol() |
| 385 | * @return current value for UnitTestCmpProtocol attribute |
| 386 | * @throws JademxException on problem |
| 387 | */ |
| 388 | public boolean isUnitTestCmpProtocol() throws JademxException { |
| 389 | return ((Boolean)getAttribute( |
| 390 | JademxAgent.ATTR_UNIT_TEST_CMP_PROTOCOL_NAME)). |
| 391 | booleanValue(); |
| 392 | } |
| 393 | |
| 394 | // attribute UnitTestCmpReceiver |
| 395 | |
| 396 | /** |
| 397 | * proxy for @see JademxAgent#setUnitTestCmpReceiver(boolean) |
| 398 | * @param b new value for UnitTestCmpReceiver attribute |
| 399 | * @throws JademxException on problem |
| 400 | */ |
| 401 | public void setUnitTestCmpReceiver( boolean b ) throws JademxException { |
| 402 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_RECEIVER_NAME, |
| 403 | new Boolean( b ) ); |
| 404 | } |
| 405 | |
| 406 | /** |
| 407 | * proxy for @see JademxAgent#isUnitTestCmpReceiver() |
| 408 | * @return current value for UnitTestCmpReceiver attribute |
| 409 | * @throws JademxException on problem |
| 410 | */ |
| 411 | public boolean isUnitTestCmpReceiver() throws JademxException { |
| 412 | return ((Boolean)getAttribute( |
| 413 | JademxAgent.ATTR_UNIT_TEST_CMP_RECEIVER_NAME)). |
| 414 | booleanValue(); |
| 415 | } |
| 416 | |
| 417 | // attribute UnitTestCmpReplyBy |
| 418 | |
| 419 | /** |
| 420 | * proxy for @see JademxAgent#setUnitTestCmpReplyBy(boolean) |
| 421 | * @param b new value for UnitTestCmpReplyBy attribute |
| 422 | * @throws JademxException on problem |
| 423 | */ |
| 424 | public void setUnitTestCmpReplyBy( boolean b ) throws JademxException { |
| 425 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_REPLY_BY_NAME, |
| 426 | new Boolean( b ) ); |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * proxy for @see JademxAgent#isUnitTestCmpReplyBy() |
| 431 | * @return current value for UnitTestCmpReplyBy attribute |
| 432 | * @throws JademxException on problem |
| 433 | */ |
| 434 | public boolean isUnitTestCmpReplyBy() throws JademxException { |
| 435 | return ((Boolean)getAttribute( |
| 436 | JademxAgent.ATTR_UNIT_TEST_CMP_REPLY_BY_NAME)). |
| 437 | booleanValue(); |
| 438 | } |
| 439 | |
| 440 | // attribute UnitTestCmpReplyTo |
| 441 | |
| 442 | /** |
| 443 | * proxy for @see JademxAgent#setUnitTestCmpReplyTo(boolean) |
| 444 | * @param b new value for UnitTestCmpReplyTo attribute |
| 445 | * @throws JademxException on problem |
| 446 | */ |
| 447 | public void setUnitTestCmpReplyTo( boolean b ) throws JademxException { |
| 448 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_REPLY_TO_NAME, |
| 449 | new Boolean( b ) ); |
| 450 | } |
| 451 | |
| 452 | /** |
| 453 | * proxy for @see JademxAgent#isUnitTestCmpReplyTo() |
| 454 | * @return current value for UnitTestCmpReplyTo attribute |
| 455 | * @throws JademxException on problem |
| 456 | */ |
| 457 | public boolean isUnitTestCmpReplyTo() throws JademxException { |
| 458 | return ((Boolean)getAttribute( |
| 459 | JademxAgent.ATTR_UNIT_TEST_CMP_REPLY_TO_NAME)). |
| 460 | booleanValue(); |
| 461 | } |
| 462 | |
| 463 | // attribute UnitTestCmpReplyWith |
| 464 | |
| 465 | /** |
| 466 | * proxy for @see JademxAgent#setUnitTestCmpReplyWith(boolean) |
| 467 | * @param b new value for UnitTestCmpReplyWith attribute |
| 468 | * @throws JademxException on problem |
| 469 | */ |
| 470 | public void setUnitTestCmpReplyWith( boolean b ) throws JademxException { |
| 471 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_REPLY_WITH_NAME, |
| 472 | new Boolean( b ) ); |
| 473 | } |
| 474 | |
| 475 | /** |
| 476 | * proxy for @see JademxAgent#isUnitTestCmpReplyWith() |
| 477 | * @return current value for UnitTestCmpReplyWith attribute |
| 478 | * @throws JademxException on problem |
| 479 | */ |
| 480 | public boolean isUnitTestCmpReplyWith() throws JademxException { |
| 481 | return ((Boolean)getAttribute( |
| 482 | JademxAgent.ATTR_UNIT_TEST_CMP_REPLY_WITH_NAME)). |
| 483 | booleanValue(); |
| 484 | } |
| 485 | |
| 486 | // attribute UnitTestCmpSender |
| 487 | |
| 488 | /** |
| 489 | * proxy for @see JademxAgent#setUnitTestCmpSender(boolean) |
| 490 | * @param b new value for UnitTestCmpSender attribute |
| 491 | * @throws JademxException on problem |
| 492 | */ |
| 493 | public void setUnitTestCmpSender( boolean b ) throws JademxException { |
| 494 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_SENDER_NAME, |
| 495 | new Boolean( b ) ); |
| 496 | } |
| 497 | |
| 498 | /** |
| 499 | * proxy for @see JademxAgent#isUnitTestCmpSender() |
| 500 | * @return current value for UnitTestCmpSender attribute |
| 501 | * @throws JademxException on problem |
| 502 | */ |
| 503 | public boolean isUnitTestCmpSender() throws JademxException { |
| 504 | return ((Boolean)getAttribute( |
| 505 | JademxAgent.ATTR_UNIT_TEST_CMP_SENDER_NAME)). |
| 506 | booleanValue(); |
| 507 | } |
| 508 | |
| 509 | // attribute UnitTestCmpUserProperties |
| 510 | |
| 511 | /** |
| 512 | * proxy for @see JademxAgent#setUnitTestCmpUserProperties(boolean) |
| 513 | * @param b new value for UnitTestCmpUserProperties attribute |
| 514 | * @throws JademxException on problem |
| 515 | */ |
| 516 | public void setUnitTestCmpUserProperties( boolean b ) throws JademxException { |
| 517 | setAttribute( JademxAgent.ATTR_UNIT_TEST_CMP_USER_PROPERTIES_NAME, |
| 518 | new Boolean( b ) ); |
| 519 | } |
| 520 | |
| 521 | /** |
| 522 | * proxy for @see JademxAgent#isUnitTestCmpUserProperties() |
| 523 | * @return current value for UnitTestCmpUserProperties attribute |
| 524 | * @throws JademxException on problem |
| 525 | */ |
| 526 | public boolean isUnitTestCmpUserProperties() throws JademxException { |
| 527 | return ((Boolean)getAttribute( |
| 528 | JademxAgent.ATTR_UNIT_TEST_CMP_USER_PROPERTIES_NAME)). |
| 529 | booleanValue(); |
| 530 | } |
| 531 | |
| 532 | // attribute UnitTestCmpIgnoreContentAIDAddresses |
| 533 | |
| 534 | /** |
| 535 | * proxy for @see JademxAgent#setUnitTestCmpIgnoreContentAIDAddresses(boolean) |
| 536 | * @param b new value for UnitTestCmpIgnoreContentAIDAddresses attribute |
| 537 | * @throws JademxException on problem |
| 538 | */ |
| 539 | public void setUnitTestCmpIgnoreContentAIDAddresses( boolean b ) throws JademxException { |
| 540 | setAttribute( JademxAgent.ATTR_UNIT_TEST_IGNORE_CONTENT_AID_ADDRESSES_NAME, |
| 541 | new Boolean( b ) ); |
| 542 | } |
| 543 | |
| 544 | /** |
| 545 | * proxy for @see JademxAgent#isUnitTestCmpIgnoreContentAIDAddresses() |
| 546 | * @return current value for UnitTestCmpIgnoreContentAIDAddresses attribute |
| 547 | * @throws JademxException on problem |
| 548 | */ |
| 549 | public boolean isUnitTestCmpIgnoreContentAIDAddresses() throws JademxException { |
| 550 | return ((Boolean)getAttribute( |
| 551 | JademxAgent.ATTR_UNIT_TEST_IGNORE_CONTENT_AID_ADDRESSES_NAME)). |
| 552 | booleanValue(); |
| 553 | } |
| 554 | |
| 555 | // attribute UnitTestCmpNewlinesNormalized |
| 556 | |
| 557 | /** |
| 558 | * proxy for @see JademxAgent#setUnitTestCmpNewlinesNormalized(boolean) |
| 559 | * @param b new value for UnitTestCmpNewlinesNormalized attribute |
| 560 | * @throws JademxException on problem |
| 561 | */ |
| 562 | public void setUnitTestCmpNewlinesNormalized( boolean b ) throws JademxException { |
| 563 | setAttribute( JademxAgent.ATTR_UNIT_TEST_NEWLINES_NORMALIZED_NAME, |
| 564 | new Boolean( b ) ); |
| 565 | } |
| 566 | |
| 567 | /** |
| 568 | * proxy for @see JademxAgent#isUnitTestCmpNewlinesNormalized() |
| 569 | * @return current value for UnitTestCmpNewlinesNormalized attribute |
| 570 | * @throws JademxException on problem |
| 571 | */ |
| 572 | public boolean isUnitTestCmpNewlinesNormalized() throws JademxException { |
| 573 | return ((Boolean)getAttribute( |
| 574 | JademxAgent.ATTR_UNIT_TEST_NEWLINES_NORMALIZED_NAME)). |
| 575 | booleanValue(); |
| 576 | |
| 577 | } |
| 578 | |
| 579 | |
| 580 | |
| 581 | // operation unitTestInjectAndExpect |
| 582 | |
| 583 | /** |
| 584 | * proxy for @see JademxAgent#unitTestInjectAndExpect() |
| 585 | * will generate either a success or failure (asynchronous) notification. |
| 586 | * @throws JademxException on problem |
| 587 | */ |
| 588 | public void unitTestInjectAndExpect() throws JademxException { |
| 589 | try { |
| 590 | mBeanServer.invoke( objectName, |
| 591 | JademxAgent.OPER_UNIT_TEST_INJECT_AND_EXPECT_NAME, |
| 592 | new Object[]{}, |
| 593 | JademxAgent.OPER_UNIT_TEST_INJECT_AND_EXPECT_SIGNATURE ); |
| 594 | } |
| 595 | catch ( Exception e ) { |
| 596 | throw new JademxException("exception invoking operation "+ |
| 597 | JademxAgent.OPER_UNIT_TEST_INJECT_AND_EXPECT_NAME, e ); |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | /** |
| 602 | * proxy for @see JademxAgent#unitTestAddVariable(String, String) |
| 603 | * @param variable string that can vary one message to next |
| 604 | * @param type type of string (see AclMsgCmp.*_MAP) |
| 605 | * @throws JademxException on problem |
| 606 | */ |
| 607 | public void unitTestAddVariable( String variable, String type ) throws JademxException { |
| 608 | try { |
| 609 | mBeanServer.invoke( objectName, |
| 610 | JademxAgent.OPER_UNIT_TEST_ADD_VARIABLE_NAME, |
| 611 | new Object[]{ variable, type }, |
| 612 | JademxAgent.OPER_UNIT_TEST_ADD_VARIABLE_SIGNATURE ); |
| 613 | } |
| 614 | catch ( Exception e ) { |
| 615 | throw new JademxException("exception invoking operation "+ |
| 616 | JademxAgent.OPER_UNIT_TEST_ADD_VARIABLE_NAME, e ); |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | // operation unitTestInjectAndExpect |
| 621 | |
| 622 | /** |
| 623 | * proxy for @see JademxAgent#unitTestClearVariables() |
| 624 | * @throws JademxException on problem |
| 625 | */ |
| 626 | public void unitTestClearVariables() throws JademxException { |
| 627 | try { |
| 628 | mBeanServer.invoke( objectName, |
| 629 | JademxAgent.OPER_UNIT_TEST_CLEAR_VARIABLES_NAME, |
| 630 | new Object[]{}, |
| 631 | JademxAgent.OPER_UNIT_TEST_CLEAR_VARIABLES_SIGNATURE); |
| 632 | } |
| 633 | catch ( Exception e ) { |
| 634 | throw new JademxException("exception invoking operation "+ |
| 635 | JademxAgent.OPER_UNIT_TEST_CLEAR_VARIABLES_NAME, e ); |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | } |