Examples of RestService


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

          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

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

    }
  }

  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

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

      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

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

  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

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

  }

  private RestResource findRestResource()
  {
    Project project = ModelSupport.getModelItemProject( this );
    RestService restService = ( RestService )project.getInterfaceByName( getRequestStepConfig().getService() );
    if( restService != null )
    {
      // get all resources with the configured path
      for( RestResource resource : restService.getResourcesByFullPath( getRequestStepConfig().getResourcePath() ) )
      {
        // try to find matching method
        if( getWsdlModelItemByName( resource.getRestMethodList(), getRequestStepConfig().getMethodName() ) != null )
          return resource;
      }
View Full Code Here

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

    @Test
    public void resourceIsFoundEvenThoughMultipleInterfacesWithDuplicateNameExists() throws RestRequestStepFactory.ItemDeletedException, XmlException, IOException, SoapUIException {
        WsdlTestCase testCase = Mockito.mock(WsdlTestCase.class);
        WsdlProject project = new WsdlProject();
        RestService restService1 = (RestService) project
                .addNewInterface(INTERFACE_NAME, RestServiceFactory.REST_TYPE);
        RestService restService2 = (RestService) project
                .addNewInterface(INTERFACE_NAME, RestServiceFactory.REST_TYPE);
        RestResource restResource = restService2.addNewResource(RESOURCE_NAME, PATH);
        restResource.addNewMethod(METHOD_NAME);
        Mockito.when(testCase.getParent()).thenReturn(project);

        TestStepConfig config = TestStepConfig.Factory.newInstance();
        RestRequestStepConfig configConfig = (RestRequestStepConfig) config.addNewConfig().changeType(RestRequestStepConfig.type);
View Full Code Here

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

        }
        return ModelItemNamer.createName(DEFAULT_PROJECT_NAME, projectList);
    }

    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

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

    protected RestResource createResource(ModelCreationStrategy creationStrategy, WsdlProject project, String URI) throws MalformedURLException {
        RestURIParser restURIParser = new RestURIParserImpl(URI);
        String resourcePath = restURIParser.getResourcePath();
        String host = restURIParser.getEndpoint();

        RestService restService = null;
        if (creationStrategy == ModelCreationStrategy.REUSE_MODEL) {
            AbstractInterface<?> existingInterface = project.getInterfaceByName(host);
            if (existingInterface instanceof RestService && ArrayUtils.contains(existingInterface.getEndpoints(), host)) {
                restService = (RestService) existingInterface;
            }
        }
        if (restService == null) {
            restService = (RestService) project.addNewInterface(host, RestServiceFactory.REST_TYPE);
            restService.addEndpoint(restURIParser.getEndpoint());
        }
        if (creationStrategy == ModelCreationStrategy.REUSE_MODEL) {
            RestResource existingResource = restService.getResourceByFullPath(RestResource.removeMatrixParams(resourcePath));
            if (existingResource != null) {
                return existingResource;
            }
        }
        return restService.addNewResource(restURIParser.getResourceName(), resourcePath);
    }
View Full Code Here

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

        for (Interface ic : getModelItem().getInterfaceList()) {
            if (ic instanceof WsdlInterface) {
                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

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

    }

    private WsdlProject createNewProjectWithRESTInterface() throws XmlException, IOException, SoapUIException {
        WsdlProject project = new WsdlProject();

        RestService restService = (RestService) project.addNewInterface("Test", RestServiceFactory.REST_TYPE);
        restService.addNewResource("Resource", "/test");
        return project;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.