Package com.eviware.soapui.impl.rest

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


  {
    Map<String, RestResource> options = new LinkedHashMap<String, RestResource>();

    WsdlProject project = requestStep.getTestCase().getTestSuite().getProject();
    String serviceName = requestStep.getRequestStepConfig().getService();
    RestService service = ( RestService )project.getInterfaceByName( serviceName );
    if( service != null )
    {
      addResources( service, options );
    }
    else
View Full Code Here


        WsdlInterface iface = ( WsdlInterface )ic;
        section.addMetric( iface.getIcon(), iface.getName(), MetricType.URL ).set( iface.getDefinition() );
      }
      else if( ic instanceof RestService )
      {
        RestService iface = ( RestService )ic;
        section.addMetric( iface.getIcon(), iface.getName(), MetricType.URL ).set( iface.getWadlUrl() );
      }

      interfaceNameSet.add( ic.getName() );
    }
View Full Code Here

public class WadlImporterTestCase extends TestCase
{
  public void testWadlImporter() throws Exception
  {
    WsdlProject project = new WsdlProject();
    RestService service = ( RestService )project.addNewInterface( "REST Service", RestServiceFactory.REST_TYPE );
    WadlImporter importer = new WadlImporter( service );
    importer.initFromWadl( WadlImporter.class.getResource( "/wadl/YahooSearch.wadl" ).toString() );
    assertEquals( service.getName(), "REST Service" );
    assertEquals( 1, service.getResourceList().size() );
    assertEquals( 0, service.getResourceList().get( 0 ).getChildResourceCount() );
    assertEquals( 1, service.getResourceList().get( 0 ).getRestMethodCount() );
  }
View Full Code Here

  }

  public void testImportWadl() throws Exception
  {
    WsdlProject project = new WsdlProject();
    RestService service = ( RestService )project.addNewInterface( "Test", RestServiceFactory.REST_TYPE );

    new WadlImporter( service ).initFromWadl( new File( "src" + File.separatorChar + "test-resources"
        + File.separatorChar + "wadl" + File.separatorChar + "YahooSearch.wadl" ).toURI().toURL().toString() );

    assertEquals( 1, service.getOperationCount() );
    assertEquals( "/NewsSearchService/V1/", service.getBasePath() );

    RestResource resource = service.getOperationAt( 0 );

    assertEquals( 1, resource.getPropertyCount() );
    assertEquals( "appid", resource.getPropertyAt( 0 ).getName() );
    assertNotNull( resource.getProperty( "appid" ) );
    assertEquals( 1, resource.getRequestCount() );
View Full Code Here

    }
  }

  private void importWadl( WsdlProject project, String url )
  {
    RestService restService = ( RestService )project
        .addNewInterface( project.getName(), RestServiceFactory.REST_TYPE );
    UISupport.select( restService );
    try
    {
      new WadlImporter( restService ).initFromWadl( url );
View Full Code Here

    importWadl( project, "file:/" + path );
  }

  private void importWadl( WsdlProject project, String path )
  {
    RestService restService = ( RestService )project.addNewInterface( ( ( RestTestRequestStepInterface )item )
        .getRequestStepConfig().getService(), RestServiceFactory.REST_TYPE );
    try
    {
      new WadlImporter( restService ).initFromWadl( path );
    }
View Full Code Here

          String expUrl = PathUtils.expandPath( url, project );

          if( new File( expUrl ).exists() )
            expUrl = new File( expUrl ).toURI().toURL().toString();

          RestService result = importWadl( project, expUrl );
          if( !url.equals( expUrl ) && result != null )
          {
            result.setWadlUrl( url );
          }
          break;
        }
      }
      catch( Exception ex )
View Full Code Here

    }
  }

  private RestService importWadl( WsdlProject project, String url )
  {
    RestService restService = ( RestService )project
        .addNewInterface( project.getName(), RestServiceFactory.REST_TYPE );
    UISupport.select( restService );
    try
    {
      new WadlImporter( restService ).initFromWadl( url );
View Full Code Here

      dialog.getFormField( Form.EXTRACTPARAMS ).setEnabled( true );
    }

    if( dialog.show() )
    {
      RestService restService = ( RestService )project.addNewInterface( dialog.getValue( Form.SERVICENAME ),
          RestServiceFactory.REST_TYPE );
      UISupport.select( restService );
      URL url = null;

      try
      {
        url = new URL( dialog.getValue( Form.SERVICEENDPOINT ) );
        String endpoint = url.getProtocol() + "://" + url.getHost();
        if( url.getPort() > 0 )
          endpoint += ":" + url.getPort();

        restService.addEndpoint( endpoint );
        restService.setBasePath( url.getPath() );
      }
      catch( Exception e )
      {
      }

      if( dialog.getFormField( Form.EXTRACTPARAMS ).isEnabled() && dialog.getBooleanValue( Form.EXTRACTPARAMS ) )
      {
        restService.setBasePath( "" );
        SoapUI.getActionRegistry().getAction( NewRestResourceAction.SOAPUI_ACTION_ID ).perform( restService, url );
      }

      if( dialog.getFormField( Form.CREATERESOURCE ).isEnabled() && dialog.getBooleanValue( Form.CREATERESOURCE ) )
      {
View Full Code Here

  private DefinitionContext<?> getWadlContext( RestMessageExchange messageExchange, SubmitContext context )
      throws Exception
  {
    RestResource operation = messageExchange.getResource();
    RestService service = operation.getService();
    if( StringUtils.isNullOrEmpty( definition )
        || definition.equals( PathUtils.expandPath( service.getDefinition(), service, context ) ) )
    {
      definitionContext = service.getWadlContext();
      ( ( WadlDefinitionContext )definitionContext ).loadIfNecessary();
    }
    else
    {
      String def = PathUtils.expandPath( definition, service, context );
View Full Code Here

TOP

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

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.