Search in sources :

Example 1 with IntellijAspectTest

use of com.google.idea.blaze.aspect.IntellijAspectTest in project intellij by bazelbuild.

the class JavaBinaryTest method testJavaBinary.

@Test
public void testJavaBinary() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":foo_fixture");
    TargetIdeInfo binaryInfo = findTarget(testFixture, ":foo");
    assertThat(binaryInfo.getKindString()).isEqualTo("java_binary");
    assertThat(relativePathsForArtifacts(binaryInfo.getJavaIdeInfo().getSourcesList())).containsExactly(testRelative("FooMain.java"));
    assertThat(dependenciesForTarget(binaryInfo)).contains(dep(":foolib"));
    assertThat(binaryInfo.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList())).containsExactly(jarString(testRelative("foo.jar"), null, testRelative("foo-src.jar")));
    assertThat(binaryInfo.getJavaIdeInfo().getMainClass()).isEqualTo("com.google.MyMainClass");
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("foolib.java-manifest"), testRelative("foolib.intellij-info.txt"), testRelative("foo.java-manifest"), testRelative("foo.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).containsAllOf(testRelative("libfoolib.jar"), testRelative("libfoolib-hjar.jar"), testRelative("libfoolib-src.jar"), testRelative("foo.jar"), testRelative("foo-src.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).containsExactly(testRelative("libfoolib.jar"), testRelative("foo.jar"));
    assertThat(binaryInfo.getJavaIdeInfo().getJdeps().getRelativePath()).isEqualTo(testRelative("foo.jdeps"));
    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)

Example 2 with IntellijAspectTest

use of com.google.idea.blaze.aspect.IntellijAspectTest in project intellij by bazelbuild.

the class JavaTestTest method testJavaTest.

@Test
public void testJavaTest() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":footest_fixture");
    TargetIdeInfo testInfo = findTarget(testFixture, ":FooTest");
    assertThat(testInfo.getKindString()).isEqualTo("java_test");
    assertThat(relativePathsForArtifacts(testInfo.getJavaIdeInfo().getSourcesList())).containsExactly(testRelative("FooTest.java"));
    assertThat(testInfo.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList())).containsExactly(jarString(testRelative("FooTest.jar"), null, testRelative("FooTest-src.jar")));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("FooTest.java-manifest"), testRelative("FooTest.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).containsAllOf(testRelative("FooTest.jar"), testRelative("FooTest-src.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).contains(testRelative("FooTest.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("FooTest.java-manifest"), testRelative("FooTest.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
    assertThat(testInfo.getJavaIdeInfo().getJdeps().getRelativePath()).isEqualTo(testRelative("FooTest.jdeps"));
    assertThat(testInfo.getTestInfo().getSize()).isEqualTo("large");
}
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)

Example 3 with IntellijAspectTest

use of com.google.idea.blaze.aspect.IntellijAspectTest in project intellij by bazelbuild.

the class GenJarsTest method testJavaLibraryWithGeneratedSourcesHasGenJars.

@Test
public void testJavaLibraryWithGeneratedSourcesHasGenJars() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":has_plugin_fixture");
    TargetIdeInfo targetIdeInfo = findTarget(testFixture, ":has_plugin");
    assertThat(targetIdeInfo.getJavaIdeInfo().getGeneratedJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList())).containsExactly(jarString(testRelative("libhas_plugin-gen.jar"), null, testRelative("libhas_plugin-gensrc.jar")));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("has_plugin.java-manifest"), testRelative("has_plugin.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).containsAllOf(testRelative("libhas_plugin-gen.jar"), testRelative("libhas_plugin-gensrc.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).containsAllOf(testRelative("libhas_plugin.jar"), testRelative("libhas_plugin-gen.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)

Example 4 with IntellijAspectTest

use of com.google.idea.blaze.aspect.IntellijAspectTest 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)

Example 5 with IntellijAspectTest

use of com.google.idea.blaze.aspect.IntellijAspectTest in project intellij by bazelbuild.

the class ScalaLibraryTest method testScalaLibrary.

@Test
public void testScalaLibrary() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":simple_fixture");
    TargetIdeInfo target = findTarget(testFixture, ":simple");
    assertThat(target.getKindString()).isEqualTo("scala_library");
    assertThat(target.hasJavaIdeInfo()).isTrue();
    assertThat(target.hasCIdeInfo()).isFalse();
    assertThat(target.hasAndroidIdeInfo()).isFalse();
    assertThat(target.hasPyIdeInfo()).isFalse();
    assertThat(target.hasProtoLibraryLegacyJavaIdeInfo()).isFalse();
    assertThat(relativePathsForArtifacts(target.getJavaIdeInfo().getSourcesList())).containsExactly(testRelative("Foo.scala"));
    assertThat(target.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(Collectors.toList())).containsExactly(jarString(testRelative("simple.jar"), null, null));
    // Also contains ijars for scala-library.
    // Also contains jars + srcjars for liblibrary.
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).contains(testRelative("simple.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).contains(testRelative("simple.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).contains(testRelative("simple.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
    assertThat(target.getJavaIdeInfo().getMainClass()).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)10 TargetIdeInfo (com.google.devtools.intellij.ideinfo.IntellijIdeInfo.TargetIdeInfo)10 BazelIntellijAspectTest (com.google.idea.blaze.BazelIntellijAspectTest)10 IntellijAspectTest (com.google.idea.blaze.aspect.IntellijAspectTest)10 Test (org.junit.Test)10