View Javadoc

1   package org.apache.maven.model.converter.plugins;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import junit.framework.Assert;
23  import org.apache.maven.model.converter.ProjectConverterException;
24  import org.codehaus.plexus.util.xml.Xpp3Dom;
25  
26  import java.io.IOException;
27  
28  /**
29   * @author Dennis Lundberg
30   * @version $Id: PCCTaglistTest.java 661727 2008-05-30 14:21:49Z bentmann $
31   */
32  public class PCCTaglistTest
33      extends AbstractPCCTest
34  {
35      protected void setUp()
36          throws Exception
37      {
38          super.setUp();
39  
40          pluginConfigurationConverter = new PCCTaglist();
41      }
42  
43      public void testBuildConfiguration()
44      {
45          try
46          {
47              projectProperties.load( getClassLoader().getResourceAsStream( "PCCTaglistTest1.properties" ) );
48  
49              pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
50  
51              String value = configuration.getChild( "tags" ).getChild( "tag" ).getValue();
52              Assert.assertEquals( "check specified tags value", "@fixme", value );
53          }
54          catch ( ProjectConverterException e )
55          {
56              Assert.fail();
57          }
58          catch ( IOException e )
59          {
60              Assert.fail( "Unable to find the requested resource." );
61          }
62      }
63  
64      public void testBuildConfiguration2()
65      {
66          try
67          {
68              projectProperties.load( getClassLoader().getResourceAsStream( "PCCTaglistTest2.properties" ) );
69  
70              pluginConfigurationConverter.buildConfiguration( configuration, v3Model, projectProperties );
71  
72              Xpp3Dom tags = configuration.getChild( "tags" );
73              Assert.assertEquals( "check unspecified tags value", null, tags );
74          }
75          catch ( ProjectConverterException e )
76          {
77              Assert.fail();
78          }
79          catch ( IOException e )
80          {
81              Assert.fail( "Unable to find the requested resource." );
82          }
83      }
84  }