Package com.eviware.soapui.config

Examples of com.eviware.soapui.config.RestRequestConfig


    return requests.size();
  }

  public RestRequest addNewRequest( String name )
  {
    RestRequestConfig requestConfig = getConfig().addNewRequest();
    requestConfig.setName( name );

    RestRequest request = new RestRequest( this, requestConfig, false );
    requests.add( request );
    request.resetPropertyValues();
View Full Code Here


    return request;
  }

  public RestRequest cloneRequest( RestRequest request, String name )
  {
    RestRequestConfig requestConfig = ( RestRequestConfig )getConfig().addNewRequest().set( request.getConfig() );
    requestConfig.setName( name );

    RestRequest newRequest = new RestRequest( this, requestConfig, false );
    requests.add( newRequest );

    // getInterface().fireRequestAdded(newRequest);
View Full Code Here

            .toString() ) );
        repr.setConfig( ( RestResourceRepresentationConfig )rep.copy() );
      }
    }

    RestRequestConfig newConfig = request.getConfig();

    newConfig.setRequest( oldConfig.getRequest() );

    for( AttachmentConfig ac : oldConfig.getAttachmentList() )
      try
      {
        if( ac.isSetData() )
        {
          File temp = File.createTempFile( "pattern", ".suffix" );
          temp.deleteOnExit();
          FileOutputStream out = new FileOutputStream( temp );
          out.write( ac.getData() );
          request.attachFile( temp, true );
        }
        else
        {
          request.attachFile( new File( ac.getUrl() ), false );
        }
      }
      catch( IOException e )
      {
        e.printStackTrace();
      }
    newConfig.setAttachmentArray( oldConfig.getAttachmentArray() );

    if( oldConfig.isSetFullPath() )
      newConfig.setFullPath( oldConfig.getFullPath() );
    if( oldConfig.isSetMediaType() )
      newConfig.setMediaType( oldConfig.getMediaType() );
    if( oldConfig.isSetPostQueryString() )
      newConfig.setPostQueryString( oldConfig.getPostQueryString() );
    if( oldConfig.isSetAccept() )
      newConfig.setAccept( oldConfig.getAccept() );
    if( oldConfig.isSetDescription() )
      newConfig.setDescription( oldConfig.getDescription() );
    if( oldConfig.isSetId() )
      newConfig.setId( oldConfig.getId() );
    if( oldConfig.isSetSettings() )
      newConfig.setSettings( ( SettingsConfig )oldConfig.getSettings().copy() );
    if( oldConfig.isSetSslKeystore() )
      newConfig.setSslKeystore( oldConfig.getSslKeystore() );
    if( oldConfig.isSetTimestamp() )
      newConfig.setTimestamp( oldConfig.getTimestamp() );
    if( oldConfig.isSetWadlId() )
      newConfig.setWadlId( oldConfig.getWadlId() );

    request.updateConfig( newConfig );

  }
View Full Code Here

  {
    try
    {
      RestRequestStepConfig restRequestStepConfig = ( RestRequestStepConfig )restTestRequestStep.getConfig()
          .getConfig();
      RestRequestConfig restRequestConfig = restRequestStepConfig.getRestRequest();
      OldRestRequestConfig oldConfig = OldRestRequestConfig.Factory.parse( restRequestConfig.toString() );

      RestParametersConfig oldParams = oldConfig.getParameters();
      if( oldParams != null )
      {
        StringToStringMapConfig newParams = restRequestConfig.addNewParameters();

        for( RestParameterConfig oldParam : oldParams.getParameterList() )
        {
          if( StringUtils.hasContent( oldParam.getValue() ) )
          {
            Entry entry = newParams.addNewEntry();
            entry.setKey( oldParam.getName() );
            entry.setValue( oldParam.getValue() );
          }
        }

        restRequestConfig.getParameters().getDomNode().getParentNode()
            .removeChild( restRequestConfig.getParameters().getDomNode() );
      }
    }
    catch( XmlException e )
    {
      SoapUI.logError( e );
View Full Code Here

  }

  public TestStepConfig createNewTestStep( RestMethod restMethod, String name )
  {
    RestRequestStepConfig requestStepConfig = RestRequestStepConfig.Factory.newInstance();
    RestRequestConfig testRequestConfig = requestStepConfig.addNewRestRequest();

    testRequestConfig.setName( name );
    testRequestConfig.setEncoding( "UTF-8" );

    if( restMethod != null )
    {
      requestStepConfig.setService( restMethod.getInterface().getName() );
      requestStepConfig.setMethodName( restMethod.getName() );
      requestStepConfig.setResourcePath( restMethod.getOperation().getFullPath() );

      String[] endpoints = restMethod.getInterface().getEndpoints();
      if( endpoints.length > 0 )
        testRequestConfig.setEndpoint( endpoints[0] );

      testRequestConfig.addNewRequest();
      StringToStringMapConfig parametersConfig = testRequestConfig.addNewParameters();

      for( RestParamProperty property : restMethod.getDefaultParams() )
      {
        if( StringUtils.hasContent( property.getDefaultValue() ) )
        {
View Full Code Here

    return true;
  }

  public TestStepConfig createConfig( WsdlMonitorMessageExchange me, String stepName )
  {
    RestRequestConfig testRequestConfig = RestRequestConfig.Factory.newInstance();

    testRequestConfig.setName( stepName );
    testRequestConfig.setEncoding( "UTF-8" );
    testRequestConfig.setEndpoint( me.getEndpoint() );
    // testRequestConfig.setParameters(
    // set parameters

    String requestContent = me.getRequestContent();
    testRequestConfig.addNewRequest().setStringValue( requestContent );

    TestStepConfig testStep = TestStepConfig.Factory.newInstance();
    testStep.setType( RESTREQUEST_TYPE );
    testStep.setConfig( testRequestConfig );
    testStep.setName( stepName );
View Full Code Here

                        .toString()));
                repr.setConfig((RestResourceRepresentationConfig) rep.copy());
            }
        }

        RestRequestConfig newConfig = request.getConfig();

        newConfig.setRequest(oldConfig.getRequest());

        for (AttachmentConfig ac : oldConfig.getAttachmentList()) {
            try {
                if (ac.isSetData()) {
                    File temp = File.createTempFile("pattern", ".suffix");
                    temp.deleteOnExit();
                    FileOutputStream out = new FileOutputStream(temp);
                    out.write(ac.getData());
                    request.attachFile(temp, true);
                } else {
                    request.attachFile(new File(ac.getUrl()), false);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        newConfig.setAttachmentArray(oldConfig.getAttachmentArray());

        if (oldConfig.isSetFullPath()) {
            newConfig.setFullPath(oldConfig.getFullPath());
        }
        if (oldConfig.isSetMediaType()) {
            newConfig.setMediaType(oldConfig.getMediaType());
        }
        if (oldConfig.isSetPostQueryString()) {
            newConfig.setPostQueryString(oldConfig.getPostQueryString());
        }
        if (oldConfig.isSetAccept()) {
            newConfig.setAccept(oldConfig.getAccept());
        }
        if (oldConfig.isSetDescription()) {
            newConfig.setDescription(oldConfig.getDescription());
        }
        if (oldConfig.isSetId()) {
            newConfig.setId(oldConfig.getId());
        }
        if (oldConfig.isSetSettings()) {
            newConfig.setSettings((SettingsConfig) oldConfig.getSettings().copy());
        }
        if (oldConfig.isSetSslKeystore()) {
            newConfig.setSslKeystore(oldConfig.getSslKeystore());
        }
        if (oldConfig.isSetTimestamp()) {
            newConfig.setTimestamp(oldConfig.getTimestamp());
        }
        if (oldConfig.isSetWadlId()) {
            newConfig.setWadlId(oldConfig.getWadlId());
        }

        request.updateConfig(newConfig);

    }
View Full Code Here

    public static void updateRestTestRequest(RestTestRequestStep restTestRequestStep) {
        try {
            RestRequestStepConfig restRequestStepConfig = (RestRequestStepConfig) restTestRequestStep.getConfig()
                    .getConfig();
            RestRequestConfig restRequestConfig = restRequestStepConfig.getRestRequest();
            OldRestRequestConfig oldConfig = OldRestRequestConfig.Factory.parse(restRequestConfig.toString());

            RestParametersConfig oldParams = oldConfig.getParameters();
            if (oldParams != null) {
                StringToStringMapConfig newParams = restRequestConfig.addNewParameters();

                for (RestParameterConfig oldParam : oldParams.getParameterList()) {
                    if (StringUtils.hasContent(oldParam.getValue())) {
                        Entry entry = newParams.addNewEntry();
                        entry.setKey(oldParam.getName());
                        entry.setValue(oldParam.getValue());
                    }
                }

                restRequestConfig.getParameters().getDomNode().getParentNode()
                        .removeChild(restRequestConfig.getParameters().getDomNode());
            }
        } catch (XmlException e) {
            SoapUI.logError(e);
        }
    }
View Full Code Here

        return null;
    }

    public TestStepConfig createNewTestStep(RestMethod restMethod, String name) {
        RestRequestStepConfig requestStepConfig = RestRequestStepConfig.Factory.newInstance();
        RestRequestConfig testRequestConfig = requestStepConfig.addNewRestRequest();

        testRequestConfig.setName(name);
        testRequestConfig.setEncoding("UTF-8");

        if (restMethod != null) {
            requestStepConfig.setService(restMethod.getInterface().getName());
            requestStepConfig.setMethodName(restMethod.getName());
            requestStepConfig.setResourcePath(restMethod.getOperation().getFullPath());

            String[] endpoints = restMethod.getInterface().getEndpoints();
            if (endpoints.length > 0) {
                testRequestConfig.setEndpoint(endpoints[0]);
            }

            testRequestConfig.addNewRequest();
            StringToStringMapConfig parametersConfig = testRequestConfig.addNewParameters();

            for (RestParamProperty property : restMethod.getDefaultParams()) {
                if (StringUtils.hasContent(property.getDefaultValue())) {
                    Entry entry = parametersConfig.addNewEntry();
                    entry.setKey(property.getName());
View Full Code Here

    public boolean canCreate() {
        return true;
    }

    public TestStepConfig createConfig(WsdlMonitorMessageExchange me, String stepName) {
        RestRequestConfig testRequestConfig = RestRequestConfig.Factory.newInstance();

        testRequestConfig.setName(stepName);
        testRequestConfig.setEncoding("UTF-8");
        testRequestConfig.setEndpoint(me.getEndpoint());
        // testRequestConfig.setParameters(
        // set parameters

        String requestContent = me.getRequestContent();
        testRequestConfig.addNewRequest().setStringValue(requestContent);

        TestStepConfig testStep = TestStepConfig.Factory.newInstance();
        testStep.setType(RESTREQUEST_TYPE);
        testStep.setConfig(testRequestConfig);
        testStep.setName(stepName);
View Full Code Here

TOP

Related Classes of com.eviware.soapui.config.RestRequestConfig

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.