Package com.eviware.soapui.impl.rest

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


        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


                "Copy of " + resource.getName());
        if (name == null) {
            return;
        }

        RestResource newResource = resource.getResourceContainer().cloneResource(resource, name);
        UISupport.selectAndShow(newResource);
    }
View Full Code Here

            dialog.setValue(Form.RESOURCEPATH, path);
        }

        if (dialog.show()) {
            String path = dialogBuilder.getUri();
            RestResource resource = createRestResource(parent, path);
            RestUtils.extractParams(dialog.getValue(Form.RESOURCEPATH), resource.getParams(), false);
            resource.setPath(removeParametersFrom(resource.getPath()));

            createMethodAndRequestFor(resource);
        }

    }
View Full Code Here

        }

    }

    protected RestResource createRestResource(T item, String path) {
        RestResource possibleParent = null;
        String pathWithoutEndpoint = removeEndpointFrom(path);

        for (RestResource resource : getResourcesFor(item)) {
            if (pathWithoutEndpoint.startsWith(resource.getFullPath() + "/")) {
                int c = 0;
                for (; c < resource.getChildResourceCount(); c++) {
                    if (pathWithoutEndpoint.startsWith(resource.getChildResourceAt(c).getFullPath() + "/")) {
                        break;
                    }
                }

                // found subresource?
                if (c != resource.getChildResourceCount()) {
                    continue;
                }

                possibleParent = resource;
                break;
            }
        }

        if (possibleParent != null
                && UISupport.confirm("Create resource as child to [" + possibleParent.getName() + "]",
                CONFIRM_DIALOG_TITLE)) {
            // adjust path
            String strippedPath = pathWithoutEndpoint;
            if (pathWithoutEndpoint.length() > 0 && possibleParent.getFullPath().length() > 0) {
                strippedPath = pathWithoutEndpoint.substring(possibleParent.getFullPath().length() + 1);
            }
            return possibleParent.addNewChildResource(extractNameFromPath(strippedPath), strippedPath);
        } else {
            String pathWithoutLeadingSlash = pathWithoutEndpoint.startsWith("/") ? pathWithoutEndpoint.substring(1) :
                    pathWithoutEndpoint;
            return addResourceTo(item, extractNameFromPath(pathWithoutEndpoint), pathWithoutLeadingSlash);
        }
View Full Code Here

        public Object getValueAt(int rowIndex, int columnIndex) {
            if (updatingService) {
                return "<updating>";
            }

            RestResource operation = restService.getOperationAt(rowIndex);

            switch (columnIndex) {
                case 0:
                    return operation.getName();
                case 1:
                    return operation.getPath();
            }

            return null;
        }
View Full Code Here

public class RestResourceFinderTest {

    @Test
    public void findLonelyResource() throws SoapUIException {

        RestResource resource = ModelItemFactory.makeRestResource();
        resource.setPath("/resource");

        RestResourceFinder finder = new RestResourceFinder(resource);

        assertThat(finder.findResourceAt(1), is(resource));
    }
View Full Code Here

    }

    @Test
    public void findParentInTwoLevelResource() throws SoapUIException {

        RestResource parent = ModelItemFactory.makeRestResource();
        RestResource child = parent.addNewChildResource("child", "/child");
        parent.setPath("/parent");

        RestResourceFinder finder = new RestResourceFinder(child);

        assertThat(finder.findResourceAt(1), is(parent));
View Full Code Here

    }

    @Test
    public void findChildInTwoLevelResource() throws SoapUIException {

        RestResource parent = ModelItemFactory.makeRestResource();
        parent.setPath("/parent");
        RestResource child = parent.addNewChildResource("child", "/child");

        RestResourceFinder finder = new RestResourceFinder(child);

        assertThat(finder.findResourceAt(10), is(child));
    }
View Full Code Here

    public void findChildInTwoLevelResource2() throws SoapUIException {
        /*  / o n e / t w o / t h r e e / f o u r
     * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
     */

        RestResource one = ModelItemFactory.makeRestResource();
        one.setPath("/one");
        RestResource two = one.addNewChildResource("two", "/two");
        RestResource three = two.addNewChildResource("three", "/three");
        RestResource four = three.addNewChildResource("four", "/four");

        RestResourceFinder finder = new RestResourceFinder(four);

        assertThat(finder.findResourceAt(0), is(one));
        assertThat(finder.findResourceAt(1), is(one));
View Full Code Here

        assertThat(finder.findResourceAt(20), is(four));
    }

    @Test
    public void returnsNullWhenBasePathIsClicked() throws Exception {
        RestResource parent = ModelItemFactory.makeRestResource();
        String basePath = "/base";
        parent.getInterface().setBasePath(basePath);
        RestResourceFinder finder = new RestResourceFinder(parent);

        assertThat(finder.findResourceAt(basePath.length()), is(nullValue()));

    }
View Full Code Here

TOP

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

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.