Пример #1
0
 @Override
 public void runBare() throws Throwable {
   if (combosEvaluated) {
     super.runBare();
   } else {
     CombinationTestSupport[] combinations = getCombinations();
     for (int i = 0; i < combinations.length; i++) {
       CombinationTestSupport test = combinations[i];
       if (getName() == null || getName().equals(test.getName())) {
         test.runBare();
       }
     }
   }
 }
Пример #2
0
  private CombinationTestSupport[] getCombinations() {
    try {
      Method method = getClass().getMethod("initCombos", (Class[]) null);
      method.invoke(this, (Object[]) null);
    } catch (Throwable e) {
    }

    String name = getName().split(" ")[0];
    String comboSetupMethodName =
        "initCombosFor" + Character.toUpperCase(name.charAt(0)) + name.substring(1);
    try {
      Method method = getClass().getMethod(comboSetupMethodName, (Class[]) null);
      method.invoke(this, (Object[]) null);
    } catch (Throwable e) {
    }

    try {
      ArrayList<HashMap<String, Object>> expandedOptions = new ArrayList<HashMap<String, Object>>();
      expandCombinations(new ArrayList<ComboOption>(comboOptions.values()), expandedOptions);

      if (expandedOptions.isEmpty()) {
        combosEvaluated = true;
        return new CombinationTestSupport[] {this};
      } else {

        ArrayList<CombinationTestSupport> result = new ArrayList<CombinationTestSupport>();
        // Run the test case for each possible combination
        for (Iterator<HashMap<String, Object>> iter = expandedOptions.iterator();
            iter.hasNext(); ) {
          CombinationTestSupport combo =
              (CombinationTestSupport) TestSuite.createTest(getClass(), name);
          combo.combosEvaluated = true;
          combo.setOptions(iter.next());
          result.add(combo);
        }

        CombinationTestSupport rc[] = new CombinationTestSupport[result.size()];
        result.toArray(rc);
        return rc;
      }
    } catch (Throwable e) {
      combosEvaluated = true;
      return new CombinationTestSupport[] {this};
    }
  }
 protected void tearDown() throws Exception {
   ignoreClientError.set(true);
   ignoreServerError.set(true);
   try {
     if (clientTransport != null) {
       clientTransport.stop();
     }
     if (serverTransport != null) {
       serverTransport.stop();
     }
     if (server != null) {
       server.stop();
     }
   } catch (Throwable e) {
     e.printStackTrace();
   }
   super.tearDown();
 }
 protected void setUp() throws Exception {
   super.setUp();
   startTransportServer();
 }