Search in sources :

Example 1 with CyclicDependenciesBuilder

use of com.intellij.cyclicDependencies.CyclicDependenciesBuilder in project intellij-community by JetBrains.

the class CyclicDependenciesTest method testT4.

public void testT4() {
    //com.a<->com.b
    //com.a->com.c->com.d->com.a
    final CyclicDependenciesBuilder builder = new CyclicDependenciesBuilder(myProject, new AnalysisScope(myProject));
    builder.analyze();
    final HashMap<PsiPackage, Set<List<PsiPackage>>> cyclicDependencies = builder.getCyclicDependencies();
    HashMap<String, String[][]> expected = new HashMap<>();
    expected.put("com.b", new String[][] { { "com.a", "com.b" } });
    expected.put("com.d", new String[][] { { "com.c", "com.a", "com.d" } });
    expected.put("com.c", new String[][] { { "com.a", "com.d", "com.c" } });
    expected.put("com.a", new String[][] { { "com.d", "com.c", "com.a" }, { "com.b", "com.a" } });
    checkResult(expected, cyclicDependencies, true);
}
Also used : JavaAnalysisScope(com.intellij.analysis.JavaAnalysisScope) AnalysisScope(com.intellij.analysis.AnalysisScope) CyclicDependenciesBuilder(com.intellij.cyclicDependencies.CyclicDependenciesBuilder) PsiPackage(com.intellij.psi.PsiPackage)

Example 2 with CyclicDependenciesBuilder

use of com.intellij.cyclicDependencies.CyclicDependenciesBuilder in project intellij-community by JetBrains.

the class CyclicDependenciesTest method testT6.

public void testT6() {
    //A->B1
    //B2->C
    //C->A
    final CyclicDependenciesBuilder builder = new CyclicDependenciesBuilder(myProject, new AnalysisScope(myProject));
    builder.analyze();
    final HashMap<PsiPackage, Set<List<PsiPackage>>> cyclicDependencies = builder.getCyclicDependencies();
    HashMap<String, String[][]> expected = new HashMap<>();
    expected.put("com.b", new String[][] { { "com.a", "com.c", "com.b" } });
    expected.put("com.c", new String[][] { { "com.b", "com.a", "com.c" } });
    expected.put("com.a", new String[][] { { "com.c", "com.b", "com.a" } });
    checkResult(expected, cyclicDependencies, true);
}
Also used : JavaAnalysisScope(com.intellij.analysis.JavaAnalysisScope) AnalysisScope(com.intellij.analysis.AnalysisScope) CyclicDependenciesBuilder(com.intellij.cyclicDependencies.CyclicDependenciesBuilder) PsiPackage(com.intellij.psi.PsiPackage)

Example 3 with CyclicDependenciesBuilder

use of com.intellij.cyclicDependencies.CyclicDependenciesBuilder in project intellij-community by JetBrains.

the class CyclicDependenciesTest method testT2.

public void testT2() {
    //com.b<->com.a
    //com.c<->com.d
    final CyclicDependenciesBuilder builder = new CyclicDependenciesBuilder(myProject, new AnalysisScope(myProject));
    builder.analyze();
    final HashMap<PsiPackage, Set<List<PsiPackage>>> cyclicDependencies = builder.getCyclicDependencies();
    HashMap<String, String[][]> expected = new HashMap<>();
    expected.put("com.b", new String[][] { { "com.a", "com.b" } });
    expected.put("com.d", new String[][] { { "com.c", "com.d" } });
    expected.put("com.c", new String[][] { { "com.d", "com.c" } });
    expected.put("com.a", new String[][] { { "com.b", "com.a" } });
    checkResult(expected, cyclicDependencies);
}
Also used : JavaAnalysisScope(com.intellij.analysis.JavaAnalysisScope) AnalysisScope(com.intellij.analysis.AnalysisScope) CyclicDependenciesBuilder(com.intellij.cyclicDependencies.CyclicDependenciesBuilder) PsiPackage(com.intellij.psi.PsiPackage)

Example 4 with CyclicDependenciesBuilder

use of com.intellij.cyclicDependencies.CyclicDependenciesBuilder in project intellij-community by JetBrains.

the class CyclicDependenciesTest method testNoCycle.

public void testNoCycle() {
    //B->A
    final CyclicDependenciesBuilder builder = new CyclicDependenciesBuilder(myProject, new AnalysisScope(myProject));
    builder.analyze();
    final HashMap<PsiPackage, Set<List<PsiPackage>>> cyclicDependencies = builder.getCyclicDependencies();
    HashMap<String, String[][]> expected = new HashMap<>();
    expected.put("com.b", new String[0][0]);
    expected.put("com.a", new String[0][0]);
    checkResult(expected, cyclicDependencies, true);
}
Also used : JavaAnalysisScope(com.intellij.analysis.JavaAnalysisScope) AnalysisScope(com.intellij.analysis.AnalysisScope) CyclicDependenciesBuilder(com.intellij.cyclicDependencies.CyclicDependenciesBuilder) PsiPackage(com.intellij.psi.PsiPackage)

Example 5 with CyclicDependenciesBuilder

use of com.intellij.cyclicDependencies.CyclicDependenciesBuilder in project intellij-community by JetBrains.

the class CyclicDependenciesTest method testT1.

public void testT1() {
    // com.a<->com.b
    final CyclicDependenciesBuilder builder = new CyclicDependenciesBuilder(myProject, new AnalysisScope(myProject));
    builder.analyze();
    final HashMap<PsiPackage, Set<List<PsiPackage>>> cyclicDependencies = builder.getCyclicDependencies();
    HashMap<String, String[][]> expected = new HashMap<>();
    expected.put("com.b", new String[][] { { "com.a", "com.b" } });
    expected.put("com.a", new String[][] { { "com.b", "com.a" } });
    checkResult(expected, cyclicDependencies);
}
Also used : JavaAnalysisScope(com.intellij.analysis.JavaAnalysisScope) AnalysisScope(com.intellij.analysis.AnalysisScope) CyclicDependenciesBuilder(com.intellij.cyclicDependencies.CyclicDependenciesBuilder) PsiPackage(com.intellij.psi.PsiPackage)

Aggregations

CyclicDependenciesBuilder (com.intellij.cyclicDependencies.CyclicDependenciesBuilder)10 JavaAnalysisScope (com.intellij.analysis.JavaAnalysisScope)9 PsiPackage (com.intellij.psi.PsiPackage)9 AnalysisScope (com.intellij.analysis.AnalysisScope)7 PerformAnalysisInBackgroundOption (com.intellij.analysis.PerformAnalysisInBackgroundOption)1 CyclicDependenciesPanel (com.intellij.cyclicDependencies.ui.CyclicDependenciesPanel)1 Content (com.intellij.ui.content.Content)1