Package com.buschmais.jqassistant.core.store.api

Examples of com.buschmais.jqassistant.core.store.api.Store


        try {
          descriptorTypes = pluginManager.getDescriptorTypes();
        } catch (PluginReaderException e) {
          throw new MojoExecutionException("Cannot get descriptor mappers.", e);
        }
        Store store = getStore(baseProject);
        try {
          store.start(descriptorTypes);
          AbstractAnalysisAggregatorMojo.this.aggregate(baseProject, projects, store);
        } finally {
          store.stop();
        }
      }
    }, currentProject, reactorProjects);
  }
View Full Code Here


    } else {
      directory = new File(baseProject.getBuild().getDirectory() + "/jqassistant/store");
    }
    getLog().info("Opening store in directory '" + directory.getAbsolutePath() + "'");
    directory.getParentFile().mkdirs();
    Store store = new EmbeddedGraphStore(directory.getAbsolutePath());
    return store;
  }
View Full Code Here

        build.setOutputDirectory("target/classes");
        build.setTestOutputDirectory("target/test-classes");
        when(project.getBuild()).thenReturn(build);
        Map<String, Object> properties = new HashMap<>();
        properties.put(MavenProject.class.getName(), project);
        Store store = mock(Store.class);
        MavenProjectDirectoryDescriptor projectDescriptor = mock(MavenProjectDirectoryDescriptor.class);
        when(store.find(MavenProjectDirectoryDescriptor.class, "group:artifact:1.0.0")).thenReturn(null, projectDescriptor);
        when(store.create(MavenProjectDirectoryDescriptor.class, "group:artifact:1.0.0")).thenReturn(projectDescriptor);

        ArtifactDirectoryDescriptor mainArtifact = mock(ArtifactDirectoryDescriptor.class);
        when(store.find(ArtifactDescriptor.class, "group:artifact:jar:main:1.0.0")).thenReturn(null, mainArtifact);
        when(store.create(ArtifactDirectoryDescriptor.class, "group:artifact:jar:main:1.0.0")).thenReturn(mainArtifact);

        ArtifactDirectoryDescriptor testArtifact = mock(ArtifactDirectoryDescriptor.class);
        when(store.find(ArtifactDescriptor.class, "group:artifact:test-jar:main:1.0.0")).thenReturn(null, testArtifact);
        when(store.create(ArtifactDirectoryDescriptor.class, "group:artifact:test-jar:main:1.0.0")).thenReturn(testArtifact);

        DependsOnDescriptor dependsOnDescriptor = mock(DependsOnDescriptor.class);
        when(store.create(testArtifact, DependsOnDescriptor.class, mainArtifact)).thenReturn(dependsOnDescriptor);

        MavenProjectDescriptor parentProjectDescriptor = mock(MavenProjectDescriptor.class);
        when(store.find(MavenProjectDescriptor.class, "group:parent-artifact:1.0.0")).thenReturn(null, parentProjectDescriptor);
        when(store.create(MavenProjectDescriptor.class, "group:parent-artifact:1.0.0")).thenReturn(parentProjectDescriptor);

        scannerPlugin.initialize(store, properties);
        Scanner scanner = mock(Scanner.class);
        List mainFiles = new ArrayList<>();
        mainFiles.add(mock(FileDescriptor.class));
View Full Code Here

        return true;
    }

    @Override
    public Iterable<FileDescriptor> scan(MavenProject project, String path, Scope scope, Scanner scanner) throws IOException {
        Store store = getStore();
        store.beginTransaction();
        MavenProjectDirectoryDescriptor projectDescriptor;
        try {
            projectDescriptor = resolveProject(project, MavenProjectDirectoryDescriptor.class);
            projectDescriptor.setFileName(project.getBasedir().getAbsolutePath());
            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);
View Full Code Here

     * @param testArtifactDescriptor
     *            The artifact descriptor representing the test artifact.
     */
    private void addProjectDetails(MavenProject project, MavenProjectDirectoryDescriptor projectDescriptor, ArtifactDescriptor mainArtifactDescriptor,
            ArtifactDescriptor testArtifactDescriptor) {
        Store store = getStore();
        store.beginTransaction();
        try {
            addParent(project, projectDescriptor);
            addModules(project, projectDescriptor);
            addDependencies(project, mainArtifactDescriptor, testArtifactDescriptor, store);
        } finally {
            store.commitTransaction();
        }
    }
View Full Code Here

            final String directoryName, Scanner scanner) throws IOException {
        final File directory = new File(directoryName);
        if (!directory.exists()) {
            LOGGER.info("Directory '" + directory.getAbsolutePath() + "' does not exist, skipping scan.");
        } else {
            Store store = getStore();
            store.beginTransaction();
            try {
                final ArtifactDirectoryDescriptor artifactDescriptor = resolveArtifact(artifact, testJar, ArtifactDirectoryDescriptor.class);
                consume(scanner.scan(new ClassesDirectory(directory, artifactDescriptor), directoryName, CLASSPATH));
                projectDescriptor.getCreatesArtifacts().add(artifactDescriptor);
                return artifactDescriptor;
            } finally {
                store.commitTransaction();
            }
        }
        return null;
    }
View Full Code Here

     * @throws java.io.IOException
     *             If scanning fails.
     */
    private void scanTestReports(Scanner scanner, String directoryName) throws IOException {
        final File directory = new File(directoryName);
        Store store = getStore();
        if (directory.exists()) {
            store.beginTransaction();
            try {
                consume(scanner.scan(directory, TESTREPORTS), new Consumer<FileDescriptor>() {
                    @Override
                    public void next(FileDescriptor fileDescriptor) {
                    }
                });
            } finally {
                store.commitTransaction();
            }
        }
    }
View Full Code Here

        return CLASSPATH.equals(scope) && path.endsWith(".properties");
    }

    @Override
    public Iterable<? extends FileDescriptor> scan(InputStream item, String path, Scope scope, Scanner scanner) throws IOException {
        Store store = getStore();
        PropertyFileDescriptor propertyFileDescriptor = store.create(PropertyFileDescriptor.class);
        Properties properties = new Properties();
        properties.load(item);
        for (String name : properties.stringPropertyNames()) {
            String value = properties.getProperty(name);
            PropertyDescriptor propertyDescriptor = store.create(PropertyDescriptor.class);
            propertyDescriptor.setName(name);
            propertyDescriptor.setValue(value);
            propertyFileDescriptor.getProperties().add(propertyDescriptor);
        }
        propertyFileDescriptor.setFileName(path);
View Full Code Here

    }

    @Override
    public Iterable<? extends FileDescriptor> scan(InputStream item, String path, Scope scope, Scanner scanner) throws IOException {
        Manifest manifest = new Manifest(item);
        Store store = getStore();
        ManifestFileDescriptor manifestFileDescriptor = store.create(ManifestFileDescriptor.class);
        ManifestSectionDescriptor mainSectionDescriptor = store.create(ManifestSectionDescriptor.class);
        mainSectionDescriptor.setName(SECTION_MAIN);
        manifestFileDescriptor.setMainSection(mainSectionDescriptor);
        readSection(manifest.getMainAttributes(), mainSectionDescriptor, store);
        for (Map.Entry<String, Attributes> sectionEntry : manifest.getEntries().entrySet()) {
            ManifestSectionDescriptor sectionDescriptor = store.create(ManifestSectionDescriptor.class);
            sectionDescriptor.setName(sectionEntry.getKey());
            readSection(sectionEntry.getValue(), sectionDescriptor, store);
            manifestFileDescriptor.getManifestSections().add(sectionDescriptor);
        }
        manifestFileDescriptor.setFileName(path);
View Full Code Here

    }

    @Override
    public void run() {
        List<Class<?>> descriptorTypes;
        final Store store = getStore();

        try {
            descriptorTypes = getScannerPluginRepository(store, properties).getDescriptorTypes();
        } catch (PluginRepositoryException e) {
            throw new RuntimeException("Cannot get descriptor mappers.", e);
        }

        try {
            store.start(descriptorTypes);
            doTheTask(store);
        } finally {
            store.stop();
        }
    }
View Full Code Here

TOP

Related Classes of com.buschmais.jqassistant.core.store.api.Store

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.