Package com.eviware.soapui.impl.rest

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


    @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

        }
        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

    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

        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

    }

    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

        return restMethod;
    }

    public RestResource makeRestResource() throws SoapUIException {
        String serviceName = "Interface_" + UUID.randomUUID().toString();
        RestService service = (RestService) project.addNewInterface(serviceName, RestServiceFactory.REST_TYPE);
        service.setName(serviceName);
        RestResource restResource = service.addNewResource("root", "/");
        return restResource;
    }
View Full Code Here

    public static RestResource makeRestResource() throws SoapUIException {
        return new RestResource(makeRestService(), RestResourceConfig.Factory.newInstance());
    }

    public static RestService makeRestService() throws SoapUIException {
        return new RestService(makeWsdlProject(), RestServiceConfig.Factory.newInstance());
    }
View Full Code Here

    public static RestResource resolveResource(RestTestRequestStep requestStep) {
        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 {
            for (Interface iface : project.getInterfaceList()) {
                if (iface instanceof RestService) {
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();
            definitionContext.loadIfNecessary();
        } else {
            String def = PathUtils.expandPath(definition, service, context);
            if (definitionContext == null || !def.equals(wsdlContextDef)) {
                definitionContext = new WadlDefinitionContext(def);
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.