SolutionImportHandler implements IPlatformImportHandler { protected void importMetaStore( ExportManifestMetaStore manifestMetaStore, boolean overwrite ) { if ( manifestMetaStore != null ) { RepositoryFileImportBundle.Builder bundleBuilder = new RepositoryFileImportBundle.Builder() .path( manifestMetaStore.getFile() ) .name( manifestMetaStore.getName() ) .withParam( "description", manifestMetaStore.getDescription() ) .charSet( UTF_8 ) .overwriteFile( overwrite ) .mime( "application/vnd.pentaho.metastore" ); cachedImports.put( manifestMetaStore.getFile(), bundleBuilder ); } } SolutionImportHandler( List<IMimeType> mimeTypes ); ImportSession getImportSession(); Log getLogger(); @Override void importFile( IPlatformImportBundle bundle ); @Override List<IMimeType> getMimeTypes(); IPlatformImportBundle build( RepositoryFileImportBundle.Builder builder ); Response createSchedulerJob( SchedulerResource scheduler, JobScheduleRequest jobScheduleRequest ); boolean isOverwriteFile(); void setOverwriteFile( boolean overwriteFile );  }
@Test public void testImportMetaStore() throws Exception { String path = "/path/to/file.zip"; ExportManifestMetaStore manifestMetaStore = new ExportManifestMetaStore( path, "metastore", "description of the metastore" ); importHandler.cachedImports = new HashMap<String, RepositoryFileImportBundle.Builder>(); importHandler.importMetaStore( manifestMetaStore, true ); Assert.assertEquals( 1, importHandler.cachedImports.size() ); Assert.assertNotNull( importHandler.cachedImports.get( path ) ); }
@Test public void testImportMetaStore_nullMetastoreManifest() throws Exception { ExportManifest manifest = Mockito.spy( new ExportManifest() ); importHandler.cachedImports = new HashMap<String, RepositoryFileImportBundle.Builder>(); importHandler.importMetaStore( manifest.getMetaStore(), true ); Assert.assertEquals( 0, importHandler.cachedImports.size() ); }