Examples of BundleMock


Examples of org.apache.aries.mocks.BundleMock

   * @throws NamingException
   */
  @Test
  public void jndiLookupWithFilter() throws NamingException
  {
    BundleMock mock = new BundleMock("scooby.doo", new Properties());
   
    Thread.currentThread().setContextClassLoader(mock.getClassLoader());

    InitialContext ctx = new InitialContext();
   
    Object s = ctx.lookup("osgi:service/java.lang.Runnable/(rubbish=smelly)");
   
    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

Examples of org.apache.aries.mocks.BundleMock

  @Test(expected=NameNotFoundException.class)
  public void testLookupWhenServiceHasBeenRemoved() throws NamingException
  {
    reg.unregister();

    BundleMock mock = new BundleMock("scooby.doo", new Properties());
   
    Thread.currentThread().setContextClassLoader(mock.getClassLoader());

    InitialContext ctx = new InitialContext();
   
    ctx.lookup("osgi:service/java.lang.Runnable");
  }
View Full Code Here

Examples of org.apache.aries.mocks.BundleMock

   * @throws NamingException
   */
  @Test(expected=NameNotFoundException.class)
  public void testLookupForServiceWeNeverHad() throws NamingException
  {
    BundleMock mock = new BundleMock("scooby.doo", new Properties());
   
    Thread.currentThread().setContextClassLoader(mock.getClassLoader());

    InitialContext ctx = new InitialContext();
   
    ctx.lookup("osgi:service/java.lang.Integer");
  }
View Full Code Here

Examples of org.apache.aries.mocks.BundleMock

  }

  @Test
  public void checkProxyDynamism() throws NamingException
  {
    BundleMock mock = new BundleMock("scooby.doo", new Properties());
   
    Thread.currentThread().setContextClassLoader(mock.getClassLoader());

    InitialContext ctx = new InitialContext();
   
    String className = Runnable.class.getName();
   
View Full Code Here

Examples of org.apache.aries.mocks.BundleMock

  }
 
  @Test
  public void checkServiceListLookup() throws NamingException
  {
    BundleMock mock = new BundleMock("scooby.doo", new Properties());
   
    Thread.currentThread().setContextClassLoader(mock.getClassLoader());

    InitialContext ctx = new InitialContext();
   
    String className = Runnable.class.getName();
   
View Full Code Here

Examples of org.apache.aries.mocks.BundleMock

  }
 
  @Test
  public void checkServiceListList() throws NamingException
  {
    BundleMock mock = new BundleMock("scooby.doo", new Properties());
   
    Thread.currentThread().setContextClassLoader(mock.getClassLoader());

    InitialContext ctx = new InitialContext();
   
    String className = Runnable.class.getName();
   
View Full Code Here

Examples of org.apache.aries.mocks.BundleMock

  }

  @Test
  public void checkServiceListListBindings() throws NamingException
  {
    BundleMock mock = new BundleMock("scooby.doo", new Properties());
   
    Thread.currentThread().setContextClassLoader(mock.getClassLoader());

    InitialContext ctx = new InitialContext();
   
    String className = Runnable.class.getName();
   
View Full Code Here

Examples of org.apache.aries.mocks.BundleMock

  }

  @Test(expected=ServiceException.class)
  public void checkProxyWhenServiceGoes() throws ServiceException, NamingException
  {
    BundleMock mock = new BundleMock("scooby.doo", new Properties());
   
    Thread.currentThread().setContextClassLoader(mock.getClassLoader());

    InitialContext ctx = new InitialContext();
   
    Runnable r = (Runnable) ctx.lookup("osgi:service/java.lang.Runnable");
   
View Full Code Here

Examples of org.apache.aries.mocks.BundleMock

  }
 
  @Test
  public void checkServiceOrderObserved() throws NamingException
  {
    BundleMock mock = new BundleMock("scooby.doo", new Properties());
   
    Thread.currentThread().setContextClassLoader(mock.getClassLoader());

    InitialContext ctx = new InitialContext();
   
    String className = Runnable.class.getName();
   
View Full Code Here

Examples of org.apache.aries.mocks.BundleMock

 
  private Bundle testBundle;
 
  @Before
  public void setup() {
    testBundle = Skeleton.newMock(new BundleMock("test",
        new Hashtable<Object, Object>()), Bundle.class);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.