Package com.eviware.soapui.impl.rest

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


          break;
        }
      }
      if( !exists )
      {
        RestRepresentation repr = method.addNewRepresentation( RestRepresentation.Type.valueOf( rep.getType()
            .toString() ) );
        repr.setConfig( ( RestResourceRepresentationConfig )rep.copy() );
      }
    }

    RestRequestConfig newConfig = request.getConfig();
View Full Code Here


  }

  private void addRepresentationFromConfig( RestMethod restMethod, Representation representation,
      RestRepresentation.Type type, List<?> status )
  {
    RestRepresentation restRepresentation = restMethod.addNewRepresentation( type );
    restRepresentation.setMediaType( representation.getMediaType() );
    restRepresentation.setElement( representation.getElement() );
    if( status != null )
      restRepresentation.setStatus( status );
    restRepresentation.setId( representation.getId() );
    restRepresentation.setDescription( getFirstTitle( representation.getDocList(), null ) );
  }
View Full Code Here

      return data.size();
    }

    public Object getValueAt( int rowIndex, int columnIndex )
    {
      RestRepresentation representation = data.get( rowIndex );

      switch( columnIndex )
      {
      case 0 :
        return representation.getType().toString();
      case 1 :
        return representation.getMediaType();
      case 2 :
        return representation.getType().equals( RestRepresentation.Type.REQUEST ) ? "n/a" : representation
            .getStatus().toString();
      case 3 :
        return representation.getElement() == null ? null : representation.getElement().toString();
      }

      return null;
    }
View Full Code Here

    @Override
    public void setValueAt( Object value, int rowIndex, int columnIndex )
    {
      if( readOnly )
        return;
      RestRepresentation representation = data.get( rowIndex );

      switch( columnIndex )
      {
      case 1 :
        representation.setMediaType( value == null ? "" : value.toString() );
        break;
      case 2 :
      {
        if( value == null )
          value = "";

        String[] items = value.toString().split( " " );
        List<Integer> status = new ArrayList<Integer>();

        for( String item : items )
        {
          try
          {
            if( StringUtils.hasContent( item ) )
              status.add( Integer.parseInt( item.trim() ) );
          }
          catch( NumberFormatException e )
          {
          }
        }

        representation.setStatus( status );
        break;
      }
      }
    }
View Full Code Here

      }
    }

    if( c == representations.length )
    {
      RestRepresentation representation = getMethod().addNewRepresentation( type );
      representation.setMediaType( response.getContentType() );
      representation.setStatus( Arrays.asList( response.getStatusCode() ) );

      String xmlContent = response.getContentAsXml();

      if( !xmlContent.equals( "<xml/>" ) )
      {
        // if(response.getContentType().equals("text/xml") ||
        // response.getContentType().equals("application/xml")) {
        try
        {
          // XmlCursor cursor = XmlObject.Factory.parse( xmlContent
          // ).newCursor();
          XmlCursor cursor = XmlUtils.createXmlObject( xmlContent ).newCursor();
          cursor.toFirstChild();
          representation.setElement( cursor.getName() );
        }
        catch( Exception e )
        {

        }
View Full Code Here

      }
    }

    if( c == representations.length )
    {
      RestRepresentation representation = getMethod().addNewRepresentation( RestRepresentation.Type.REQUEST );
      representation.setMediaType( responseContentType );

      String xmlContent = response.getRequestContent();

      if( !xmlContent.equals( "<xml/>" ) )
      {
        try
        {
          // XmlCursor cursor = XmlObject.Factory.parse( xmlContent
          // ).newCursor();
          XmlCursor cursor = XmlUtils.createXmlObject( xmlContent ).newCursor();
          cursor.toFirstChild();
          representation.setElement( cursor.getName() );
        }
        catch( Exception e )
        {
        }
      }
View Full Code Here

                break;
            }
        }

        if (c == representations.length) {
            RestRepresentation representation = getMethod().addNewRepresentation(type);
            representation.setMediaType(response.getContentType());
            representation.setStatus(Arrays.asList(response.getStatusCode()));

            String xmlContent = response.getContentAsXml();

            if (xmlContent != null && !xmlContent.equals("<xml/>")) {
                // if(response.getContentType().equals("text/xml") ||
                // response.getContentType().equals("application/xml")) {
                try {
                    // XmlCursor cursor = XmlObject.Factory.parse( xmlContent
                    // ).newCursor();
                    XmlCursor cursor = XmlUtils.createXmlObject(xmlContent).newCursor();
                    cursor.toFirstChild();
                    representation.setElement(cursor.getName());
                } catch (Exception e) {

                }
            }
        }
View Full Code Here

                break;
            }
        }

        if (c == representations.length) {
            RestRepresentation representation = getMethod().addNewRepresentation(RestRepresentation.Type.REQUEST);
            representation.setMediaType(responseContentType);

            String xmlContent = response.getRequestContent();

            if (!xmlContent.equals("<xml/>")) {
                try {
                    // XmlCursor cursor = XmlObject.Factory.parse( xmlContent
                    // ).newCursor();
                    XmlCursor cursor = XmlUtils.createXmlObject(xmlContent).newCursor();
                    cursor.toFirstChild();
                    representation.setElement(cursor.getName());
                } catch (Exception e) {
                }
            }
        }
    }
View Full Code Here

                    exists = true;
                    break;
                }
            }
            if (!exists) {
                RestRepresentation repr = method.addNewRepresentation(RestRepresentation.Type.valueOf(rep.getType()
                        .toString()));
                repr.setConfig((RestResourceRepresentationConfig) rep.copy());
            }
        }

        RestRequestConfig newConfig = request.getConfig();
View Full Code Here

        addRepresentationFromConfig(restMethod, representation, type, status);
    }

    private void addRepresentationFromConfig(RestMethod restMethod, Representation representation,
                                             RestRepresentation.Type type, List<?> status) {
        RestRepresentation restRepresentation = restMethod.addNewRepresentation(type);
        restRepresentation.setMediaType(representation.getMediaType());
        restRepresentation.setElement(representation.getElement());
        if (status != null) {
            restRepresentation.setStatus(status);
        }
        restRepresentation.setId(representation.getId());
        restRepresentation.setDescription(getFirstTitle(representation.getDocList(), null));
    }
View Full Code Here

TOP

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

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.