Esempio n. 1
0
  @Test
  public void testHybridMobileManagerUpdateEngines() throws CoreException {
    final HybridMobileEngine[] engines = new HybridMobileEngine[2];
    engines[0] = new HybridMobileEngine();
    engines[0].setId("platform_0");
    engines[0].setVersion("0.0.0");
    engines[1] = new HybridMobileEngine();
    engines[1].setId("platform_1");
    engines[1].setVersion("1.1.1");
    manager.updateEngines(engines);
    // Run on a IWorkspaceRunnable because it needs to sync with the udpateEngines call.
    IWorkspaceRunnable runnable =
        new IWorkspaceRunnable() {

          @Override
          public void run(IProgressMonitor monitor) throws CoreException {
            Widget w = WidgetModel.getModel(testproject.hybridProject()).getWidgetForRead();
            assertEquals(engines.length, w.getEngines().size());
            checkEnginesPersistedCorrectly(engines);
            manager.updateEngines(engines);
            w = WidgetModel.getModel(testproject.hybridProject()).getWidgetForRead();
            assertEquals(engines.length, w.getEngines().size());
            checkEnginesPersistedCorrectly(engines);
          }
        };
    IWorkspace ws = ResourcesPlugin.getWorkspace();
    ISchedulingRule rule = ws.getRuleFactory().modifyRule(testproject.getProject());
    ResourcesPlugin.getWorkspace().run(runnable, rule, 0, new NullProgressMonitor());
  }
 @Test
 public void testHybridMobileManagerUpdateEngines() throws CoreException {
   final HybridMobileEngine[] engines = new HybridMobileEngine[2];
   engines[0] = new HybridMobileEngine();
   engines[0].setId("platform_0");
   engines[0].setVersion("0.0.0");
   engines[1] = new HybridMobileEngine();
   engines[1].setId("platform_1");
   engines[1].setVersion("1.1.1");
   manager.updateEngines(engines);
   Widget w = WidgetModel.getModel(testproject.hybridProject()).getWidgetForRead();
   assertEquals(engines.length, w.getEngines().size());
   checkEnginesPersistedCorrectly(engines);
   manager.updateEngines(engines);
   w = WidgetModel.getModel(testproject.hybridProject()).getWidgetForRead();
   assertEquals(engines.length, w.getEngines().size());
   checkEnginesPersistedCorrectly(engines);
 }
 @Test
 public void testHybridMobileManagerActiveEngines() throws CoreException {
   // Test project is created with default engines so we expect them to be equal.
   assertArrayEquals(HybridMobileEngineManager.defaultEngines(), manager.getActiveEngines());
 }