Package melnorme.utilbox.concurrency

Examples of melnorme.utilbox.concurrency.LatchRunnable


   
    IProject project;
    long taskCount;
   
    // Test project with dub.json, but no D nature
    LatchRunnable latchRunnable = new LatchRunnable();
    getModelAgent().submit(latchRunnable);
    taskCount = getModelAgent().getSubmittedTaskCount();
    project = createAndOpenProject(DUB_TEST, true).getProject();
    writeDubJson(project, jsObject(jsEntry("name", "xptobundle")));
    // check no changes or updates submitted:
    assertTrue(getModelAgent().getSubmittedTaskCount() == taskCount);
    assertTrue(model.getBundleInfo(project) == null);
    latchRunnable.releaseAll();
   
    // Ensure non-d projects dont provoke updates
    deleteProject(DUB_TEST);
    assertTrue(getModelAgent().getSubmittedTaskCount() == taskCount);
   
    // Test project with D nature, but no dub.json
    taskCount = getModelAgent().getSubmittedTaskCount();
    project = createAndOpenDeeProject(DUB_TEST, true).getProject();
    // check no changes or updates submitted:
    assertTrue(getModelAgent().getSubmittedTaskCount() == taskCount);
    assertTrue(model.getBundleInfo(project) == null);
   
    // Test concurrency: updating a project that was removed in the meantime
    LatchRunnable preUpdateLatch = writeDubJsonWithModelLatch(project,
      "{"+ jsEntry("name", "xptobundle")+ jsFileEnd());
    DubBundleDescription unresolvedBundleDesc = getExistingDubBundleInfo(project);
    assertTrue(model.getBundleInfo(project) != null);
    project.delete(true, null);
    preUpdateLatch.releaseAll();
    _awaitModelUpdates_();
    assertTrue(model.getBundleInfo(project) == null);
   
    _awaitModelUpdates_();
    // Run sequence of workspace model tests
    project = createAndOpenDeeProject(DUB_TEST, true).getProject();
    runBasicTestSequence______________(project);
    project.delete(true, null); // cleanup
    assertTrue(model.getBundleInfo(project) == null);
    assertTrue(model.getProjectInfo(project) == null);
   
    // Verify code path where a non-D project that already has dub manifest is made a D project.
    _awaitModelUpdates_();
    project = createAndOpenProject(DUB_TEST, true);
    LatchRunnable modelLatch = writeDubJsonWithModelLatch(project, jsObject(jsEntry("name", "xptobundle")));
    setupStandardDeeProject(project);
    System.out.println("--------- .project contents: ");
    System.out.println(readFileContents(project.getFile(".project")));
   
    unresolvedBundleDesc = getExistingDubBundleInfo(project);
    modelLatch.releaseAll();
    checkDubModel(unresolvedBundleDesc, project,
      main(loc(project), null, "xptobundle", DubBundle.DEFAULT_VERSION, srcFolders(), rawDeps()));
   
    testProjectBPDependencies();
  }
View Full Code Here


  public static DubDependenciesContainer getDubContainer(IProject project) {
    return assertNotNull(model.getProjectInfo(project)).getDubContainer(project);
  }
 
  protected static LatchRunnable writeDubJsonWithModelLatch(IProject project, String contents) throws CoreException {
    LatchRunnable latchRunnable = new LatchRunnable();
    getModelAgent().submit(latchRunnable);
    writeDubJson(project, contents);
    return latchRunnable;
  }
View Full Code Here

    return CommonDubTest.paths(elems);
  }
 
  public void writeDubJsonAndCheckDubModel(String dubJson, IProject project, DubBundleChecker expMainBundle)
      throws CoreException {
    LatchRunnable preUpdateLatch = writeDubJsonWithModelLatch(project, dubJson);
    DubBundleDescription unresolvedBundleDesc = getExistingDubBundleInfo(project);
    preUpdateLatch.releaseAll();
   
    checkDubModel(unresolvedBundleDesc, project, expMainBundle);
  }
View Full Code Here

TOP

Related Classes of melnorme.utilbox.concurrency.LatchRunnable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.