vmassol     2004/11/08 12:26:19

  Modified:    
integration/maven/src/plugin-test/testIncludeResources/src/test-cactus/org/apache/maven/cactus/sample
                        ResourcesTest.java
  Log:
  - Added javadoc documentation to explain what the ResourcesTest class does
  - Removed unnecessary methods
  - Added @version tag which is part of our conventions (see 
http://jakarta.apache.org/cactus/participating/coding_conventions.html, point 
10)
  
  Revision  Changes    Path
  1.3       +81 -83    
jakarta-cactus/integration/maven/src/plugin-test/testIncludeResources/src/test-cactus/org/apache/maven/cactus/sample/ResourcesTest.java
  
  Index: ResourcesTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/integration/maven/src/plugin-test/testIncludeResources/src/test-cactus/org/apache/maven/cactus/sample/ResourcesTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResourcesTest.java        8 Nov 2004 00:33:49 -0000       1.2
  +++ ResourcesTest.java        8 Nov 2004 20:26:19 -0000       1.3
  @@ -1,83 +1,81 @@
  -/* 

  - * ========================================================================

  - * 

  - * Copyright 2004 The Apache Software Foundation.

  - *

  - * Licensed under the Apache License, Version 2.0 (the "License");

  - * you may not use this file except in compliance with the License.

  - * You may obtain a copy of the License at

  - * 

  - *   http://www.apache.org/licenses/LICENSE-2.0

  - * 

  - * Unless required by applicable law or agreed to in writing, software

  - * distributed under the License is distributed on an "AS IS" BASIS,

  - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  - * See the License for the specific language governing permissions and

  - * limitations under the License.

  - * 

  - * ========================================================================

  - */

  -

  -package org.apache.maven.cactus.sample;

  -

  -import org.apache.cactus.ServletTestCase;

  -import java.io.InputStream;

  -

  -public class ResourcesTest extends ServletTestCase

  -{

  -    public ResourcesTest()

  -    {

  -        super();

  -    }

  -

  -    public ResourcesTest(String name)

  -    {

  -        super(name);

  -    }

  -

  -    private void includesTest( String resource )

  -    {

  -        Thread currentThread = Thread.currentThread();

  -        ClassLoader classLoader = currentThread.getContextClassLoader();

  -        InputStream input = classLoader.getResourceAsStream(resource);

  -        assertNotNull("could not open resource " + resource, input);

  -    }

  -

  -    private void excludesTest( String resource )

  -    {

  -        Thread currentThread = Thread.currentThread();

  -        ClassLoader classLoader = currentThread.getContextClassLoader();

  -        InputStream input = classLoader.getResourceAsStream(resource);

  -        assertNull("should not have opened resource " + resource, input);

  -    }

  -

  -    public void testConfigProperties()

  -    {

  -        includesTest( "test.properties" );

  -    }

  -  

  -    public void testConfigXml()

  -    {

  -        includesTest( "test.xml" );

  -    }

  -    

  -    public void testIncludes()

  -    {

  -        includesTest( "testKO.properties" );

  -    }

  -    

  -    public void testExcludes()

  -    {

  -        excludesTest( "testbad.properties" );

  -    }

  -

  -    public void testRecursive()

  -    {

  -        includesTest( "recursiveResources/test-recursive.properties" );

  -    }

  -    

  -    public void testRecursiveDefault()

  -    {

  -        includesTest( "recursiveResources/test-recursive-default.xml");

  -    }

  -}

  +/* 
  + * ========================================================================
  + * 
  + * Copyright 2004 The Apache Software Foundation.
  + *
  + * Licensed under the Apache License, Version 2.0 (the "License");
  + * you may not use this file except in compliance with the License.
  + * You may obtain a copy of the License at
  + * 
  + *   http://www.apache.org/licenses/LICENSE-2.0
  + * 
  + * Unless required by applicable law or agreed to in writing, software
  + * distributed under the License is distributed on an "AS IS" BASIS,
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + * See the License for the specific language governing permissions and
  + * limitations under the License.
  + * 
  + * ========================================================================
  + */
  +
  +package org.apache.maven.cactus.sample;
  +
  +import org.apache.cactus.ServletTestCase;
  +import java.io.InputStream;
  +
  +/**
  + * Verify that resources included with the
  + * <code>cactus.resources.dirs</code> properties are found in the resulting
  + * cactified WAR. Note that we're testing this by executing this code inside
  + * the container.
  + *
  + * @version $Id$
  + */
  +public class ResourcesTest extends ServletTestCase
  +{
  +    private void includesTest( String resource )
  +    {
  +        Thread currentThread = Thread.currentThread();
  +        ClassLoader classLoader = currentThread.getContextClassLoader();
  +        InputStream input = classLoader.getResourceAsStream(resource);
  +        assertNotNull("could not open resource " + resource, input);
  +    }
  +
  +    private void excludesTest( String resource )
  +    {
  +        Thread currentThread = Thread.currentThread();
  +        ClassLoader classLoader = currentThread.getContextClassLoader();
  +        InputStream input = classLoader.getResourceAsStream(resource);
  +        assertNull("should not have opened resource " + resource, input);
  +    }
  +
  +    public void testConfigProperties()
  +    {
  +        includesTest( "test.properties" );
  +    }
  +  
  +    public void testConfigXml()
  +    {
  +        includesTest( "test.xml" );
  +    }
  +    
  +    public void testIncludes()
  +    {
  +        includesTest( "testKO.properties" );
  +    }
  +    
  +    public void testExcludes()
  +    {
  +        excludesTest( "testbad.properties" );
  +    }
  +
  +    public void testRecursive()
  +    {
  +        includesTest( "recursiveResources/test-recursive.properties" );
  +    }
  +    
  +    public void testRecursiveDefault()
  +    {
  +        includesTest( "recursiveResources/test-recursive-default.xml");
  +    }
  +}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to