Package com.eviware.soapui.impl.rest

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


    public void canRenameRestParameterInAncestorResource() throws Exception {
        RestResource parentResource = makeRestResource();
        String oldName = "the_original_name";
        parentResource.addProperty(oldName);
        RestResource childResource = parentResource.addNewChildResource("child", "child");
        RestMethod method = childResource.addNewMethod("Get Method");
        restRequest = new RestRequest(method, RestRequestConfig.Factory.newInstance(), false);

        parametersHolder = (RestRequestParamsPropertyHolder) restRequest.getParams();
        String newParameterName = "the_new_name";
        parametersHolder.renameProperty(oldName, newParameterName);
View Full Code Here


    }

    @Test
    public void usesParameterOrderFromRestRequestConfiguration() throws Exception {
        RestRequestConfig requestConfig = buildRestRequestConfigWithParameters("first", "second", "third");
        RestMethod method = buildRestMethodWithParameters("third", "second", "first");
        RestRequest restRequest = new RestRequest(method, requestConfig, false);

        List<String> parameterNameList = Arrays.asList(restRequest.getPropertyNames());
        assertThat(parameterNameList, is(Arrays.asList("first", "second", "third")));
View Full Code Here

    }

    @Test
    public void removesNonExistentParameterFromOrderedList() throws Exception {
        RestRequestConfig requestConfig = buildRestRequestConfigWithParameters("first", "second", "third");
        RestMethod method = buildRestMethodWithParameters("third", "first");
        RestRequest restRequest = new RestRequest(method, requestConfig, false);

        List<String> parameterNameList = Arrays.asList(restRequest.getPropertyNames());
        assertThat(parameterNameList, is(Arrays.asList("first", "third")));
View Full Code Here

    }

    @Test
    public void addsNewParameterToOrderedList() throws Exception {
        RestRequestConfig requestConfig = buildRestRequestConfigWithParameters("first", "second", "third");
        RestMethod method = buildRestMethodWithParameters("third", "second", "newOne", "first");
        RestRequest restRequest = new RestRequest(method, requestConfig, false);

        List<String> parameterNameList = Arrays.asList(restRequest.getPropertyNames());
        assertThat(parameterNameList, is(Arrays.asList("first", "second", "third", "newOne")));
View Full Code Here

        assertThat(parameterNameList, is(Arrays.asList("first", "second", "third", "newOne")));

    }

    private RestMethod buildRestMethodWithParameters(String... parameterNames) throws SoapUIException {
        RestMethod method = ModelItemFactory.makeRestMethod();
        RestParamsPropertyHolder methodParams = method.getParams();
        for (String parameterName : parameterNames) {
            methodParams.addProperty(parameterName);
        }
        return method;
    }
View Full Code Here

        RestService service = (RestService) project.addNewInterface("Test", RestServiceFactory.REST_TYPE);

        new WadlImporter(service).initFromWadl(RestUtilsTest.class.getResource(
                "/wadl/YahooSearchWithExpansions.wadl").toURI().toString());
        RestResource operation = (RestResource) service.getAllOperations()[0];
        RestMethod restMethod = operation.getRestMethodAt(0);
        RestRequest request = restMethod.getRequestAt(0);
        assertThat(request.getParams().getProperty("language").getDefaultValue(), is(anEmptyString()));
    }
View Full Code Here

    }

    public void perform(RestRequest request, Object param) {
        if (UISupport.confirm("Delete Request [" + request.getName() + "] from Resource ["
                + request.getOperation().getName() + "]", "Delete Request")) {
            RestMethod method = request.getRestMethod();
            method.removeRequest(request);
        }
    }
View Full Code Here

        return Math.min(semicolonIndex == -1 ? Integer.MAX_VALUE : semicolonIndex,
                questionMarkIndex == -1 ? Integer.MAX_VALUE : questionMarkIndex);
    }

    private void createMethodAndRequestFor(RestResource resource) {
        RestMethod method = resource.addNewMethod("Method " + (resource.getRestMethodCount() + 1));
        method.setMethod(RestRequestInterface.HttpMethod.GET);
        RestRequest request = method.addNewRequest("Request " + (method.getRequestCount() + 1));
        UISupport.select(request);
        UISupport.showDesktopPanel(request);
    }
View Full Code Here

        String name = UISupport.prompt("Specify name of cloned Method", "Clone Method", "Copy of " + method.getName());
        if (name == null) {
            return;
        }

        RestMethod newMethod = method.getOperation().cloneMethod(method, name);
        UISupport.selectAndShow(newMethod);
    }
View Full Code Here

TOP

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

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.