예제 #1
0
  /**
   * Creates an instance of <tt>ChatRoomQuery</tt> by specifying the parent contact source, the
   * query string to match and the maximum result contacts to return.
   *
   * @param queryString the query string to match
   * @param contactSource the parent contact source
   */
  public ChatRoomQuery(String queryString, ChatRoomContactSourceService contactSource) {
    super(
        contactSource,
        Pattern.compile(queryString, Pattern.CASE_INSENSITIVE | Pattern.LITERAL),
        true);
    this.queryString = queryString;

    mucService = MUCActivator.getMUCService();
  }
예제 #2
0
/** Verify that all bundles are resolved */
public class UnresolvedTester extends TestCase {
  BundleContext context;
  static Pattern IP_P =
      Pattern.compile(
          " \\(&\\(osgi.wiring.package=([^)]+)\\)\\(version>=([^)]+)\\)\\(!\\(version>=([^)]+)\\)\\)\\)");

  public void setBundleContext(BundleContext context) {
    this.context = context;
    System.out.println("got context " + context);
  }

  @SuppressWarnings("deprecation")
  public void testAllResolved() {
    assertNotNull("Expected a Bundle Context", context);
    StringBuilder sb = new StringBuilder();

    for (Bundle b : context.getBundles()) {
      if (b.getState() == Bundle.INSTALLED
          && b.getHeaders().get(aQute.bnd.osgi.Constants.FRAGMENT_HOST) == null) {
        try {
          b.start();
        } catch (BundleException e) {
          sb.append(b.getBundleId())
              .append(" ")
              .append(b.getSymbolicName())
              .append(";")
              .append(b.getVersion())
              .append("\n");
          sb.append("    ").append(e.getMessage()).append("\n\n");
          System.err.println(e.getMessage());
        }
      }
    }
    Matcher matcher = IP_P.matcher(sb);
    String out =
        matcher.replaceAll(
            "\n\n         " + aQute.bnd.osgi.Constants.IMPORT_PACKAGE + ": $1;version=[$2,$3)\n");
    assertTrue("Unresolved bundles\n" + out, sb.length() == 0);
  }
}