FileDocCategorySizeDatePackage
PEDomainConfigValidatorTest.javaAPI DocGlassfish v2 API4929Fri May 04 22:24:34 BST 2007com.sun.enterprise.admin.servermgmt.pe

PEDomainConfigValidatorTest

public class PEDomainConfigValidatorTest extends TestCase
author
Toby H Ferguson
version
$Revision: 1.4 $

Fields Summary
PEDomainConfigValidator
p
com.sun.enterprise.admin.servermgmt.DomainConfig
dc1
com.sun.enterprise.admin.servermgmt.DomainConfig
dc2
Constructors Summary
public PEDomainConfigValidatorTest(String name)

	super(name);
  
Methods Summary
public static voidmain(java.lang.String[] args)

	if (args.length == 0){
	  junit.textui.TestRunner.run(PEDomainConfigValidatorTest.class);
	} else {
	  junit.textui.TestRunner.run(makeSuite(args));
	}
  
private static junit.framework.TestSuitemakeSuite(java.lang.String[] args)

	final TestSuite ts = new TestSuite();
	for (int i = 0; i < args.length; i++){
	  ts.addTest(new PEDomainConfigValidatorTest(args[i]));
	}
	return ts;
  
private voidnyi()

	fail("Not Yet Implemented");
  
protected voidsetUp()

	p = new PEDomainConfigValidator();
	dc1 = new DomainConfig("domainName",
						  new Integer(1),
						  "domainRoot", 
						  "adminUser",
						  "adminPassword",
						  "masterPassword",
						  new Integer(2),
						  "jmsUser",
						  "jmsPassword",
						  new Integer(3), 
						  new Integer(4),
						  new Integer(5), 
						  new Integer(6),
						  new Integer(7),
						  new Properties()){
		protected String getFilePath(String p){
		  return p;
		}
	  };
	dc2 = new DomainConfig("domainName",
						  new Integer(1),
						  "domainRoot", 
						  "adminUser",
						  "adminPassword",
						  new Integer(1),
						  "jmsUser",
						  "jmsPassword",
						  new Integer(1), 
						  new Integer(2),
						  new Integer(1), 
						  new Integer(2),
						  new Integer(3),
						  new Properties()){
		protected String getFilePath(String p){
		  return p;
		}
	  };
  
protected voidtearDown()

  
public voidtestDuplicatesInDomainConfig()

	try {
	  p.uniquePorts(dc2);
	  fail("Expectged an InvalidConfigException indicating that there were duplicate ports");
	}
	catch (InvalidConfigException e){
	  assertEquals("Duplicate ports were found: 1 -> {domain.adminPort, domain.instancePort, http.ssl.port, jms.port}, 2 -> {orb.listener.port, orb.ssl.port}", e.getMessage());
	}
  
public voidtestGetDuplicatePorts()

	final Map ports = new HashMap();
	ports.put("a", "1");
	ports.put("b", "1");
	ports.put("c", "2");
	ports.put("d", "2");
	ports.put("e", "3");
	assertEquals("1 -> {a, b}, 2 -> {c, d}", p.getDuplicatePorts(ports));
  
public voidtestNoDuplicatePorts()

	final Map ports = new HashMap();
	ports.put("a", "1");
	assertEquals("", p.getDuplicatePorts(ports));
  
public voidtestNoDuplicatesInDomainConfig()

	p.uniquePorts(dc1);
  
public voidtestNumPorts()

	assertEquals(7, dc2.getPorts().size());