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();
PortletApplicationDefinition portletApp = null;
PlutoWebXmlRewriter webXmlRewriter = null;
List<String> portletWarEntries = Arrays.asList( testWarEntryNames );
List<String> unassembledWarEntries = Arrays.asList( unassembledWarEntryName );
List<String> 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() ) ) {
portletApp = portletSvc.read( "test", "/test",
new ByteArrayInputStream( IOUtils.toByteArray( warIn ) ) );
}
if ( Assembler.SERVLET_XML.equals( warEntry.getName() ) ) {
webXmlRewriter = new PlutoWebXmlRewriter( new ByteArrayInputStream( IOUtils.toByteArray( warIn ) ) );
}