Package com.buschmais.jqassistant.plugin.common.api.type

Examples of com.buschmais.jqassistant.plugin.common.api.type.ArtifactDescriptor


    }

    protected <T extends ArtifactDescriptor> T resolveArtifact(Artifact artifact, boolean testJar, Class<T> expectedType) {
        String type = testJar ? ARTIFACTTYPE_TEST_JAR : artifact.getType();
        String id = createId(artifact.getGroupId(), artifact.getArtifactId(), type, artifact.getClassifier(), artifact.getVersion());
        ArtifactDescriptor artifactDescriptor = store.find(ArtifactDescriptor.class, id);
        if (artifactDescriptor == null) {
            artifactDescriptor = store.create(expectedType, id);
            artifactDescriptor.setGroup(artifact.getGroupId());
            artifactDescriptor.setName(artifact.getArtifactId());
            artifactDescriptor.setVersion(artifact.getVersion());
            artifactDescriptor.setClassifier(artifact.getClassifier());
            artifactDescriptor.setType(type);
        } else if (!expectedType.isAssignableFrom(artifactDescriptor.getClass())) {
            artifactDescriptor = getStore().migrate(artifactDescriptor, expectedType);
        }
        return expectedType.cast(artifactDescriptor);
    }
View Full Code Here


            projectDescriptor.setPackaging(project.getPackaging());
        } finally {
            store.commitTransaction();
        }
        Artifact artifact = project.getArtifact();
        ArtifactDescriptor mainArtifactDescriptor = scanClassesDirectory(projectDescriptor, artifact, false, project.getBuild().getOutputDirectory(), scanner);
        ArtifactDescriptor testArtifactDescriptor = scanClassesDirectory(projectDescriptor, artifact, true, project.getBuild().getTestOutputDirectory(),
                scanner);
        addProjectDetails(project, projectDescriptor, mainArtifactDescriptor, testArtifactDescriptor);
        scanTestReports(scanner, project.getBuild().getDirectory() + "/surefire-reports");
        scanTestReports(scanner, project.getBuild().getDirectory() + "/failsafe-reports");
        return emptyList();
View Full Code Here

        if (mainArtifactDescriptor != null && testArtifactDescriptor != null) {
            DependsOnDescriptor dependsOnDescriptor = store.create(testArtifactDescriptor, DependsOnDescriptor.class, mainArtifactDescriptor);
            dependsOnDescriptor.setScope(Artifact.SCOPE_TEST);
        }
        for (Artifact dependency : (Set<Artifact>) project.getDependencyArtifacts()) {
            ArtifactDescriptor dependencyDescriptor = resolveArtifact(dependency);
            DependsOnDescriptor dependsOnDescriptor;
            ArtifactDescriptor dependentDescriptor;
            String scope = dependency.getScope();
            if (Artifact.SCOPE_TEST.equals(scope)) {
                dependentDescriptor = testArtifactDescriptor;
            } else {
                dependentDescriptor = mainArtifactDescriptor;
View Full Code Here

        when(artifact.getType()).thenReturn("jar");
        when(artifact.getGroupId()).thenReturn("group");
        when(artifact.getArtifactId()).thenReturn("artifact");
        when(project.getArtifact()).thenReturn(artifact);

        ArtifactDescriptor artifactDescriptor = mock(ArtifactDescriptor.class);
        when(artifactDescriptor.getContains()).thenReturn(new HashSet<FileDescriptor>());
        when(store.create(Mockito.any(Class.class), Mockito.anyString())).thenReturn(artifactDescriptor);
    }
View Full Code Here

     * @throws IOException
     *             If scanning fails.
     */
    protected void scanClasses(String artifactId, Class<?>... classes) throws IOException {
        store.beginTransaction();
        ArtifactDescriptor artifact = getArtifactDescriptor(artifactId);
        for (FileDescriptor descriptor : getScanner().scan(asList(classes), JavaScope.CLASSPATH)) {
            artifact.addContains(descriptor);
        }
        store.commitTransaction();
    }
View Full Code Here

    }

    protected void scanResources(Scope scope, String artifactId, String... resources) throws IOException {
        File directory = getClassesDirectory(this.getClass());
        store.beginTransaction();
        ArtifactDescriptor artifact = artifactId != null ? getArtifactDescriptor(artifactId) : null;
        for (String resource : resources) {
            File file = new File(directory, resource);
            for (FileDescriptor descriptor : getScanner().scan(file, resource, scope)) {
                artifact.addContains(descriptor);
            }
        }
        store.commitTransaction();
    }
View Full Code Here

    @Override
    public Iterable<FileDescriptor> scan(MavenProject project, String path, Scope scope, Scanner scanner) throws IOException {
        Store store = getStore();
        store.beginTransaction();
        try {
            final ArtifactDescriptor artifact = resolveArtifact(project.getArtifact(), false, ArtifactDescriptor.class);
            for (File file : getPdeFiles(project)) {
                consume(scanner.scan(file, file.getPath(), CLASSPATH), new IterableConsumer.Consumer<FileDescriptor>() {
                    @Override
                    public void next(FileDescriptor fileDescriptor) {
                        artifact.addContains(fileDescriptor);
                    }
                });
            }
        } finally {
            store.commitTransaction();
View Full Code Here

TOP

Related Classes of com.buschmais.jqassistant.plugin.common.api.type.ArtifactDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.