geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject cvs commit: incubator-geronimo/specs/j2ee-deployment/src/test/javax/enterprise/deploy/spi/factories MockDeploymentFactory.java
Date Sat, 16 Aug 2003 15:58:55 GMT
jdillon     2003/08/16 08:58:55

  Added:       specs/j2ee-deployment/src/test/javax/enterprise/deploy/model
                        XPathEventTest.java
               specs/j2ee-deployment/src/test/javax/enterprise/deploy/shared
                        ActionTypeTest.java CommandTypeTest.java
                        DConfigBeanVersionTypeTest.java ModuleTypeTest.java
                        StateTypeTest.java
               specs/j2ee-deployment/src/test/javax/enterprise/deploy/spi
                        MockDeploymentManager.java
               specs/j2ee-deployment/src/test/javax/enterprise/deploy/spi/factories
                        MockDeploymentFactory.java
  Removed:     modules/core/src/test/javax/enterprise/deploy/model
                        XPathEventTest.java
               modules/core/src/test/javax/enterprise/deploy/shared
                        ActionTypeTest.java CommandTypeTest.java
                        DConfigBeanVersionTypeTest.java ModuleTypeTest.java
                        StateTypeTest.java
               modules/core/src/test/javax/enterprise/deploy/spi
                        MockDeploymentManager.java
               modules/core/src/test/javax/enterprise/deploy/spi/factories
                        MockDeploymentFactory.java
  Log:
   o Moved (most) j2ee-deployment tests to specs/j2ee-deployment, except
     DeploymentFactoryManagerTest which current depends on
     GeronimoDeploymentFactory
  
  Revision  Changes    Path
  1.1                  incubator-geronimo/specs/j2ee-deployment/src/test/javax/enterprise/deploy/model/XPathEventTest.java
  
  Index: XPathEventTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package javax.enterprise.deploy.model;
  
  import junit.framework.TestCase;
  
  public class XPathEventTest extends TestCase {
  
       public void testIsAddEvent() {
          XpathEvent addEvent = new XpathEvent(null, XpathEvent.BEAN_ADDED);
          assertTrue(addEvent.isAddEvent());
          assertFalse(addEvent.isChangeEvent());
          assertFalse(addEvent.isRemoveEvent());
      }
  
      public void testIsChangeEvent() {
          XpathEvent changeEvent = new XpathEvent(null, XpathEvent.BEAN_CHANGED);
          assertTrue(changeEvent.isChangeEvent());
          assertFalse(changeEvent.isAddEvent());
          assertFalse(changeEvent.isRemoveEvent());
      }
  
      public void testIsRemoveEvent() {
          XpathEvent removeEvent = new XpathEvent(null, XpathEvent.BEAN_REMOVED);
          assertTrue(removeEvent.isRemoveEvent());
          assertFalse(removeEvent.isAddEvent());
          assertFalse(removeEvent.isChangeEvent());
      }
  
  }
  
  
  
  1.1                  incubator-geronimo/specs/j2ee-deployment/src/test/javax/enterprise/deploy/shared/ActionTypeTest.java
  
  Index: ActionTypeTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package javax.enterprise.deploy.shared;
  
  import junit.framework.TestCase;
  
  public class ActionTypeTest extends TestCase {
  
      public void testValues() {
          assertEquals(0, ActionType.EXECUTE.getValue());
          assertEquals(1, ActionType.CANCEL.getValue());
          assertEquals(2, ActionType.STOP.getValue());
      }
  
      public void testToString() {
          assertEquals("execute", ActionType.EXECUTE.toString());
          assertEquals("cancel", ActionType.CANCEL.toString());
          assertEquals("stop", ActionType.STOP.toString());
          // only possible due to package local access
          assertEquals("5", new ActionType(5).toString());
      }
  
      public void testValueToSmall() {
          try {
              ActionType.getActionType(-1);
              fail("Expected AIOOBE");
          } catch (ArrayIndexOutOfBoundsException aioobe) {
          }
      }
  
      public void testValueToLarge() {
          try {
              ActionType.getActionType(5);
              fail("Expected AIOOBE");
          } catch (ArrayIndexOutOfBoundsException aioobe) {
          }
      }
  }
  
  
  
  
  1.1                  incubator-geronimo/specs/j2ee-deployment/src/test/javax/enterprise/deploy/shared/CommandTypeTest.java
  
  Index: CommandTypeTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package javax.enterprise.deploy.shared;
  
  import junit.framework.TestCase;
  
  public class CommandTypeTest extends TestCase {
      public void testValues() {
          assertEquals(0, CommandType.DISTRIBUTE.getValue());
          assertEquals(1, CommandType.START.getValue());
          assertEquals(2, CommandType.STOP.getValue());
          assertEquals(3, CommandType.UNDEPLOY.getValue());
          assertEquals(4, CommandType.REDEPLOY.getValue());
      }
  
      public void testToString() {
          assertEquals("distribute", CommandType.DISTRIBUTE.toString());
          assertEquals("start", CommandType.START.toString());
          assertEquals("stop", CommandType.STOP.toString());
          assertEquals("undeploy", CommandType.UNDEPLOY.toString());
          assertEquals("redeploy", CommandType.REDEPLOY.toString());
          // only possible due to package local access
          assertEquals("10", new ActionType(10).toString());
          assertEquals("-1", new ActionType(-1).toString());
      }
  
      public void testValueToSmall() {
          try {
              CommandType.getCommandType(-1);
              fail("Expected AIOOBE");
          } catch (ArrayIndexOutOfBoundsException aioobe) {
          }
      }
  
      public void testValueToLarge() {
          try {
              CommandType.getCommandType(10);
              fail("Expected AIOOBE");
          } catch (ArrayIndexOutOfBoundsException aioobe) {
          }
      }
  }
  
  
  
  1.1                  incubator-geronimo/specs/j2ee-deployment/src/test/javax/enterprise/deploy/shared/DConfigBeanVersionTypeTest.java
  
  Index: DConfigBeanVersionTypeTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package javax.enterprise.deploy.shared;
  
  import junit.framework.TestCase;
  
  /**
  DConfigBeanVersionType
   */
  public class DConfigBeanVersionTypeTest extends TestCase {
       public void testValues() {
          assertEquals(0, DConfigBeanVersionType.V1_3.getValue());
          assertEquals(1, DConfigBeanVersionType.V1_3_1.getValue());
          assertEquals(2, DConfigBeanVersionType.V1_4.getValue());
      }
  
      public void testToString() {
          assertEquals("V1_3", DConfigBeanVersionType.V1_3.toString());
          assertEquals("V1_3_1", DConfigBeanVersionType.V1_3_1.toString());
          assertEquals("V1_4", DConfigBeanVersionType.V1_4.toString());
          // only possible due to package local access
          assertEquals("5", new ActionType(5).toString());
      }
  
      public void testValueToSmall() {
          try {
              DConfigBeanVersionType.getDConfigBeanVersionType(-1);
              fail("Expected AIOOBE");
          } catch (ArrayIndexOutOfBoundsException aioobe) {
          }
      }
  
      public void testValueToLarge() {
          try {
              DConfigBeanVersionType.getDConfigBeanVersionType(3);
              fail("Expected AIOOBE");
          } catch (ArrayIndexOutOfBoundsException aioobe) {
          }
      }
  }
  
  
  
  1.1                  incubator-geronimo/specs/j2ee-deployment/src/test/javax/enterprise/deploy/shared/ModuleTypeTest.java
  
  Index: ModuleTypeTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package javax.enterprise.deploy.shared;
  
  import junit.framework.TestCase;
  
  public class ModuleTypeTest extends TestCase {
        public void testValues() {
          assertEquals(0, ModuleType.EAR.getValue());
          assertEquals(1, ModuleType.EJB.getValue());
          assertEquals(2, ModuleType.CAR.getValue());
          assertEquals(3, ModuleType.RAR.getValue());
          assertEquals(4, ModuleType.WAR.getValue());
      }
  
      public void testToString() {
          assertEquals("ear", ModuleType.EAR.toString());
          assertEquals("ejb", ModuleType.EJB.toString());
          assertEquals("car", ModuleType.CAR.toString());
          assertEquals("rar", ModuleType.RAR.toString());
          assertEquals("war", ModuleType.WAR.toString());
          // only possible due to package local access
          assertEquals("5", new ModuleType(5).toString());
      }
  
      public void testModuleExtension() {
          assertEquals(".ear", ModuleType.EAR.getModuleExtension());
          assertEquals(".jar", ModuleType.EJB.getModuleExtension());
          assertEquals(".jar", ModuleType.CAR.getModuleExtension());
          assertEquals(".rar", ModuleType.RAR.getModuleExtension());
          assertEquals(".war", ModuleType.WAR.getModuleExtension());
      }
  
      public void testValueToSmall() {
          try {
              ModuleType.getModuleType(-1);
              fail("Expected AIOOBE");
          } catch (ArrayIndexOutOfBoundsException aioobe) {
          }
      }
  
      public void testValueToLarge() {
          try {
              ModuleType.getModuleType(5);
              fail("Expected AIOOBE");
          } catch (ArrayIndexOutOfBoundsException aioobe) {
          }
      }
  }
  
  
  
  1.1                  incubator-geronimo/specs/j2ee-deployment/src/test/javax/enterprise/deploy/shared/StateTypeTest.java
  
  Index: StateTypeTest.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package javax.enterprise.deploy.shared;
  
  import junit.framework.TestCase;
  
  public class StateTypeTest extends TestCase {
      public void testValues() {
          assertEquals(0, StateType.RUNNING.getValue());
          assertEquals(1, StateType.COMPLETED.getValue());
          assertEquals(2, StateType.FAILED.getValue());
          assertEquals(3, StateType.RELEASED.getValue());
      }
  
      public void testToString() {
          assertEquals("running", StateType.RUNNING.toString());
          assertEquals("completed", StateType.COMPLETED.toString());
          assertEquals("failed", StateType.FAILED.toString());
          assertEquals("released", StateType.RELEASED.toString());
          // only possible due to package local access
          assertEquals("5", new ActionType(5).toString());
      }
  
      public void testValueToSmall() {
          try {
              StateType.getStateType(-1);
              fail("Expected AIOOBE");
          } catch (ArrayIndexOutOfBoundsException aioobe) {
          }
      }
  
      public void testValueToLarge() {
          try {
              StateType.getStateType(5);
              fail("Expected AIOOBE");
          } catch (ArrayIndexOutOfBoundsException aioobe) {
          }
      }
  }
  
  
  
  1.1                  incubator-geronimo/specs/j2ee-deployment/src/test/javax/enterprise/deploy/spi/MockDeploymentManager.java
  
  Index: MockDeploymentManager.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package javax.enterprise.deploy.spi;
  
  import javax.enterprise.deploy.model.DeployableObject;
  import javax.enterprise.deploy.shared.DConfigBeanVersionType;
  import javax.enterprise.deploy.shared.ModuleType;
  import javax.enterprise.deploy.spi.exceptions.DConfigBeanVersionUnsupportedException;
  import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
  import javax.enterprise.deploy.spi.exceptions.TargetException;
  import javax.enterprise.deploy.spi.status.ProgressObject;
  import java.io.File;
  import java.io.InputStream;
  import java.util.Locale;
  
  public class MockDeploymentManager implements DeploymentManager {
      public Target[] getTargets() throws IllegalStateException {
          return new Target[0];
      }
  
      public TargetModuleID[] getRunningModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException {
          return new TargetModuleID[0];
      }
  
      public TargetModuleID[] getNonRunningModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException {
          return new TargetModuleID[0];
      }
  
      public TargetModuleID[] getAvailableModules(ModuleType moduleType, Target[] targetList)
throws TargetException, IllegalStateException {
          return new TargetModuleID[0];
      }
  
      public DeploymentConfiguration createConfiguration(DeployableObject dObj) throws InvalidModuleException
{
          return null;
      }
  
      public ProgressObject distribute(Target[] targetList, File moduleArchive, File deploymentPlan)
throws IllegalStateException {
          return null;
      }
  
      public ProgressObject distribute(Target[] targetList, InputStream moduleArchive, InputStream
deploymentPlan) throws IllegalStateException {
          return null;
      }
  
      public ProgressObject start(TargetModuleID[] moduleIDList) throws IllegalStateException
{
          return null;
      }
  
      public ProgressObject stop(TargetModuleID[] moduleIDList) throws IllegalStateException
{
          return null;
      }
  
      public ProgressObject undeploy(TargetModuleID[] moduleIDList) throws IllegalStateException
{
          return null;
      }
  
      public boolean isRedeploySupported() {
          return false;
      }
  
      public ProgressObject redeploy(TargetModuleID[] moduleIDList, File moduleArchive, File
deploymentPlan) throws UnsupportedOperationException, IllegalStateException {
          return null;
      }
  
      public ProgressObject redeploy(TargetModuleID[] moduleIDList, InputStream moduleArchive,
InputStream deploymentPlan) throws UnsupportedOperationException, IllegalStateException {
          return null;
      }
  
      public void release() {
      }
  
      public Locale getDefaultLocale() {
          return null;
      }
  
      public Locale getCurrentLocale() {
          return null;
      }
  
      public void setLocale(Locale locale) throws UnsupportedOperationException {
      }
  
      public Locale[] getSupportedLocales() {
          return new Locale[0];
      }
  
      public boolean isLocaleSupported(Locale locale) {
          return false;
      }
  
      public DConfigBeanVersionType getDConfigBeanVersion() {
          return null;
      }
  
      public boolean isDConfigBeanVersionSupported(DConfigBeanVersionType version) {
          return false;
      }
  
      public void setDConfigBeanVersion(DConfigBeanVersionType version) throws DConfigBeanVersionUnsupportedException
{
      }
  }
  
  
  
  1.1                  incubator-geronimo/specs/j2ee-deployment/src/test/javax/enterprise/deploy/spi/factories/MockDeploymentFactory.java
  
  Index: MockDeploymentFactory.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package javax.enterprise.deploy.spi.factories;
  
  import javax.enterprise.deploy.spi.MockDeploymentManager;
  import javax.enterprise.deploy.spi.DeploymentManager;
  import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
  
  public class MockDeploymentFactory implements DeploymentFactory {
      public boolean handlesURI(String uri) {
          // for the moment we accept all uri's
          return true;
      }
  
      public DeploymentManager getDeploymentManager(String uri, String username, String password)
throws DeploymentManagerCreationException {
          return getDisconnectedDeploymentManager(uri);
      }
  
      public DeploymentManager getDisconnectedDeploymentManager(String uri) throws DeploymentManagerCreationException
{
          if ("return-null".equals(uri)) {
              return null;
          } else if ("throw-exception".equals(uri)) {
              throw new DeploymentManagerCreationException("Simulated Exception");
          } else {
              return new MockDeploymentManager();
          }
      }
  
      public String getDisplayName() {
          return null;
      }
  
      public String getProductVersion() {
          return null;
      }
  }
  
  
  

Mime
View raw message