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 4756 2013-01-04 08:01:00Z schulte $ 032 * 033 */ 034// </editor-fold> 035// SECTION-END 036package org.jomc.cli.test; 037 038import java.io.File; 039import java.io.IOException; 040import java.io.OutputStream; 041import java.net.URI; 042import java.net.URL; 043import java.util.zip.ZipEntry; 044import java.util.zip.ZipInputStream; 045import javax.xml.bind.JAXBElement; 046import javax.xml.bind.Unmarshaller; 047import javax.xml.transform.stream.StreamSource; 048import javax.xml.validation.Schema; 049import org.apache.commons.io.FileUtils; 050import org.apache.commons.io.IOUtils; 051import org.jomc.ObjectManagerFactory; 052import org.jomc.cli.Command; 053import org.jomc.cli.Jomc; 054import org.jomc.model.ModelObject; 055import org.jomc.model.Module; 056import org.jomc.modlet.ModelContext; 057import org.jomc.modlet.ModelContextFactory; 058import org.jomc.modlet.Modlet; 059import org.jomc.modlet.ModletObject; 060import org.junit.Before; 061import org.junit.Test; 062import static org.junit.Assert.assertEquals; 063import static org.junit.Assert.assertFalse; 064import static org.junit.Assert.assertNotNull; 065import static org.junit.Assert.assertNull; 066import 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 ⁑ JomcTest</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:cs@schulte.it">Christian Schulte</a> 1.0 082 * @version 1.4.1 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.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 089// </editor-fold> 090// SECTION-END 091public 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() + '"', 479 "-mdexc=\"JOMC ⁑ Model" + File.pathSeparatorChar + "JOMC ⁑ Tools" + File.pathSeparatorChar 480 + "JOMC ⁑ Modlet\"", "-cp", "." 481 }; 482 483 final String[] unsupportedOption = new String[] 484 { 485 "merge-modlets", "--unsupported-option" 486 }; 487 488 assertEquals( Command.STATUS_SUCCESS, Jomc.run( help ) ); 489 assertEquals( Command.STATUS_FAILURE, Jomc.run( unsupportedOption ) ); 490 491 assertEquals( Command.STATUS_SUCCESS, Jomc.run( args ) ); 492 Modlet merged = unmarshaller.unmarshal( 493 new StreamSource( this.getTestModletOutputDocument() ), Modlet.class ).getValue(); 494 495 assertNotNull( merged ); 496 assertEquals( this.getTestModletName(), merged.getName() ); 497 assertNotNull( merged.getSchemas() ); 498 assertNotNull( merged.getServices() ); 499 assertEquals( 2, merged.getSchemas().getSchema().size() ); 500 assertEquals( 6, merged.getServices().getService().size() ); 501 assertFalse( merged.getSchemas().getSchemasByPublicId( new URI( "http://jomc.org/model" ) ).isEmpty() ); 502 assertFalse( merged.getSchemas().getSchemasByPublicId( new URI( "http://jomc.org/tools/model" ) ).isEmpty() ); 503 assertEquals( 2, merged.getServices().getServices( "org.jomc.modlet.ModelProvider" ).size() ); 504 assertEquals( 2, merged.getServices().getServices( "org.jomc.modlet.ModelProcessor" ).size() ); 505 assertEquals( 2, merged.getServices().getServices( "org.jomc.modlet.ModelValidator" ).size() ); 506 507 assertEquals( Command.STATUS_SUCCESS, Jomc.run( includeArgs ) ); 508 merged = unmarshaller.unmarshal( 509 new StreamSource( this.getTestModletOutputDocument() ), Modlet.class ).getValue(); 510 511 assertNotNull( merged ); 512 assertEquals( this.getTestModletName(), merged.getName() ); 513 assertNotNull( merged.getSchemas() ); 514 assertNotNull( merged.getServices() ); 515 assertEquals( 1, merged.getSchemas().getSchema().size() ); 516 assertFalse( merged.getSchemas().getSchemasByPublicId( new URI( "http://jomc.org/model" ) ).isEmpty() ); 517 assertEquals( 3, merged.getServices().getService().size() ); 518 assertEquals( 1, merged.getServices().getServices( "org.jomc.modlet.ModelProvider" ).size() ); 519 assertEquals( 1, merged.getServices().getServices( "org.jomc.modlet.ModelProcessor" ).size() ); 520 assertEquals( 1, merged.getServices().getServices( "org.jomc.modlet.ModelValidator" ).size() ); 521 522 assertEquals( Command.STATUS_SUCCESS, Jomc.run( excludeArgs ) ); 523 merged = unmarshaller.unmarshal( 524 new StreamSource( this.getTestModletOutputDocument() ), Modlet.class ).getValue(); 525 526 assertNotNull( merged ); 527 assertEquals( this.getTestModletName(), merged.getName() ); 528 assertNull( merged.getSchemas() ); 529 assertNull( merged.getServices() ); 530 } 531 532 @Test 533 public final void testShowModel() throws Exception 534 { 535 final File classesDirectory = new File( this.getOutputDirectory(), "jomc-test-classes" ); 536 537 final String[] help = new String[] 538 { 539 "show-model", "help" 540 }; 541 542 final String[] showModel = new String[] 543 { 544 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"' 545 }; 546 547 final String[] writeModel = new String[] 548 { 549 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-d", 550 '"' + this.getTestShowModelOutputDocument().getAbsolutePath() + '"' 551 }; 552 553 final String[] showSpecification = new String[] 554 { 555 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-spec=\"JOMC ⁑ CLI ⁑ Command\"" 556 }; 557 558 final String[] writeSpecification = new String[] 559 { 560 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-spec=\"JOMC ⁑ CLI ⁑ Command\"", 561 "-d", '"' + this.getTestShowSpecificationOutputDocument().getAbsolutePath() + '"' 562 }; 563 564 final String[] showInstance = new String[] 565 { 566 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', 567 "-impl=\"JOMC ⁑ CLI ⁑ Default show-model Command\"" 568 }; 569 570 final String[] writeInstance = new String[] 571 { 572 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', 573 "-impl=\"JOMC ⁑ CLI ⁑ Default show-model Command\"", 574 "-d", '"' + this.getTestShowInstanceOutputDocument().getAbsolutePath() + '"' 575 }; 576 577 final String[] showSpecificationAndInstance = new String[] 578 { 579 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', "-spec=\"JOMC ⁑ CLI ⁑ Command\"", 580 "-impl=\"JOMC ⁑ CLI ⁑ Default show-model Command\"" 581 }; 582 583 final String[] writeSpecificationAndInstance = new String[] 584 { 585 "show-model", "-cp", '"' + classesDirectory.getAbsolutePath() + '"', 586 "-spec=\"JOMC ⁑ CLI ⁑ Command\"", 587 "-impl=\"JOMC ⁑ CLI ⁑ Default show-model Command\"", "-d", 588 '"' + this.getTestShowSpecificationAndInstanceOutputDocument().getAbsolutePath() + '"' 589 }; 590 591 final String[] unsupportedOption = new String[] 592 { 593 "show-model", "--unsupported-option" 594 }; 595 596 assertEquals( Command.STATUS_SUCCESS, Jomc.run( help ) ); 597 assertEquals( Command.STATUS_SUCCESS, Jomc.run( showModel ) ); 598 assertEquals( Command.STATUS_SUCCESS, Jomc.run( writeModel ) ); 599 assertEquals( Command.STATUS_SUCCESS, Jomc.run( showInstance ) ); 600 assertEquals( Command.STATUS_SUCCESS, Jomc.run( writeInstance ) ); 601 assertEquals( Command.STATUS_SUCCESS, Jomc.run( showSpecification ) ); 602 assertEquals( Command.STATUS_SUCCESS, Jomc.run( writeSpecification ) ); 603 assertEquals( Command.STATUS_SUCCESS, Jomc.run( showSpecificationAndInstance ) ); 604 assertEquals( Command.STATUS_SUCCESS, Jomc.run( writeSpecificationAndInstance ) ); 605 assertEquals( Command.STATUS_FAILURE, Jomc.run( unsupportedOption ) ); 606 } 607 608 @Before 609 public void setUp() throws IOException 610 { 611 // Ensures the singleton is initialized prior to class Jomc switching resource locations. 612 ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ); 613 614 final File f = this.getOutputDirectory(); 615 if ( !f.exists() ) 616 { 617 assertTrue( f.mkdirs() ); 618 } 619 620 final File resourcesDirectory = this.getResourcesDirectory(); 621 assertTrue( resourcesDirectory.isAbsolute() ); 622 FileUtils.deleteDirectory( resourcesDirectory ); 623 assertTrue( resourcesDirectory.mkdirs() ); 624 625 for ( String testResourceName : TEST_RESOURCE_NAMES ) 626 { 627 final URL rsrc = this.getClass().getResource( ABSOLUTE_RESOURCE_NAME_PREFIX + testResourceName ); 628 assertNotNull( rsrc ); 629 FileUtils.copyURLToFile( rsrc, new File( resourcesDirectory, testResourceName ) ); 630 } 631 632 final File classesDirectory = this.getClassesDirectory(); 633 this.unzipResource( ABSOLUTE_RESOURCE_NAME_PREFIX + "classfiles.zip", classesDirectory ); 634 635 final File templatesDirectory = this.getTemplatesDirectory(); 636 this.unzipResource( ABSOLUTE_RESOURCE_NAME_PREFIX + "templates.zip", templatesDirectory ); 637 } 638 639 private void unzipResource( final String resourceName, final File targetDirectory ) throws IOException 640 { 641 assertTrue( resourceName.startsWith( "/" ) ); 642 final URL resource = this.getClass().getResource( resourceName ); 643 assertNotNull( "Expected '" + resourceName + "' not found.", resource ); 644 645 assertTrue( targetDirectory.isAbsolute() ); 646 FileUtils.deleteDirectory( targetDirectory ); 647 assertTrue( targetDirectory.mkdirs() ); 648 649 ZipInputStream in = null; 650 boolean suppressExceptionOnClose = true; 651 652 try 653 { 654 in = new ZipInputStream( resource.openStream() ); 655 ZipEntry e; 656 657 while ( ( e = in.getNextEntry() ) != null ) 658 { 659 if ( e.isDirectory() ) 660 { 661 continue; 662 } 663 664 final File dest = new File( targetDirectory, e.getName() ); 665 assertTrue( dest.isAbsolute() ); 666 667 OutputStream out = null; 668 669 try 670 { 671 out = FileUtils.openOutputStream( dest ); 672 IOUtils.copy( in, out ); 673 suppressExceptionOnClose = false; 674 } 675 finally 676 { 677 try 678 { 679 if ( out != null ) 680 { 681 out.close(); 682 } 683 684 suppressExceptionOnClose = true; 685 } 686 catch ( final IOException ex ) 687 { 688 if ( !suppressExceptionOnClose ) 689 { 690 throw ex; 691 } 692 } 693 } 694 695 in.closeEntry(); 696 } 697 698 suppressExceptionOnClose = false; 699 } 700 finally 701 { 702 try 703 { 704 if ( in != null ) 705 { 706 in.close(); 707 } 708 } 709 catch ( final IOException e ) 710 { 711 if ( !suppressExceptionOnClose ) 712 { 713 throw e; 714 } 715 } 716 } 717 } 718 719 // SECTION-END 720 // SECTION-START[Constructors] 721 // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> 722 /** Creates a new {@code JomcTest} instance. */ 723 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 724 public JomcTest() 725 { 726 // SECTION-START[Default Constructor] 727 super(); 728 // SECTION-END 729 } 730 // </editor-fold> 731 // SECTION-END 732 // SECTION-START[Dependencies] 733 // SECTION-END 734 // SECTION-START[Properties] 735 // <editor-fold defaultstate="collapsed" desc=" Generated Properties "> 736 /** 737 * Gets the value of the {@code <Classes Directory>} property. 738 * <p><dl> 739 * <dt><b>Final:</b></dt><dd>No</dd> 740 * </dl></p> 741 * @return Directory holding class files. 742 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 743 */ 744 @SuppressWarnings("unused") 745 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 746 private java.io.File getClassesDirectory() 747 { 748 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Classes Directory" ); 749 assert _p != null : "'Classes Directory' property not found."; 750 return _p; 751 } 752 /** 753 * Gets the value of the {@code <Resources Directory>} property. 754 * <p><dl> 755 * <dt><b>Final:</b></dt><dd>No</dd> 756 * </dl></p> 757 * @return Directory holding resources. 758 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 759 */ 760 @SuppressWarnings("unused") 761 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 762 private java.io.File getResourcesDirectory() 763 { 764 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Resources Directory" ); 765 assert _p != null : "'Resources Directory' property not found."; 766 return _p; 767 } 768 /** 769 * Gets the value of the {@code <Templates Directory>} property. 770 * <p><dl> 771 * <dt><b>Final:</b></dt><dd>No</dd> 772 * </dl></p> 773 * @return Directory holding templates. 774 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 775 */ 776 @SuppressWarnings("unused") 777 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 778 private java.io.File getTemplatesDirectory() 779 { 780 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Templates Directory" ); 781 assert _p != null : "'Templates Directory' property not found."; 782 return _p; 783 } 784 /** 785 * Gets the value of the {@code <Test Classes Directory>} property. 786 * <p><dl> 787 * <dt><b>Final:</b></dt><dd>No</dd> 788 * </dl></p> 789 * @return Directory holding class files to commit to and to validate. 790 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 791 */ 792 @SuppressWarnings("unused") 793 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 794 private java.io.File getTestClassesDirectory() 795 { 796 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Classes Directory" ); 797 assert _p != null : "'Test Classes Directory' property not found."; 798 return _p; 799 } 800 /** 801 * Gets the value of the {@code <Test Model Document>} property. 802 * <p><dl> 803 * <dt><b>Final:</b></dt><dd>No</dd> 804 * </dl></p> 805 * @return Valid model document. 806 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 807 */ 808 @SuppressWarnings("unused") 809 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 810 private java.io.File getTestModelDocument() 811 { 812 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Model Document" ); 813 assert _p != null : "'Test Model Document' property not found."; 814 return _p; 815 } 816 /** 817 * Gets the value of the {@code <Test Model Document Illegal>} property. 818 * <p><dl> 819 * <dt><b>Final:</b></dt><dd>No</dd> 820 * </dl></p> 821 * @return Model document with invalid model. 822 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 823 */ 824 @SuppressWarnings("unused") 825 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 826 private java.io.File getTestModelDocumentIllegal() 827 { 828 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Model Document Illegal" ); 829 assert _p != null : "'Test Model Document Illegal' property not found."; 830 return _p; 831 } 832 /** 833 * Gets the value of the {@code <Test Model Document Illegal Schema Constraints>} property. 834 * <p><dl> 835 * <dt><b>Final:</b></dt><dd>No</dd> 836 * </dl></p> 837 * @return Model document not valid to the JOMC JAXP schema. 838 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 839 */ 840 @SuppressWarnings("unused") 841 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 842 private java.io.File getTestModelDocumentIllegalSchemaConstraints() 843 { 844 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Model Document Illegal Schema Constraints" ); 845 assert _p != null : "'Test Model Document Illegal Schema Constraints' property not found."; 846 return _p; 847 } 848 /** 849 * Gets the value of the {@code <Test Model Document Non Existent Classes>} property. 850 * <p><dl> 851 * <dt><b>Final:</b></dt><dd>No</dd> 852 * </dl></p> 853 * @return Model document referencing non-existent classes. 854 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 855 */ 856 @SuppressWarnings("unused") 857 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 858 private java.io.File getTestModelDocumentNonExistentClasses() 859 { 860 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Model Document Non Existent Classes" ); 861 assert _p != null : "'Test Model Document Non Existent Classes' property not found."; 862 return _p; 863 } 864 /** 865 * Gets the value of the {@code <Test Model Output Document>} property. 866 * <p><dl> 867 * <dt><b>Final:</b></dt><dd>No</dd> 868 * </dl></p> 869 * @return File to write a transformed model to. 870 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 871 */ 872 @SuppressWarnings("unused") 873 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 874 private java.io.File getTestModelOutputDocument() 875 { 876 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Model Output Document" ); 877 assert _p != null : "'Test Model Output Document' property not found."; 878 return _p; 879 } 880 /** 881 * Gets the value of the {@code <Test Model Stylesheet>} property. 882 * <p><dl> 883 * <dt><b>Final:</b></dt><dd>No</dd> 884 * </dl></p> 885 * @return Valid model object stylesheet. 886 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 887 */ 888 @SuppressWarnings("unused") 889 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 890 private java.io.File getTestModelStylesheet() 891 { 892 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Model Stylesheet" ); 893 assert _p != null : "'Test Model Stylesheet' property not found."; 894 return _p; 895 } 896 /** 897 * Gets the value of the {@code <Test Modlet Name>} property. 898 * <p><dl> 899 * <dt><b>Final:</b></dt><dd>No</dd> 900 * </dl></p> 901 * @return Test module name. 902 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 903 */ 904 @SuppressWarnings("unused") 905 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 906 private java.lang.String getTestModletName() 907 { 908 final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Modlet Name" ); 909 assert _p != null : "'Test Modlet Name' property not found."; 910 return _p; 911 } 912 /** 913 * Gets the value of the {@code <Test Modlet Output Document>} property. 914 * <p><dl> 915 * <dt><b>Final:</b></dt><dd>No</dd> 916 * </dl></p> 917 * @return File to write a transformed modlet to. 918 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 919 */ 920 @SuppressWarnings("unused") 921 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 922 private java.io.File getTestModletOutputDocument() 923 { 924 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Modlet Output Document" ); 925 assert _p != null : "'Test Modlet Output Document' property not found."; 926 return _p; 927 } 928 /** 929 * Gets the value of the {@code <Test Modlet Stylesheet>} property. 930 * <p><dl> 931 * <dt><b>Final:</b></dt><dd>No</dd> 932 * </dl></p> 933 * @return Valid modlet object stylesheet. 934 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 935 */ 936 @SuppressWarnings("unused") 937 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 938 private java.io.File getTestModletStylesheet() 939 { 940 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Modlet Stylesheet" ); 941 assert _p != null : "'Test Modlet Stylesheet' property not found."; 942 return _p; 943 } 944 /** 945 * Gets the value of the {@code <Test Module Name>} property. 946 * <p><dl> 947 * <dt><b>Final:</b></dt><dd>No</dd> 948 * </dl></p> 949 * @return Test module name. 950 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 951 */ 952 @SuppressWarnings("unused") 953 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 954 private java.lang.String getTestModuleName() 955 { 956 final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Module Name" ); 957 assert _p != null : "'Test Module Name' property not found."; 958 return _p; 959 } 960 /** 961 * Gets the value of the {@code <Test Resources Directory>} property. 962 * <p><dl> 963 * <dt><b>Final:</b></dt><dd>No</dd> 964 * </dl></p> 965 * @return Directory to generate resources to. 966 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 967 */ 968 @SuppressWarnings("unused") 969 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 970 private java.io.File getTestResourcesDirectory() 971 { 972 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Resources Directory" ); 973 assert _p != null : "'Test Resources Directory' property not found."; 974 return _p; 975 } 976 /** 977 * Gets the value of the {@code <Test Show Instance Output Document>} property. 978 * <p><dl> 979 * <dt><b>Final:</b></dt><dd>No</dd> 980 * </dl></p> 981 * @return File to write an instance to. 982 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 983 */ 984 @SuppressWarnings("unused") 985 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 986 private java.io.File getTestShowInstanceOutputDocument() 987 { 988 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Show Instance Output Document" ); 989 assert _p != null : "'Test Show Instance Output Document' property not found."; 990 return _p; 991 } 992 /** 993 * Gets the value of the {@code <Test Show Model Output Document>} property. 994 * <p><dl> 995 * <dt><b>Final:</b></dt><dd>No</dd> 996 * </dl></p> 997 * @return File to write a model to. 998 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 999 */ 1000 @SuppressWarnings("unused") 1001 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 1002 private java.io.File getTestShowModelOutputDocument() 1003 { 1004 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Show Model Output Document" ); 1005 assert _p != null : "'Test Show Model Output Document' property not found."; 1006 return _p; 1007 } 1008 /** 1009 * Gets the value of the {@code <Test Show Specification And Instance Output Document>} property. 1010 * <p><dl> 1011 * <dt><b>Final:</b></dt><dd>No</dd> 1012 * </dl></p> 1013 * @return File to write a model holding a specification and an instance to. 1014 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 1015 */ 1016 @SuppressWarnings("unused") 1017 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 1018 private java.io.File getTestShowSpecificationAndInstanceOutputDocument() 1019 { 1020 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Show Specification And Instance Output Document" ); 1021 assert _p != null : "'Test Show Specification And Instance Output Document' property not found."; 1022 return _p; 1023 } 1024 /** 1025 * Gets the value of the {@code <Test Show Specification Output Document>} property. 1026 * <p><dl> 1027 * <dt><b>Final:</b></dt><dd>No</dd> 1028 * </dl></p> 1029 * @return File to write a specification to. 1030 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 1031 */ 1032 @SuppressWarnings("unused") 1033 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 1034 private java.io.File getTestShowSpecificationOutputDocument() 1035 { 1036 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Show Specification Output Document" ); 1037 assert _p != null : "'Test Show Specification Output Document' property not found."; 1038 return _p; 1039 } 1040 /** 1041 * Gets the value of the {@code <Test Sources Directory>} property. 1042 * <p><dl> 1043 * <dt><b>Final:</b></dt><dd>No</dd> 1044 * </dl></p> 1045 * @return Directory holding source code files to manage. 1046 * @throws org.jomc.ObjectManagementException if getting the property instance fails. 1047 */ 1048 @SuppressWarnings("unused") 1049 @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.4", comments = "See http://www.jomc.org/jomc/1.4/jomc-tools-1.4" ) 1050 private java.io.File getTestSourcesDirectory() 1051 { 1052 final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "Test Sources Directory" ); 1053 assert _p != null : "'Test Sources Directory' property not found."; 1054 return _p; 1055 } 1056 // </editor-fold> 1057 // SECTION-END 1058 // SECTION-START[Messages] 1059 // SECTION-END 1060}