Package com.eviware.soapui.impl.rest

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


        }
        options.put("<Delete TestRequest>", null);

        String message = "Select a new REST Resource to place TestRequest \"" + requestStep.getName() + "\" under.";
        Object op = UISupport.prompt(message, "Missing REST Resource for TestRequest", options.keySet().toArray());
        RestResource resource = options.get(op);

        return resource;
    }
View Full Code Here


            service.setWadlUrl(wadlUrl);
            service.getConfig().setWadlVersion(isWADL11 ? Constants.WADL11_NS : Constants.WADL10_NS);

            for (Resources resources : resourcesList) {
                RestResource baseResource = null;
                if (resourcesList.size() > 1) {
                    String path = resources.getBase();
                    baseResource = service.addNewResource(path, path);
                }
                for (Resource resource : resources.getResourceList()) {
                    String name = getFirstTitle(resource.getDocList(), resource.getPath());
                    String path = resource.getPath();

                    RestResource newResource = null;

                    if (baseResource != null && path != null) {
                        for (RestResource res : baseResource.getChildResourceList()) {
                            if (path.equals(res.getPath())) {
                                newResource = res;
View Full Code Here

                path = "";
            }

            String name = getFirstTitle(res.getDocList(), path);

            RestResource newRes = null;

            for (RestResource child : newResource.getChildResourceList()) {
                if (path.equals(child.getPath())) {
                    newRes = child;
                    break;
View Full Code Here

        assertThat(params, hasParameter("page"));
    }

    @Test
    public void addsAndRemovesTemplateParameterOnParentShouldOnlyUpdateParentPath() throws Exception {
        RestResource restResource = restRequest.getResource();
        RestResource childResource = restResource.addNewChildResource("childResource", "/subPath");
        String childPath = childResource.getPath();
        String parentPath = restResource.getPath();
        String expectedParentPath = parentPath + "{" + PARAMETER_NAME + "}";
        String expectedChildPath = expectedParentPath + childPath;

        RestRequest childRestRequest = ModelItemFactory.makeRestRequest(childResource);
        childRestRequest.setMethod(RestRequestInterface.HttpMethod.GET);

        RestRequestDesktopPanel childRequestDesktopPanel = new RestRequestDesktopPanel(childRestRequest);

        restRequest.getParams().getProperty(PARAMETER_NAME).setStyle(RestParamsPropertyHolder.ParameterStyle.TEMPLATE);

        // Assert that it adds the template parameter on the path
        assertThat(requestDesktopPanel.resourcePanel.getText(), equalTo(expectedParentPath));
        assertThat(childRequestDesktopPanel.resourcePanel.getText(), equalTo(expectedChildPath));

        restRequest.getParams().getProperty(PARAMETER_NAME).setStyle(RestParamsPropertyHolder.ParameterStyle.QUERY);

        assertThat(requestDesktopPanel.resourcePanel.getText(), equalTo(parentPath));
        assertThat(childRequestDesktopPanel.resourcePanel.getText(), equalTo(childResource.getFullPath()));
    }
View Full Code Here

        assertThat(childRequestDesktopPanel.resourcePanel.getText(), equalTo(childResource.getFullPath()));
    }

    @Test
    public void renamesTemplateParameterOnParentResource() throws Exception {
        RestResource restResource = restRequest.getResource();
        RestResource childResource = restResource.addNewChildResource("childResource", "/subPath");
        String childPath = childResource.getPath();
        String parentPath = restResource.getPath();
        String newParamName = "sessionID";
        String expectedParentPath = parentPath + "{" + newParamName + "}";
        String expectedChildPath = expectedParentPath + childPath;
View Full Code Here

    }

    @Test
    public void addsAndRemovesTemplateParameterOnChildResourcePath() throws Exception {
        RestResource restResource = restRequest.getResource();
        RestResource childResource = restResource.addNewChildResource("childResource", "/subPath");
        String fullPath = childResource.getFullPath();

        String childParamName = "childParam";
        childResource.setPropertyValue(childParamName, "childValue");

        RestRequest childRestRequest = ModelItemFactory.makeRestRequest(childResource);
        childRestRequest.setMethod(RestRequestInterface.HttpMethod.GET);

        RestRequestDesktopPanel origDesktopPanel = requestDesktopPanel;
        requestDesktopPanel = new RestRequestDesktopPanel(childRestRequest);

        childResource.getProperty(childParamName).setStyle(RestParamsPropertyHolder.ParameterStyle.TEMPLATE);
        // Assert that it adds the template parameter on the path
        assertThat(requestDesktopPanel.resourcePanel.getText(), equalTo(fullPath + "{" + childParamName + "}"));

        childResource.getProperty(childParamName).setStyle(RestParamsPropertyHolder.ParameterStyle.QUERY);
        // Assert that it adds the template parameter on the path
        assertThat(requestDesktopPanel.resourcePanel.getText(), equalTo(fullPath));

        // Set back the desktop panel
        requestDesktopPanel = origDesktopPanel;
View Full Code Here

        requestDesktopPanel = origDesktopPanel;
    }

    @Test
    public void renameTemplateParameterOnChildResourcePath() throws Exception {
        RestResource restResource = restRequest.getResource();
        RestResource childResource = restResource.addNewChildResource("childResource", "/subPath");
        String fullPath = childResource.getFullPath();

        String childParamName = "childParam";
        String newParamName = "newChildParam";
        childResource.setPropertyValue(childParamName, "childValue");

        RestRequest childRestRequest = ModelItemFactory.makeRestRequest(childResource);
        childRestRequest.setMethod(RestRequestInterface.HttpMethod.GET);

        RestRequestDesktopPanel origDesktopPanel = requestDesktopPanel;
        requestDesktopPanel = new RestRequestDesktopPanel(childRestRequest);

        childResource.getProperty(childParamName).setStyle(RestParamsPropertyHolder.ParameterStyle.TEMPLATE);
        childResource.getProperty(childParamName).setName(newParamName);

        // Assert that it adds the template parameter on the path
        assertThat(requestDesktopPanel.resourcePanel.getText(), equalTo(fullPath + "{" + newParamName + "}"));

        // Set back the desktop panel
View Full Code Here

        assertThat(requestDesktopPanel.resourcePanel.getText(), equalTo(path + "{" + newParamName + "}"));
    }

    @Test
    public void addingTemplateParameterOnParentShouldUpdateChildPathEvenIfParentDialogNotOpen() throws SoapUIException {
        RestResource parentResource = ModelItemFactory.makeRestResource();
        parentResource.setPath("/parent");

        RestResource childResource = parentResource.addNewChildResource("child", "/child");

        String expectedChildPath = parentResource.getPath() + "{" + PARAMETER_NAME + "}" + childResource.getPath();

        RestRequest childRestRequest = ModelItemFactory.makeRestRequest(childResource);
        childRestRequest.setMethod(RestRequestInterface.HttpMethod.GET);

        RestRequestDesktopPanel childRequestDesktopPanel = new RestRequestDesktopPanel(childRestRequest);
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 {
View Full Code Here

        getRequestStepConfig().setService(method.getInterface().getName());
        getRequestStepConfig().setResourcePath(method.getResource().getFullPath());
        getRequestStepConfig().setMethodName(method.getName());

        // new resource?
        RestResource res = findRestResource();
        if (res != getResource()) {
            restResource.removePropertyChangeListener(this);
            restResource.getService().removeInterfaceListener(interfaceListener);
            restResource.getService().removePropertyChangeListener(this);
View Full Code Here

TOP

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

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.