Package com.eviware.soapui.impl.rest

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


    private RestResource findRestResource() {
        Project project = ModelSupport.getModelItemProject(this);
        for (Interface iface : project.getInterfaceList()) {
            if (iface.getName().equals(getRequestStepConfig().getService()) && iface instanceof RestService) {
                RestService restService = (RestService) iface;
                // 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


public class WadlImporterTest {

    @Test
    public void testWadlImporter() throws Exception {
        WsdlProject project = new WsdlProject();
        RestService service = (RestService) project.addNewInterface("REST Service", RestServiceFactory.REST_TYPE);
        WadlImporter importer = new WadlImporter(service);
        importer.initFromWadl(WadlImporter.class.getResource("/wadl/YahooSearch.wadl").toString());
        assertEquals(service.getName(), "REST Service");
        assertEquals(1, service.getResourceList().size());
        assertEquals(0, service.getResourceList().get(0).getChildResourceCount());
        assertEquals(1, service.getResourceList().get(0).getRestMethodCount());
    }
View Full Code Here

    }

    @Test
    public void importsWadl() throws Exception {
        WsdlProject project = new WsdlProject();
        RestService service = (RestService) project.addNewInterface("Test", RestServiceFactory.REST_TYPE);

        new WadlImporter(service).initFromWadl(RestUtilsTest.class.getResource("/wadl/YahooSearch.wadl").toURI().toString());

        assertEquals(1, service.getOperationCount());
        assertEquals("/NewsSearchService/V1/", service.getBasePath());

        RestResource resource = service.getOperationAt(0);

        assertEquals(1, resource.getPropertyCount());
        assertEquals("appid", resource.getPropertyAt(0).getName());
        assertNotNull(resource.getProperty("appid"));
        assertEquals(1, resource.getRequestCount());
View Full Code Here

    }

    @Test
    public void removesPropertyExpansions() throws Exception {
        WsdlProject project = new WsdlProject();
        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

                    if (new File(expandedUrl).exists()) {
                        expandedUrl = new File(expandedUrl).toURI().toURL().toString();
                    }

                    RestService result = importWadl(project, expandedUrl);
                    if (!url.equals(expandedUrl) && result != null) {
                        result.setWadlUrl(url);
                        if (dialog.getBooleanValue(Form.GENERATETESTSUITE)) {
                            new GenerateRestTestSuiteAction().perform(result, true);
                        }
                    }
                    break;
View Full Code Here

            dialog.getFormField(Form.GENERATETESTSUITE).setEnabled(false);
        }
    }

    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);
        } catch (Exception e) {
View Full Code Here

        importWadl(project, "file:/" + path);
    }

    private void importWadl(WsdlProject project, String path) {
        RestService restService = (RestService) project.addNewInterface(((RestTestRequestStepInterface) item)
                .getRequestStepConfig().getService(), RestServiceFactory.REST_TYPE);
        try {
            new WadlImporter(restService).initFromWadl(path);
        } catch (Exception e) {
            UISupport.showErrorMessage(e);
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.