Search in sources :

Example 1 with ArtifactFileDescriptor

use of com.buschmais.jqassistant.plugin.common.api.model.ArtifactFileDescriptor in project jqa-java-plugin by buschmais.

the class TypeResolverIT method independentArtifacts.

/**
     * Verifies scanning dependent types located in independent artifacts.
     *
     * @throws IOException
     *             If the test fails.
     */
@Test
public void independentArtifacts() throws IOException {
    scanClasses("a1", A.class);
    scanClasses("a2", B.class);
    store.beginTransaction();
    TestResult testResult = query("match (artifact:Artifact)-[:CONTAINS]->(t:Type) where artifact.fqn={artifact} return t", MapBuilder.<String, Object>create("artifact", "a1").get());
    assertThat(testResult.getRows().size(), equalTo(1));
    assertThat(testResult.getColumn("t"), hasItem(typeDescriptor(A.class)));
    testResult = query("match (artifact:Artifact)-[:CONTAINS]->(t:Type) where artifact.fqn={artifact} return t", MapBuilder.<String, Object>create("artifact", "a2").get());
    assertThat(testResult.getRows().size(), equalTo(1));
    assertThat(testResult.getColumn("t"), hasItem(typeDescriptor(B.class)));
    testResult = query("match (artifact2:Artifact)-[:CONTAINS]->(b:Type)-[:DEPENDS_ON]->(a:Type)<-[:CONTAINS]-(artifact1:Artifact) where artifact1.fqn={a1} and artifact2.fqn={a2} and b.fqn={b} return a", MapBuilder.<String, Object>create("b", B.class.getName()).put("a1", "a1").put("a2", "a2").get());
    assertThat(testResult.getRows().size(), equalTo(0));
    testResult = query("match (artifact:Artifact)-[:REQUIRES]->(a:Type) where a.fqn={a} return artifact", MapBuilder.<String, Object>create("a", A.class.getName()).get());
    assertThat(testResult.getRows().size(), equalTo(1));
    ArtifactFileDescriptor a = (ArtifactFileDescriptor) testResult.getColumn("artifact").get(0);
    assertThat(a.getFullQualifiedName(), equalTo("a2"));
    store.commitTransaction();
}
Also used : JavaArtifactFileDescriptor(com.buschmais.jqassistant.plugin.java.api.model.JavaArtifactFileDescriptor) ArtifactFileDescriptor(com.buschmais.jqassistant.plugin.common.api.model.ArtifactFileDescriptor) Test(org.junit.Test)

Aggregations

ArtifactFileDescriptor (com.buschmais.jqassistant.plugin.common.api.model.ArtifactFileDescriptor)1 JavaArtifactFileDescriptor (com.buschmais.jqassistant.plugin.java.api.model.JavaArtifactFileDescriptor)1 Test (org.junit.Test)1