protected void validateEarAssembly( File earFile ) throws Exception {
assertTrue( "EAR archive [" + earFile.getAbsolutePath() + "] cannot be found or cannot be read",
earFile.exists() && earFile.canRead() );
PortletAppDescriptorService portletSvc = new PortletAppDescriptorServiceImpl();
WebAppDescriptorService webSvc = new WebAppDescriptorServiceImpl();
PortletAppDD portletAppDD = null;
WebAppDD webAppDD = null;
List portletWarEntries = Arrays.asList( testWarEntryNames );
List unassembledWarEntries = Arrays.asList( unassembledWarEntryName );
List testPortlets = Arrays.asList( testPortletNames );
int earEntryCount = 0;
int totalWarEntryCount = 0;
int portletWarEntryCount = 0;
JarInputStream earIn = new JarInputStream( new FileInputStream( earFile ) );
JarEntry earEntry;
JarEntry warEntry;
while ( ( earEntry = earIn.getNextJarEntry() ) != null ) {
earEntryCount++;
if ( earEntry.getName().endsWith( ".war" ) ) {
totalWarEntryCount++;
JarInputStream warIn = new JarInputStream( earIn );
while ( ( warEntry = warIn.getNextJarEntry() ) != null ) {
if ( Assembler.PORTLET_XML.equals( warEntry.getName() ) ) {
portletAppDD = portletSvc.read(
new ByteArrayInputStream( IOUtils.toByteArray( warIn ) ) );
}
if ( Assembler.SERVLET_XML.equals( warEntry.getName() ) ) {
webAppDD = webSvc.read(
new ByteArrayInputStream( IOUtils.toByteArray( warIn ) ) );