Examples of VersionConstraint


Examples of org.eclipse.osgi.service.resolver.VersionConstraint

        }
        bundles.add(bundle);
        ResolverError[] errors = state.getResolverErrors(bundle);
        for (ResolverError error : errors) {
            logError(bundle, level, error);
            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            switch (error.getType()) {
                case MISSING_IMPORT_PACKAGE:
                    ImportPackageSpecification pkgSpec = (ImportPackageSpecification)constraint;
                    for (BundleDescription b : getBundles()) {
                        for (ExportPackageDescription pkg : b.getExportPackages()) {
                            if (pkg.getName().equals(pkgSpec.getName())) {
                                if (pkgSpec.getVersionRange().isIncluded(pkg.getVersion())) {
                                    if (!pkg.getExporter().isResolved()) {
                                        logError(b, level, "Bundle unresolved: " + pkg);
                                        analyzeErrors(pkg.getExporter(), bundles, level + 1);
                                    }
                                } else {
                                    logError(b, level, "Version mismatch: " + pkgSpec + " " + pkg);
                                }
                            }
                        }
                    }
                    break;
                case MISSING_REQUIRE_BUNDLE:
                case MISSING_FRAGMENT_HOST:
                    // BundleSpecification bundleSpec = (BundleSpecification)constraint;
                    for (BundleDescription b : getBundles()) {
                        if (b == bundle) {
                            continue;
                        }
                        if (b.getSymbolicName().equals(constraint.getName())) {
                            if (constraint.getVersionRange().isIncluded(b.getVersion())) {
                                // There must be something wrong in the bundle
                                analyzeErrors(b, bundles, level);
                            } else {
                                logError(bundle, level, "Version mismatch: " + constraint + " " + b);
                            }
View Full Code Here

Examples of org.eclipse.osgi.service.resolver.VersionConstraint

    }
       
    private void collectErrors(BundleDescription bundle, State state, List<BundleDescription> bundleDescriptions, Collection<ErrorDetail> errorList) {
        ResolverError[] errors = state.getResolverErrors(bundle);
        for (ResolverError error : errors) {
            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            switch (error.getType()) {
                case MISSING_IMPORT_PACKAGE:
                    ImportPackageSpecification importPackageSpecification = (ImportPackageSpecification) constraint;
                    String resolution = (String) importPackageSpecification.getDirective(Constants.RESOLUTION_DIRECTIVE);
                    if (ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(resolution) || ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(resolution)) {
View Full Code Here

Examples of org.eclipse.osgi.service.resolver.VersionConstraint

        ResolverError[] bundleErrors = state.getResolverErrors(bundle);
        for (int j = 0; j < bundleErrors.length; j++) {
            ResolverError error = bundleErrors[j];
            errors.add(error);

            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
                BundleDescription[] requiredBundles = state.getBundles(constraint.getName());
                for (int i = 0; i < requiredBundles.length; i++) {
                    getRelevantErrors(errors, requiredBundles[i]);
                }
            }
        }
View Full Code Here

Examples of org.eclipse.osgi.service.resolver.VersionConstraint

        }
        bundles.add(bundle);
        ResolverError[] errors = state.getResolverErrors(bundle);
        for (ResolverError error : errors) {
            logError(bundle, level, error);
            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            switch (error.getType()) {
                case MISSING_IMPORT_PACKAGE:
                    ImportPackageSpecification pkgSpec = (ImportPackageSpecification)constraint;
                    for (BundleDescription b : getBundles()) {
                        for (ExportPackageDescription pkg : b.getExportPackages()) {
                            if (pkg.getName().equals(pkgSpec.getName())) {
                                if (pkgSpec.getVersionRange().isIncluded(pkg.getVersion())) {
                                    if (!pkg.getExporter().isResolved()) {
                                        logError(b, level, "Bundle unresolved: " + pkg);
                                        analyzeErrors(pkg.getExporter(), bundles, level + 1);
                                    }
                                } else {
                                    logError(b, level, "Version mismatch: " + pkgSpec + " " + pkg);
                                }
                            }
                        }
                    }
                    break;
                case MISSING_REQUIRE_BUNDLE:
                case MISSING_FRAGMENT_HOST:
                    // BundleSpecification bundleSpec = (BundleSpecification)constraint;
                    for (BundleDescription b : getBundles()) {
                        if (b == bundle) {
                            continue;
                        }
                        if (b.getSymbolicName() == null) {
                            logError(b, level, "No SymbolicName for " + b.getLocation());
                            continue;
                        }
                        if (constraint.getName() == null) {
                            logError(bundle, level, "no constraint name: " + constraint);
                        }
                        if (b.getSymbolicName().equals(constraint.getName())) {
                            if (constraint.getVersionRange().isIncluded(b.getVersion())) {
                                // There must be something wrong in the bundle
                                analyzeErrors(b, bundles, level);
                            } else {
                                logError(bundle, level, "Version mismatch: " + constraint + " " + b);
                            }
View Full Code Here

Examples of org.eclipse.sapphire.VersionConstraint

    {
        final TestElement element = TestElement.TYPE.instantiate();
       
        element.setVersionConstraint( "[1.2.3-2.0)" );
       
        final VersionConstraint constraint = element.getVersionConstraint().content();
       
        assertNotNull( constraint );
        assertTrue( constraint.check( "1.2.3" ) );
        assertTrue( constraint.check( "1.5" ) );
        assertFalse( constraint.check( "2.0" ) );
        assertFalse( constraint.check( "55.0" ) );
    }
View Full Code Here

Examples of org.eclipse.sapphire.VersionConstraint

{
    @Test
   
    public void testSingleVersionConstraint()
    {
        final VersionConstraint constraint = new VersionConstraint( "1.2.3" );
       
        assertTrue( constraint.check( new Version( "1.2.3" ) ) );
        assertTrue( constraint.check( new Version( "1.2.3.0.0" ) ) );
        assertFalse( constraint.check( new Version( "1.2.4" ) ) );
        assertFalse( constraint.check( new Version( "1.2.3.4" ) ) );
    }
View Full Code Here

Examples of org.eclipse.sapphire.VersionConstraint

   
    @Test
   
    public void testClosedRangeVersionConstraint1()
    {
        final VersionConstraint constraint = new VersionConstraint( "[1.2.3-1.3)" );
       
        assertTrue( constraint.check( new Version( "1.2.3" ) ) );
        assertTrue( constraint.check( new Version( "1.2.3.0.0" ) ) );
        assertTrue( constraint.check( new Version( "1.2.5" ) ) );
        assertFalse( constraint.check( new Version( "1.3" ) ) );
        assertFalse( constraint.check( new Version( "1.3.0" ) ) );
    }
View Full Code Here

Examples of org.eclipse.sapphire.VersionConstraint

   
    @Test
   
    public void testClosedRangeVersionConstraint2()
    {
        final VersionConstraint constraint = new VersionConstraint( "[1.2.3-1.3]" );
       
        assertTrue( constraint.check( new Version( "1.2.3" ) ) );
        assertTrue( constraint.check( new Version( "1.2.3.0.0" ) ) );
        assertTrue( constraint.check( new Version( "1.2.5" ) ) );
        assertTrue( constraint.check( new Version( "1.3" ) ) );
        assertTrue( constraint.check( new Version( "1.3.0" ) ) );
        assertFalse( constraint.check( new Version( "1.3.1" ) ) );
    }
View Full Code Here

Examples of org.eclipse.sapphire.VersionConstraint

   
    @Test

    public void testClosedRangeVersionConstraint3()
    {
        final VersionConstraint constraint = new VersionConstraint( "(1.2.3-1.3]" );
       
        assertFalse( constraint.check( new Version( "1.2.3" ) ) );
        assertFalse( constraint.check( new Version( "1.2.3.0.0" ) ) );
        assertTrue( constraint.check( new Version( "1.2.5" ) ) );
        assertTrue( constraint.check( new Version( "1.3" ) ) );
        assertTrue( constraint.check( new Version( "1.3.0" ) ) );
        assertFalse( constraint.check( new Version( "1.3.1" ) ) );
    }
View Full Code Here

Examples of org.eclipse.sapphire.VersionConstraint

   
    @Test

    public void testOpenRangeVersionConstraint1()
    {
        final VersionConstraint constraint = new VersionConstraint( "[1.2.3" );
       
        assertFalse( constraint.check( new Version( "0.5.3" ) ) );
        assertFalse( constraint.check( new Version( "1.0" ) ) );
        assertFalse( constraint.check( new Version( "1.2.2" ) ) );
        assertTrue( constraint.check( new Version( "1.2.3" ) ) );
        assertTrue( constraint.check( new Version( "1.2.3.0.0" ) ) );
        assertTrue( constraint.check( new Version( "1.2.5" ) ) );
        assertTrue( constraint.check( new Version( "1.3" ) ) );
        assertTrue( constraint.check( new Version( "2.0" ) ) );
        assertTrue( constraint.check( new Version( "55.0" ) ) );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.