Package org.apache.aries.unittest.mocks

Examples of org.apache.aries.unittest.mocks.MethodCall


  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"));
   
    AriesApplicationContextManager ctxMgr = Skeleton.newMock(AriesApplicationContextManager.class);
    _appMgr.setApplicationContextManager(ctxMgr);

    _appMgr.update(app, depMf);   
View Full Code Here


    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 {
View Full Code Here

    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 {
View Full Code Here

  }
 
  private DeploymentMetadata createUpdateDepMf()
  {
    DeploymentMetadata depMf = Skeleton.newMock(DeploymentMetadata.class);
    Skeleton.getSkeleton(depMf).setReturnValue(new MethodCall(DeploymentMetadata.class, "getApplicationSymbolicName"), "org.apache.aries.application.management.test");
    Skeleton.getSkeleton(depMf).setReturnValue(new MethodCall(DeploymentMetadata.class, "getApplicationVersion"), new Version("1.0.0"));

    return depMf;
  }
View Full Code Here

  @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"));
   
    Skeleton.getSkeleton(app).setReturnValue(
        new MethodCall(AriesApplication.class, "getBundleInfo"),
        new HashSet<BundleInfo>());
   
    ApplicationRepository rep = new ApplicationRepository(app);
    BundleSuggestion sug = rep.suggestBundleToUse(new DeploymentContentImpl("test.bundle", new Version("2.0.0")));
   
View Full Code Here

   
    @Before
    public void setup() {
        context = Skeleton.newMock(BundleContext.class);
        Skeleton.getSkeleton(context).setReturnValue(
                new MethodCall(BundleContext.class, "getServiceReference", "org.osgi.service.framework.CompositeBundleFactory"),
                Skeleton.newMock(ServiceReference.class));
    }
View Full Code Here

    }
   
    private CompositeBundle composite(String symbolicName, String version) {
        CompositeBundle cb = Skeleton.newMock(CompositeBundle.class);
        Skeleton cbSkel = Skeleton.getSkeleton(cb);
        cbSkel.setReturnValue(new MethodCall(CompositeBundle.class, "getSymbolicName"), symbolicName);
        cbSkel.setReturnValue(new MethodCall(CompositeBundle.class, "getVersion"), new Version(version));
        return cb;
    }
View Full Code Here

   
    pp = Skeleton.newMock(PersistenceProvider.class);
   
    providerBundleP100 = Skeleton.newMock(new BundleMock("no.such.Provider", new Hashtable<String, Object>()), Bundle.class);
    Skeleton skel = Skeleton.getSkeleton(providerBundleP100);
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("1.0.0"));

    providerBundleP101 = Skeleton.newMock(new BundleMock("no.such.Provider", new Hashtable<String, Object>()), Bundle.class);
    skel = Skeleton.getSkeleton(providerBundleP101);
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("1.0.1"));

    providerBundleP110 = Skeleton.newMock(new BundleMock("no.such.Provider", new Hashtable<String, Object>()), Bundle.class);
    skel = Skeleton.getSkeleton(providerBundleP110);
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("1.1.0"));

    providerBundleP111 = Skeleton.newMock(new BundleMock("no.such.Provider", new Hashtable<String, Object>()), Bundle.class);
    skel = Skeleton.getSkeleton(providerBundleP111);
    skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("1.1.1"));

    extenderBundle = Skeleton.newMock(new BundleMock("extender", new Hashtable<String, Object>()), Bundle.class);
//    Skeleton.getSkeleton(extenderBundle).setReturnValue(new MethodCall(Bundle.class, "getResource", "schemas/persistence_1_0.xsd"), new File("unittest/resources/persistence_1_0.xsd").toURI().toURL());
   
  }
View Full Code Here

  private BundleContext preExistingBundleSetup() {
   
    BundleContext extenderContext = extenderBundle.getBundleContext();

    Skeleton.getSkeleton(extenderContext).setReturnValue(
        new MethodCall(BundleContext.class, "getBundles"),
        new Bundle[] {persistenceBundle});
   
    mgr = new PersistenceBundleManager(extenderContext);
    mgr.setConfig(new Properties());
    mgr.setParser(new PersistenceDescriptorParserImpl());
View Full Code Here

  {
    preExistingBundleSetup();
    mgr.open();

    //Check the persistence.xml was not looked for
    Skeleton.getSkeleton(persistenceBundle).assertNotCalled(new MethodCall(Bundle.class, "getEntry", String.class));
    //Check we didn't use getResource()
    Skeleton.getSkeleton(persistenceBundle).assertNotCalled(new MethodCall(Bundle.class, "getResource", String.class));
    //Check we don't have an EMF
    BundleContextMock.assertNoServiceExists(EntityManagerFactory.class.getName());
   
    assertNull("We should not have an EntityManagerFactoryManager", getTrackedObject());
   
View Full Code Here

TOP

Related Classes of org.apache.aries.unittest.mocks.MethodCall

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.