Esempio n. 1
0
 public void assertProjectLibraries(String... expectedNames) {
   List<String> actualNames = new ArrayList<String>();
   for (Library each : ProjectLibraryTable.getInstance(myProject).getLibraries()) {
     String name = each.getName();
     actualNames.add(name == null ? "<unnamed>" : name);
   }
   assertUnorderedElementsAreEqual(actualNames, expectedNames);
 }
Esempio n. 2
0
 protected void readProjects(VirtualFile... files) {
   List<MavenProject> projects = new ArrayList<MavenProject>();
   for (VirtualFile each : files) {
     projects.add(myProjectsManager.findProject(each));
   }
   myProjectsManager.forceUpdateProjects(projects);
   waitForReadingCompletion();
 }
Esempio n. 3
0
  protected void assertModules(String... expectedNames) {
    Module[] actual = ModuleManager.getInstance(myProject).getModules();
    List<String> actualNames = new ArrayList<String>();

    for (Module m : actual) {
      actualNames.add(m.getName());
    }

    assertUnorderedElementsAreEqual(actualNames, expectedNames);
  }
Esempio n. 4
0
  private List<String> collectModuleDepsNames(String moduleName, Class clazz) {
    List<String> actual = new ArrayList<String>();

    for (OrderEntry e : getRootManager(moduleName).getOrderEntries()) {
      if (clazz.isInstance(e)) {
        actual.add(e.getPresentableName());
      }
    }
    return actual;
  }
Esempio n. 5
0
  private ContentEntry getContentRoot(String moduleName) {
    ContentEntry[] ee = getContentRoots(moduleName);
    List<String> roots = new ArrayList<String>();
    for (ContentEntry e : ee) {
      roots.add(e.getUrl());
    }

    String message = "Several content roots found: [" + StringUtil.join(roots, ", ") + "]";
    assertEquals(message, 1, ee.length);

    return ee[0];
  }
Esempio n. 6
0
  protected void assertContentRoots(String moduleName, String... expectedRoots) {
    List<String> actual = new ArrayList<String>();
    for (ContentEntry e : getContentRoots(moduleName)) {
      actual.add(e.getUrl());
    }

    for (int i = 0; i < expectedRoots.length; i++) {
      expectedRoots[i] = VfsUtil.pathToUrl(expectedRoots[i]);
    }

    assertUnorderedPathsAreEqual(actual, Arrays.asList(expectedRoots));
  }
Esempio n. 7
0
 protected void assertGeneratedSources(String moduleName, String... expectedSources) {
   ContentEntry contentRoot = getContentRoot(moduleName);
   List<ContentFolder> folders = new ArrayList<ContentFolder>();
   for (SourceFolder folder : contentRoot.getSourceFolders(JavaSourceRootType.SOURCE)) {
     JavaSourceRootProperties properties =
         folder.getJpsElement().getProperties(JavaSourceRootType.SOURCE);
     assertNotNull(properties);
     if (properties.isForGeneratedSources()) {
       folders.add(folder);
     }
   }
   doAssertContentFolders(contentRoot, folders, expectedSources);
 }
Esempio n. 8
0
  private static void doAssertContentFolders(
      ContentEntry e, final List<? extends ContentFolder> folders, String... expected) {
    List<String> actual = new ArrayList<String>();
    for (ContentFolder f : folders) {
      String rootUrl = e.getUrl();
      String folderUrl = f.getUrl();

      if (folderUrl.startsWith(rootUrl)) {
        int length = rootUrl.length() + 1;
        folderUrl = folderUrl.substring(Math.min(length, folderUrl.length()));
      }

      actual.add(folderUrl);
    }

    assertOrderedElementsAreEqual(actual, Arrays.asList(expected));
  }