org.knowhowlab.osgi.testing.assertions
Class ServiceAssert

java.lang.Object
  extended by org.knowhowlab.osgi.testing.assertions.OSGiAssert
      extended by org.knowhowlab.osgi.testing.assertions.ServiceAssert

public class ServiceAssert
extends OSGiAssert

A set of OSGi services specific assertion methods useful for writing tests.

Before use it should be initialized OSGiAssert.init(org.osgi.framework.BundleContext)

Version:
1.0
Author:
dmytro.pishchukhin
See Also:
AssertionError, OSGiAssert

Method Summary
static void assertServiceAvailable(Class clazz)
          Asserts that service with class is available in OSGi registry.
static void assertServiceAvailable(Class clazz, long timeout)
          Asserts that service with class is available in OSGi registry within given timeout.
static void assertServiceAvailable(Class clazz, long timeout, TimeUnit timeUnit)
          Asserts that service with class is available in OSGi registry within given timeout.
static void assertServiceAvailable(org.osgi.framework.Filter filter)
          Asserts that service with filter is available in OSGi registry.
static void assertServiceAvailable(org.osgi.framework.Filter filter, long timeout)
          Asserts that service with filter is available in OSGi registry within given timeout.
static void assertServiceAvailable(org.osgi.framework.Filter filter, long timeout, TimeUnit timeUnit)
          Asserts that service with filter is available in OSGi registry within given timeout.
static void assertServiceAvailable(String className)
          Asserts that service with class name is available in OSGi registry.
static void assertServiceAvailable(String message, Class clazz)
          Asserts that service with class is available in OSGi registry.
static void assertServiceAvailable(String message, Class clazz, long timeout)
          Asserts that service with class is available in OSGi registry within given timeout.
static void assertServiceAvailable(String message, Class clazz, long timeout, TimeUnit timeUnit)
          Asserts that service with class is available in OSGi registry within given timeout.
static void assertServiceAvailable(String message, org.osgi.framework.Filter filter)
          Asserts that service with filter is available in OSGi registry.
static void assertServiceAvailable(String message, org.osgi.framework.Filter filter, long timeout)
          Asserts that service with filter is available in OSGi registry within given timeout.
static void assertServiceAvailable(String message, org.osgi.framework.Filter filter, long timeout, TimeUnit timeUnit)
          Asserts that service with filter is available in OSGi registry within given timeout.
static void assertServiceAvailable(String className, long timeout)
          Asserts that service with class name is available in OSGi registry within given timeout.
static void assertServiceAvailable(String className, long timeout, TimeUnit timeUnit)
          Asserts that service with class name is available in OSGi registry within given timeout.
static void assertServiceAvailable(String message, String className)
          Asserts that service with class name is available in OSGi registry.
static void assertServiceAvailable(String message, String className, long timeout)
          Asserts that service with class name is available in OSGi registry within given timeout.
static void assertServiceAvailable(String message, String className, long timeout, TimeUnit timeUnit)
          Asserts that service with class name is available in OSGi registry within given timeout.
static void assertServiceUnavailable(Class clazz)
          Asserts that service with class is unavailable in OSGi registry.
static void assertServiceUnavailable(Class clazz, long timeout)
          Asserts that service with class is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(Class clazz, long timeout, TimeUnit timeUnit)
          Asserts that service with class is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(org.osgi.framework.Filter filter)
          Asserts that service with filter is unavailable in OSGi registry.
static void assertServiceUnavailable(org.osgi.framework.Filter filter, long timeout)
          Asserts that service with filter is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(org.osgi.framework.Filter filter, long timeout, TimeUnit timeUnit)
          Asserts that service with filter is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(String className)
          Asserts that service with class name is unavailable in OSGi registry.
static void assertServiceUnavailable(String message, Class clazz)
          Asserts that service with class is unavailable in OSGi registry.
static void assertServiceUnavailable(String message, Class clazz, long timeout)
          Asserts that service with class is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(String message, Class clazz, long timeout, TimeUnit timeUnit)
          Asserts that service with class is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(String message, org.osgi.framework.Filter filter)
          Asserts that service with filter is unavailable in OSGi registry.
static void assertServiceUnavailable(String message, org.osgi.framework.Filter filter, long timeout)
          Asserts that service with filter is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(String message, org.osgi.framework.Filter filter, long timeout, TimeUnit timeUnit)
          Asserts that service with filter is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(String className, long timeout)
          Asserts that service with class name is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(String className, long timeout, TimeUnit timeUnit)
          Asserts that service with class name is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(String message, String className)
          Asserts that service with class name is unavailable in OSGi registry.
static void assertServiceUnavailable(String message, String className, long timeout)
          Asserts that service with class name is unavailable in OSGi registry within given timeout.
static void assertServiceUnavailable(String message, String className, long timeout, TimeUnit timeUnit)
          Asserts that service with class name is unavailable in OSGi registry within given timeout.
 
Methods inherited from class org.knowhowlab.osgi.testing.assertions.OSGiAssert
getBundleContext, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertServiceAvailable

public static void assertServiceAvailable(Class clazz)
Asserts that service with class is available in OSGi registry. If it not as expected AssertionError without a message is thrown

Parameters:
clazz - service class

assertServiceAvailable

public static void assertServiceAvailable(String message,
                                          Class clazz)
Asserts that service with class is available in OSGi registry. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
clazz - service class

assertServiceAvailable

public static void assertServiceAvailable(Class clazz,
                                          long timeout)
Asserts that service with class is available in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
clazz - service class
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceAvailable

public static void assertServiceAvailable(String message,
                                          Class clazz,
                                          long timeout)
Asserts that service with class is available in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
clazz - service class
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceAvailable

public static void assertServiceAvailable(Class clazz,
                                          long timeout,
                                          TimeUnit timeUnit)
Asserts that service with class is available in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
clazz - service class
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceAvailable

public static void assertServiceAvailable(String message,
                                          Class clazz,
                                          long timeout,
                                          TimeUnit timeUnit)
Asserts that service with class is available in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
clazz - service class
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceAvailable

public static void assertServiceAvailable(String className)
Asserts that service with class name is available in OSGi registry. If it not as expected AssertionError without a message is thrown

Parameters:
className - service class name

assertServiceAvailable

public static void assertServiceAvailable(String message,
                                          String className)
Asserts that service with class name is available in OSGi registry. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
className - service class name

assertServiceAvailable

public static void assertServiceAvailable(String className,
                                          long timeout)
Asserts that service with class name is available in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
className - service class name
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceAvailable

public static void assertServiceAvailable(String message,
                                          String className,
                                          long timeout)
Asserts that service with class name is available in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
className - service class name
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceAvailable

public static void assertServiceAvailable(String className,
                                          long timeout,
                                          TimeUnit timeUnit)
Asserts that service with class name is available in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
className - service class name
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceAvailable

public static void assertServiceAvailable(String message,
                                          String className,
                                          long timeout,
                                          TimeUnit timeUnit)
Asserts that service with class name is available in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
className - service class name
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceAvailable

public static void assertServiceAvailable(org.osgi.framework.Filter filter)
Asserts that service with filter is available in OSGi registry. If it not as expected AssertionError without a message is thrown

Parameters:
filter - service filter

assertServiceAvailable

public static void assertServiceAvailable(String message,
                                          org.osgi.framework.Filter filter)
Asserts that service with filter is available in OSGi registry. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
filter - service filter

assertServiceAvailable

public static void assertServiceAvailable(org.osgi.framework.Filter filter,
                                          long timeout)
Asserts that service with filter is available in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
filter - service filter
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceAvailable

public static void assertServiceAvailable(String message,
                                          org.osgi.framework.Filter filter,
                                          long timeout)
Asserts that service with filter is available in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
filter - service filter
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceAvailable

public static void assertServiceAvailable(org.osgi.framework.Filter filter,
                                          long timeout,
                                          TimeUnit timeUnit)
Asserts that service with filter is available in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
filter - service filter
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceAvailable

public static void assertServiceAvailable(String message,
                                          org.osgi.framework.Filter filter,
                                          long timeout,
                                          TimeUnit timeUnit)
Asserts that service with filter is available in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
filter - service filter
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceUnavailable

public static void assertServiceUnavailable(Class clazz)
Asserts that service with class is unavailable in OSGi registry. If it not as expected AssertionError without a message is thrown

Parameters:
clazz - service class

assertServiceUnavailable

public static void assertServiceUnavailable(String message,
                                            Class clazz)
Asserts that service with class is unavailable in OSGi registry. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
clazz - service class

assertServiceUnavailable

public static void assertServiceUnavailable(Class clazz,
                                            long timeout)
Asserts that service with class is unavailable in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
clazz - service class
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceUnavailable

public static void assertServiceUnavailable(String message,
                                            Class clazz,
                                            long timeout)
Asserts that service with class is unavailable in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
clazz - service class
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceUnavailable

public static void assertServiceUnavailable(Class clazz,
                                            long timeout,
                                            TimeUnit timeUnit)
Asserts that service with class is unavailable in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
clazz - service class
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceUnavailable

public static void assertServiceUnavailable(String message,
                                            Class clazz,
                                            long timeout,
                                            TimeUnit timeUnit)
Asserts that service with class is unavailable in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
clazz - service class
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceUnavailable

public static void assertServiceUnavailable(String className)
Asserts that service with class name is unavailable in OSGi registry. If it not as expected AssertionError without a message is thrown

Parameters:
className - service class name

assertServiceUnavailable

public static void assertServiceUnavailable(String message,
                                            String className)
Asserts that service with class name is unavailable in OSGi registry. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
className - service class name

assertServiceUnavailable

public static void assertServiceUnavailable(String className,
                                            long timeout)
Asserts that service with class name is unavailable in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
className - service class name
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceUnavailable

public static void assertServiceUnavailable(String message,
                                            String className,
                                            long timeout)
Asserts that service with class name is unavailable in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
className - service class name
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceUnavailable

public static void assertServiceUnavailable(String className,
                                            long timeout,
                                            TimeUnit timeUnit)
Asserts that service with class name is unavailable in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
className - service class name
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceUnavailable

public static void assertServiceUnavailable(String message,
                                            String className,
                                            long timeout,
                                            TimeUnit timeUnit)
Asserts that service with class name is unavailable in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
className - service class name
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceUnavailable

public static void assertServiceUnavailable(org.osgi.framework.Filter filter)
Asserts that service with filter is unavailable in OSGi registry. If it not as expected AssertionError without a message is thrown

Parameters:
filter - service filter

assertServiceUnavailable

public static void assertServiceUnavailable(String message,
                                            org.osgi.framework.Filter filter)
Asserts that service with filter is unavailable in OSGi registry. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
filter - service filter

assertServiceUnavailable

public static void assertServiceUnavailable(org.osgi.framework.Filter filter,
                                            long timeout)
Asserts that service with filter is unavailable in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
filter - service filter
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceUnavailable

public static void assertServiceUnavailable(String message,
                                            org.osgi.framework.Filter filter,
                                            long timeout)
Asserts that service with filter is unavailable in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
filter - service filter
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.

assertServiceUnavailable

public static void assertServiceUnavailable(org.osgi.framework.Filter filter,
                                            long timeout,
                                            TimeUnit timeUnit)
Asserts that service with filter is unavailable in OSGi registry within given timeout. If it not as expected AssertionError without a message is thrown

Parameters:
filter - service filter
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit

assertServiceUnavailable

public static void assertServiceUnavailable(String message,
                                            org.osgi.framework.Filter filter,
                                            long timeout,
                                            TimeUnit timeUnit)
Asserts that service with filter is unavailable in OSGi registry within given timeout. If it not as expected AssertionError is thrown with the given message

Parameters:
message - message
filter - service filter
timeout - time interval in milliseconds to wait. If zero, the method will wait indefinately.
timeUnit - timeout time unit


Copyright © 2012 Know-How Lab. All Rights Reserved.