Package org.apache.aries.application.management

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


    _appMgr.update(app, depMf);   
  }
 
  @Test
  public void testFailedUpdate() throws Exception {
    AriesApplication app = createApplication(TEST_EBA);

    DeploymentMetadata depMf = createUpdateDepMf();
   
    AriesApplicationContext ctx = Skeleton.newMock(AriesApplicationContext.class);
    Skeleton.getSkeleton(ctx).setReturnValue(new MethodCall(AriesApplicationContext.class, "getApplication"), app);
   
    AriesApplicationContextManager ctxMgr = Skeleton.newMock(AriesApplicationContextManager.class);
    Skeleton.getSkeleton(ctxMgr).setReturnValue(
        new MethodCall(AriesApplicationContextManager.class, "getApplicationContexts"),
        Collections.singleton(ctx));   
   
    Skeleton.getSkeleton(ctxMgr).setThrows(
        new MethodCall(AriesApplicationContextManager.class, "update", AriesApplication.class, DeploymentMetadata.class),
        new UpdateException("", null, false, null));
   
    _appMgr.setApplicationContextManager(ctxMgr);

    try {
      _appMgr.update(app, depMf);
      fail("Update should have failed.");
    } catch (UpdateException e) {
      assertTrue("Deployment.mf should have been updated", app.getDeploymentMetadata() == depMf);
    }
  }
View Full Code Here


    }
  }
 
  @Test
  public void testRolledbackUpdate() throws Exception {
    AriesApplication app = createApplication(TEST_EBA);

    DeploymentMetadata depMf = createUpdateDepMf();
    DeploymentMetadata oldMf = app.getDeploymentMetadata();
   
    AriesApplicationContext ctx = Skeleton.newMock(AriesApplicationContext.class);
    Skeleton.getSkeleton(ctx).setReturnValue(new MethodCall(AriesApplicationContext.class, "getApplication"), app);
   
    AriesApplicationContextManager ctxMgr = Skeleton.newMock(AriesApplicationContextManager.class);
    Skeleton.getSkeleton(ctxMgr).setReturnValue(
        new MethodCall(AriesApplicationContextManager.class, "getApplicationContexts"),
        Collections.singleton(ctx));   
   
    Skeleton.getSkeleton(ctxMgr).setThrows(
        new MethodCall(AriesApplicationContextManager.class, "update", AriesApplication.class, DeploymentMetadata.class),
        new UpdateException("", null, true, null));
   
    _appMgr.setApplicationContextManager(ctxMgr);

    try {
      _appMgr.update(app, depMf);
      fail("Update should have failed.");
    } catch (UpdateException e) {
      assertTrue("Deployment.mf should have been rolled back to the old", app.getDeploymentMetadata() == oldMf);
    }
  }
View Full Code Here

    v.set(resolvedPersistenceLibrary, new Version("1.1.0"));
    nextResolverResult.add(resolvedPersistenceLibrary);
    _resolver.setNextResult(nextResolverResult);
   
    IDirectory testEba = FileSystem.getFSRoot(new File(fileName));   
    AriesApplication app = _appMgr.createApplication(testEba);
    app = _appMgr.resolve(app);
    return app;
  }
View Full Code Here

import static org.junit.Assert.*;

public class ApplicationRepositoryTest {
  @Test
  public void testBundleNotInApp() {
    AriesApplication app = Skeleton.newMock(AriesApplication.class);
   
    BundleInfo bi = Skeleton.newMock(BundleInfo.class);
    Skeleton.getSkeleton(bi).setReturnValue(new MethodCall(BundleInfo.class, "getSymbolicName"), "test.bundle");
    Skeleton.getSkeleton(bi).setReturnValue(new MethodCall(BundleInfo.class, "getVersion"), new Version("1.0.0"));
   
View Full Code Here

 
  @Test
  public void testAppWithoutApplicationManifest() throws Exception {
   
    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
    AriesApplicationContext ctx = manager.install(app);
   
    ctx.start();
    assertHelloWorldService("test.eba");
  }
View Full Code Here

 
  @Test
  public void testAppWithApplicationManifest() throws Exception {
       
    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
    AriesApplicationContext ctx = manager.install(app);
   
    ctx.start();
    assertHelloWorldService("org.apache.aries.sample2");
  }
View Full Code Here

  }
 
  @Test
  public void testUninstallReinstall() throws Exception {
    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
    AriesApplicationContext ctx = manager.install(app);
   
    app = ctx.getApplication();

    ctx.start();
View Full Code Here

 
  @Test
  public void testAppWithFragment() throws Exception
  {
    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("withFragment.eba")));
    AriesApplicationContext ctx = manager.install(app);

    ctx.start();
   
    assertHelloWorldService("withFragment.eba");
View Full Code Here

  @Test
  public void testAppWithGlobalRepositoryBundle() throws Exception
  {
    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
   
    IsolationTestUtils.prepareSampleBundleV2(bundleContext,
        getOsgiService(RepositoryGenerator.class),
        getOsgiService(RepositoryAdmin.class),
        getOsgiService(ModellingManager.class));

    AriesApplication newApp = manager.resolve(app, new ResolveConstraint() {
      public String getBundleName() {
        return "org.apache.aries.isolated.sample";
      }

      public VersionRange getVersionRange() {
View Full Code Here

 
  @Test
  public void testAppWithoutApplicationManifest() throws Exception {
   
    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test.eba")));
   
    // application name should be equal to eba name since application.mf is not provided
    assertEquals("test.eba", app.getApplicationMetadata().getApplicationName());
    AriesApplicationContext ctx = manager.install(app);
    ctx.start();
   
    HelloWorld hw = getOsgiService(HelloWorld.class);
    String result = hw.getMessage();
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.