adc         2003/12/06 10:27:45

  Added:       
modules/kernel/src/test/org/apache/geronimo/kernel/deployment/goal
                        AbstractDeploymentGoalTest.java DeployURLTest.java
                        DistributeURLTest.java RedeployURLTest.java
                        UndeployURLTest.java
  Log:
  Unit test from Ed Letifov.
  
  Revision  Changes    Path
  1.1                  
incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/deployment/goal/AbstractDeploymentGoalTest.java
  
  Index: AbstractDeploymentGoalTest.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 [EMAIL PROTECTED]
   *
   * 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 org.apache.geronimo.kernel.deployment.goal;
  
  import org.apache.geronimo.kernel.deployment.GeronimoTargetModule;
  import org.apache.geronimo.kernel.deployment.ServerTarget;
  import junit.framework.TestCase;
  
  
  /**
   * Base class for testing various descendants of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DeploymentGoal}.
   * @version $Revision: 1.1 $ $Date: 2003/12/06 18:27:45 $
   */
  public abstract class AbstractDeploymentGoalTest extends TestCase {
      protected DeploymentGoal deploymentGoal;
      protected GeronimoTargetModule targetModule = new 
GeronimoTargetModule(new ServerTarget("dummytarget"), "dummymodule");
  
      /**
       * Sets up the test context.
       */
      public final void setUp() {
          deploymentGoal = getDeploymentGoal(targetModule);
      }
  
      /**
       * Descendants should provide implementation that creates a specific 
descendant
       * of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DeploymentGoal}
       * @param targetModule target to create the goal
       * @return a specific descendant of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DeploymentGoal}
       */
      public abstract DeploymentGoal getDeploymentGoal(GeronimoTargetModule 
targetModule);
  
      /**
       * Tests that accessor to <code>targetModule</code> attribute returns the 
same
       * [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.GeronimoTargetModule} as used while 
creating the
       * [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DeploymentGoal}
       */
      public final void testGetTargetModule() {
          assertSame("The target module the goal is created is indeed 
returned", targetModule, deploymentGoal.getTargetModule());
      }
  
      /**
       * Tests the default value, accessor and mutator for 
<code>attained</code> attribute.
       */
      public final void testAttained() {
          assertFalse("By default the attained is set to false", 
deploymentGoal.isAttained());
          deploymentGoal.setAttained(true);
          assertTrue("After setting attained to true it is indeed true", 
deploymentGoal.isAttained());
          deploymentGoal.setAttained(false);
          assertFalse("After setting attained to false it is indeed false", 
deploymentGoal.isAttained());
      }
  }
  
  
  
  
  1.1                  
incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/deployment/goal/DeployURLTest.java
  
  Index: DeployURLTest.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 [EMAIL PROTECTED]
   *
   * 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 org.apache.geronimo.kernel.deployment.goal;
  
  import org.apache.geronimo.kernel.deployment.scanner.URLType;
  import org.apache.geronimo.kernel.deployment.GeronimoTargetModule;
  
  import java.io.File;
  import java.net.URL;
  
  
  /**
   * Tests the [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DeployURL} deployment goal
   * @see org.apache.geronimo.kernel.deployment.goal.AbstractDeploymentGoalTest
   * @see org.apache.geronimo.kernel.deployment.goal.DeploymentGoal
   * @version $Revision: 1.1 $ $Date: 2003/12/06 18:27:45 $
   */
  public class DeployURLTest extends AbstractDeploymentGoalTest {
  
      protected URL url = null;
      protected DeployURL deployURL = null;
  
      /**
       * Creates an instance of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DeployURL} to be used in deployment 
goal tests
       * performed by the base class. This implementation creates an instance
       * of [EMAIL PROTECTED] java.net.URL} for <code>http://localhost/</code> 
and uses
       * [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.scanner.URLType#PACKED_ARCHIVE} as 
DeployURL URLtype.
       *
       * @param targetModule target to create deployment goal
       * @return [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DeployURL} deployment goal
       */
      public DeploymentGoal getDeploymentGoal(GeronimoTargetModule 
targetModule) {
          try {
              url = new URL("http://localhost/";);
          } catch (java.net.MalformedURLException mue) {
              throw new RuntimeException(mue);
          }
          deployURL = new DeployURL(targetModule, url, URLType.PACKED_ARCHIVE);
          return deployURL;
      }
  
      /**
       * Tests the accessor to <code>url</code> attribute in case of non-file 
protocol URL.
       * The current implementation of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DeployURL} in this case returns the
       * original url as is.
       */
      public void testGetNonFileURL() {
          assertSame("The URL wasn't changed for http protocol", 
deployURL.getUrl(), url);
      }
  
      /**
       * Tests the accessor to <code>type</code> attribute.
       */
      public void testGetType() {
          assertSame("The URLType returned is correct", deployURL.getType(), 
URLType.PACKED_ARCHIVE);
      }
  
      /**
       * Test the normalizing algorithm and the accessor to <code>url</code> 
attribute in case of file protocol URL.
       * @throws java.lang.Exception
       */
      public void testNormalizeURL() throws Exception {
          File newFile = new File("deployURLTest.tmp");
          URL fileURL = newFile.toURI().toURL();
          DeployURL deployURL2 = new DeployURL(targetModule, fileURL, 
URLType.PACKED_ARCHIVE);
          URL normalizedURL = deployURL2.getUrl();
          assertNotSame("URL for file protocol is not the same (presumably 
normalized)", normalizedURL, fileURL);
          URL normalizedURL2 = new File(fileURL.getFile().replace('/', 
File.separatorChar)).toURI().toURL();
          assertEquals("URL is normalized", normalizedURL2, normalizedURL);
      }
  
      /**
       * Tests the current behaviour of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DeployURL} constructor that does not 
accept
       * <code>null</code> for the url argument.
       */
      public void testNullURL() {
          try {
              new DeployURL(targetModule, null, URLType.PACKED_ARCHIVE);
              assertTrue("An IllegalArgumentException is thrown when URL is 
passed as null", false);
          } catch (IllegalArgumentException iae) {
          }
      }
  
      /**
       * Tests the current behaviour of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DeployURL} constructor that does not 
accept
       * <code>null</code> for the type argument.
       */
      public void testNullType() {
          try {
              new DeployURL(targetModule, url, null);
              assertTrue("An IllegalArgumentException is thrown when URLType is 
passed as null", false);
          } catch (IllegalArgumentException iae) {
          }
      }
  }
  
  
  
  
  1.1                  
incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/deployment/goal/DistributeURLTest.java
  
  Index: DistributeURLTest.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 [EMAIL PROTECTED]
   *
   * 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 org.apache.geronimo.kernel.deployment.goal;
  
  import org.apache.geronimo.kernel.deployment.scanner.URLType;
  import org.apache.geronimo.kernel.deployment.GeronimoTargetModule;
  
  import java.io.File;
  import java.net.URL;
  
  
  /**
   * Tests the [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DistributeURL} deployment goal
   * @see org.apache.geronimo.kernel.deployment.goal.AbstractDeploymentGoalTest
   * @see org.apache.geronimo.kernel.deployment.goal.DeploymentGoal
   * @version $Revision: 1.1 $ $Date: 2003/12/06 18:27:45 $
   */
  public class DistributeURLTest extends AbstractDeploymentGoalTest {
  
      protected URL url = null;
      protected DistributeURL distributeURL = null;
  
      /**
       * Creates an instance of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DistributeURL} to be used in 
deployment goal tests
       * performed by the base class. This implementation creates an instance
       * of [EMAIL PROTECTED] java.net.URL} for <code>http://localhost/</code> 
and uses
       * [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.scanner.URLType#PACKED_ARCHIVE} as 
DeployURL URLtype.
       *
       * @param targetModule target to create deployment goal
       * @return [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DistributeURL} deployment goal
       */
      public DeploymentGoal getDeploymentGoal(GeronimoTargetModule 
targetModule) {
  
          try {
              url = new URL("http://localhost/";);
          } catch (java.net.MalformedURLException mue) {
              throw new RuntimeException(mue);
          }
          distributeURL = new DistributeURL(targetModule, url, 
URLType.PACKED_ARCHIVE);
          return distributeURL;
      }
  
      /**
       * Tests the accessor to <code>url</code> attribute in case of non-file 
protocol URL.
       * The current implementation of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DistributeURL} in this case returns 
the
       * original url as is.
       */
      public void testGetNonFileURL() {
          assertSame("The URL wasn't changed for http protocol", 
distributeURL.getUrl(), url);
      }
  
      /**
       * Tests the accessor to <code>type</code> attribute.
       */
      public void testGetType() {
          assertSame("The URLType returned is correct", 
distributeURL.getType(), URLType.PACKED_ARCHIVE);
      }
  
      /**
       * Test the normalizing algorithm and the accessor to <code>url</code> 
attribute in case of file protocol URL.
       * @throws java.lang.Exception
       */
      public void testNormalizeURL() throws Exception {
          File newFile = new File("distributeURLTest.tmp");
          URL fileURL = newFile.toURI().toURL();
          DistributeURL distributeURL2 = new DistributeURL(targetModule, 
fileURL, URLType.PACKED_ARCHIVE);
          URL normalizedURL = distributeURL2.getUrl();
          assertNotSame("URL for file protocol is not the same (presumably 
normalized)", normalizedURL, fileURL);
          URL normalizedURL2 = new File(fileURL.getFile().replace('/', 
File.separatorChar)).toURI().toURL();
          assertEquals("URL is normalized", normalizedURL2, normalizedURL);
      }
  
      /**
       * Tests the current behaviour of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DistributeURL} constructor that does 
not accept
       * <code>null</code> for the url argument.
       */
      public void testNullURL() {
          try {
              DistributeURL distributeURL2 = new DistributeURL(targetModule, 
null, URLType.PACKED_ARCHIVE);
              assertTrue("An IllegalArgumentException is thrown when URL is 
passed as null", false);
          } catch (IllegalArgumentException iae) {
          }
      }
  
      /**
       * Tests the current behaviour of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.DistributeURL} constructor that does 
not accept
       * <code>null</code> for the type argument.
       */
      public void testNullType() {
          try {
              DistributeURL distributeURL2 = new DistributeURL(targetModule, 
url, null);
              assertTrue("An IllegalArgumentException is thrown when URLType is 
passed as null", false);
          } catch (IllegalArgumentException iae) {
          }
      }
  }
  
  
  
  
  1.1                  
incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/deployment/goal/RedeployURLTest.java
  
  Index: RedeployURLTest.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 [EMAIL PROTECTED]
   *
   * 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 org.apache.geronimo.kernel.deployment.goal;
  
  import org.apache.geronimo.kernel.deployment.GeronimoTargetModule;
  
  import java.net.MalformedURLException;
  import java.net.URL;
  
  
  /**
   * Tests the [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.RedeployURL} deployment goal
   * @see org.apache.geronimo.kernel.deployment.goal.AbstractDeploymentGoalTest
   * @see org.apache.geronimo.kernel.deployment.goal.DeploymentGoal
   * @version $Revision: 1.1 $ $Date: 2003/12/06 18:27:45 $
   */
  public class RedeployURLTest extends AbstractDeploymentGoalTest {
      URL url = null;
      RedeployURL redeployURL;
  
      /**
       * Creates an instance of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.RedeployURL} to be used in 
deployment goal tests
       * performed by the base class. This implementation creates an instance
       * of [EMAIL PROTECTED] java.net.URL} for <code>http://localhost/</code>.
       * @param targetModule target to create deployment goal
       * @return [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.RedeployURL} deployment goal
       */
      public DeploymentGoal getDeploymentGoal(GeronimoTargetModule 
targetModule) {
          try {
              url = new URL("http://localhost/";);
              redeployURL = new RedeployURL(targetModule, url);
              return redeployURL;
          } catch (MalformedURLException mue) {
              throw new RuntimeException(mue);
          }
      }
  
      /**
       * Tests the accessor for <code>url</code> attribute.
       */
      public void testGetURL() {
          assertSame("The URL returned is in fact the original object", 
redeployURL.getUrl(), url);
      }
  
      /**
       * Tests the current behaviour of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.RedeployURL} constructor
       * that accepts <code>null</code> for the URL argument.
       */
      public void testNullURL() {
          RedeployURL redeployURL2 = new RedeployURL(targetModule, null);
          assertNull("The null is stored and returned", redeployURL2.getUrl());
      }
  }
  
  
  
  
  1.1                  
incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/deployment/goal/UndeployURLTest.java
  
  Index: UndeployURLTest.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 [EMAIL PROTECTED]
   *
   * 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 org.apache.geronimo.kernel.deployment.goal;
  
  import org.apache.geronimo.kernel.deployment.GeronimoTargetModule;
  
  import java.net.MalformedURLException;
  import java.net.URL;
  
  
  /**
   * Tests the [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.UndeployURL} deployment goal
   * @see org.apache.geronimo.kernel.deployment.goal.AbstractDeploymentGoalTest
   * @see org.apache.geronimo.kernel.deployment.goal.DeploymentGoal
   * @version $Revision: 1.1 $
   * @version $Revision: 1.1 $ $Date: 2003/12/06 18:27:45 $
   */
  public class UndeployURLTest extends AbstractDeploymentGoalTest {
      URL url = null;
      UndeployURL undeployURL;
  
      /**
       * Creates an instance of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.UndeployURL} to be used in 
deployment goal tests
       * performed by the base class. This implementation creates an instance
       * of [EMAIL PROTECTED] java.net.URL} for <code>http://localhost/</code>.
       *
       * @param targetModule target to create deployment goal
       * @return [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.UndeployURL} deployment goal
       */
      public DeploymentGoal getDeploymentGoal(GeronimoTargetModule 
targetModule) {
          try {
              url = new URL("http://localhost/";);
              undeployURL = new UndeployURL(targetModule, url);
              return undeployURL;
          } catch (MalformedURLException mue) {
              throw new RuntimeException(mue);
          }
      }
  
      /**
       * Tests the accessor for <code>url</code> attribute.
       */
      public void testGetURL() {
          assertSame("The URL returned is in fact the original object", 
undeployURL.getUrl(), url);
      }
  
      /**
       * Tests the current behaviour of [EMAIL PROTECTED] 
org.apache.geronimo.kernel.deployment.goal.UndeployURL} constructor
       * that accepts <code>null</code> for the URL argument.
       */
      public void testNullURL() {
          UndeployURL undeployURL2 = new UndeployURL(targetModule, null);
          assertNull("The null is stored and returned", undeployURL2.getUrl());
      }
  }
  
  
  
  

Reply via email to