001 // SECTION-START[License Header] 002 // <editor-fold defaultstate="collapsed" desc=" Generated License "> 003 /* 004 * Java Object Management and Configuration 005 * Copyright (C) Christian Schulte, 2005-206 006 * All rights reserved. 007 * 008 * Redistribution and use in source and binary forms, with or without 009 * modification, are permitted provided that the following conditions 010 * are met: 011 * 012 * o Redistributions of source code must retain the above copyright 013 * notice, this list of conditions and the following disclaimer. 014 * 015 * o Redistributions in binary form must reproduce the above copyright 016 * notice, this list of conditions and the following disclaimer in 017 * the documentation and/or other materials provided with the 018 * distribution. 019 * 020 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 021 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 022 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 023 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, 024 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 025 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 026 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 027 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 029 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 030 * 031 * $JOMC: JomcTest.java 4511 2012-04-24 01:59:23Z schulte2005 $ 032 * 033 */ 034 // </editor-fold> 035 // SECTION-END 036 package org.jomc.cli.test; 037 038 import java.io.File; 039 import java.io.IOException; 040 import java.io.OutputStream; 041 import java.net.URI; 042 import java.net.URL; 043 import java.util.zip.ZipEntry; 044 import java.util.zip.ZipInputStream; 045 import javax.xml.bind.JAXBElement; 046 import javax.xml.bind.Unmarshaller; 047 import javax.xml.transform.stream.StreamSource; 048 import javax.xml.validation.Schema; 049 import org.apache.commons.io.FileUtils; 050 import org.apache.commons.io.IOUtils; 051 import org.jomc.ObjectManagerFactory; 052 import org.jomc.cli.Command; 053 import org.jomc.cli.Jomc; 054 import org.jomc.model.ModelObject; 055 import org.jomc.model.Module; 056 import org.jomc.modlet.ModelContext; 057 import org.jomc.modlet.ModelContextFactory; 058 import org.jomc.modlet.Modlet; 059 import org.jomc.modlet.ModletObject; 060 import org.junit.Before; 061 import org.junit.Test; 062 import static org.junit.Assert.assertEquals; 063 import static org.junit.Assert.assertFalse; 064 import static org.junit.Assert.assertNotNull; 065 import static org.junit.Assert.assertNull; 066 import static org.junit.Assert.assertTrue; 067 068 // SECTION-START[Documentation] 069 // <editor-fold defaultstate="collapsed" desc=" Generated Documentation "> 070 /** 071 * Tests the {@code Jomc} CLI class. 072 * 073 * <dl> 074 * <dt><b>Identifier:</b></dt><dd>org.jomc.cli.test.JomcTest</dd> 075 * <dt><b>Name:</b></dt><dd>JOMC CLI Tests</dd> 076 * <dt><b>Abstract:</b></dt><dd>No</dd> 077 * <dt><b>Final:</b></dt><dd>No</dd> 078 * <dt><b>Stateless:</b></dt><dd>No</dd> 079 * </dl> 080 * 081 * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0 082 * @version 1.2.7 083 */ 084 // </editor-fold> 085 // SECTION-END 086 // SECTION-START[Annotations] 087 // <editor-fold defaultstate="collapsed" desc=" Generated Annotations "> 088 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 089 // </editor-fold> 090 // SECTION-END 091 public class JomcTest 092 { 093 // SECTION-START[JomcTest] 094 095 /** Constant to prefix relative resource names with. */ 096 private static final String ABSOLUTE_RESOURCE_NAME_PREFIX = "/org/jomc/cli/test/"; 097 098 /** Constant for the name of the system property holding the output directory for the test. */ 099 private static final String OUTPUT_DIRECTORY_PROPERTY_NAME = "jomc.test.outputDirectory"; 100 101 /** Test resources to copy to the resources directory. */ 102 private static final String[] TEST_RESOURCE_NAMES = 103 { 104 "model-relocations.xsl", 105 "modlet-relocations.xsl", 106 "jomc.xml", 107 "illegal-module.xml", 108 "illegal-module-document.xml", 109 "module-nonexistent-classes.xml" 110 }; 111 112 /** The output directory of the instance. */ 113 private File outputDirectory; 114 115 /** 116 * Gets the output directory of instance. 117 * 118 * @return The output directory of instance. 119 * 120 * @see #setOutputDirectory(java.io.File) 121 */ 122 public final File getOutputDirectory() 123 { 124 if ( this.outputDirectory == null ) 125 { 126 final String name = System.getProperty( OUTPUT_DIRECTORY_PROPERTY_NAME ); 127 assertNotNull( "Expected '" + OUTPUT_DIRECTORY_PROPERTY_NAME + "' system property not found.", name ); 128 this.outputDirectory = new File( new File( name ), "JomcTest" ); 129 assertTrue( "Expected '" + OUTPUT_DIRECTORY_PROPERTY_NAME + "' system property to hold an absolute path.", 130 this.outputDirectory.isAbsolute() ); 131 132 if ( !this.outputDirectory.exists() ) 133 { 134 assertTrue( this.outputDirectory.mkdirs() ); 135 } 136 } 137 138 return this.outputDirectory; 139 } 140 141 /** 142 * Sets the output directory of instance. 143 * 144 * @param value The new output directory of instance or {@code null}. 145 * 146 * @see #getOutputDirectory() 147 */ 148 public final void setOutputDirectory( final File value ) 149 { 150 if ( value != null ) 151 { 152 assertTrue( "Expected absolute 'outputDirectory'.", value.isAbsolute() ); 153 } 154 155 this.outputDirectory = value; 156 } 157 158 @Test 159 public final void testNoArguments() throws Exception 160 { 161 assertEquals( Command.STATUS_FAILURE, Jomc.run( new String[ 0 ] ) ); 162 } 163 164 @Test 165 public final void testGenerateResources() throws Exception 166 { 167 final File testResourcesDirectory = this.getTestResourcesDirectory(); 168 assertTrue( testResourcesDirectory.isAbsolute() ); 169 170 if ( testResourcesDirectory.exists() ) 171 { 172 FileUtils.deleteDirectory( testResourcesDirectory ); 173 } 174 175 final String[] help = new String[] 176 { 177 "generate-resources", "help" 178 }; 179 180 final String[] args = new String[] 181 { 182 "generate-resources", "-rd", '"' + this.getTestResourcesDirectory().getAbsolutePath() + '"', "-df", 183 '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-D" 184 }; 185 186 final String[] unsupportedOption = new String[] 187 { 188 "generate-resources", "--unsupported-option" 189 }; 190 191 final String[] failOnWarnings = new String[] 192 { 193 "generate-resources", "-rd", '"' + this.getTestResourcesDirectory().getAbsolutePath() + '"', "-df", 194 '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-mn", "DOES_NOT_EXIST", "--fail-on-warnings", 195 "-D" 196 }; 197 198 assertEquals( Command.STATUS_SUCCESS, Jomc.run( help ) ); 199 assertEquals( Command.STATUS_FAILURE, Jomc.run( args ) ); 200 assertEquals( Command.STATUS_FAILURE, Jomc.run( unsupportedOption ) ); 201 202 assertTrue( testResourcesDirectory.mkdirs() ); 203 assertEquals( Command.STATUS_SUCCESS, Jomc.run( args ) ); 204 assertEquals( Command.STATUS_FAILURE, Jomc.run( failOnWarnings ) ); 205 } 206 207 @Test 208 public final void testManageSources() throws Exception 209 { 210 final File testSourcesDirectory = this.getTestSourcesDirectory(); 211 assertTrue( testSourcesDirectory.isAbsolute() ); 212 213 if ( testSourcesDirectory.exists() ) 214 { 215 FileUtils.deleteDirectory( testSourcesDirectory ); 216 } 217 218 final String[] help = new String[] 219 { 220 "manage-sources", "help" 221 }; 222 223 final String[] args = new String[] 224 { 225 "manage-sources", "-sd", '"' + this.getTestSourcesDirectory().getAbsolutePath() + '"', "-df", 226 '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-mn", '"' + this.getTestModuleName() + '"', 227 "-D", "-ls", "\r\n", "-idt", "\t", "-tp", "jomc-cli", "-tl", 228 '"' + this.getTemplatesDirectory().getAbsolutePath() + '"' 229 }; 230 231 final String[] unsupportedOption = new String[] 232 { 233 "manage-sources", "--unsupported-option" 234 }; 235 236 final String[] failOnWarnings = new String[] 237 { 238 "manage-sources", "-sd", '"' + this.getTestSourcesDirectory().getAbsolutePath() + '"', "-df", 239 '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-mn", "DOES_NOT_EXIST", "--fail-on-warnings", 240 "-D", "-tp", "jomc-cli", "-tl", '"' + this.getTemplatesDirectory().getAbsolutePath() + '"' 241 }; 242 243 assertEquals( Command.STATUS_SUCCESS, Jomc.run( help ) ); 244 assertEquals( Command.STATUS_FAILURE, Jomc.run( args ) ); 245 assertEquals( Command.STATUS_FAILURE, Jomc.run( unsupportedOption ) ); 246 247 assertTrue( testSourcesDirectory.mkdirs() ); 248 assertEquals( Command.STATUS_SUCCESS, Jomc.run( args ) ); 249 assertEquals( Command.STATUS_FAILURE, Jomc.run( failOnWarnings ) ); 250 } 251 252 @Test 253 public final void testCommitValidateClasses() throws Exception 254 { 255 final File testClassesDirectory = this.getTestClassesDirectory(); 256 assertTrue( testClassesDirectory.isAbsolute() ); 257 258 if ( testClassesDirectory.exists() ) 259 { 260 FileUtils.deleteDirectory( testClassesDirectory ); 261 } 262 263 final String[] commitHelp = new String[] 264 { 265 "commit-classes", "help" 266 }; 267 268 final String[] validateHelp = new String[] 269 { 270 "validate-classes", "help" 271 }; 272 273 final String[] commitArgs = new String[] 274 { 275 "commit-classes", "-df", '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-cd", 276 '"' + this.getClassesDirectory().getAbsolutePath() + '"', "-mn", 277 '"' + this.getTestModuleName() + '"', "-D" 278 }; 279 280 final String[] commitArgsNoDirectory = new String[] 281 { 282 "commit-classes", "-df", '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-cd", 283 '"' + this.getTestClassesDirectory().getAbsolutePath() + '"', "-mn", '"' + this.getTestModuleName() + '"', 284 "-D" 285 }; 286 287 final String[] validateArgs = new String[] 288 { 289 "validate-classes", "-cp", '"' + this.getClassesDirectory().getAbsolutePath() + '"', "-D" 290 }; 291 292 final String[] validateArgsNonExistentClasses = new String[] 293 { 294 "validate-classes", "-df", '"' + this.getTestModelDocumentNonExistentClasses().getAbsolutePath() + '"', 295 "-cp", '"' + this.getClassesDirectory().getAbsolutePath() + '"', "-D" 296 }; 297 298 final String[] commitUnsupportedOption = new String[] 299 { 300 "commit-classes", "--unsupported-option" 301 }; 302 303 final String[] validateUnsupportedOption = new String[] 304 { 305 "validate-classes", "--unsupported-option" 306 }; 307 308 final String[] commitFailOnWarnings = new String[] 309 { 310 "commit-classes", "-df", '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-cd", 311 '"' + this.getClassesDirectory().getAbsolutePath() + '"', "-mn", "DOES_NOT_EXIST", "--fail-on-warnings", 312 "-D" 313 }; 314 315 final String[] validateFailOnWarnings = new String[] 316 { 317 "validate-classes", "-df", '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-cp", 318 '"' + this.getClassesDirectory().getAbsolutePath() + '"', "-mn", "DOES_NOT_EXIST", "--fail-on-warnings", 319 "-D" 320 }; 321 322 final String[] commitWithStylesheet = new String[] 323 { 324 "commit-classes", "-df", '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-cd", 325 '"' + this.getClassesDirectory().getAbsolutePath() + '"', "-mn", '"' + this.getTestModuleName() + '"', 326 "-D", "-stylesheet", '"' + this.getTestModelStylesheet().getAbsolutePath() + '"' 327 }; 328 329 assertEquals( Command.STATUS_SUCCESS, Jomc.run( commitHelp ) ); 330 assertEquals( Command.STATUS_SUCCESS, Jomc.run( validateHelp ) ); 331 assertEquals( Command.STATUS_FAILURE, Jomc.run( commitArgsNoDirectory ) ); 332 assertEquals( Command.STATUS_FAILURE, Jomc.run( commitUnsupportedOption ) ); 333 assertEquals( Command.STATUS_FAILURE, Jomc.run( validateUnsupportedOption ) ); 334 335 assertEquals( Command.STATUS_SUCCESS, Jomc.run( commitArgs ) ); 336 assertEquals( Command.STATUS_SUCCESS, Jomc.run( validateArgs ) ); 337 assertEquals( Command.STATUS_SUCCESS, Jomc.run( commitWithStylesheet ) ); 338 assertEquals( Command.STATUS_FAILURE, Jomc.run( commitFailOnWarnings ) ); 339 assertEquals( Command.STATUS_FAILURE, Jomc.run( validateFailOnWarnings ) ); 340 assertEquals( Command.STATUS_FAILURE, Jomc.run( validateArgsNonExistentClasses ) ); 341 } 342 343 @Test 344 public final void testMergeModules() throws Exception 345 { 346 final ModelContext context = ModelContextFactory.newInstance().newModelContext(); 347 final Unmarshaller unmarshaller = context.createUnmarshaller( ModelObject.MODEL_PUBLIC_ID ); 348 final Schema schema = context.createSchema( ModelObject.MODEL_PUBLIC_ID ); 349 unmarshaller.setSchema( schema ); 350 351 final String[] help = new String[] 352 { 353 "merge-modules", "help" 354 }; 355 356 final String[] args = new String[] 357 { 358 "merge-modules", "-df", '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-xs", 359 '"' + this.getTestModelStylesheet().getAbsolutePath() + '"', "-mn", '"' + this.getTestModuleName() + '"', 360 "-d", '"' + this.getTestModelOutputDocument().getAbsolutePath() + '"', "-D" 361 }; 362 363 final String[] includesArg = new String[] 364 { 365 "merge-modules", "-df", '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-xs", 366 '"' + this.getTestModelStylesheet().getAbsolutePath() + '"', "-mn", '"' + this.getTestModuleName() + '"', 367 "-d", '"' + this.getTestModelOutputDocument().getAbsolutePath() + '"', "-minc", "\"JOMC CLI\"", "-D" 368 }; 369 370 final String[] excludesArg = new String[] 371 { 372 "merge-modules", "-df", '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-xs", 373 '"' + this.getTestModelStylesheet().getAbsolutePath() + '"', "-mn", '"' + this.getTestModuleName() + '"', 374 "-d", '"' + this.getTestModelOutputDocument().getAbsolutePath() + '"', "-mexc", "\"JOMC CLI\"", "-D" 375 }; 376 377 final String[] unsupportedOption = new String[] 378 { 379 "merge-modules", "--unsupported-option" 380 }; 381 382 final String[] illegalDoc = new String[] 383 { 384 "merge-modules", "-df", '"' + this.getTestModelDocumentIllegalSchemaConstraints().getAbsolutePath() + '"', 385 "-xs", '"' + this.getTestModelStylesheet().getAbsolutePath() + '"', "-mn", 386 '"' + this.getTestModuleName() + '"', "-d", '"' + this.getTestModelOutputDocument().getAbsolutePath() + '"', 387 "-D" 388 }; 389 390 assertEquals( Command.STATUS_SUCCESS, Jomc.run( help ) ); 391 assertEquals( Command.STATUS_SUCCESS, Jomc.run( args ) ); 392 393 unmarshaller.unmarshal( new StreamSource( this.getTestModelOutputDocument() ), Module.class ); 394 395 assertEquals( Command.STATUS_SUCCESS, Jomc.run( includesArg ) ); 396 397 final JAXBElement<Module> includedModule = 398 unmarshaller.unmarshal( new StreamSource( this.getTestModelOutputDocument() ), Module.class ); 399 400 assertNotNull( "Merged module does not contain any included specifications.", 401 includedModule.getValue().getSpecifications() ); 402 403 assertNotNull( "Merged module does not contain included 'org.jomc.cli.Command' specification.", 404 includedModule.getValue().getSpecifications().getSpecification( Command.class ) ); 405 406 assertEquals( Command.STATUS_SUCCESS, Jomc.run( excludesArg ) ); 407 408 final JAXBElement<Module> excludedModule = 409 unmarshaller.unmarshal( new StreamSource( this.getTestModelOutputDocument() ), Module.class ); 410 411 assertNull( "Merged module contains excluded specifications.", 412 excludedModule.getValue().getSpecifications() ); 413 414 assertEquals( Command.STATUS_FAILURE, Jomc.run( unsupportedOption ) ); 415 assertEquals( Command.STATUS_FAILURE, Jomc.run( illegalDoc ) ); 416 } 417 418 @Test 419 public final void testValidateModel() throws Exception 420 { 421 final String[] help = new String[] 422 { 423 "validate-model", "help" 424 }; 425 426 final String[] args = new String[] 427 { 428 "validate-model", "-df", '"' + this.getTestModelDocument().getAbsolutePath() + '"', "-D" 429 }; 430 431 final String[] unsupportedOption = new String[] 432 { 433 "validate-model", "--unsupported-option" 434 }; 435 436 final String[] illegalDoc = new String[] 437 { 438 "validate-model", "-df", '"' + this.getTestModelDocumentIllegal().getAbsolutePath() + '"', "-D" 439 }; 440 441 assertEquals( Command.STATUS_SUCCESS, Jomc.run( help ) ); 442 assertEquals( Command.STATUS_SUCCESS, Jomc.run( args ) ); 443 assertEquals( Command.STATUS_FAILURE, Jomc.run( unsupportedOption ) ); 444 assertEquals( Command.STATUS_FAILURE, Jomc.run( illegalDoc ) ); 445 } 446 447 @Test 448 public final void testMergeModlets() throws Exception 449 { 450 final ModelContext context = ModelContextFactory.newInstance().newModelContext(); 451 final Unmarshaller unmarshaller = context.createUnmarshaller( ModletObject.MODEL_PUBLIC_ID ); 452 final Schema schema = context.createSchema( ModletObject.MODEL_PUBLIC_ID ); 453 unmarshaller.setSchema( schema ); 454 455 final String[] help = new String[] 456 { 457 "merge-modlets", "help" 458 }; 459 460 final String[] args = new String[] 461 { 462 "merge-modlets", "-xs", '"' + this.getTestModletStylesheet().getAbsolutePath() + '"', "-mdn", 463 '"' + this.getTestModletName() + '"', "-d", 464 '"' + this.getTestModletOutputDocument().getAbsolutePath() + '"', "-cp", "." 465 }; 466 467 final String[] includeArgs = new String[] 468 { 469 "merge-modlets", "-xs", '"' + this.getTestModletStylesheet().getAbsolutePath() + '"', "-mdn", 470 '"' + this.getTestModletName() + '"', "-d", 471 '"' + this.getTestModletOutputDocument().getAbsolutePath() + '"', "-mdinc", "JOMC Model", "-cp", "." 472 }; 473 474 final String[] excludeArgs = new String[] 475 { 476 "merge-modlets", "-xs", '"' + this.getTestModletStylesheet().getAbsolutePath() + '"', "-mdn", 477 '"' + this.getTestModletName() + '"', "-d", 478 '"' + this.getTestModletOutputDocument().getAbsolutePath() + '"', "-mdexc", 479 "JOMC Model" + File.pathSeparatorChar + "JOMC Tools" + File.pathSeparatorChar + "JOMC Modlet", "-cp", "." 480 }; 481 482 final String[] unsupportedOption = new String[] 483 { 484 "merge-modlets", "--unsupported-option" 485 }; 486 487 assertEquals( Command.STATUS_SUCCESS, Jomc.run( help ) ); 488 assertEquals( Command.STATUS_FAILURE, Jomc.run( unsupportedOption ) ); 489 490 assertEquals( Command.STATUS_SUCCESS, Jomc.run( args ) ); 491 Modlet merged = unmarshaller.unmarshal( 492 new StreamSource( this.getTestModletOutputDocument() ), Modlet.class ).getValue(); 493 494 assertNotNull( merged ); 495 assertEquals( this.getTestModletName(), merged.getName() ); 496 assertNotNull( merged.getSchemas() ); 497 assertNotNull( merged.getServices() ); 498 assertEquals( 2, merged.getSchemas().getSchema().size() ); 499 assertEquals( 6, merged.getServices().getService().size() ); 500 assertFalse( merged.getSchemas().getSchemasByPublicId( new URI( "http://jomc.org/model" ) ).isEmpty() ); 501 assertFalse( merged.getSchemas().getSchemasByPublicId( new URI( "http://jomc.org/tools/model" ) ).isEmpty() ); 502 assertEquals( 2, merged.getServices().getServices( "org.jomc.modlet.ModelProvider" ).size() ); 503 assertEquals( 2, merged.getServices().getServices( "org.jomc.modlet.ModelProcessor" ).size() ); 504 assertEquals( 2, merged.getServices().getServices( "org.jomc.modlet.ModelValidator" ).size() ); 505 506 assertEquals( Command.STATUS_SUCCESS, Jomc.run( includeArgs ) ); 507 merged = unmarshaller.unmarshal( 508 new StreamSource( this.getTestModletOutputDocument() ), Modlet.class ).getValue(); 509 510 assertNotNull( merged ); 511 assertEquals( this.getTestModletName(), merged.getName() ); 512 assertNotNull( merged.getSchemas() ); 513 assertNotNull( merged.getServices() ); 514 assertEquals( 1, merged.getSchemas().getSchema().size() ); 515 assertFalse( merged.getSchemas().getSchemasByPublicId( new URI( "http://jomc.org/model" ) ).isEmpty() ); 516 assertEquals( 3, merged.getServices().getService().size() ); 517 assertEquals( 1, merged.getServices().getServices( "org.jomc.modlet.ModelProvider" ).size() ); 518 assertEquals( 1, merged.getServices().getServices( "org.jomc.modlet.ModelProcessor" ).size() ); 519 assertEquals( 1, merged.getServices().getServices( "org.jomc.modlet.ModelValidator" ).size() ); 520 521 assertEquals( Command.STATUS_SUCCESS, Jomc.run( excludeArgs ) ); 522 merged = unmarshaller.unmarshal( 523 new StreamSource( this.getTestModletOutputDocument() ), Modlet.class ).getValue(); 524 525 assertNotNull( merged ); 526 assertEquals( this.getTestModletName(), merged.getName() ); 527 assertNull( merged.getSchemas() ); 528 assertNull( merged.getServices() ); 529 } 530 531 @Test 532 public final void testShowModel() throws Exception 533 { 534 final File classesDirectory = new File( this.getOutputDirectory(), "jomc-test-classes" ); 535 536 final String[] help = new String[] 537 { 538 "show-model", "help" 539 }; 540 541 final String[] showModel = new String[] 542 { 543 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"' 544 }; 545 546 final String[] writeModel = new String[] 547 { 548 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-d", 549 '"' + this.getTestShowModelOutputDocument().getAbsolutePath() + '"' 550 }; 551 552 final String[] showSpecification = new String[] 553 { 554 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-spec", "JOMC CLI Command" 555 }; 556 557 final String[] writeSpecification = new String[] 558 { 559 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-spec", "JOMC CLI Command", "-d", 560 '"' + this.getTestShowSpecificationOutputDocument().getAbsolutePath() + '"' 561 }; 562 563 final String[] showInstance = new String[] 564 { 565 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-impl", "JOMC CLI show-model Command" 566 }; 567 568 final String[] writeInstance = new String[] 569 { 570 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-impl", "JOMC CLI show-model Command", 571 "-d", 572 '"' + this.getTestShowInstanceOutputDocument().getAbsolutePath() + '"' 573 }; 574 575 final String[] showSpecificationAndInstance = new String[] 576 { 577 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-spec", "JOMC CLI Command", "-impl", 578 "JOMC CLI show-model Command" 579 }; 580 581 final String[] writeSpecificationAndInstance = new String[] 582 { 583 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-spec", "JOMC CLI Command", "-impl", 584 "JOMC CLI show-model Command", "-d", 585 '"' + this.getTestShowSpecificationAndInstanceOutputDocument().getAbsolutePath() + '"' 586 }; 587 588 final String[] unsupportedOption = new String[] 589 { 590 "show-model", "--unsupported-option" 591 }; 592 593 assertEquals( Command.STATUS_SUCCESS, Jomc.run( help ) ); 594 assertEquals( Command.STATUS_SUCCESS, Jomc.run( showModel ) ); 595 assertEquals( Command.STATUS_SUCCESS, Jomc.run( writeModel ) ); 596 assertEquals( Command.STATUS_SUCCESS, Jomc.run( showInstance ) ); 597 assertEquals( Command.STATUS_SUCCESS, Jomc.run( writeInstance ) ); 598 assertEquals( Command.STATUS_SUCCESS, Jomc.run( showSpecification ) ); 599 assertEquals( Command.STATUS_SUCCESS, Jomc.run( writeSpecification ) ); 600 assertEquals( Command.STATUS_SUCCESS, Jomc.run( showSpecificationAndInstance ) ); 601 assertEquals( Command.STATUS_SUCCESS, Jomc.run( writeSpecificationAndInstance ) ); 602 assertEquals( Command.STATUS_FAILURE, Jomc.run( unsupportedOption ) ); 603 } 604 605 @Before 606 public void setUp() throws IOException 607 { 608 // Ensures the singleton is initialized prior to class Jomc switching resource locations. 609 ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ); 610 611 final File f = this.getOutputDirectory(); 612 if ( !f.exists() ) 613 { 614 assertTrue( f.mkdirs() ); 615 } 616 617 final File resourcesDirectory = this.getResourcesDirectory(); 618 assertTrue( resourcesDirectory.isAbsolute() ); 619 FileUtils.deleteDirectory( resourcesDirectory ); 620 assertTrue( resourcesDirectory.mkdirs() ); 621 622 for ( String testResourceName : TEST_RESOURCE_NAMES ) 623 { 624 final URL rsrc = this.getClass().getResource( ABSOLUTE_RESOURCE_NAME_PREFIX + testResourceName ); 625 assertNotNull( rsrc ); 626 FileUtils.copyURLToFile( rsrc, new File( resourcesDirectory, testResourceName ) ); 627 } 628 629 final File classesDirectory = this.getClassesDirectory(); 630 this.unzipResource( ABSOLUTE_RESOURCE_NAME_PREFIX + "classfiles.zip", classesDirectory ); 631 632 final File templatesDirectory = this.getTemplatesDirectory(); 633 this.unzipResource( ABSOLUTE_RESOURCE_NAME_PREFIX + "templates.zip", templatesDirectory ); 634 } 635 636 private void unzipResource( final String resourceName, final File targetDirectory ) throws IOException 637 { 638 assertTrue( resourceName.startsWith( "/" ) ); 639 final URL resource = this.getClass().getResource( resourceName ); 640 assertNotNull( "Expected '" + resourceName + "' not found.", resource ); 641 642 assertTrue( targetDirectory.isAbsolute() ); 643 FileUtils.deleteDirectory( targetDirectory ); 644 assertTrue( targetDirectory.mkdirs() ); 645 646 ZipInputStream in = null; 647 boolean suppressExceptionOnClose = true; 648 649 try 650 { 651 in = new ZipInputStream( resource.openStream() ); 652 ZipEntry e; 653 654 while ( ( e = in.getNextEntry() ) != null ) 655 { 656 if ( e.isDirectory() ) 657 { 658 continue; 659 } 660 661 final File dest = new File( targetDirectory, e.getName() ); 662 assertTrue( dest.isAbsolute() ); 663 664 OutputStream out = null; 665 666 try 667 { 668 out = FileUtils.openOutputStream( dest ); 669 IOUtils.copy( in, out ); 670 suppressExceptionOnClose = false; 671 } 672 finally 673 { 674 try 675 { 676 if ( out != null ) 677 { 678 out.close(); 679 } 680 681 suppressExceptionOnClose = true; 682 } 683 catch ( final IOException ex ) 684 { 685 if ( !suppressExceptionOnClose ) 686 { 687 throw ex; 688 } 689 } 690 } 691 692 in.closeEntry(); 693 } 694 695 suppressExceptionOnClose = false; 696 } 697 finally 698 { 699 try 700 { 701 if ( in != null ) 702 { 703 in.close(); 704 } 705 } 706 catch ( final IOException e ) 707 { 708 if ( !suppressExceptionOnClose ) 709 { 710 throw e; 711 } 712 } 713 } 714 } 715 716 // SECTION-END 717 // SECTION-START[Constructors] 718 // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> 719 /** Creates a new {@code JomcTest} instance. */ 720 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 721 public JomcTest() 722 { 723 // SECTION-START[Default Constructor] 724 super(); 725 // SECTION-END 726 } 727 // </editor-fold> 728 // SECTION-END 729 // SECTION-START[Dependencies] 730 // SECTION-END 731 // SECTION-START[Properties] 732 // <editor-fold defaultstate="collapsed" desc=" Generated Properties "> 733 /** 734 * Gets the value of the {@code <classesDirectory>} property. 735 * <p><dl> 736 * <dt><b>Final:</b></dt><dd>No</dd> 737 * </dl></p> 738 * @return Directory holding class files. 739 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 740 */ 741 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 742 private java.io.File getClassesDirectory() 743 { 744 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "classesDirectory" ); 745 assert _p != null : "'classesDirectory' property not found."; 746 return _p; 747 } 748 /** 749 * Gets the value of the {@code <resourcesDirectory>} property. 750 * <p><dl> 751 * <dt><b>Final:</b></dt><dd>No</dd> 752 * </dl></p> 753 * @return Directory holding resources. 754 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 755 */ 756 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 757 private java.io.File getResourcesDirectory() 758 { 759 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "resourcesDirectory" ); 760 assert _p != null : "'resourcesDirectory' property not found."; 761 return _p; 762 } 763 /** 764 * Gets the value of the {@code <templatesDirectory>} property. 765 * <p><dl> 766 * <dt><b>Final:</b></dt><dd>No</dd> 767 * </dl></p> 768 * @return Directory holding templates. 769 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 770 */ 771 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 772 private java.io.File getTemplatesDirectory() 773 { 774 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "templatesDirectory" ); 775 assert _p != null : "'templatesDirectory' property not found."; 776 return _p; 777 } 778 /** 779 * Gets the value of the {@code <testClassesDirectory>} property. 780 * <p><dl> 781 * <dt><b>Final:</b></dt><dd>No</dd> 782 * </dl></p> 783 * @return Directory holding class files to commit to and to validate. 784 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 785 */ 786 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 787 private java.io.File getTestClassesDirectory() 788 { 789 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testClassesDirectory" ); 790 assert _p != null : "'testClassesDirectory' property not found."; 791 return _p; 792 } 793 /** 794 * Gets the value of the {@code <testModelDocument>} property. 795 * <p><dl> 796 * <dt><b>Final:</b></dt><dd>No</dd> 797 * </dl></p> 798 * @return Valid model document. 799 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 800 */ 801 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 802 private java.io.File getTestModelDocument() 803 { 804 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelDocument" ); 805 assert _p != null : "'testModelDocument' property not found."; 806 return _p; 807 } 808 /** 809 * Gets the value of the {@code <testModelDocumentIllegal>} property. 810 * <p><dl> 811 * <dt><b>Final:</b></dt><dd>No</dd> 812 * </dl></p> 813 * @return Model document with invalid model. 814 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 815 */ 816 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 817 private java.io.File getTestModelDocumentIllegal() 818 { 819 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelDocumentIllegal" ); 820 assert _p != null : "'testModelDocumentIllegal' property not found."; 821 return _p; 822 } 823 /** 824 * Gets the value of the {@code <testModelDocumentIllegalSchemaConstraints>} property. 825 * <p><dl> 826 * <dt><b>Final:</b></dt><dd>No</dd> 827 * </dl></p> 828 * @return Model document not valid to the JOMC JAXP schema. 829 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 830 */ 831 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 832 private java.io.File getTestModelDocumentIllegalSchemaConstraints() 833 { 834 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelDocumentIllegalSchemaConstraints" ); 835 assert _p != null : "'testModelDocumentIllegalSchemaConstraints' property not found."; 836 return _p; 837 } 838 /** 839 * Gets the value of the {@code <testModelDocumentNonExistentClasses>} property. 840 * <p><dl> 841 * <dt><b>Final:</b></dt><dd>No</dd> 842 * </dl></p> 843 * @return Model document referencing non-existent classes. 844 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 845 */ 846 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 847 private java.io.File getTestModelDocumentNonExistentClasses() 848 { 849 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelDocumentNonExistentClasses" ); 850 assert _p != null : "'testModelDocumentNonExistentClasses' property not found."; 851 return _p; 852 } 853 /** 854 * Gets the value of the {@code <testModelOutputDocument>} property. 855 * <p><dl> 856 * <dt><b>Final:</b></dt><dd>No</dd> 857 * </dl></p> 858 * @return File to write a transformed model to. 859 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 860 */ 861 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 862 private java.io.File getTestModelOutputDocument() 863 { 864 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelOutputDocument" ); 865 assert _p != null : "'testModelOutputDocument' property not found."; 866 return _p; 867 } 868 /** 869 * Gets the value of the {@code <testModelStylesheet>} property. 870 * <p><dl> 871 * <dt><b>Final:</b></dt><dd>No</dd> 872 * </dl></p> 873 * @return Valid model object stylesheet. 874 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 875 */ 876 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 877 private java.io.File getTestModelStylesheet() 878 { 879 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelStylesheet" ); 880 assert _p != null : "'testModelStylesheet' property not found."; 881 return _p; 882 } 883 /** 884 * Gets the value of the {@code <testModletName>} property. 885 * <p><dl> 886 * <dt><b>Final:</b></dt><dd>No</dd> 887 * </dl></p> 888 * @return Test module name. 889 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 890 */ 891 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 892 private java.lang.String getTestModletName() 893 { 894 final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModletName" ); 895 assert _p != null : "'testModletName' property not found."; 896 return _p; 897 } 898 /** 899 * Gets the value of the {@code <testModletOutputDocument>} property. 900 * <p><dl> 901 * <dt><b>Final:</b></dt><dd>No</dd> 902 * </dl></p> 903 * @return File to write a transformed modlet to. 904 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 905 */ 906 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 907 private java.io.File getTestModletOutputDocument() 908 { 909 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModletOutputDocument" ); 910 assert _p != null : "'testModletOutputDocument' property not found."; 911 return _p; 912 } 913 /** 914 * Gets the value of the {@code <testModletStylesheet>} property. 915 * <p><dl> 916 * <dt><b>Final:</b></dt><dd>No</dd> 917 * </dl></p> 918 * @return Valid modlet object stylesheet. 919 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 920 */ 921 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 922 private java.io.File getTestModletStylesheet() 923 { 924 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModletStylesheet" ); 925 assert _p != null : "'testModletStylesheet' property not found."; 926 return _p; 927 } 928 /** 929 * Gets the value of the {@code <testModuleName>} property. 930 * <p><dl> 931 * <dt><b>Final:</b></dt><dd>No</dd> 932 * </dl></p> 933 * @return Test module name. 934 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 935 */ 936 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 937 private java.lang.String getTestModuleName() 938 { 939 final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModuleName" ); 940 assert _p != null : "'testModuleName' property not found."; 941 return _p; 942 } 943 /** 944 * Gets the value of the {@code <testResourcesDirectory>} property. 945 * <p><dl> 946 * <dt><b>Final:</b></dt><dd>No</dd> 947 * </dl></p> 948 * @return Directory to generate resources to. 949 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 950 */ 951 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 952 private java.io.File getTestResourcesDirectory() 953 { 954 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testResourcesDirectory" ); 955 assert _p != null : "'testResourcesDirectory' property not found."; 956 return _p; 957 } 958 /** 959 * Gets the value of the {@code <testShowInstanceOutputDocument>} property. 960 * <p><dl> 961 * <dt><b>Final:</b></dt><dd>No</dd> 962 * </dl></p> 963 * @return File to write an instance to. 964 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 965 */ 966 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 967 private java.io.File getTestShowInstanceOutputDocument() 968 { 969 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testShowInstanceOutputDocument" ); 970 assert _p != null : "'testShowInstanceOutputDocument' property not found."; 971 return _p; 972 } 973 /** 974 * Gets the value of the {@code <testShowModelOutputDocument>} property. 975 * <p><dl> 976 * <dt><b>Final:</b></dt><dd>No</dd> 977 * </dl></p> 978 * @return File to write a model to. 979 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 980 */ 981 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 982 private java.io.File getTestShowModelOutputDocument() 983 { 984 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testShowModelOutputDocument" ); 985 assert _p != null : "'testShowModelOutputDocument' property not found."; 986 return _p; 987 } 988 /** 989 * Gets the value of the {@code <testShowSpecificationAndInstanceOutputDocument>} property. 990 * <p><dl> 991 * <dt><b>Final:</b></dt><dd>No</dd> 992 * </dl></p> 993 * @return File to write a model holding a specification and an instance to. 994 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 995 */ 996 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 997 private java.io.File getTestShowSpecificationAndInstanceOutputDocument() 998 { 999 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testShowSpecificationAndInstanceOutputDocument" ); 1000 assert _p != null : "'testShowSpecificationAndInstanceOutputDocument' property not found."; 1001 return _p; 1002 } 1003 /** 1004 * Gets the value of the {@code <testShowSpecificationOutputDocument>} property. 1005 * <p><dl> 1006 * <dt><b>Final:</b></dt><dd>No</dd> 1007 * </dl></p> 1008 * @return File to write a specification to. 1009 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 1010 */ 1011 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 1012 private java.io.File getTestShowSpecificationOutputDocument() 1013 { 1014 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testShowSpecificationOutputDocument" ); 1015 assert _p != null : "'testShowSpecificationOutputDocument' property not found."; 1016 return _p; 1017 } 1018 /** 1019 * Gets the value of the {@code <testSourcesDirectory>} property. 1020 * <p><dl> 1021 * <dt><b>Final:</b></dt><dd>No</dd> 1022 * </dl></p> 1023 * @return Directory holding source code files to manage. 1024 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 1025 */ 1026 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" ) 1027 private java.io.File getTestSourcesDirectory() 1028 { 1029 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testSourcesDirectory" ); 1030 assert _p != null : "'testSourcesDirectory' property not found."; 1031 return _p; 1032 } 1033 // </editor-fold> 1034 // SECTION-END 1035 // SECTION-START[Messages] 1036 // SECTION-END 1037 }