Search in sources :

Example 26 with IntellijAspectTestFixture

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

the class ScalaTestTest method testScalaTest.

@Test
public void testScalaTest() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":footest_fixture");
    TargetIdeInfo testInfo = findTarget(testFixture, ":FooTest");
    assertThat(testInfo.getKindString()).isEqualTo("scala_test");
    assertThat(relativePathsForArtifacts(testInfo.getJavaIdeInfo().getSourcesList())).containsExactly(testRelative("FooTest.scala"));
    assertThat(testInfo.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(Collectors.toList())).containsExactly(jarString(testRelative("FooTest.jar"), null, null));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).contains(testRelative("FooTest.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).contains(testRelative("FooTest.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).contains(testRelative("FooTest.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
    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 27 with IntellijAspectTestFixture

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

the class JavaLibraryTest method testJavaLibrary.

@Test
public void testJavaLibrary() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":simple_fixture");
    TargetIdeInfo target = findTarget(testFixture, ":simple");
    assertThat(target.getKindString()).isEqualTo("java_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.java"));
    assertThat(target.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList())).containsExactly(jarString(testRelative("libsimple.jar"), testRelative("libsimple-hjar.jar"), testRelative("libsimple-src.jar")));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("simple.java-manifest"), testRelative("simple.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).containsExactly(testRelative("libsimple.jar"), testRelative("libsimple-hjar.jar"), testRelative("libsimple-src.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).containsExactly(testRelative("libsimple.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-generic")).isEmpty();
    assertThat(target.getJavaIdeInfo().getJdeps().getRelativePath()).isEqualTo(testRelative("libsimple.jdeps"));
    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)

Example 28 with IntellijAspectTestFixture

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

the class JavaPluginTest method testJavaPlugin.

@Test
public void testJavaPlugin() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":java_plugin_fixture");
    TargetIdeInfo plugin = findTarget(testFixture, ":plugin");
    assertThat(plugin.getKindString()).isEqualTo("java_plugin");
    assertThat(plugin.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList())).containsExactly(jarString(testRelative("libplugin.jar"), testRelative("libplugin-hjar.jar"), testRelative("libplugin-src.jar")));
}
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 29 with IntellijAspectTestFixture

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

the class JavaProtoLibraryTest method testJavaProtoLibrary.

@Test
public void testJavaProtoLibrary() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":lib_fixture");
    TargetIdeInfo lib = findTarget(testFixture, ":lib");
    assertThat(lib).isNotNull();
    TargetIdeInfo jpl = findTarget(testFixture, ":bar_java_proto");
    assertThat(jpl).isNotNull();
    // We don't want java_proto_library to be rolling up any jars
    assertThat(jpl.getJavaIdeInfo().getJarsList()).isEmpty();
    // We shouldn't have reached the underlying base proto_library's
    assertThat(findTarget(testFixture, ":bar_proto")).isNull();
    assertThat(findTarget(testFixture, ":foo_proto")).isNull();
    TargetIdeInfo barProto = findAspectTarget(testFixture, ":bar_proto", "JavaProtoAspect");
    TargetIdeInfo fooProto = findAspectTarget(testFixture, ":foo_proto", "JavaProtoAspect");
    assertThat(barProto).isNotNull();
    assertThat(fooProto).isNotNull();
    // jpl -> (proto + jpl aspect)
    assertThat(jpl.getDepsList()).contains(Dependency.newBuilder().setDependencyType(DependencyType.COMPILE_TIME).setTarget(barProto.getKey()).build());
    // Make sure we suppress the proto_library legacy provider info
    assertThat(barProto.hasProtoLibraryLegacyJavaIdeInfo()).isFalse();
    assertThat(barProto.hasJavaIdeInfo()).isTrue();
    List<String> jarStrings = barProto.getJavaIdeInfo().getJarsList().stream().map(IntellijAspectTest::libraryArtifactToString).collect(toList());
    assertThat(jarStrings).containsExactly(jarString(testRelative("libbar_proto-speed.jar"), testRelative("libbar_proto-speed-hjar.jar"), testRelative("bar_proto-speed-src.jar")));
}
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 30 with IntellijAspectTestFixture

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

the class NoIdeTest method testNoIde.

@Test
public void testNoIde() throws Exception {
    IntellijAspectTestFixture testFixture = loadTestFixture(":noide_fixture");
    assertThat(findTarget(testFixture, ":foo")).isNotNull();
    assertThat(findTarget(testFixture, ":bar")).isNull();
    assertThat(findTarget(testFixture, ":baz")).isNull();
    assertThat(getOutputGroupFiles(testFixture, "intellij-info-java")).containsAllOf(testRelative("foo.java-manifest"), testRelative("foo.intellij-info.txt"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-resolve-java")).containsExactly(testRelative("libfoo.jar"), testRelative("libfoo-hjar.jar"), testRelative("libfoo-src.jar"));
    assertThat(getOutputGroupFiles(testFixture, "intellij-compile-java")).containsExactly(testRelative("libfoo.jar"));
}
Also used : IntellijAspectTestFixture(com.google.devtools.intellij.IntellijAspectTestFixtureOuterClass.IntellijAspectTestFixture) 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