Example #1
0
 private static boolean checkIfJMS(MessageExchangeModelItem messageExchange) {
   try {
     MessageExchange me = ((MessageExchangeModelItem) messageExchange).getMessageExchange();
     if (me != null) {
       StringToStringMap strmap = me.getProperties();
       if (strmap != null && strmap.containsKey("Endpoint")) {
         String r = me.getProperty("Endpoint");
         return r != null && r.startsWith(JMSEndpoint.JMS_ENDPIONT_PREFIX);
       } else {
         return false;
       }
     } else {
       return false;
     }
   } catch (NullPointerException e) {
     SoapUI.logError(e);
   }
   return false;
 }
  @Override
  protected String internalAssertResponse(MessageExchange messageExchange, SubmitContext context)
      throws AssertionException {
    Map<String, String> checkMap = createCheckMap(context);
    List<AssertionError> assertionErrorList = new ArrayList<AssertionError>();
    String response = messageExchange.getResponseContent();
    Set<String> messages = new HashSet<String>();

    try {
      for (String token : checkMap.keySet()) {
        boolean useRegexp = token.trim().startsWith(PREFIX);
        String description = !checkMap.get(token).equals("") ? checkMap.get(token) : token;
        if (useRegexp) {
          token = token.substring(token.indexOf(PREFIX) + 1);
        }

        String match = SecurityScanUtil.contains(context, response, token, useRegexp);
        if (match != null) {
          String message = description + " - Token [" + token + "] found [" + match + "]";
          if (!messages.contains(message)) {
            assertionErrorList.add(new AssertionError(message));
            messages.add(message);
          }
        }
      }
    } catch (Throwable e) {
      SoapUI.logError(e);
    }

    if (!messages.isEmpty()) {
      throw new AssertionException(
          assertionErrorList.toArray(new AssertionError[assertionErrorList.size()]));
    }

    return "OK";
  }
 public String internalAssertResponse(MessageExchange messageExchange, SubmitContext context)
     throws AssertionException {
   return assertContent(context, messageExchange.getResponseContent(), "Response");
 }
 @Override
 protected String internalAssertRequest(MessageExchange messageExchange, SubmitContext context)
     throws AssertionException {
   return assertContent(context, messageExchange.getRequestContent(), "Request");
 }