Package org.apache.aries.unittest.mocks

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


    setupPersistenceBundle("file6", "");
   
    mgr.open();
   
    //Check the persistence.xml was looked for
    Skeleton.getSkeleton(persistenceBundle).assertCalled(new MethodCall(Bundle.class, "getEntry", "META-INF/persistence.xml"));
    //Check we didn't use getResource()
    Skeleton.getSkeleton(persistenceBundle).assertNotCalled(new MethodCall(Bundle.class, "getResource", String.class));
   
    testSuccessfulCreationEvent(ref, extenderContext, 2);
    testSuccessfulRegistrationEvent(ref, extenderContext, 2, "alpha", "bravo");
  }
View Full Code Here


    setupPersistenceBundle("file7", "");
   
    mgr.open();
   
    //Check the persistence.xml was looked for
    Skeleton.getSkeleton(persistenceBundle).assertCalled(new MethodCall(Bundle.class, "getEntry", "META-INF/persistence.xml"));
    //Check we didn't use getResource()
    Skeleton.getSkeleton(persistenceBundle).assertNotCalled(new MethodCall(Bundle.class, "getResource", String.class));
   
    testSuccessfulCreationEvent(ref, extenderContext, 2);
    testSuccessfulRegistrationEvent(ref, extenderContext, 2, "alpha", "bravo");
  }
View Full Code Here

    setupPersistenceBundle("file8", "");
   
    mgr.open();
   
    //Check the persistence.xml was looked for
    Skeleton.getSkeleton(persistenceBundle).assertCalled(new MethodCall(Bundle.class, "getEntry", "META-INF/persistence.xml"));
    //Check we didn't use getResource()
    Skeleton.getSkeleton(persistenceBundle).assertNotCalled(new MethodCall(Bundle.class, "getResource", String.class));
   
    Skeleton.getSkeleton(extenderContext).assertNotCalled(new MethodCall(BundleContext.class, "getService", ServiceReference.class));
    Skeleton.getSkeleton(extenderContext).assertNotCalled(new MethodCall(BundleContext.class, "ungetService", ServiceReference.class));
    Skeleton.getSkeleton(pp).assertNotCalled(new MethodCall(PersistenceProvider.class, "createContainerEntityManagerFactory", PersistenceUnitInfo.class, Map.class));
    Skeleton.getSkeleton(pp2).assertNotCalled(new MethodCall(PersistenceProvider.class, "createContainerEntityManagerFactory", PersistenceUnitInfo.class, Map.class));

   
 
  }
View Full Code Here

    mgr.open();

    BundleContextMock.assertNoServiceExists(EntityManagerFactory.class.getName());

    //A provider was instantiated
    Skeleton.getSkeleton(extenderContext).assertNotCalled(new MethodCall(BundleContext.class, "getService", ServiceReference.class));
  }
View Full Code Here

  {
    createSut();
    Skeleton.getSkeleton(listener).assertSkeletonNotCalled();
   
    ctx.registerService("java.lang.String", "uno", null);
    Skeleton.getSkeleton(listener).assertCalled(new MethodCall(SingleServiceListener.class, "serviceFound"));
   
    assertEquals("uno", sut.getService());
  }
View Full Code Here

    }
   
    private BundleToClassLoaderAdapter makeSUT(boolean includeBundleClass) {
        Bundle bundle = Skeleton.newMock(Bundle.class);
        if (includeBundleClass) {
            Skeleton.getSkeleton(bundle).setReturnValue(new MethodCall(Bundle.class, "loadClass", Bundle.class.getName()), Bundle.class);
        } else {
            Skeleton.getSkeleton(bundle).setThrows(new MethodCall(Bundle.class, "loadClass", Bundle.class.getName()), new ClassNotFoundException());
        }
       
        return new BundleToClassLoaderAdapter(bundle);
    }
View Full Code Here

   
    assertNotNull("We didn't get a service back from our lookup :(", s);
   
    service.run();
   
    Skeleton.getSkeleton(service).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1);

    Skeleton.getSkeleton(mock.getBundleContext()).assertCalled(new MethodCall(BundleContext.class, "getServiceReferences", "java.lang.Runnable", "(rubbish=smelly)"));
  }
View Full Code Here

   
    Runnable r = (Runnable) ctx.lookup("osgi:service/java.lang.Runnable");
   
    r.run();
   
    Skeleton.getSkeleton(t).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1);
    Skeleton.getSkeleton(t2).assertNotCalled(new MethodCall(Runnable.class, "run"));
   
    reg.unregister();
   
    r.run();
   
    Skeleton.getSkeleton(t).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1);
    Skeleton.getSkeleton(t2).assertCalledExactNumberOfTimes(new MethodCall(Runnable.class, "run"), 1);
  }
View Full Code Here

   
    Runnable r = (Runnable) ctx2.lookup(String.valueOf(reg.getReference().getProperty(Constants.SERVICE_ID)));

    r.run();
   
    Skeleton.getSkeleton(t).assertCalled(new MethodCall(Runnable.class, "run"));
   
    reg.unregister();
   
    try {
      r.run();
View Full Code Here

    InitialContext ctx = new InitialContext();
   
    String className = Runnable.class.getName();
   
    MethodCall run = new MethodCall(Runnable.class, "run");
   
    Runnable t = Skeleton.newMock(Runnable.class);
    Runnable t2 = Skeleton.newMock(Runnable.class);
   
    // we don't want the default service
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.