Search in sources :

Example 11 with IntellijAspectTestFixture

use of com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture in project intellij by bazelbuild.

the class DependenciesTest method testJavaLibraryWithExports.

@Test
public void testJavaLibraryWithExports() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":export_fixture");
    TargetIdeInfo foo = findTarget(testFixture, ":foo");
    TargetIdeInfo fooExporter = findTarget(testFixture, ":foo_exporter");
    TargetIdeInfo exportConsumer = findTarget(testFixture, ":export_consumer");
    assertThat(foo).isNotNull();
    assertThat(dependenciesForTarget(fooExporter)).contains(dep(":foo"));
    assertThat(dependenciesForTarget(exportConsumer)).containsAllOf(dep(":foo_exporter"), dep(":foo"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("foo.java-manifest"), testRelative("foo.intellij-info.txt"), testRelative("foo_exporter.java-manifest"), testRelative("foo_exporter.intellij-info.txt"), testRelative("export_consumer.java-manifest"), testRelative("export_consumer.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).containsExactly(testRelative("libfoo.jar"), testRelative("libfoo-hjar.jar"), testRelative("libfoo-src.jar"), testRelative("libfoo_exporter.jar"), testRelative("libfoo_exporter-hjar.jar"), testRelative("libfoo_exporter-src.jar"), testRelative("libexport_consumer.jar"), testRelative("libexport_consumer-hjar.jar"), testRelative("libexport_consumer-src.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).containsExactly(testRelative("libfoo.jar"), testRelative("libfoo_exporter.jar"), testRelative("libexport_consumer.jar"));
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) Test(org.junit.Test) BazelIntellijAspectTest(com.google.idea.blaze.BazelIntellijAspectTest)

Example 12 with IntellijAspectTestFixture

use of com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture in project intellij by bazelbuild.

the class DependenciesTest method testJavaLibraryWithDependencies.

@Test
public void testJavaLibraryWithDependencies() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":single_dep_fixture");
    TargetIdeInfo fooTarget = findTarget(testFixture, ":foo");
    assertThat(fooTarget).isNotNull();
    TargetIdeInfo depTarget = findTarget(testFixture, ":single_dep");
    assertThat(dependenciesForTarget(depTarget)).contains(dep(":foo"));
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) Test(org.junit.Test) BazelIntellijAspectTest(com.google.idea.blaze.BazelIntellijAspectTest)

Example 13 with IntellijAspectTestFixture

use of com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture in project intellij by bazelbuild.

the class DependenciesTest method testJavaLibraryWithTransitiveExports.

@Test
public void testJavaLibraryWithTransitiveExports() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":transitive_export_fixture");
    TargetIdeInfo transitiveExportConsumer = findTarget(testFixture, ":transitive_export_consumer");
    assertThat(dependenciesForTarget(transitiveExportConsumer)).containsAllOf(dep(":foo"), dep(":foo_exporter"), dep(":foo_exporter_exporter"));
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) Test(org.junit.Test) BazelIntellijAspectTest(com.google.idea.blaze.BazelIntellijAspectTest)

Example 14 with IntellijAspectTestFixture

use of com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture in project intellij by bazelbuild.

the class PyLibraryTest method testPyLibrary.

@Test
public void testPyLibrary() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":simple_fixture");
    TargetIdeInfo target = findTarget(testFixture, ":simple");
    assertThat(target.getKindString()).isEqualTo("py_library");
    assertThat(target.hasPyIdeInfo()).isTrue();
    assertThat(target.hasJavaIdeInfo()).isFalse();
    assertThat(target.hasCIdeInfo()).isFalse();
    assertThat(target.hasAndroidIdeInfo()).isFalse();
    assertThat(target.hasProtoLibraryLegacyJavaIdeInfo()).isFalse();
    assertThat(relativePathsForArtifacts(target.getPyIdeInfo().getSourcesList())).containsExactly(testRelative("simple.py"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-py")).containsExactly(testRelative("simple.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) Test(org.junit.Test) BazelIntellijAspectTest(com.google.idea.blaze.BazelIntellijAspectTest)

Example 15 with IntellijAspectTestFixture

use of com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture in project intellij by bazelbuild.

the class ScalaBinaryTest method testScalaBinary.

@Test
public void testScalaBinary() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":foo_fixture");
    TargetIdeInfo binaryInfo = findTarget(testFixture, ":foo");
    assertThat(binaryInfo.getKindString()).isEqualTo("scala_binary");
    assertThat(relativePathsForArtifacts(binaryInfo.getJavaIdeInfo().getSourcesList())).containsExactly(testRelative("FooMain.scala"));
    assertThat(dependenciesForTarget(binaryInfo)).contains(dep(":foolib"));
    assertThat(binaryInfo.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(Collectors.toList())).containsExactly(jarString(testRelative("foo.jar"), null, null));
    assertThat(binaryInfo.getJavaIdeInfo().getMainClass()).isEqualTo("com.google.MyMainClass");
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("foolib.intellij-info.txt"), testRelative("foo.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).containsAllOf(testRelative("foolib.jar"), testRelative("foo.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).containsAllOf(testRelative("foolib.jar"), testRelative("foo.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
}
Also used : TargetIdeInfo(com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo) IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) IntellijAspectTest(com.google.idea.blaze.aspect.IntellijAspectTest) Test(org.junit.Test) BazelIntellijAspectTest(com.google.idea.blaze.BazelIntellijAspectTest)

Aggregations

IntellijAspectTestFixture (com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture)34 BazelIntellijAspectTest (com.google.idea.blaze.BazelIntellijAspectTest)33 Test (org.junit.Test)33 TargetIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo)32 IntellijAspectTest (com.google.idea.blaze.aspect.IntellijAspectTest)11 CIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.CIdeInfo)5 Iterables (com.google.common.collect.Iterables)1 Truth.assertThat (com.google.common.truth.Truth.assertThat)1 CToolchainIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.CToolchainIdeInfo)1 Dependency (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.Dependency)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 List (java.util.List)1 Objects (java.util.Objects)1 Collectors (java.util.stream.Collectors)1 Collectors.toList (java.util.stream.Collectors.toList)1 RunWith (org.junit.runner.RunWith)1 JUnit4 (org.junit.runners.JUnit4)1