Package org.apache.aries.application.modelling

Examples of org.apache.aries.application.modelling.DeployedBundles


 
  @Test
  public void testGetImportPackage_bundleSymbolicNameOK() throws Exception
  {
    DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.CONTENT, ternary.NONE);
   
    deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
        Arrays.asList("package.b;version=1.0.0;bundle-symbolic-name=bundle.b;bundle-version=\"[1.0.0,2.0.0)\""), new ArrayList<String>()));
    deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
        new ArrayList<String>(), Arrays.asList("package.b;version=2.0.0")));
   
    // Check that the bundle-symbolic-name attribute for a bundle within deployed-content is ok.
    String importPackageEntry = null;
    try
    {
      importPackageEntry = deployedBundles.getImportPackage();     
    }
    catch (ResolverException e)
    {
      e.printStackTrace();
      Assert.fail(e.toString());
View Full Code Here


  }
 
  @Test
  public void testGetImportPackage_rfc138PreventsBundleSymbolicNameWorking() throws Exception
  {
    DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.USES, ternary.NONE);
   
    deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
        Arrays.asList("package.b;version=1.0.0;bundle-symbolic-name=bundle.b"), new ArrayList<String>()));
    deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
        new ArrayList<String>(), Arrays.asList("package.b;version=2.0.0")));

   
    // Check that the bundle-symbolic-name attribute for a bundle outside use-bundle causes an exception.
    String importPackageEntry = null;
    try
    {
      importPackageEntry = deployedBundles.getImportPackage();
      Assert.fail("Expected exception. ImportPackage=" + importPackageEntry);
    }
    catch (ResolverException e)
    {
      // We expect to reach this point if the test passes.
View Full Code Here

  }
 
  @Test
  public void testGetImportPackage_rfc138PreventsBundleVersionWorking() throws Exception
  {
    DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.NONE, ternary.NONE);
   
    deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
        Arrays.asList("package.b;version=1.0.0;bundle-version=1.0.0"), new ArrayList<String>()));
    deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
        new ArrayList<String>(), Arrays.asList("package.b;version=2.0.0")));

   
    // Check that the bundle-symbolic-name attribute for a bundle outside use-bundle causes an exception.
    String importPackageEntry = null;
    try
    {
      importPackageEntry = deployedBundles.getImportPackage();
      Assert.fail("Expected exception. ImportPackage=" + importPackageEntry);
    }
    catch (ResolverException e)
    {
      // We expect to reach this point if the test passes.
View Full Code Here

  }
 
  @Test
  public void testGetImportPackage_ValidResolutionAttribute() throws Exception
  {
    DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.CONTENT, ternary.NONE);
   
    deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
        Arrays.asList("package.c;version=1.0.0;resolution:=optional"), new ArrayList<String>()));
    deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
         Arrays.asList("package.c;version=1.0.0"), new ArrayList<String>()));
    deployedBundles.addBundle(createModelledResource("bundle.c", "1.0.0",
        new ArrayList<String>(), Arrays.asList("package.c;version=1.0.0")));
   
    // Check that the resulting resolution directive is not optional.
    String importPackageEntry = null;
    try
    {
      importPackageEntry = deployedBundles.getImportPackage();
    }
    catch (ResolverException e)
    {
      e.printStackTrace();
      Assert.fail(e.toString());
View Full Code Here

  {
    // Bundle A requires package B from bundle B with no version requirement.
    // Bundle B requires package C from bundle C with no version requirement.
    // Bundle C requires package B from bundle B with explicit version requirement.
   
    DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.USES, ternary.USES);
   
    deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
        Arrays.asList("package.b"), new ArrayList<String>()));
    deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
         Arrays.asList("package.c"), Arrays.asList("package.b;version=1.0.0")));
    deployedBundles.addBundle(createModelledResource("bundle.c", "1.0.0",
        Arrays.asList("package.b;version=1.0.0"), Arrays.asList("package.c;version=1.0.0")));
     
    // Check the redundant use-bundle entry is identified.
    // Bundle C is not required by app content, although it is specified in use-bundle.
    Collection<ModelledResource> requiredUseBundle = null;
    try
    {
      requiredUseBundle = deployedBundles.getRequiredUseBundle();
    }
    catch (ResolverException e)
    {
      e.printStackTrace();
      Assert.fail(e.toString());
View Full Code Here

  @Test
  public void testGetRequiredUseBundle_Valid() throws Exception
  {
    // Get a valid set of deployment information.
    DeployedBundles deployedBundles = validDeployedBundles();
    packagesResolve(deployedBundles);
   
    // Check all the use-bundle entries are required.
    Collection<ModelledResource> requiredUseBundle = null;
    try
    {
      requiredUseBundle = deployedBundles.getRequiredUseBundle();
    }
    catch (ResolverException e)
    {
      e.printStackTrace();
      Assert.fail(e.toString());
View Full Code Here

 
  //Inside cannot bundle-symbolic-name an outside bundle until the new RFC 138!
  @Test
  public void testGetImportPackage_InvalidBundleVersion() throws Exception
  {
    DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.USES, ternary.NONE);
   
    deployedBundles.addBundle(createModelledResource("bundle.a", "1.0.0",
        Arrays.asList("package.b;version=\"[1.0.0,1.0.0]\";bundle-symbolic-name=bundle.b;bundle-version=\"[0.0.0,1.0.0)\"")
        , new ArrayList<String>()));
    deployedBundles.addBundle(createModelledResource("bundle.b", "1.0.0",
         new ArrayList<String>(), Arrays.asList("package.b;version=1.0.0")));

    // Check that the bundle version requirement generates an error because it doesn't match the a bundle in use-bundle.
    String importPackageEntry = null;
    try
    {
      importPackageEntry = deployedBundles.getImportPackage();
      Assert.fail("Expected exception. ImportPackage=" + importPackageEntry);
    }
    catch (ResolverException e)
    {
      // We expect to reach this point if the test passes.
View Full Code Here

 
 
  @Test
  public void testImportedService() throws Exception
  {
    DeployedBundles deployedBundles = getSimpleDeployedBundles(ternary.CONTENT, ternary.NONE, ternary.NONE);

    deployedBundles.addBundle(createModelledServiceBundle("bundle.a", "1.0.0",
        Collections.singleton("java.util.List"), Collections.<String>emptyList()));

    deployedBundles.addBundle(createModelledServiceBundle("bundle.b", "1.0.0",
        Collections.singleton("java.util.Set"), Collections.singleton("java.util.List")));

    deployedBundles.addBundle(createModelledServiceBundle("bundle.c", "1.0.0",
        Collections.<String>emptyList(), Collections.singleton("java.util.Set")));
   
    assertEquals("(objectClass=java.util.List)", deployedBundles.getDeployedImportService());
  }
View Full Code Here

  @Test
  public void testGetContent_Valid() throws Exception
  {
    // Get a valid set of deployment information.
    DeployedBundles deployedBundles = validDeployedBundles();
    packagesResolve(deployedBundles);
   
    // Check the deployed content entry is correct.
    String contentEntry = deployedBundles.getContent();
    String expectedResult = "bundle.a;deployed-version=1.0.0,bundle.b;deployed-version=1.0.0";
    Assert.assertTrue("Content=" + contentEntry, isEqual(contentEntry, expectedResult));
  }
View Full Code Here

  @Test
  public void testGetUseBundle_Valid() throws Exception
  {
    // Get a valid set of deployment information.
    DeployedBundles deployedBundles = validDeployedBundles();
    packagesResolve(deployedBundles);
   
    // Check the deployed use bundle entry is correct.
    String useBundleEntry = deployedBundles.getUseBundle();
    String expectedResult = "bundle.c;deployed-version=1.0.0,bundle.d;deployed-version=1.0.0";
    Assert.assertTrue("UseBundle=" + useBundleEntry, isEqual(useBundleEntry, expectedResult));
  }
View Full Code Here

TOP

Related Classes of org.apache.aries.application.modelling.DeployedBundles

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.