コード例 #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());
  }
コード例 #2
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);
   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);
 }
コード例 #3
0
 @After
 public void cleanUpHybridMobileManager() throws CoreException {
   if (testproject != null) {
     testproject.delete();
     testproject = null;
   }
   if (manager != null) {
     manager = null;
   }
 }
コード例 #4
0
 // Check given set of engines are persisted to config.xml correctly
 private void checkEnginesPersistedCorrectly(final HybridMobileEngine[] engines)
     throws CoreException {
   Widget w = WidgetModel.getModel(testproject.hybridProject()).getWidgetForRead();
   assertEquals(engines.length, w.getEngines().size());
   List<Engine> persistedEngines = w.getEngines();
   for (HybridMobileEngine hybridMobileEngine : engines) {
     boolean enginePersisted = false;
     for (Engine engine : persistedEngines) {
       if (hybridMobileEngine.getId().equals(engine.getName())
           && hybridMobileEngine.getVersion().equals(engine.getVersion())) {
         enginePersisted = true;
         break;
       }
     }
     assertTrue("HybridMobile Engine is not persisted correctly", enginePersisted);
   }
 }
コード例 #5
0
 @Before
 public void setUpHybridMobileManager() throws CoreException {
   testproject = new TestProject();
   manager = new HybridMobileEngineManager(testproject.hybridProject());
 }