XActionImportHandler extends RepositoryFileImportFileHandler implements IPlatformImportHandler { @Override public void importFile( IPlatformImportBundle bundle ) throws PlatformImportException { try { RepositoryFileImportBundle importBundle = (RepositoryFileImportBundle) bundle; byte[] bytes = IOUtils.toByteArray( bundle.getInputStream() ); importBundle.setInputStream( new ByteArrayInputStream( bytes ) ); Document document = getImportBundleDocument( new ByteArrayInputStream( bytes ) ); if ( importBundle.isHidden() == null ) { NodeList resultTypes = document.getElementsByTagName( "result-type" ); if ( resultTypes.getLength() > 0 ) { Node resultType = resultTypes.item( 0 ); boolean isHidden = "none".equals( resultType.getTextContent() ); importBundle.setHidden( isHidden ); } } importBundle( importBundle ); } catch ( Exception e ) { throw new PlatformImportException( e.getMessage(), e ); } } XActionImportHandler( List<IMimeType> mimeTypes ); @Override void importFile( IPlatformImportBundle bundle );  }
@Test public void testImportXactionWithHiddenFlagSetToFalse() throws Exception { ( (RepositoryFileImportBundle) bundle ).setInputStream( getXactionAsInputStream( XACTION_HIDDEN_FLAG_FALSE ) ); handler.importFile( bundle ); Assert.assertNotNull( ( (XActionImportHandlerForTesting) handler ).getResultingImportBundle() ); }
@Test public void testImportXactionWithHiddenFlagSetToTrue() throws Exception { ( (RepositoryFileImportBundle) bundle ).setInputStream( getXactionAsInputStream( XACTION_HIDDEN_FLAG_TRUE ) ); handler.importFile( bundle ); Assert.assertNotNull( ( (XActionImportHandlerForTesting) handler ).getResultingImportBundle() ); Assert.assertTrue( ( (XActionImportHandlerForTesting) handler ).getResultingImportBundle().isHidden() ); }