private String stateMessage(StringBuilder builder) {
   for (Call receivedCall : receivedCalls) builder.append("\n  Received ").append(receivedCall);
   builder.append("\n");
   if (pendingCalls.isEmpty()) builder.append("\n  Awaiting no further calls");
   else for (Call pendingCall : pendingCalls) builder.append("\n  Awaiting ").append(pendingCall);
   return builder.toString();
 }
Beispiel #2
0
  @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);
  }
  /**
   * Test that <code>Clob.getCharacterStream(long,long)</code> works on CLOBs that are streamed from
   * store. (DERBY-2891)
   */
  public void testGetCharacterStreamLongOnLargeClob() throws Exception {
    getConnection().setAutoCommit(false);

    // create large (>32k) clob that can be read from store
    final int size = 33000;
    StringBuilder sb = new StringBuilder(size);
    for (int i = 0; i < size; i += 10) {
      sb.append("1234567890");
    }

    final int id = BlobClobTestSetup.getID();
    PreparedStatement ps =
        prepareStatement("insert into blobclob(id, clobdata) values (?,cast(? as clob))");
    ps.setInt(1, id);
    ps.setString(2, sb.toString());
    ps.executeUpdate();
    ps.close();

    Statement s = createStatement();
    ResultSet rs = s.executeQuery("select clobdata from blobclob where id = " + id);
    assertTrue(rs.next());
    Clob c = rs.getClob(1);

    // request a small region of the clob
    BufferedReader r = new BufferedReader(c.getCharacterStream(4L, 3L));
    assertEquals("456", r.readLine());

    r.close();
    c.free();
    rs.close();
    s.close();
    rollback();
  }
Beispiel #4
0
 public static void testWrap() {
   StringBuilder sb = new StringBuilder();
   sb.append(
       "Abc \t3Def ghi asoudg gd ais gdiasgd asgd auysgd asyudga8sdga8sydga 8sdg\fSame column\nbegin\n"
           + "\t3abc\t5def\nabc");
   Justif justif = new Justif(30);
   justif.wrap(sb);
   System.err.println(sb);
 }
 /**
  * Test of appendQueryBodyToSql method, of class
  * org.mmbase.storage.search.implementation.database.ChainedSqlHandler.
  */
 public void testAppendQueryBodyToSql() throws Exception {
   StringBuilder sb = new StringBuilder();
   instance.appendQueryBodyToSql(sb, query, instance);
   String queryBody = sb.toString();
   sb.setLength(0);
   testSuccessor.appendQueryBodyToSql(sb, query, instance);
   String queryBody2 = sb.toString();
   assertTrue(queryBody.length() > 0);
   assertTrue(queryBody.equals(queryBody2));
 }
 /**
  * Test of appendConstraintToSql method, of class
  * org.mmbase.storage.search.implementation.database.ChainedSqlHandler.
  */
 public void testAppendConstraintToSql() throws Exception {
   StringBuilder sb = new StringBuilder();
   Constraint constraint = new BasicCompositeConstraint(CompositeConstraint.LOGICAL_AND);
   instance.appendConstraintToSql(sb, constraint, query, false, false);
   String strConstraint = sb.toString();
   sb.setLength(0);
   testSuccessor.appendConstraintToSql(sb, constraint, query, false, false);
   String queryBody2 = sb.toString();
   assertTrue(strConstraint.length() > 0);
   assertTrue(strConstraint.equals(queryBody2));
 }
    public String toString() {
      StringBuilder buffer = new StringBuilder();

      buffer.append(_methodName);
      buffer.append("( ");

      if (_argTypes != null) {
        int count = _argTypes.length;

        for (int i = 0; i < count; i++) {
          if (i > 0) {
            buffer.append(", ");
          }

          buffer.append(_argTypes[i].getName());
        }
      }

      buffer.append(" )");

      return buffer.toString();
    }