Package org.apache.aries.application.modelling.internal

Examples of org.apache.aries.application.modelling.internal.PackageRequirementMerger


      {
        result.add(req);
      }
    }
   
    PackageRequirementMerger merger = new PackageRequirementMerger(result);
    if (!merger.isMergeSuccessful())
    {
      List<String> pkgNames = new ArrayList<String>(merger.getInvalidRequirements());
     
      StringBuilder buff = new StringBuilder();
      for (String pkgName : merger.getInvalidRequirements())
      {
        buff.append(pkgName).append(", ");
      }

      int buffLen = buff.length();
      String pkgString = (buffLen > 0 ? buff.substring(0, buffLen - 2) : "");

      ResolverException re = new ResolverException(MessageUtil.getMessage(
          "INCOMPATIBLE_PACKAGE_VERSION_REQUIREMENTS", new Object[] { assetName, pkgString }));
      re.setUnsatisfiedRequirements(pkgNames);
      logger.debug(LOG_EXIT,"getExternalPackageRequirements", re);
     
      throw re;
    }
   
    result = merger.getMergedRequirements();
    logger.debug(LOG_EXIT,"getExternalPackageRequirements", result);
   
    return result;
  }
View Full Code Here


      {
        result.add(req);
      }
    }
   
    PackageRequirementMerger merger = new PackageRequirementMerger(result);
    if (!merger.isMergeSuccessful())
    {
      List<String> pkgNames = new ArrayList<String>(merger.getInvalidRequirements());
     
      StringBuilder buff = new StringBuilder();
      for (String pkgName : merger.getInvalidRequirements())
      {
        buff.append(pkgName).append(", ");
      }

      int buffLen = buff.length();
      String pkgString = (buffLen > 0 ? buff.substring(0, buffLen - 2) : "");

      ResolverException re = new ResolverException(MessageUtil.getMessage(
          "INCOMPATIBLE_PACKAGE_VERSION_REQUIREMENTS", new Object[] { assetName, pkgString }));
      re.setUnsatisfiedRequirements(pkgNames);
      logger.debug(LOG_EXIT,"getExternalPackageRequirements", re);
     
      throw re;
    }
   
    result = merger.getMergedRequirements();
    logger.debug(LOG_EXIT,"getExternalPackageRequirements", result);
   
    return result;
  }
View Full Code Here

    reqs.add(newImportedPackage("a", "2.0.0"));
    reqs.add(newImportedPackage("a", "3.0.0"));
    reqs.add(newImportedPackage("b", "1.0.0"));
    reqs.add(newImportedPackage("b", "2.0.0"));
    reqs.add(newImportedPackage("c", "1.0.0"));
    PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
   
    Assert.assertTrue(merger.isMergeSuccessful());
   
    Assert.assertTrue(merger.getInvalidRequirements().isEmpty());
   
    Collection<ImportedPackage> result = merger.getMergedRequirements();
    Collection<ImportedPackage> expected = new ArrayList<ImportedPackage>();
    expected.add(newImportedPackage("a", "3.0.0"));
    expected.add(newImportedPackage("b", "2.0.0"));
    expected.add(newImportedPackage("c", "1.0.0"));
    Assert.assertTrue(result.toString(), isEqual(result, expected));
View Full Code Here

    reqs.add(newImportedPackage("a", "[3.0.0,3.0.0]"));
    reqs.add(newImportedPackage("b", "1.0.0"));
    reqs.add(newImportedPackage("b", "2.0.0"));
    reqs.add(newImportedPackage("c", "[1.0.0,2.0.0)"));
    reqs.add(newImportedPackage("c", "2.0.0"));
    PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
   
    Assert.assertFalse(merger.isMergeSuccessful());
   
    try
    {
      merger.getMergedRequirements();
      Assert.fail("getMergedRequirements should throw IllegalStateException.");
    }
    catch (IllegalStateException e) { }
   
    Set<String> result = merger.getInvalidRequirements();
    Set<String> expected = new HashSet<String>();
    expected.add("a");
    expected.add("c");
    Assert.assertEquals(expected, result);
  }
View Full Code Here

  public void testMergeOptionalResolution() throws Exception
  {
    Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
    reqs.add(newImportedPackage("a", "1.0.0", true));
    reqs.add(newImportedPackage("a", "2.0.0", true));
    PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
   
    Assert.assertTrue(merger.isMergeSuccessful());
   
    Assert.assertTrue(merger.getInvalidRequirements().isEmpty());
   
    Collection<ImportedPackage> result = merger.getMergedRequirements();
    Collection<ImportedPackage> expected = new ArrayList<ImportedPackage>();
    expected.add(newImportedPackage("a", "2.0.0", true));
    Assert.assertTrue(result.toString(), isEqual(result, expected));
  }
View Full Code Here

  public void testMergeMandatoryResolution() throws Exception
  {
    Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
    reqs.add(newImportedPackage("a", "1.0.0", true));
    reqs.add(newImportedPackage("a", "2.0.0", false));
    PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
   
    Assert.assertTrue(merger.isMergeSuccessful());
   
    Assert.assertTrue(merger.getInvalidRequirements().isEmpty());
   
    Collection<ImportedPackage> result = merger.getMergedRequirements();
    Collection<ImportedPackage> expected = new ArrayList<ImportedPackage>();
    expected.add(newImportedPackage("a", "2.0.0"));
    Assert.assertTrue(result.toString(), isEqual(result, expected));
  }
View Full Code Here

  public void testMergeValidAdditionalAttributes()  throws Exception
  {
    Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
    reqs.add(newImportedPackage("a", "1.0.0", "foo=bar"));
    reqs.add(newImportedPackage("a", "2.0.0", "foo=bar"));
    PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
   
    Assert.assertTrue(merger.isMergeSuccessful());
   
    Assert.assertTrue(merger.getInvalidRequirements().isEmpty());
   
    Collection<ImportedPackage> result = merger.getMergedRequirements();
    Collection<ImportedPackage> expected = new ArrayList<ImportedPackage>();
    expected.add(newImportedPackage("a", "2.0.0", "foo=bar"));
    Assert.assertTrue(result.toString(), isEqual(result, expected));
  }
View Full Code Here

  {
    Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
    reqs.add(newImportedPackage("a", "1.0.0", "foo=bar"));
    reqs.add(newImportedPackage("a", "2.0.0", "foo=blah"));
    reqs.add(newImportedPackage("b", "1.0.0"));
    PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
   
    Assert.assertFalse(merger.isMergeSuccessful());
   
    try
    {
      merger.getMergedRequirements();
      Assert.fail("getMergedRequirements should throw IllegalStateException.");
    }
    catch (IllegalStateException e) { }
   
    Set<String> result = merger.getInvalidRequirements();
    Set<String> expected = new HashSet<String>();
    expected.add("a");
    Assert.assertEquals(expected, result);
  }
View Full Code Here

TOP

Related Classes of org.apache.aries.application.modelling.internal.PackageRequirementMerger

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.