Update of /cvsroot/ejtools/libraries/j2ee.deployment/src/test/test/enterprise/deploy/shared/factories
In directory sc8-pr-cvs1:/tmp/cvs-serv4692/src/test/test/enterprise/deploy/shared/factories
Added Files:
DeploymentFactoryManagerTest.java
Log Message:
Add up-to-date implementation for the JSR 88. No need for the Sun one.
--- NEW FILE: DeploymentFactoryManagerTest.java ---
/*
* EJTools, the Enterprise Java Tools
*
* Distributable under LGPL license.
* See terms of license at www.gnu.org.
*/
package test.enterprise.deploy.shared.factories;
import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager;
import javax.enterprise.deploy.spi.DeploymentManager;
import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
import javax.enterprise.deploy.spi.factories.DeploymentFactory;
import junit.framework.TestCase;
import test.enterprise.deploy.spi.factories.AdvancedDeploymentFactory;
import test.enterprise.deploy.spi.factories.BasicDeploymentFactory;
/**
* @author letiemble
* @version $Revision: 1.1 $
*/
public class DeploymentFactoryManagerTest extends TestCase
{
/** Description of the Field */
protected DeploymentFactoryManager manager;
/** Constructor for the TypeTest object */
public DeploymentFactoryManagerTest()
{
super();
}
/**
* Constructor for the TypeTest object
*
* @param name Description of the Parameter
*/
public DeploymentFactoryManagerTest(String name)
{
super(name);
}
/** A unit test for JUnit */
public void testNoFactory()
{
DeploymentFactory[] factories = manager.getDeploymentFactories();
assertEquals("No factory must be found", factories.length, 0);
}
/** A unit test for JUnit */
public void testWithFactories()
{
BasicDeploymentFactory factory1 = new BasicDeploymentFactory();
AdvancedDeploymentFactory factory2 = new AdvancedDeploymentFactory();
manager.registerDeploymentFactory(factory1);
assertEquals("One factory must be found", manager.getDeploymentFactories().length, 1);
manager.registerDeploymentFactory(factory1);
assertEquals("One factory must be found", manager.getDeploymentFactories().length, 1);
manager.registerDeploymentFactory(factory2);
assertEquals("Two factories must be found", manager.getDeploymentFactories().length, 2);
DeploymentManager dmanager;
try{
dmanager = manager.getDeploymentManager(BasicDeploymentFactory.URI + "//localhost:6969", null, null);
assertNotNull("DeploymentManager cannot be null", dmanager);
dmanager = manager.getDisconnectedDeploymentManager(BasicDeploymentFactory.URI + "//localhost:6969");
assertNotNull("DeploymentManager cannot be null", dmanager);
dmanager = manager.getDeploymentManager(AdvancedDeploymentFactory.URI + "//localhost:6969", null, null);
assertNotNull("DeploymentManager cannot be null", dmanager);
dmanager = manager.getDisconnectedDeploymentManager(AdvancedDeploymentFactory.URI + "//localhost:6969");
assertNotNull("DeploymentManager cannot be null", dmanager);
}catch(DeploymentManagerCreationException dmce){
fail("Creation shoud be successfull");
}
}
/**
* The JUnit setup method
*
* @exception Exception Description of the Exception
*/
protected void setUp()
throws Exception
{
this.manager = DeploymentFactoryManager.getInstance();
}
/**
* The teardown method for JUnit
*
* @exception Exception Description of the Exception
*/
protected void tearDown()
throws Exception
{
this.manager = null;
}
}
|