/*
 * JBoss, the OpenSource J2EE webOS
 * 
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.test.deployers.ear.test;

import java.util.HashSet;

import junit.framework.Test;

import org.jboss.deployment.DeploymentInfo;
import org.jboss.test.deployers.AbstractDeploymentTest;

/**
 * A test that deploys everything in an EAR.
 * 
 * @author <a href="adrian@jboss.com">Adrian Brock</a>
 * @version $Revision: 1.1.2.2 $
 */
public class UnpackedEARDeploymentUnitTestCase extends AbstractDeploymentTest
{
  
   public void testEARDeployment() throws Exception
   {
      final HashSet expected = new HashSet();
      expected.add(ear2DeploymentUnpacked);
      expected.add(bean1DeploymentUnpacked);
      expected.add(web1DeploymentUnpacked);
      expected.add(rar1DeploymentUnpacked);
      expected.add(rarjar1Deployment);
      expected.add(client1DeploymentUnpacked);
      expected.add(ds1DeploymentUnpacked2);
      expected.add(service1Deployment);
      expected.add(sar1DeploymentUnpacked);
      
      DeploymentInfo topInfo = assertDeployed(ear2DeploymentUnpacked);
      CheckExpectedDeploymentInfoVisitor visitor = new CheckExpectedDeploymentInfoVisitor(expected);
      visitor.start(topInfo);
      assertTrue("Expected subdeployments: " + expected, expected.isEmpty());
   }
   
   public UnpackedEARDeploymentUnitTestCase(String test)
   {
      super(test);
   }

   public static Test suite() throws Exception
   {
      return getDeploySetup(UnpackedEARDeploymentUnitTestCase.class, ear2DeploymentUnpacked);
   }
}
