@Test (enabled=true, dataProvider="validData") public void testImport(String inputFilename, String expectedRootName, boolean cyclical, int numTopLevel) throws Exception { File file = new File(inputFilename); ArrayList<File> files = new ArrayList<File>(); files.add(file); componentA = createAbstractComponent("compA", "0"); componentA.save(); Assert.assertEquals(0, componentA.getComponents().size()); Importer importer = new Importer(files, "TheOwner", componentA); importer.doInBackground(); Assert.assertEquals(componentA.getComponents().size(), 1); Assert.assertEquals(componentA.getComponents().get(0) .getComponents().size(), 1); Assert.assertEquals(componentA.getComponents().get(0) .getComponents().get(0) .getComponents().size(), numTopLevel); AbstractComponent importedComp = componentA.getComponents().get(0) .getComponents().get(0) .getComponents().get(0); Assert.assertEquals(importedComp.getDisplayName(), expectedRootName); if (cyclical) { verifyCyclicalSave(componentA); } else { verifySave(componentA); } }
@Override public Void doInBackground() { setProgress(0); PersistenceProvider provider = PlatformAccess.getPlatform().getPersistenceProvider(); provider.startRelatedOperations(); boolean completed = false; try { importComponents(); completed = true; } finally { provider.completeRelatedOperations(completed); } return null; }
Importer extends SwingWorker<Void, Void> { @Override public Void doInBackground() { setProgress(0); PersistenceProvider provider = PlatformAccess.getPlatform().getPersistenceProvider(); provider.startRelatedOperations(); boolean completed = false; try { importComponents(); completed = true; } finally { provider.completeRelatedOperations(completed); } return null; } }
Importer extends SwingWorker<Void, Void> { @Override public Void doInBackground() { setProgress(0); PersistenceProvider provider = PlatformAccess.getPlatform().getPersistenceProvider(); provider.startRelatedOperations(); boolean completed = false; try { importComponents(); completed = true; } finally { provider.completeRelatedOperations(completed); } return null; } Importer(List<File> files, String owner,	AbstractComponent selectedComponent, 
			        JProgressBar progressBar, JDialog jd);  Importer(List<File> files, String owner, AbstractComponent selectedComponent); }
Importer extends SwingWorker<Void, Void> { @Override public Void doInBackground() { setProgress(0); PersistenceProvider provider = PlatformAccess.getPlatform().getPersistenceProvider(); provider.startRelatedOperations(); boolean completed = false; try { importComponents(); completed = true; } finally { provider.completeRelatedOperations(completed); } return null; } Importer(List<File> files, String owner,	AbstractComponent selectedComponent, 
			        JProgressBar progressBar, JDialog jd);  Importer(List<File> files, String owner, AbstractComponent selectedComponent); @Override Void doInBackground(); @Override void done(); }
Importer extends SwingWorker<Void, Void> { @Override public Void doInBackground() { setProgress(0); PersistenceProvider provider = PlatformAccess.getPlatform().getPersistenceProvider(); provider.startRelatedOperations(); boolean completed = false; try { importComponents(); completed = true; } finally { provider.completeRelatedOperations(completed); } return null; } Importer(List<File> files, String owner,	AbstractComponent selectedComponent, 
			        JProgressBar progressBar, JDialog jd);  Importer(List<File> files, String owner, AbstractComponent selectedComponent); @Override Void doInBackground(); @Override void done();  }