Home » geronimo-2.2-source-release » org.apache.geronimo.deployment.service » [javadoc | source]

    1   /**
    2    *
    3    * Copyright 2003-2004 The Apache Software Foundation
    4    *
    5    *  Licensed under the Apache License, Version 2.0 (the "License");
    6    *  you may not use this file except in compliance with the License.
    7    *  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   
   18   package org.apache.geronimo.deployment.service;
   19   
   20   import java.net.URL;
   21   
   22   import org.apache.geronimo.deployment.xbeans.AttributeType;
   23   import org.apache.geronimo.deployment.xbeans.ConfigurationDocument;
   24   import org.apache.geronimo.deployment.xbeans.ConfigurationType;
   25   import org.apache.geronimo.deployment.xbeans.GbeanType;
   26   import org.apache.geronimo.deployment.xbeans.ReferenceType;
   27   import org.apache.geronimo.deployment.xbeans.DependencyType;
   28   import org.apache.geronimo.deployment.FooBarBean;
   29   
   30   import junit.framework.TestCase;
   31   
   32   /**
   33    * 
   34    * 
   35    * @version $Rev: 156292 $ $Date: 2005-03-05 18:48:02 -0800 (Sat, 05 Mar 2005) $
   36    */
   37   public class ConfigPlanTest extends TestCase {
   38       private URL plan1;
   39   
   40       public void testParser() throws Exception {
   41           ConfigurationDocument doc = ConfigurationDocument.Factory.parse(plan1);
   42           ConfigurationType configuration = doc.getConfiguration();
   43           assertEquals("test/plan1", configuration.getConfigId());
   44   
   45           DependencyType[] dependencies = configuration.getDependencyArray();
   46           assertEquals(1, dependencies.length);
   47           assertEquals("geronimo", dependencies[0].getGroupId());
   48           assertEquals("geronimo-kernel", dependencies[0].getArtifactId());
   49           assertEquals("DEV", dependencies[0].getVersion());
   50   
   51           GbeanType[] gbeans = configuration.getGbeanArray();
   52           assertEquals(1, gbeans.length);
   53           assertEquals("geronimo.test:name=MyMockGMBean", gbeans[0].getGbeanName());
   54           AttributeType[] attrs = gbeans[0].getAttributeArray();
   55           assertEquals(2, attrs.length);
   56           assertEquals("value", attrs[0].getName());
   57           assertEquals("1234", attrs[0].getStringValue());
   58           assertEquals("intValue", attrs[1].getName());
   59           assertEquals("1234", attrs[1].getStringValue());
   60   
   61           ReferenceType[] refs = gbeans[0].getReferenceArray();
   62           assertEquals(1, refs.length);
   63           assertEquals("MockEndpoint", refs[0].getName2());
   64           assertEquals("geronimo.test:name=MyMockGMBean", refs[0].getGbeanName());
   65       }
   66   
   67       protected void setUp() throws Exception {
   68           super.setUp();
   69           ClassLoader cl = Thread.currentThread().getContextClassLoader();
   70           plan1 = cl.getResource("services/plan1.xml");
   71       }
   72   }

Home » geronimo-2.2-source-release » org.apache.geronimo.deployment.service » [javadoc | source]