Package com.eviware.soapui.impl.rest

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


    public void shouldAddOperationToMockServiceAction() throws SoapUIException {
        RestMethod restMethod = mock(RestMethod.class);
        when(restMethod.getRequestAt(0)).thenReturn(restRequest);
        when(restMethod.getMethod()).thenReturn(RestRequestInterface.HttpMethod.GET);

        RestResource restResource = mock(RestResource.class);
        when(restResource.getRestMethodCount()).thenReturn(1);
        when(restResource.getFullPath()).thenReturn("/full/path");
        List<RestMethod> restMethodList = new ArrayList<RestMethod>();
        restMethodList.add(restMethod);
        when(restResource.getRestMethodList()).thenReturn(restMethodList);


        restMockService.addNewMockOperation(restResource);

        RestMockAction mockOperation = restMockService.getMockOperationAt(0);
View Full Code Here


        String childResourcePath = "anthony_jr";

        action.createRestResource(service, ENDPOINT + "/" + PARENT_RESOURCE_PATH + "/" + childResourcePath);
        List<RestResource> rootLevelResources = service.getResourceList();
        assertThat(rootLevelResources, is(aCollectionWithSize(1)));
        RestResource newChildResource = rootLevelResources.get(0).getAllChildResources()[0];
        assertThat(newChildResource.getPath(), is(childResourcePath));
    }
View Full Code Here

        String childResourcePath = "anthony_jr";

        action.createRestResource(service, ENDPOINT + parentResource.getFullPath() + "/" + childResourcePath);
        List<RestResource> rootLevelResources = service.getResourceList();
        assertThat(rootLevelResources, is(aCollectionWithSize(1)));
        RestResource newChildResource = rootLevelResources.get(0).getAllChildResources()[0];
        assertThat(newChildResource.getPath(), is(childResourcePath));
    }
View Full Code Here

        }
    }

    @Test
    public void shouldGenerateRestMockServiceForNestedResources() {
        RestResource one = restService.addNewResource("one", "/one{version}");

        RestParamProperty path = one.addProperty("version");
        path.setValue("v1");

        RestResourceConfig nestedResourceConfig = one.getConfig().addNewResource();
        nestedResourceConfig.setPath("/path/again");

        RestResource three = one.addNewChildResource("three", "/will/be/overwritten");
        three.setConfig(nestedResourceConfig);

        restService.addNewResource("two", "/two");

        action.perform(restService, null);
View Full Code Here

        assertMockActionWithPath(restMockService, "/two");
    }

    @Test
    public void shouldGenerateRestMockServiceForResourceWithSeveralMethods() {
        RestResource resource = restService.addNewResource("one", "/one");

        addMethod(resource, HttpMethod.GET);
        addMethod(resource, HttpMethod.POST);

        action.perform(restService, null);
View Full Code Here

        assertMockAction(HttpMethod.POST, "/one", restMockService.getMockOperationAt(1));
    }

    @Test
    public void shouldExpandPathParamForEmptyRestMethod() {
        RestResource resource = restService.addNewResource("one", "/one{version}");
        RestParamProperty path = resource.addProperty("version");
        path.setValue("v1");

        addMethod(resource, HttpMethod.GET);

        action.perform(restService, null);
View Full Code Here

    private void mockParams() {
        params = mock(RestParamsPropertyHolder.class);
        RestRequest restRequest = mock(RestRequest.class);

        RestResource resource = mock(RestResource.class);
        RestParamsPropertyHolder resourceParams = mock(XmlBeansRestParamsTestPropertyHolder.class);
        when(resource.getParams()).thenReturn(resourceParams);
        when(restRequest.getResource()).thenReturn(resource);

        RestMethod restMethod = mock(RestMethod.class);
        RestParamsPropertyHolder methodParams = mock(XmlBeansRestParamsTestPropertyHolder.class);
        when(restMethod.getParams()).thenReturn(methodParams);
View Full Code Here

        assertThat(parametersHolder.getPropertyCount(), is(0));
    }

    @Test
    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

            setBorder(originalBorder);
            setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
            mouseListener = new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    final RestResource focusedResource = new RestResourceFinder(editingRestResource).findResourceAt(lastSelectedPosition);
                    SwingUtilities.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            openPopup(focusedResource);
                        }
View Full Code Here

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

        RestRequest request = resource.getRequestAt(0);
        assertEquals(RestRequestInterface.HttpMethod.GET, request.getMethod());
        assertEquals(9, request.getPropertyCount());
    }
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.