コード例 #1
0
ファイル: WsdlInterface.java プロジェクト: thamuz/soapui
  @Override
  public void release() {
    super.release();

    for (WsdlOperation operation : operations) operation.release();

    if (wsdlContext != null) wsdlContext.release();
  }
コード例 #2
0
ファイル: WsdlInterface.java プロジェクト: thamuz/soapui
  public WsdlOperation addNewOperation(BindingOperation operation) {
    WsdlOperation operationImpl = new WsdlOperation(this, getConfig().addNewOperation());
    operations.add(operationImpl);

    operationImpl.initFromBindingOperation(operation);
    fireOperationAdded(operationImpl);
    return operationImpl;
  }
コード例 #3
0
ファイル: WsdlInterface.java プロジェクト: thamuz/soapui
  // need to fix removing mock response and test cases.
  private void replace(WsdlOperation wsdlOperation, OperationConfig reloadedOperation) {
    int index = operations.indexOf(wsdlOperation);

    int c = operations.indexOf(wsdlOperation);
    if (c < 0) throw new IllegalArgumentException(wsdlOperation.getName() + " not found");

    log.info("deleting operation [" + wsdlOperation.getName() + "]");

    // remove requests first (should this be done by some listener?)
    while (wsdlOperation.getRequestCount() > 0)
      wsdlOperation.removeRequest(wsdlOperation.getRequestAt(0));

    operations.remove(c);

    try {
      fireOperationRemoved(wsdlOperation);
    } finally {
      wsdlOperation.release();
      getConfig().removeOperation(c);
    }

    OperationConfig newConfig =
        (OperationConfig)
            getConfig().addNewOperation().set(reloadedOperation).changeType(OperationConfig.type);
    WsdlOperation newOperation = new WsdlOperation(this, newConfig);
    operations.add(index, newOperation);
    newOperation.afterLoad();
    fireOperationAdded(newOperation);
  }
コード例 #4
0
ファイル: WsdlInterface.java プロジェクト: thamuz/soapui
  public void removeOperation(WsdlOperation wsdlOperation) {
    int c = operations.indexOf(wsdlOperation);
    if (c < 0) throw new IllegalArgumentException(wsdlOperation.getName() + " not found");

    log.info("deleting operation [" + wsdlOperation.getName() + "]");

    // remove requests first (should this be done by some listener?)
    while (wsdlOperation.getRequestCount() > 0)
      wsdlOperation.removeRequest(wsdlOperation.getRequestAt(0));

    operations.remove(c);

    try {
      fireOperationRemoved(wsdlOperation);
    } finally {
      wsdlOperation.release();
      getConfig().removeOperation(c);
    }
  }
コード例 #5
0
ファイル: WsdlInterface.java プロジェクト: thamuz/soapui
  public void deleteOperation(String bindingOperationName) {
    for (int c = 0; c < operations.size(); c++) {
      WsdlOperation wsdlOperation = operations.get(c);
      if (wsdlOperation.getBindingOperationName().equals(bindingOperationName)) {
        log.info("deleting operation [" + bindingOperationName + "]");

        // remove requests first (should this be done by some listener?)
        while (wsdlOperation.getRequestCount() > 0)
          wsdlOperation.removeRequest(wsdlOperation.getRequestAt(0));

        operations.remove(c);

        try {
          fireOperationRemoved(wsdlOperation);
        } finally {
          wsdlOperation.release();
          getConfig().removeOperation(c);
        }

        return;
      }
    }
  }
コード例 #6
0
ファイル: WsdlInterface.java プロジェクト: thamuz/soapui
  @SuppressWarnings("unchecked")
  public void transferOperations(Binding binding, boolean createRequests) {
    // prepare for transfer of operations/requests
    List<BindingOperation> newOperations =
        new ArrayList<BindingOperation>(binding.getBindingOperations());
    Map<String, WsdlOperation> oldOperations = new HashMap<String, WsdlOperation>();
    for (int c = 0; c < operations.size(); c++)
      oldOperations.put(operations.get(c).getBindingOperationName(), operations.get(c));

    // clear existing from both collections
    for (int c = 0; c < newOperations.size(); c++) {
      BindingOperation newOperation = newOperations.get(c);
      String bindingOperationName = newOperation.getName();
      if (oldOperations.containsKey(bindingOperationName)) {
        log.info("Synchronizing existing operation [" + bindingOperationName + "]");
        WsdlOperation wsdlOperation = oldOperations.get(bindingOperationName);
        WsdlUtils.getAnonymous(wsdlOperation);
        wsdlOperation.initFromBindingOperation(newOperation);
        fireOperationUpdated(wsdlOperation);

        oldOperations.remove(bindingOperationName);
        newOperations.remove(c);
        c--;
      }
    }

    // remove leftover operations
    Iterator<String> i = oldOperations.keySet().iterator();
    while (i.hasNext()) {
      String name = i.next();

      if (newOperations.size() > 0) {
        List<String> list = new ArrayList<String>();
        list.add("none - delete operation");
        for (int c = 0; c < newOperations.size(); c++) list.add(newOperations.get(c).getName());

        String retval =
            (String)
                UISupport.prompt(
                    "Binding operation ["
                        + name
                        + "] not found in new interface, select new\nbinding operation to map to",
                    "Map Operation",
                    list.toArray(),
                    "none/cancel - delete operation");

        int ix = retval == null ? -1 : list.indexOf(retval) - 1;

        // delete operation?
        if (ix < 0) {
          deleteOperation(name);
        }
        // change operation?
        else {
          BindingOperation newOperation = newOperations.get(ix);
          WsdlOperation wsdlOperation = oldOperations.get(name);
          wsdlOperation.initFromBindingOperation(newOperation);
          fireOperationUpdated(wsdlOperation);
          newOperations.remove(ix);
        }

        oldOperations.remove(name);
      } else {
        deleteOperation(name);
        oldOperations.remove(name);
      }

      i = oldOperations.keySet().iterator();
    }

    // add leftover new operations
    if (newOperations.size() > 0) {
      for (int c = 0; c < newOperations.size(); c++) {
        BindingOperation newOperation = newOperations.get(c);
        WsdlOperation wsdlOperation = addNewOperation(newOperation);

        if (createRequests) {
          WsdlRequest request = wsdlOperation.addNewRequest("Request 1");
          try {
            request.setRequestContent(wsdlOperation.createRequest(true));
          } catch (Exception e) {
            SoapUI.logError(e);
          }
        }
      }
    }
  }