Package org.apache.aries.application.management

Examples of org.apache.aries.application.management.AriesApplication


        waitForStart();
     
        URL urlToEba = getUrlToEba("org.apache.aries.samples.blog", "org.apache.aries.samples.blog.jdbc.eba");

        AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
        AriesApplication app = manager.createApplication(urlToEba);
        AriesApplicationContext ctx = manager.install(app);
        ctx.start();

    /* Check that the Blog Sample bundles are present an started */
        Bundle bapi = getInstalledBundle("org.apache.aries.samples.blog.api");
View Full Code Here


      waitForStart();
     
  /* Install and start the blog eba */
  URL urlToEba = getUrlToEba("org.apache.aries.samples.blog", "org.apache.aries.samples.blog.jpa.eba");
  AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
  AriesApplication app = manager.createApplication(urlToEba);
  AriesApplicationContext ctx = manager.install(app);
  ctx.start();

    /* Find and check all the blog sample bundles */

 
View Full Code Here

      waitForStart();
     
  /* Install and start the blog eba */
  URL urlToEba = getUrlToEba("org.apache.aries.samples.blog", "org.apache.aries.samples.blog.jpa.eba");
  AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
  AriesApplication app = manager.createApplication(urlToEba);
  AriesApplicationContext ctx = manager.install(app);
  ctx.start();

    /* Find and check all the blog sample bundles */

 
View Full Code Here

                                                ConfigurationStore targetConfigurationStore)
        throws IOException, DeploymentException {

        AriesApplicationManager appManager = getAriesApplicationManager();

        AriesApplication app = null;
        try {
            app = appManager.createApplication(FileSystem.getFSRoot(new File(jarFile.getName())));
        } catch (Exception e) {
            throw new DeploymentException("Error creating Aries Application", e);
        }

        if (!app.isResolved() && getResolveOnDeploy()) {
            try {
                app = appManager.resolve(app);
            } catch (Exception e) {
                throw new DeploymentException("Error resolving Aries Application", e);
            }
View Full Code Here

    return fileToHandlerLocation.getName().toLowerCase().endsWith(".eba");
  }

  public void install(File applicationLocation) throws Exception
  {
    AriesApplication app = applicationManager
        .createApplication(FileSystem.getFSRoot(applicationLocation));
   
    String appSymName = app.getApplicationMetadata().getApplicationSymbolicName();
    Version appVersion = app.getApplicationMetadata().getApplicationVersion();

    LOGGER.debug("created app from {} : {} {} with contents {}", new Object[] {
        applicationLocation.getName(), appSymName, appVersion,
        app.getApplicationMetadata().getApplicationContents() });

    AriesApplicationContext context = applicationManager.install(app);

    LOGGER.debug("installed app {} {} state: {}", new Object[] {
        appSymName, appVersion,
View Full Code Here

    _appMgr.setLocalPlatform(new DummyLocalPlatform());
  }
 
  @Test
  public void testCreate() throws Exception {
    AriesApplication app = createApplication (TEST_EBA);
   
    ApplicationMetadata appMeta = app.getApplicationMetadata();
    assertEquals (appMeta.getApplicationName(), "Test application");
    assertEquals (appMeta.getApplicationSymbolicName(), "org.apache.aries.application.management.test");
    assertEquals (appMeta.getApplicationVersion(), new Version("1.0"));
    List<Content> appContent = appMeta.getApplicationContents();
    assertEquals (appContent.size(), 2);
    Content fbw = new ContentImpl("foo.bar.widgets;version=1.0.0");
    Content mbl = new ContentImpl("my.business.logic;version=1.0.0");
    assertTrue (appContent.contains(fbw));
    assertTrue (appContent.contains(mbl));
   
    DeploymentMetadata dm = app.getDeploymentMetadata();
    List<DeploymentContent> dcList = dm.getApplicationDeploymentContents();

    assertEquals (2, dcList.size());
    DeploymentContent dc1 = new DeploymentContentImpl ("foo.bar.widgets;deployed-version=1.1.0");
    DeploymentContent dc2 = new DeploymentContentImpl ("my.business.logic;deployed-version=1.1.0");
View Full Code Here

  }
 
  @Test
  public void testCreateAndConversion() throws Exception {
      AriesApplication app = createApplication (CONVERSION_EBA);     
      ApplicationMetadata appMeta = app.getApplicationMetadata();     
      assertEquals (appMeta.getApplicationName(), "conversion.eba");    
      assertEquals (appMeta.getApplicationSymbolicName(), "conversion.eba");     
      assertEquals (appMeta.getApplicationVersion(), new Version("0.0"));     
      List<Content> appContent = appMeta.getApplicationContents();
      assertEquals (2, appContent.size());
      Content fbw = new ContentImpl("hello.world.jar;version=\"[1.1.0, 1.1.0]\"");
      Content mbl = new ContentImpl("helloWorld.war;version=\"[0.0.0, 0.0.0]\"");
      assertTrue (appContent.contains(fbw));
      assertTrue (appContent.contains(mbl));
     
      DeploymentMetadata dm = app.getDeploymentMetadata();
      List<DeploymentContent> dcList = dm.getApplicationDeploymentContents();

      assertEquals (2, dcList.size());
      DeploymentContent dc1 = new DeploymentContentImpl ("hello.world.jar;deployed-version=1.1.0");
      DeploymentContent dc2 = new DeploymentContentImpl ("helloWorld.war;deployed-version=0.0.0");
      DeploymentContent dc3 = new DeploymentContentImpl ("a.handy.persistence.library;deployed-version=1.1.0");
      assertTrue (dcList.contains(dc1));
      assertTrue (dcList.contains(dc2));
     
      dcList = dm.getApplicationProvisionBundles();
     
      assertEquals(1, dcList.size());
      assertTrue (dcList.contains(dc3));
     
      assertEquals(2, app.getBundleInfo().size());
      BundleInfo info;
      info = findBundleInfo(app.getBundleInfo(), "hello.world.jar");
      assertNotNull(info);
      assertEquals("HelloWorldJar", info.getHeaders().get(Constants.BUNDLE_NAME));
     
      info = findBundleInfo(app.getBundleInfo(), "helloWorld.war");
        assertNotNull(info);
        assertEquals("helloWorld.war", info.getHeaders().get(Constants.BUNDLE_NAME));
        assertEquals("/test", info.getHeaders().get("Bundle-ContextPath"));
  }
View Full Code Here

      return null;
  }
 
  @Test
  public void testStoreAndReload() throws Exception {
    AriesApplication app = createApplication (TEST_EBA);
    File dest = new File ("ariesApplicationManagerImplTest/stored.eba");
    app.store(dest);
   
    /* Dest should be a zip file with four entries:
     *  /foo.bar.widgets.jar
     *  /my.business.logic.jar
     *  /META-INF/APPLICATION.MF
     *  /META-INF/DEPLOYMENT.MF
     */
   
    IDirectory storedEba = FileSystem.getFSRoot(dest);
    assertNotNull (storedEba);
    assertEquals (storedEba.listFiles().size(), 3);
    IFile ifile = storedEba.getFile("META-INF/APPLICATION.MF");
    assertNotNull (ifile);
    ifile = storedEba.getFile ("META-INF/DEPLOYMENT.MF");
    assertNotNull (ifile);
    ifile = storedEba.getFile ("foo.bar.widgets.jar");
    assertNotNull (ifile);
    ifile = storedEba.getFile ("my.business.logic.jar");
    assertNotNull (ifile);
   
    AriesApplication newApp = _appMgr.createApplication(storedEba);
    DeploymentMetadata dm = newApp.getDeploymentMetadata();
    assertEquals (2, dm.getApplicationDeploymentContents().size());
    assertEquals(1, dm.getApplicationProvisionBundles().size());
    assertEquals (dm.getApplicationSymbolicName(), app.getApplicationMetadata().getApplicationSymbolicName());
    assertEquals (dm.getApplicationVersion(), app.getApplicationMetadata().getApplicationVersion());
  }
View Full Code Here

    assertEquals (dm.getApplicationVersion(), app.getApplicationMetadata().getApplicationVersion());
  }
 
  @Test
  public void testUpdate() throws Exception {
    AriesApplication app = createApplication(TEST_EBA);

    DeploymentMetadata depMf = createUpdateDepMf();
   
    AriesApplicationContextManager ctxMgr = Skeleton.newMock(AriesApplicationContextManager.class);
    _appMgr.setApplicationContextManager(ctxMgr);

    _appMgr.update(app, depMf);
   
    assertTrue("Deployment.mf should have been updated", app.getDeploymentMetadata() == depMf);
  }
View Full Code Here

  }
 
  @Test(expected=IllegalArgumentException.class)
  public void testUpdateWithIncorrectDepMf() throws Exception
  {
    AriesApplication app = createApplication(TEST_EBA);

    DeploymentMetadata depMf = Skeleton.newMock(DeploymentMetadata.class);
    Skeleton.getSkeleton(depMf).setReturnValue(new MethodCall(DeploymentMetadata.class, "getApplicationSymbolicName"), "random.app");
    Skeleton.getSkeleton(depMf).setReturnValue(new MethodCall(DeploymentMetadata.class, "getApplicationVersion"), new Version("1.0.0"));
   
View Full Code Here

TOP

Related Classes of org.apache.aries.application.management.AriesApplication

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.