1   /*
2    * Copyright 2005 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.pluto.descriptors.portlet;
17  
18  import java.io.InputStream;
19  import java.io.OutputStream;
20  
21  import junit.framework.Test;
22  import junit.framework.TestCase;
23  import junit.framework.TestSuite;
24  import org.apache.pluto.descriptors.services.impl.StreamPortletAppDescriptorServiceImpl;
25  
26  /***
27   *
28   * @author <a href="ddewolf@apache.org">David H. DeWolf</a>
29   * @version $Id: CastorMappingTest.java 156743 2005-03-10 05:50:30Z ddewolf $
30   * @since Mar 4, 2005
31   */
32  public class CastorMappingTest extends TestCase {
33  
34      private boolean debug = false;
35  
36  
37  //
38      public void setUp() throws Exception {
39          this.debug = false;
40      }
41  
42      public void testUnmarshalWebXml() throws Exception {
43          InputStream in = getClass().getResourceAsStream("portlet.xml");
44          PortletAppDD config =
45              new StreamPortletAppDescriptorServiceImpl(
46                  "test", in, (OutputStream)null
47              ).read();
48  
49          assertTrue(config!=null);
50          assertTrue(config.getPortlets()!=null);
51          assertTrue(config.getPortlets().size() > 0);
52      }
53  
54      /***
55       * Start the tests.
56       *
57       * @param theArgs the arguments. Not used
58       */
59      public static void main(String[] theArgs) {
60          junit.awtui.TestRunner.main(
61              new String[] { CastorMappingTest.class.getName()});
62      }
63  
64      /***
65       * @return a test suite (<code>TestSuite</code>) that includes all methods
66       *         starting with "test"
67       */
68      public static Test suite() {
69          // All methods starting with "test" will be executed in the test suite.
70          return new TestSuite(CastorMappingTest.class);
71      }
72  
73  }
74