Package com.eviware.soapui.impl.rest

Examples of com.eviware.soapui.impl.rest.RestMethod


                          + "introducing a new REST Method item in-between each REST Resource and Request.\r\n"
                          + "Any existing REST Request must now be placed under either an existing Method or a new one, "
                          + "either automatically or manually.\r\n\r\nWould You like soapUI to do this automatically using the default values?",
                      "Update REST model for project: " + project.getName() ) );
    }
    RestMethod method = null;
    List<String> options = new ArrayList<String>();
    for( int c = 0; c < resource.getRestMethodCount(); c++ )
    {
      RestMethod restMethod = resource.getRestMethodAt( c );
      if( restMethod.getMethod().toString().equals( methodType ) )
        options.add( restMethod.getName() );
    }
    if( autoConvert.get( project ) )
    {
      if( options.size() > 0 )
      {
View Full Code Here


        if( type != null )
        {
          for( Method method : type.getMethodList() )
          {
            method = resolveMethod( method );
            RestMethod restMethod = initMethod( newResource, method );

            for( Param param : type.getParamList() )
            {
              param = resolveParameter( param );
              if( param != null )
              {
                String nm = param.getName();
                RestParamProperty prop = restMethod.hasProperty( nm ) ? restMethod.getProperty( nm )
                    : restMethod.addProperty( nm );

                initParam( param, prop );
              }
            }
          }
View Full Code Here

        name = orgName + "-" + cnt;
      }
    }

    // add to resource
    RestMethod restMethod = newResource.addNewMethod( name );
    restMethod.setMethod( RestRequestInterface.RequestMethod.valueOf( method.getName() ) );

    if( method.getRequest() != null )
    {
      for( Param param : method.getRequest().getParamList() )
      {
        param = resolveParameter( param );
        if( param != null )
        {
          RestParamProperty p = restMethod.addProperty( param.getName() );
          initParam( param, p );
        }
      }

      for( Representation representation : method.getRequest().getRepresentationList() )
      {
        representation = resolveRepresentation( representation );
        addRepresentationFromConfig( restMethod, representation, RestRepresentation.Type.REQUEST, null );
      }
    }

    for( Response response : method.getResponseList() )
    {
      for( Representation representation : response.getRepresentationList() )
      {
        addRepresentation( response, restMethod, representation );
      }
      if( !isWADL11 )
      {
        NodeList children = response.getDomNode().getChildNodes();
        for( int i = 0; i < children.getLength(); i++ )
        {
          Node n = children.item( i );
          if( "fault".equals( n.getNodeName() ) )
          {
            String content = XmlUtils.serialize( n, false );
            try
            {
              Map<Object, Object> map = new HashMap<Object, Object>();
              XmlCursor cursor = response.newCursor();
              cursor.getAllNamespaces( map );
              cursor.dispose();
              XmlOptions options = new XmlOptions();
              options.setLoadAdditionalNamespaces( map );
              // XmlObject obj = XmlObject.Factory.parse(
              // content.replaceFirst( "<(([a-z]+:)?)fault ",
              // "<$1representation " ), options );
              XmlObject obj = XmlUtils.createXmlObject(
                  content.replaceFirst( "<(([a-z]+:)?)fault ", "<$1representation " ), options );
              RepresentationDocument representation = ( RepresentationDocument )obj
                  .changeType( RepresentationDocument.type );
              addRepresentation( response, restMethod, representation.getRepresentation() );
            }
            catch( XmlException e )
            {
            }
          }
        }
      }
    }

    restMethod.addNewRequest( "Request 1" );
    return restMethod;
  }
View Full Code Here

    {
      Component result = super.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );

      if( value instanceof RestMethod )
      {
        RestMethod item = ( RestMethod )value;
        setIcon( item.getIcon() );
        setText( item.getResource().getName() + " -> " + item.getName() );
      }

      return result;
    }
View Full Code Here

  }

  @Override
  protected RestMethod createRestMethod( RestResource resource, XFormDialog dialog )
  {
    RestMethod method = resource.addNewMethod( dialog.getValue( Form.RESOURCENAME ) );
    method.setMethod( RestRequestInterface.RequestMethod.GET );
    return method;
  }
View Full Code Here

    paramsTable = new MethodInternalRestParamsTable( params, ParamLocation.METHOD );
    dialog.getFormField( Form.PARAMSTABLE ).setProperty( "component", paramsTable );

    if( dialog.show() )
    {
      RestMethod method = resource.addNewMethod( dialog.getValue( Form.RESOURCENAME ) );
      method.setMethod( RestRequestInterface.RequestMethod.valueOf( dialog.getValue( Form.METHOD ) ) );
      paramsTable.extractParams( method.getParams(), ParamLocation.METHOD );

      UISupport.select( method );

      if( dialog.getBooleanValue( Form.CREATEREQUEST ) )
      {
View Full Code Here

  }

  @Override
  protected RestMethod createRestMethod( RestResource resource, XFormDialog dialog )
  {
    RestMethod method = resource.addNewMethod( dialog.getValue( Form.RESOURCENAME ) );
    method.setMethod( RestRequestInterface.RequestMethod.GET );
    return method;
  }
View Full Code Here

  public void perform( RestRequest request, Object param )
  {
    if( UISupport.confirm( "Delete Request [" + request.getName() + "] from Resource ["
        + request.getOperation().getName() + "]", "Delete Request" ) )
    {
      RestMethod method = request.getRestMethod();
      method.removeRequest( request );
    }
  }
View Full Code Here

  {
    String name = UISupport.prompt( "Specify name of cloned Method", "Clone Method", "Copy of " + method.getName() );
    if( name == null )
      return;

    RestMethod newMethod = method.getOperation().cloneMethod( method, name );
    UISupport.selectAndShow( newMethod );
  }
View Full Code Here

    }
  }

  public void setRestMethod( RestMethod restMethod )
  {
    RestMethod old = this.getRestMethod();

    if( old != null )
    {
      old.getResource().removePropertyChangeListener( this );
    }

    super.setRestMethod( restMethod );

    restMethod.getResource().addPropertyChangeListener( this );
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.rest.RestMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.