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 4588 2012-06-03 06:01:30Z schulte2005 $
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</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.3
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.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
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() + '"', "-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.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.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    @SuppressWarnings("unused")
742    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
743    private java.io.File getClassesDirectory()
744    {
745        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "classesDirectory" );
746        assert _p != null : "'classesDirectory' property not found.";
747        return _p;
748    }
749    /**
750     * Gets the value of the {@code <resourcesDirectory>} property.
751     * <p><dl>
752     *   <dt><b>Final:</b></dt><dd>No</dd>
753     * </dl></p>
754     * @return Directory holding resources.
755     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
756     */
757    @SuppressWarnings("unused")
758    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
759    private java.io.File getResourcesDirectory()
760    {
761        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "resourcesDirectory" );
762        assert _p != null : "'resourcesDirectory' property not found.";
763        return _p;
764    }
765    /**
766     * Gets the value of the {@code <templatesDirectory>} property.
767     * <p><dl>
768     *   <dt><b>Final:</b></dt><dd>No</dd>
769     * </dl></p>
770     * @return Directory holding templates.
771     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
772     */
773    @SuppressWarnings("unused")
774    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
775    private java.io.File getTemplatesDirectory()
776    {
777        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "templatesDirectory" );
778        assert _p != null : "'templatesDirectory' property not found.";
779        return _p;
780    }
781    /**
782     * Gets the value of the {@code <testClassesDirectory>} property.
783     * <p><dl>
784     *   <dt><b>Final:</b></dt><dd>No</dd>
785     * </dl></p>
786     * @return Directory holding class files to commit to and to validate.
787     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
788     */
789    @SuppressWarnings("unused")
790    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
791    private java.io.File getTestClassesDirectory()
792    {
793        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testClassesDirectory" );
794        assert _p != null : "'testClassesDirectory' property not found.";
795        return _p;
796    }
797    /**
798     * Gets the value of the {@code <testModelDocument>} property.
799     * <p><dl>
800     *   <dt><b>Final:</b></dt><dd>No</dd>
801     * </dl></p>
802     * @return Valid model document.
803     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
804     */
805    @SuppressWarnings("unused")
806    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
807    private java.io.File getTestModelDocument()
808    {
809        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelDocument" );
810        assert _p != null : "'testModelDocument' property not found.";
811        return _p;
812    }
813    /**
814     * Gets the value of the {@code <testModelDocumentIllegal>} property.
815     * <p><dl>
816     *   <dt><b>Final:</b></dt><dd>No</dd>
817     * </dl></p>
818     * @return Model document with invalid model.
819     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
820     */
821    @SuppressWarnings("unused")
822    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
823    private java.io.File getTestModelDocumentIllegal()
824    {
825        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelDocumentIllegal" );
826        assert _p != null : "'testModelDocumentIllegal' property not found.";
827        return _p;
828    }
829    /**
830     * Gets the value of the {@code <testModelDocumentIllegalSchemaConstraints>} property.
831     * <p><dl>
832     *   <dt><b>Final:</b></dt><dd>No</dd>
833     * </dl></p>
834     * @return Model document not valid to the JOMC JAXP schema.
835     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
836     */
837    @SuppressWarnings("unused")
838    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
839    private java.io.File getTestModelDocumentIllegalSchemaConstraints()
840    {
841        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelDocumentIllegalSchemaConstraints" );
842        assert _p != null : "'testModelDocumentIllegalSchemaConstraints' property not found.";
843        return _p;
844    }
845    /**
846     * Gets the value of the {@code <testModelDocumentNonExistentClasses>} property.
847     * <p><dl>
848     *   <dt><b>Final:</b></dt><dd>No</dd>
849     * </dl></p>
850     * @return Model document referencing non-existent classes.
851     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
852     */
853    @SuppressWarnings("unused")
854    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
855    private java.io.File getTestModelDocumentNonExistentClasses()
856    {
857        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelDocumentNonExistentClasses" );
858        assert _p != null : "'testModelDocumentNonExistentClasses' property not found.";
859        return _p;
860    }
861    /**
862     * Gets the value of the {@code <testModelOutputDocument>} property.
863     * <p><dl>
864     *   <dt><b>Final:</b></dt><dd>No</dd>
865     * </dl></p>
866     * @return File to write a transformed model to.
867     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
868     */
869    @SuppressWarnings("unused")
870    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
871    private java.io.File getTestModelOutputDocument()
872    {
873        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelOutputDocument" );
874        assert _p != null : "'testModelOutputDocument' property not found.";
875        return _p;
876    }
877    /**
878     * Gets the value of the {@code <testModelStylesheet>} property.
879     * <p><dl>
880     *   <dt><b>Final:</b></dt><dd>No</dd>
881     * </dl></p>
882     * @return Valid model object stylesheet.
883     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
884     */
885    @SuppressWarnings("unused")
886    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
887    private java.io.File getTestModelStylesheet()
888    {
889        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModelStylesheet" );
890        assert _p != null : "'testModelStylesheet' property not found.";
891        return _p;
892    }
893    /**
894     * Gets the value of the {@code <testModletName>} property.
895     * <p><dl>
896     *   <dt><b>Final:</b></dt><dd>No</dd>
897     * </dl></p>
898     * @return Test module name.
899     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
900     */
901    @SuppressWarnings("unused")
902    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
903    private java.lang.String getTestModletName()
904    {
905        final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModletName" );
906        assert _p != null : "'testModletName' property not found.";
907        return _p;
908    }
909    /**
910     * Gets the value of the {@code <testModletOutputDocument>} property.
911     * <p><dl>
912     *   <dt><b>Final:</b></dt><dd>No</dd>
913     * </dl></p>
914     * @return File to write a transformed modlet to.
915     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
916     */
917    @SuppressWarnings("unused")
918    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
919    private java.io.File getTestModletOutputDocument()
920    {
921        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModletOutputDocument" );
922        assert _p != null : "'testModletOutputDocument' property not found.";
923        return _p;
924    }
925    /**
926     * Gets the value of the {@code <testModletStylesheet>} property.
927     * <p><dl>
928     *   <dt><b>Final:</b></dt><dd>No</dd>
929     * </dl></p>
930     * @return Valid modlet object stylesheet.
931     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
932     */
933    @SuppressWarnings("unused")
934    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
935    private java.io.File getTestModletStylesheet()
936    {
937        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModletStylesheet" );
938        assert _p != null : "'testModletStylesheet' property not found.";
939        return _p;
940    }
941    /**
942     * Gets the value of the {@code <testModuleName>} property.
943     * <p><dl>
944     *   <dt><b>Final:</b></dt><dd>No</dd>
945     * </dl></p>
946     * @return Test module name.
947     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
948     */
949    @SuppressWarnings("unused")
950    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
951    private java.lang.String getTestModuleName()
952    {
953        final java.lang.String _p = (java.lang.String) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testModuleName" );
954        assert _p != null : "'testModuleName' property not found.";
955        return _p;
956    }
957    /**
958     * Gets the value of the {@code <testResourcesDirectory>} property.
959     * <p><dl>
960     *   <dt><b>Final:</b></dt><dd>No</dd>
961     * </dl></p>
962     * @return Directory to generate resources to.
963     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
964     */
965    @SuppressWarnings("unused")
966    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
967    private java.io.File getTestResourcesDirectory()
968    {
969        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testResourcesDirectory" );
970        assert _p != null : "'testResourcesDirectory' property not found.";
971        return _p;
972    }
973    /**
974     * Gets the value of the {@code <testShowInstanceOutputDocument>} property.
975     * <p><dl>
976     *   <dt><b>Final:</b></dt><dd>No</dd>
977     * </dl></p>
978     * @return File to write an instance to.
979     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
980     */
981    @SuppressWarnings("unused")
982    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
983    private java.io.File getTestShowInstanceOutputDocument()
984    {
985        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testShowInstanceOutputDocument" );
986        assert _p != null : "'testShowInstanceOutputDocument' property not found.";
987        return _p;
988    }
989    /**
990     * Gets the value of the {@code <testShowModelOutputDocument>} property.
991     * <p><dl>
992     *   <dt><b>Final:</b></dt><dd>No</dd>
993     * </dl></p>
994     * @return File to write a model to.
995     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
996     */
997    @SuppressWarnings("unused")
998    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
999    private java.io.File getTestShowModelOutputDocument()
1000    {
1001        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testShowModelOutputDocument" );
1002        assert _p != null : "'testShowModelOutputDocument' property not found.";
1003        return _p;
1004    }
1005    /**
1006     * Gets the value of the {@code <testShowSpecificationAndInstanceOutputDocument>} property.
1007     * <p><dl>
1008     *   <dt><b>Final:</b></dt><dd>No</dd>
1009     * </dl></p>
1010     * @return File to write a model holding a specification and an instance to.
1011     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
1012     */
1013    @SuppressWarnings("unused")
1014    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
1015    private java.io.File getTestShowSpecificationAndInstanceOutputDocument()
1016    {
1017        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testShowSpecificationAndInstanceOutputDocument" );
1018        assert _p != null : "'testShowSpecificationAndInstanceOutputDocument' property not found.";
1019        return _p;
1020    }
1021    /**
1022     * Gets the value of the {@code <testShowSpecificationOutputDocument>} property.
1023     * <p><dl>
1024     *   <dt><b>Final:</b></dt><dd>No</dd>
1025     * </dl></p>
1026     * @return File to write a specification to.
1027     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
1028     */
1029    @SuppressWarnings("unused")
1030    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
1031    private java.io.File getTestShowSpecificationOutputDocument()
1032    {
1033        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testShowSpecificationOutputDocument" );
1034        assert _p != null : "'testShowSpecificationOutputDocument' property not found.";
1035        return _p;
1036    }
1037    /**
1038     * Gets the value of the {@code <testSourcesDirectory>} property.
1039     * <p><dl>
1040     *   <dt><b>Final:</b></dt><dd>No</dd>
1041     * </dl></p>
1042     * @return Directory holding source code files to manage.
1043     * @throws org.jomc.ObjectManagementException if getting the property instance fails.
1044     */
1045    @SuppressWarnings("unused")
1046    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
1047    private java.io.File getTestSourcesDirectory()
1048    {
1049        final java.io.File _p = (java.io.File) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getProperty( this, "testSourcesDirectory" );
1050        assert _p != null : "'testSourcesDirectory' property not found.";
1051        return _p;
1052    }
1053    // </editor-fold>
1054    // SECTION-END
1055    // SECTION-START[Messages]
1056    // SECTION-END
1057}