|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.tomcat5; import javax.enterprise.deploy.spi.DeploymentManager; import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException; import javax.enterprise.deploy.spi.factories.DeploymentFactory; import junit.framework.*; import org.openide.ErrorManager; import org.openide.util.NbBundle; /** * * @author Radim Kubacki */ public class TomcatFactoryTest extends TestCase { public static final String TOMCAT_URI = "http://localhost:8080/manager/"; public static final String TOMCAT_UNAME = "admin"; public static final String TOMCAT_PASSWD = "manager"; public TomcatFactoryTest (java.lang.String testName) { super (testName); } public static Test suite () { TestSuite suite = new TestSuite (TomcatFactoryTest.class); return suite; } /** Test of getDeploymentManager method, of class org.netbeans.modules.tomcat5.TomcatFactory. */ public void testGetDeploymentManager () { System.out.println ("testGetDeploymentManager"); TomcatFactory tf = TomcatFactory.create (); try { assertNotNull ("getDeploymentManager", tf.getDeploymentManager ("tomcat:"+TOMCAT_URI, TOMCAT_UNAME, TOMCAT_PASSWD)); } catch (Exception ex) { fail ("getDeploymentManager threw exception "+ex); } } /** Test of getDisconnectedDeploymentManager method, of class org.netbeans.modules.tomcat5.TomcatFactory. */ public void testGetDisconnectedDeploymentManager () { System.out.println ("testGetDisconnectedDeploymentManager"); TomcatFactory tf = TomcatFactory.create (); try { assertNotNull ("getDisconnectedDeploymentManager", tf.getDisconnectedDeploymentManager ("tomcat:"+TOMCAT_URI)); } catch (Exception ex) { fail ("getDeploymentManager threw exception "+ex); } } /** Test of getDisconnectedDeploymentManager method, of class org.netbeans.modules.tomcat5.TomcatFactory. */ public void testBundledDeploymentManager () { System.out.println ("testBundledDeploymentManager"); TomcatFactory tf = TomcatFactory.create (); try { String home = "jakarta-tomcat-5.0.x"; String base = "jakarta-tomcat-5.0.x_base"; TomcatManager tm = (TomcatManager)tf.getDisconnectedDeploymentManager ("tomcat:home="+home+":base="+base+":"+TOMCAT_URI); assertNotNull ("getDisconnectedDeploymentManager", tm); assertEquals (base, tm.getCatalinaBase ()); assertEquals (home, tm.getCatalinaHome ()); } catch (Exception ex) { fail ("getDeploymentManager threw exception "+ex); } } /** Test of getDisconnectedDeploymentManager method, of class org.netbeans.modules.tomcat5.TomcatFactory. */ public void testExternalDeploymentManager () { System.out.println ("testExternalDeploymentManager"); TomcatFactory tf = TomcatFactory.create (); try { String home = "c:\\jakarta-tomcat-5.0.x"; TomcatManager tm = (TomcatManager)tf.getDisconnectedDeploymentManager ("tomcat:home="+home+":"+TOMCAT_URI); assertNotNull ("getDisconnectedDeploymentManager", tm); assertNull (tm.getCatalinaBase ()); assertEquals (home, tm.getCatalinaHome ()); } catch (Exception ex) { fail ("getDeploymentManager threw exception "+ex); } } /** Test of getDisplayName method, of class org.netbeans.modules.tomcat5.TomcatFactory. */ public void testGetDisplayName () { System.out.println ("testGetDisplayName"); assertNotNull ("display name must not be null", TomcatFactory.create ().getDisplayName ()); } /** Test of getProductVersion method, of class org.netbeans.modules.tomcat5.TomcatFactory. */ public void testGetProductVersion () { System.out.println ("testGetProductVersion"); assertNotNull ("product version must not be null", TomcatFactory.create ().getProductVersion ()); } /** Test of handlesURI method, of class org.netbeans.modules.tomcat5.TomcatFactory. */ public void testHandlesURI () { System.out.println ("testHandlesURI"); TomcatFactory tf = TomcatFactory.create (); assertFalse ("handlesURI for null", tf.handlesURI (null)); assertFalse ("handlesURI for bad string", tf.handlesURI ("arbitrary string")); assertTrue ("handlesURI for tomcat's URI", tf.handlesURI ("tomcat:http://localhost:8081/manager/")); } // Add test methods here, they have to start with 'test' name. // for example: // public void testHello() {} } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.