/** Find all methods in this framework which raise SQLFeatureNotSupportedException. */
  public void testSupportedMethods() throws Exception {
    getTestConfiguration().setVerbosity(true);

    HashSet<String> vanishedMethodList = new HashSet<String>();
    HashSet<String> unsupportedList = new HashSet<String>();
    HashSet<String> notUnderstoodList = new HashSet<String>();

    // Build map of interfaces to their methods which may raise SQLFeatureNotSupportedException.
    initializeExcludableMap(vanishedMethodList);

    vetDataSource(unsupportedList, notUnderstoodList);
    vetConnectionPooledDataSource(unsupportedList, notUnderstoodList);
    vetXADataSource(unsupportedList, notUnderstoodList);

    //
    // Print methods which behave unexpectedly.
    //
    printVanishedMethodList(vanishedMethodList);
    printUnsupportedList(unsupportedList);
    printNotUnderstoodList(notUnderstoodList);

    int actualErrorCount =
        vanishedMethodList.size() + unsupportedList.size() + notUnderstoodList.size();

    assertEquals("Unexpected discrepancies.", 0, actualErrorCount);
  }
  // debug print the list of methods which have disappeared from the SQL interface
  private void printVanishedMethodList(HashSet<String> vanishedMethodList) {
    int count = vanishedMethodList.size();

    if (count == 0) {
      return;
    }

    println("--------------- VANISHED METHODS ------------------");
    println("--");

    String[] result = new String[count];

    vanishedMethodList.toArray(result);
    Arrays.sort(result);

    for (int i = 0; i < count; i++) {
      println(result[i]);
    }
  }
  // debug print the list of methods which throw SQLFeatureNotSupportedException
  private void printUnsupportedList(HashSet<String> unsupportedList) {
    int count = unsupportedList.size();

    if (count == 0) {
      return;
    }

    println("--------------- UNSUPPORTED METHODS ------------------");
    println("--");

    String[] result = new String[count];

    unsupportedList.toArray(result);
    Arrays.sort(result);

    for (int i = 0; i < count; i++) {
      println(result[i]);
    }
  }
  // Debug print the list of method failures which we don't understand
  private void printNotUnderstoodList(HashSet<String> notUnderstoodList) {
    int count = notUnderstoodList.size();

    if (count == 0) {
      return;
    }

    println("\n\n");
    println("--------------- NOT UNDERSTOOD METHODS ------------------");
    println("--");

    String[] result = new String[count];

    notUnderstoodList.toArray(result);
    Arrays.sort(result);

    for (int i = 0; i < count; i++) {
      println(result[i]);
    }
  }
Ejemplo n.º 5
0
 public synchronized int getListenerCount() {
   return mlisteners.size();
 }