Package net.sourceforge.cobertura.coveragedata

Examples of net.sourceforge.cobertura.coveragedata.ProjectData


                (String) pair[0], x);
        indexedPackageData.put(index, ppd);
    }

    public static ProjectData readCoberturaCoverageFile(File x) {
        ProjectData data = CoverageDataFileHandler.loadCoverageData(x);
        if (data == null) {
            throw new RuntimeException("File " + x.getName() + " is corrupt.");
        }
        return data;
    }
View Full Code Here


                        if (x instanceof PackageDataPair) {
                            PackageData pd = (PackageData) x.getData();
                            complexity = complexityCalc.getCCNForPackage(pd);
                        }
                        if (x instanceof ProjectDataPair) {
                            ProjectData pjd = (ProjectData) x.getData();
                            complexity = complexityCalc.getCCNForProject(pjd);
                        }
                        if (complexity != null) {
                            result.put("complexity", complexity.doubleValue());
                        } else {
View Full Code Here

public class ProjectDataHolderTest extends Assert {

    @Test
    public void testCaching() throws Exception {
        File f = File.createTempFile( "pp-pdh-unittest", null);
        ProjectDataHolder pdh = new ProjectDataHolder( new ProjectData(), f );
        pdh.saveChanges();
        assertEquals( 1, pdh.getSaves() );
        ProjectData before = pdh.getData();
        assertEquals( 1, pdh.getHits() );
        assertEquals( 0, pdh.getMisses() );
        pdh.ref.clear();
        ProjectData after = pdh.getData();
        assertEquals( 1, pdh.getHits() );
        assertEquals( 1, pdh.getMisses() );
        assertTrue( before != after );
        assertNotNull( after );
        assertNotNull( before );
        assertSame( f, pdh.getFile() );
       
        pdh = new ProjectDataHolder( new ProjectData() );
        pdh.saveChanges();
        pdh.getData();
        assertEquals( 0, pdh.getHits() );
        assertEquals( 0, pdh.getMisses() );
        assertEquals( 0, pdh.getSaves() );
View Full Code Here

        // caching;
        PackageAndProjectData ppd = accum.getIndexedPackageData().values().iterator().next();
        Assert.assertNotNull( ppd.getFile() );
        int hits = ppd.getHits();
        int misses = ppd.getMisses();
        ProjectData before = ppd.getData();
        assertEquals( ppd.getHits(), ++hits );
        assertEquals( ppd.getMisses(), misses );
        ppd.dataRef.clear();
        ProjectData after = ppd.getData();
        assertEquals( ppd.getHits(), hits );
        assertEquals( ppd.getMisses(), ++misses );
        assertFalse( before == after );
        assertEquals( before.getLineCoverageRate(), after.getLineCoverageRate(), .000000001 );
        assertEquals( before.getNumberOfChildren(), after.getNumberOfChildren() );
       

    }
View Full Code Here

            ProjectDataDifferenceCalculator calc = new ProjectDataDifferenceCalculator(
                    ppd.getData(), prev.getData());
            ProjectDataHolder perPackage = packageToCoverage
                    .get(ppd.getPackageName());
            if (perPackage == null) {
                ProjectData data = new ProjectData();
                if ( tmpdir == null ) {
                    perPackage = new ProjectDataHolder( data );
                }
                else {
                    perPackage = new ProjectDataHolder( data, new File( tmpdir, fileNameFor( ppd.getPackageName() )));
View Full Code Here

    public ProjectData getData() {
        if ( data != null ) {
            return data;
        }
        ProjectData result = dataRef.get();
        if ( result == null ) {
            result =  CoverageDirectoryReader.readCoberturaCoverageFile(file); // TODO location of this method?
            dataRef = new SoftReference<ProjectData>(result);
            ++misses;
        }
View Full Code Here

            cd.touch(i, 1);
        }
    }

    ProjectData buildBaseProjectData() {
        ProjectData data = new ProjectData();
        // addSomeStuff( data, "irrelevant", 8 );
        return data;
    }
View Full Code Here

        // addSomeStuff( data, "irrelevant", 8 );
        return data;
    }

    ProjectData buildOneCoverage() {
        ProjectData data = buildBaseProjectData();
        addSomeStuff(data, "foo", 3);
        addSomeStuff(data, "bar", 3);
        return data;
    }
View Full Code Here

    @Test
    public void testDiffs() throws Exception {
        PackageAndProjectData pZero = new PackageAndProjectData(
                buildBaseProjectData(), "an.ignored.name");
        ProjectData one = buildOneCoverage();
        PackageAndProjectData pOne = new PackageAndProjectData(one, "com.one");
        ProjectData two = buildOneCoverage();
        addSomeStuff(two, "foo", 2);
        addSomeStuff(two, "baz", 8);
        PackageAndProjectData pTwo = new PackageAndProjectData(two, "com.two");
        ProjectData three = buildOneCoverage();
        addSomeStuff(three, "foo", 2);
        addSomeStuff(three, "baz", 8);
        addSomeStuff(three, "bar", 1);
        addSomeStuff(three, "foo", 8);
        PackageAndProjectData pThree = new PackageAndProjectData(three,
View Full Code Here

   
    public ProjectData getData() {
        if ( raw != null ) {
            return raw;
        }
        ProjectData result = ref.get();
        if ( result == null ) {
            result = CoverageDirectoryReader.readCoberturaCoverageFile( file );
            ref = new SoftReference<ProjectData>(result);
            ++misses;
        }
View Full Code Here

TOP

Related Classes of net.sourceforge.cobertura.coveragedata.ProjectData

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.