1 7 package com.inversoft.verge.mvc.controller.form.config.test; 8 9 10 import org.jdom.Element; 11 12 import com.inversoft.config.ConfigurationException; 13 import com.inversoft.config.component.ComponentConfigBuilderRegistry; 14 import com.inversoft.junit.WebTestCase; 15 import com.inversoft.verge.mvc.controller.LongTxnSetup; 16 import com.inversoft.verge.mvc.controller.form.config.Constants; 17 import com.inversoft.verge.mvc.controller.form.config.FormConfig; 18 import com.inversoft.verge.mvc.controller.form.config.FormConfigBuilder; 19 import com.inversoft.verge.mvc.controller.form.config.FormMVCConfigRegistry; 20 import com.inversoft.verge.repository.RepositoryBean; 21 import com.inversoft.verge.repository.config.RepositoryConfigRegistry; 22 import com.inversoft.verge.repository.test.RepositoryTest; 23 import com.inversoft.verge.util.ScopeConstants; 24 import com.inversoft.verge.util.WebBean; 25 26 27 34 public class FormBuilderTest extends WebTestCase { 35 36 39 public FormBuilderTest(String name) { 40 super(name); 41 setLocal(true); 42 } 43 44 45 48 public void testBuild() { 49 Element element = new Element("form"); 50 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 51 Element formBean = new Element("formBean"); 52 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 53 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 54 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 55 element.addContent(formBean); 56 57 FormConfigBuilder builder = new FormConfigBuilder(); 58 try { 59 FormConfig config = (FormConfig) builder.build(element); 60 assertTrue("Name should be test", config.getName().equals("test")); 61 assertNotNull("Should have formBean", config.getFormBean("testFormBean")); 62 assertTrue("formBean should be testFormBean", 63 config.getFormBean("testFormBean").getID().equals("testFormBean")); 64 assertTrue("formBean should be right class", 65 config.getFormBean("testFormBean").getClassName().equals( 66 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean")); 67 assertTrue("formBean should be right class", 68 config.getFormBean("testFormBean").getBeanClass() == TestFormBean.class); 69 assertTrue("formBean should be request scoped", 70 config.getFormBean("testFormBean").getScope() == ScopeConstants.REQUEST_INT); 71 } catch (ConfigurationException ce) { 72 fail(ce.toString()); 73 } 74 } 75 76 79 public void testBuildMultiFormBeans() { 80 Element element = new Element("form"); 81 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 82 Element formBean = new Element("formBean"); 83 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 84 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 85 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 86 element.addContent(formBean); 87 formBean = new Element("formBean"); 88 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean2"); 89 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 90 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 91 element.addContent(formBean); 92 formBean = new Element("formBean"); 93 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBeanRID1"); 94 formBean.setAttribute(Constants.IS_REPOSITORY_ATTRIBUTE, "true"); 95 element.addContent(formBean); 96 formBean = new Element("formBean"); 97 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBeanRID2"); 98 formBean.setAttribute(Constants.IS_REPOSITORY_ATTRIBUTE, "true"); 99 element.addContent(formBean); 100 101 FormConfigBuilder builder = new FormConfigBuilder(); 102 try { 103 FormConfig config = (FormConfig) builder.build(element); 104 assertTrue("Name should be test", config.getName().equals("test")); 105 assertNotNull("Should have formBean", config.getFormBean("testFormBean")); 106 assertEquals("formBean should be testFormBean", "testFormBean", 107 config.getFormBean("testFormBean").getID()); 108 assertTrue("formBean should be right class", 109 config.getFormBean("testFormBean").getClassName().equals( 110 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean")); 111 assertTrue("formBean should be right class", 112 config.getFormBean("testFormBean").getBeanClass() == TestFormBean.class); 113 assertTrue("formBean should be request scoped", 114 config.getFormBean("testFormBean").getScope() == ScopeConstants.REQUEST_INT); 115 116 assertNotNull("Should have formBean2", config.getFormBean("testFormBean2")); 117 assertEquals("formBean should be testFormBean2", "testFormBean2", 118 config.getFormBean("testFormBean2").getID()); 119 assertTrue("formBean should be right class", 120 config.getFormBean("testFormBean2").getClassName().equals( 121 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean")); 122 assertTrue("formBean should be right class", 123 config.getFormBean("testFormBean2").getBeanClass() == TestFormBean.class); 124 assertTrue("formBean2 should be request scoped", 125 config.getFormBean("testFormBean2").getScope() == ScopeConstants.REQUEST_INT); 126 127 assertTrue("formBean should be testFormBeanRID1", 128 config.getFormBeanRIDs().contains("testFormBeanRID1")); 129 assertTrue("formBean should be testFormBeanRID1", 130 config.isFormBeanRepository("testFormBeanRID1")); 131 132 assertTrue("formBean should be testFormBeanRID2", 133 config.getFormBeanRIDs().contains("testFormBeanRID2")); 134 assertTrue("formBean should be testFormBeanRID2", 135 config.isFormBeanRepository("testFormBeanRID2")); 136 } catch (ConfigurationException e) { 137 fail(e.toString()); 138 } 139 } 140 141 144 public void testBuildWithScope() { 145 Element element = new Element("form"); 146 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 147 Element formBean = new Element("formBean"); 148 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 149 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 150 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 151 formBean.setAttribute(com.inversoft.verge.mvc.config.Constants.SCOPE_ATTRIBUTE, "session"); 152 element.addContent(formBean); 153 154 FormConfigBuilder builder = new FormConfigBuilder(); 155 try { 156 FormConfig config = (FormConfig) builder.build(element); 157 assertTrue("Name should be test", config.getName().equals("test")); 158 assertNotNull("Should have formBean", config.getFormBean("testFormBean")); 159 assertTrue("formBean should be testFormBean", 160 config.getFormBean("testFormBean").getID().equals("testFormBean")); 161 assertTrue("formBean should be right class", 162 config.getFormBean("testFormBean").getClassName().equals( 163 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean")); 164 assertTrue("formBean should be right class", 165 config.getFormBean("testFormBean").getBeanClass() == TestFormBean.class); 166 assertTrue("formBean should be request scoped", 167 config.getFormBean("testFormBean").getScope() == ScopeConstants.SESSION_INT); 168 } catch (Exception e) { 169 fail(e.toString()); 170 } 171 } 172 173 176 public void testFailure() { 177 178 Element element = new Element("form"); 180 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 181 182 FormConfigBuilder builder = new FormConfigBuilder(); 183 195 196 element = new Element("form"); 198 Element formBean = new Element("formBean"); 200 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 201 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 202 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 203 element.addContent(formBean); 204 205 try { 206 builder.build(element); 207 fail("Should have failed because no form name"); 208 } catch (Exception e) { 209 assertTrue("Should be a ConfigurationException", 210 e instanceof ConfigurationException); 211 assertTrue("Should have errorlist", 212 ((ConfigurationException) e).getErrors() != null && 213 !((ConfigurationException) e).getErrors().isEmpty()); 214 } 215 216 element = new Element("form"); 218 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 219 formBean = new Element("formBean"); 220 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 222 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 223 element.addContent(formBean); 224 225 try { 226 builder.build(element); 227 fail("Should have failed because no form bean name"); 228 } catch (Exception e) { 229 assertTrue("Should be a ConfigurationException", 230 e instanceof ConfigurationException); 231 assertTrue("Should have errorlist", 232 ((ConfigurationException) e).getErrors() != null && 233 !((ConfigurationException) e).getErrors().isEmpty()); 234 } 235 236 element = new Element("form"); 238 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 239 formBean = new Element("formBean"); 240 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 241 element.addContent(formBean); 244 245 try { 246 builder.build(element); 247 fail("Should have failed because no form bean class"); 248 } catch (Exception e) { 249 assertTrue("Should be a ConfigurationException", 250 e instanceof ConfigurationException); 251 assertTrue("Should have errorlist", 252 ((ConfigurationException) e).getErrors() != null && 253 !((ConfigurationException) e).getErrors().isEmpty()); 254 } 255 256 element = new Element("form"); 258 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 259 formBean = new Element("formBean"); 260 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 261 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 262 "com.inversoft.verge.mvc.controller.form.config.test.NotAClass"); 263 element.addContent(formBean); 264 265 try { 266 builder.build(element); 267 fail("Should have failed because invalid form bean class"); 268 } catch (Exception e) { 269 assertTrue("Should be a ConfigurationException", 270 e instanceof ConfigurationException); 271 assertTrue("Should have errorlist", 272 ((ConfigurationException) e).getErrors() != null && 273 !((ConfigurationException) e).getErrors().isEmpty()); 274 } 275 276 element = new Element("form"); 278 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 279 formBean = new Element("formBean"); 280 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 281 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 282 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 283 formBean.setAttribute(com.inversoft.verge.mvc.config.Constants.SCOPE_ATTRIBUTE, "foo"); 284 element.addContent(formBean); 285 286 try { 287 builder.build(element); 288 fail("Should have failed because invalid form bean scope"); 289 } catch (Exception e) { 290 assertTrue("Should be a ConfigurationException", 291 e instanceof ConfigurationException); 292 assertTrue("Should have errorlist", 293 ((ConfigurationException) e).getErrors() != null && 294 !((ConfigurationException) e).getErrors().isEmpty()); 295 } 296 } 297 298 301 public void testActions() { 302 Element element = new Element("form"); 303 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 304 305 Element formBean = new Element("formBean"); 306 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 307 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 308 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 309 element.addContent(formBean); 310 311 Element action1 = new Element("action"); 312 action1.setAttribute(Constants.NAME_ATTRIBUTE, "testAction"); 313 action1.setAttribute(Constants.HANDLER_ATTRIBUTE, 314 "com.inversoft.verge.mvc.controller.form.config.test.TestActionHandler"); 315 Element action2 = new Element("action"); 316 action2.setAttribute(Constants.NAME_ATTRIBUTE, "testAction2"); 317 action2.setAttribute(Constants.HANDLER_ATTRIBUTE, 318 "com.inversoft.verge.mvc.controller.form.config.test.TestActionHandler"); 319 element.addContent(action1); 320 element.addContent(action2); 321 322 FormConfigBuilder builder = new FormConfigBuilder(); 323 try { 324 ComponentConfigBuilderRegistry registry = 325 new ComponentConfigBuilderRegistry( 326 "com.inversoft.verge.mvc.controller.form.config.FormMVCConfigBuilders"); 327 builder.setRegistry(registry); 328 329 FormConfig config = (FormConfig) builder.build(element); 330 assertTrue("Form has action1", config.getActionConfig("testAction") != null); 331 assertTrue("Form has action2", config.getActionConfig("testAction2") != null); 332 } catch (ConfigurationException ce) { 333 fail(ce.toString()); 334 } 335 } 336 337 340 public void testActionsFailure() { 341 Element element = new Element("form"); 342 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 343 344 Element formBean = new Element("formBean"); 345 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 346 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 347 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 348 element.addContent(formBean); 349 350 Element action1 = new Element("action"); 351 action1.setAttribute(Constants.NAME_ATTRIBUTE, "testAction"); 352 action1.setAttribute(Constants.HANDLER_ATTRIBUTE, 353 "com.inversoft.verge.mvc.controller.form.config.test.TestActionHandler"); 354 Element action2 = new Element("action"); 355 action2.setAttribute(Constants.NAME_ATTRIBUTE, "testAction"); 356 action2.setAttribute(Constants.HANDLER_ATTRIBUTE, 357 "com.inversoft.verge.mvc.controller.form.config.test.TestActionHandler"); 358 element.addContent(action1); 359 element.addContent(action2); 360 361 FormConfigBuilder builder = new FormConfigBuilder(); 362 try { 363 ComponentConfigBuilderRegistry registry = 364 new ComponentConfigBuilderRegistry( 365 "com.inversoft.verge.mvc.controller.form.config.FormMVCConfigBuilders"); 366 builder.setRegistry(registry); 367 368 builder.build(element); 369 fail("Should have failed, actions named the same"); 370 } catch (Exception e) { 371 assertTrue("Should be a ConfigurationException", 372 e instanceof ConfigurationException); 373 assertTrue("Should have errorlist", 374 ((ConfigurationException) e).getErrors() != null && 375 !((ConfigurationException) e).getErrors().isEmpty()); 376 } 377 } 378 379 382 public void testMappings() { 383 Element element = new Element("form"); 384 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 385 386 Element formBean = new Element("formBean"); 387 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 388 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 389 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 390 element.addContent(formBean); 391 392 Element mapping1 = new Element("mapping"); 393 mapping1.setAttribute(Constants.NAME_ATTRIBUTE, "testMapping1"); 394 mapping1.setAttribute(Constants.URL_ATTRIBUTE, "testMapping1.jsp"); 395 mapping1.setAttribute(Constants.FORWARD_ATTRIBUTE, "true"); 396 Element mapping2 = new Element("mapping"); 397 mapping2.setAttribute(Constants.NAME_ATTRIBUTE, "testMapping2"); 398 mapping2.setAttribute(Constants.URL_ATTRIBUTE, "testMapping2.jsp"); 399 mapping2.setAttribute(Constants.FORWARD_ATTRIBUTE, "true"); 400 element.addContent(mapping1); 401 element.addContent(mapping2); 402 403 FormConfigBuilder builder = new FormConfigBuilder(); 404 try { 405 ComponentConfigBuilderRegistry registry = 406 new ComponentConfigBuilderRegistry( 407 "com.inversoft.verge.mvc.controller.form.config.FormMVCConfigBuilders"); 408 builder.setRegistry(registry); 409 410 FormConfig config = (FormConfig) builder.build(element); 411 assertTrue("Form has mapping1", config.getMappingConfig("testMapping1") != null); 412 assertTrue("Form has mapping2", config.getMappingConfig("testMapping2") != null); 413 } catch (Exception e) { 414 fail(e.toString()); 415 } 416 } 417 418 421 public void testMappingsFailure() { 422 Element element = new Element("form"); 423 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 424 425 Element formBean = new Element("formBean"); 426 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "testFormBean"); 427 formBean.setAttribute(Constants.CLASS_ATTRIBUTE, 428 "com.inversoft.verge.mvc.controller.form.config.test.TestFormBean"); 429 element.addContent(formBean); 430 431 Element mapping1 = new Element("mapping"); 432 mapping1.setAttribute(Constants.NAME_ATTRIBUTE, "testMapping1"); 433 mapping1.setAttribute(Constants.URL_ATTRIBUTE, "testMapping1.jsp"); 434 mapping1.setAttribute(Constants.FORWARD_ATTRIBUTE, "true"); 435 Element mapping2 = new Element("mapping"); 436 mapping2.setAttribute(Constants.NAME_ATTRIBUTE, "testMapping1"); 437 mapping2.setAttribute(Constants.URL_ATTRIBUTE, "testMapping1.jsp"); 438 mapping2.setAttribute(Constants.FORWARD_ATTRIBUTE, "true"); 439 element.addContent(mapping1); 440 element.addContent(mapping2); 441 442 FormConfigBuilder builder = new FormConfigBuilder(); 443 try { 444 ComponentConfigBuilderRegistry registry = 445 new ComponentConfigBuilderRegistry( 446 "com.inversoft.verge.mvc.controller.form.config.FormMVCConfigBuilders"); 447 builder.setRegistry(registry); 448 449 builder.build(element); 450 fail("Should have failed, mappings named the same"); 451 } catch (Exception e) { 452 assertTrue("Should be a ConfigurationException", 453 e instanceof ConfigurationException); 454 assertTrue("Should have errorlist", 455 ((ConfigurationException) e).getErrors() != null && 456 !((ConfigurationException) e).getErrors().isEmpty()); 457 } 458 } 459 460 463 public void testRepositoryBuildPartial() { 464 465 RepositoryTest tester = new RepositoryTest("testInitialization"); 467 tester.setContext(context); 468 tester.testInitialization(); 469 470 Element element = new Element("form"); 473 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 474 475 Element formBean = new Element("formBean"); 476 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "item1"); 477 formBean.setAttribute(Constants.IS_REPOSITORY_ATTRIBUTE, "true"); 478 element.addContent(formBean); 479 480 FormConfigBuilder builder = new FormConfigBuilder(); 481 try { 482 FormConfig config = (FormConfig) builder.build(element); 483 assertTrue("Name should be test", config.getName().equals("test")); 484 assertNull("formBean should be null", config.getFormBean("item1")); 485 assertTrue("Should be repository", config.isFormBeanRepository("item1")); 486 } catch (Exception e) { 487 fail(e.toString()); 488 } 489 } 490 491 494 public void testRepositoryBuild() { 495 496 RepositoryTest tester = new RepositoryTest("testInitialization"); 498 tester.setContext(context); 499 tester.testInitialization(); 500 501 Element element = new Element("form"); 504 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 505 506 Element formBeanElem = new Element("formBean"); 507 formBeanElem.setAttribute(Constants.NAME_ATTRIBUTE, "item1"); 508 formBeanElem.setAttribute(Constants.IS_REPOSITORY_ATTRIBUTE, "true"); 509 element.addContent(formBeanElem); 510 511 FormConfigBuilder builder = new FormConfigBuilder(); 512 try { 513 FormConfig config = (FormConfig) builder.build(element); 514 assertTrue("Name should be test", config.getName().equals("test")); 515 assertNull("formBean should be null", config.getFormBean("item1")); 516 assertTrue("Should be repository", config.isFormBeanRepository("item1")); 517 518 RepositoryConfigRegistry registry = 519 RepositoryConfigRegistry.getInstance(request); 520 builder.validate(config, registry, FormMVCConfigRegistry.getInstance(null)); 521 522 assertTrue("Name should be test", config.getName().equals("test")); 523 assertNotNull("formBean not should be null", config.getFormBean("item1")); 524 assertTrue("Should be repository", config.isFormBeanRepository("item1")); 525 526 WebBean formBean = config.getFormBean("item1"); 527 assertTrue("Should be a repository bean", 528 formBean instanceof RepositoryBean); 529 assertTrue("formBean should be item1", 530 formBean.getID().equals("item1")); 531 assertTrue("formBean should be SimpleItem", 532 formBean.getClassName().equals( 533 "com.inversoft.verge.repository.test.SimpleItem")); 534 assertTrue("formBean should be SimpleItem Class", 535 formBean.getBeanClass() == 536 com.inversoft.verge.repository.test.SimpleItem.class); 537 } catch (Exception e) { 538 fail(e.toString()); 539 } 540 } 541 542 545 public void testRepositoryFailurePartial() { 546 547 Element element = new Element("form"); 550 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 551 552 Element formBean = new Element("formBean"); 553 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "item1"); 554 formBean.setAttribute(Constants.IS_REPOSITORY_ATTRIBUTE, "bob"); 555 element.addContent(formBean); 556 557 FormConfigBuilder builder = new FormConfigBuilder(); 558 try { 559 builder.build(element); 560 fail("Should have failed bcause repository boolean is bob"); 561 } catch (Exception e) { 562 assertTrue("Should be a ConfigurationException", 563 e instanceof ConfigurationException); 564 assertTrue("Should have errorlist", 565 ((ConfigurationException) e).getErrors() != null && 566 !((ConfigurationException) e).getErrors().isEmpty()); 567 System.out.println(e.toString()); 568 } 569 } 570 571 574 public void testRepositoryFailure() { 575 576 RepositoryTest tester = new RepositoryTest("testInitialization"); 578 tester.setContext(context); 579 tester.testInitialization(); 580 581 Element element = new Element("form"); 584 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 585 586 Element formBean = new Element("formBean"); 587 formBean.setAttribute(Constants.NAME_ATTRIBUTE, "notCorrect"); 588 formBean.setAttribute(Constants.IS_REPOSITORY_ATTRIBUTE, "true"); 589 element.addContent(formBean); 590 591 592 FormConfigBuilder builder = new FormConfigBuilder(); 593 try { 594 FormConfig config = (FormConfig) builder.build(element); 595 assertTrue("Name should be test", config.getName().equals("test")); 596 assertNull("formBean should be null", config.getFormBean("notCorrect")); 597 assertTrue("Should be repository", config.isFormBeanRepository("notCorrect")); 598 599 RepositoryConfigRegistry registry = 600 RepositoryConfigRegistry.getInstance(request); 601 builder.validate(config, registry, FormMVCConfigRegistry.getInstance(null)); 602 603 fail("Should have failed bcause repository item does not exist"); 604 } catch (Exception e) { 605 assertTrue("Should be a ConfigurationException", 606 e instanceof ConfigurationException); 607 assertTrue("Should have errorlist", 608 ((ConfigurationException) e).getErrors() != null && 609 !((ConfigurationException) e).getErrors().isEmpty()); 610 System.out.println(e.toString()); 611 } 612 } 613 614 615 618 public void testLongTxnSetup() { 619 620 Element element = new Element("form"); 621 element.setAttribute(Constants.NAME_ATTRIBUTE, "test"); 622 element.setAttribute(Constants.LONG_TXN_SETUP_ATTRIBUTE, 623 "com.inversoft.verge.mvc.controller.form.config.test.TestLongTxnSetup"); 624 625 FormConfigBuilder builder = new FormConfigBuilder(); 626 try { 627 FormConfig config = (FormConfig) builder.build(element); 628 assertTrue("Name should be test", config.getName().equals("test")); 629 assertTrue(LongTxnSetup.class.isAssignableFrom(config.getLongTxnSetup().getClass())); 630 } catch (ConfigurationException ce) { 631 fail(ce.toString()); 632 } 633 } 634 } | Popular Tags |