Package com.eviware.soapui.impl.rest

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


            throw new RuntimeException("Unexpected", e);
        }
    }

    public RestRequest makeRestRequest() throws SoapUIException {
        return new RestRequest(makeRestMethod(), RestRequestConfig.Factory.newInstance(), false);
    }
View Full Code Here


    public RestRequest makeRestRequest() throws SoapUIException {
        return new RestRequest(makeRestMethod(), RestRequestConfig.Factory.newInstance(), false);
    }

    public RestRequest makeRestRequest(RestResource restResource) throws SoapUIException {
        return new RestRequest(makeRestMethod(restResource), RestRequestConfig.Factory.newInstance(), false);
    }
View Full Code Here

/**
* Class containing factory methods for commonly used model items, for use in automatic tests.
*/
public class ModelItemFactory {
    public static RestRequest makeRestRequest() throws SoapUIException {
        return new RestRequest(makeRestMethod(), RestRequestConfig.Factory.newInstance(), false);
    }
View Full Code Here

    public static RestRequest makeRestRequest() throws SoapUIException {
        return new RestRequest(makeRestMethod(), RestRequestConfig.Factory.newInstance(), false);
    }

    public static RestRequest makeRestRequest(RestResource restResource) throws SoapUIException {
        return new RestRequest(makeRestMethod(restResource), RestRequestConfig.Factory.newInstance(), false);
    }
View Full Code Here

    }

    @SuppressWarnings("deprecation")
    private static void convert(RestResource resource, OldRestRequestConfig oldConfig, RestMethod method) {

        RestRequest request = method.addNewRequest(oldConfig.getName());

        XmlBeansRestParamsTestPropertyHolder params = new XmlBeansRestParamsTestPropertyHolder(null,
                oldConfig.getParameters());
        RestParamsPropertyHolder parentParams = method.getOverlayParams();

        for (TestProperty prop : params.values()) {
            if (!parentParams.containsKey(prop.getName())) {
                method.getParams().addParameter((RestParamProperty) prop);
            }
            request.setPropertyValue(prop.getName(), prop.getValue());
        }
        params.release();

        boolean exists;
        for (RestResourceRepresentationConfig rep : oldConfig.getRepresentationList()) {
            exists = false;
            for (RestRepresentation existing : method.getRepresentations(
                    RestRepresentation.Type.valueOf(rep.getType().toString()), rep.getMediaType())) {
                if (existing.getElement() == null && rep.getElement() == null
                        || existing.getElement().equals(rep.getElement())) {
                    exists = true;
                    break;
                }
            }
            if (!exists) {
                RestRepresentation repr = method.addNewRepresentation(RestRepresentation.Type.valueOf(rep.getType()
                        .toString()));
                repr.setConfig((RestResourceRepresentationConfig) rep.copy());
            }
        }

        RestRequestConfig newConfig = request.getConfig();

        newConfig.setRequest(oldConfig.getRequest());

        for (AttachmentConfig ac : oldConfig.getAttachmentList()) {
            try {
                if (ac.isSetData()) {
                    File temp = File.createTempFile("pattern", ".suffix");
                    temp.deleteOnExit();
                    FileOutputStream out = new FileOutputStream(temp);
                    out.write(ac.getData());
                    request.attachFile(temp, true);
                } else {
                    request.attachFile(new File(ac.getUrl()), false);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        newConfig.setAttachmentArray(oldConfig.getAttachmentArray());

        if (oldConfig.isSetFullPath()) {
            newConfig.setFullPath(oldConfig.getFullPath());
        }
        if (oldConfig.isSetMediaType()) {
            newConfig.setMediaType(oldConfig.getMediaType());
        }
        if (oldConfig.isSetPostQueryString()) {
            newConfig.setPostQueryString(oldConfig.getPostQueryString());
        }
        if (oldConfig.isSetAccept()) {
            newConfig.setAccept(oldConfig.getAccept());
        }
        if (oldConfig.isSetDescription()) {
            newConfig.setDescription(oldConfig.getDescription());
        }
        if (oldConfig.isSetId()) {
            newConfig.setId(oldConfig.getId());
        }
        if (oldConfig.isSetSettings()) {
            newConfig.setSettings((SettingsConfig) oldConfig.getSettings().copy());
        }
        if (oldConfig.isSetSslKeystore()) {
            newConfig.setSslKeystore(oldConfig.getSslKeystore());
        }
        if (oldConfig.isSetTimestamp()) {
            newConfig.setTimestamp(oldConfig.getTimestamp());
        }
        if (oldConfig.isSetWadlId()) {
            newConfig.setWadlId(oldConfig.getWadlId());
        }

        request.updateConfig(newConfig);

    }
View Full Code Here

        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);
View Full Code Here

        String newParamName = "sessionID";
        String expectedParentPath = parentPath + "{" + newParamName + "}";
        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);
        restRequest.getParams().getProperty(PARAMETER_NAME).setName(newParamName);
View Full Code Here

        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);
View Full Code Here

        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);
View Full Code Here

        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);

        parentResource.addProperty(PARAMETER_NAME);
        parentResource.getParams().getProperty(PARAMETER_NAME).setStyle(RestParamsPropertyHolder.ParameterStyle.TEMPLATE);
View Full Code Here

TOP

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

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.