Package com.eviware.soapui.impl.rest.support

Examples of com.eviware.soapui.impl.rest.support.RestParamProperty


    }

    /* Backward compatibility tests end */

    private RestParamProperty addRequestParameter(String name, String value) {
        RestParamProperty parameter = request.getParams().addProperty(name);
        parameter.setValue(value);
        return parameter;
    }
View Full Code Here


    }


    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        RestParamProperty prop = getParameterAt(rowIndex);

        switch (columnIndex) {
            case NAME_COLUMN_INDEX:
                return prop.getName();
            case VALUE_COLUMN_INDEX:
                return prop.getValue();
            case STYLE_COLUMN_INDEX:
                return mode == Mode.MINIMAL ? null : prop.getStyle();
            case LOCATION_COLUMN_INDEX:
                return mode != Mode.FULL ? null : prop.getParamLocation();
        }

        return null;
    }
View Full Code Here

        return null;
    }

    @Override
    public void setValueAt(Object value, int rowIndex, int columnIndex) {
        RestParamProperty prop = getParameterAt(rowIndex);

        switch (columnIndex) {
            case NAME_COLUMN_INDEX:
                if (propertyExists(value, prop)) {
                    return;
                }

                params.renameProperty(prop.getName(), value.toString());
                return;
            case VALUE_COLUMN_INDEX:
                //if( !prop.getParamLocation().equals( ParamLocation.REQUEST ) )
                //{
                prop.setDefaultValue(value.toString());
                //}
                prop.setValue(value.toString());
                return;
            case STYLE_COLUMN_INDEX:
                if (mode != Mode.MINIMAL) {
                    prop.setStyle((ParameterStyle) value);
                }
                return;
            case LOCATION_COLUMN_INDEX:
                if (mode == Mode.FULL) {
                    if (params.getModelItem() != null && params.getModelItem() instanceof RestRequest) {
View Full Code Here

        templateResource = ModelItemFactory.makeRestResource();
        templateResource.setPath("/hello{param1}{param2}");

        parentResource = ModelItemFactory.makeRestResource();
        parentResource.setPath("/parent{param1}");
        RestParamProperty existingparam = parentResource.addProperty("existingparam");
        existingparam.setValue("existingvalue");
        existingparam.setDefaultValue("existingvalue");

        childResource = parentResource.addNewChildResource("child", "the_child{param2}{existingparam}");
    }
View Full Code Here

            @Override
            public Component prepareEditor(TableCellEditor editor, int row, int column) {
                Component component = super.prepareEditor(editor, row, column);
                if (getColumnClass(column) == ParameterStyle.class) {
                    RestParamProperty parameter = paramsTableModel.getParameterAt(row);
                    JComboBox comboBox = (JComboBox) ((DefaultCellEditor) editor).getComponent();
                    comboBox.setModel(getStylesForLocation(parameter.getParamLocation()));
                    super.prepareEditor(editor, row, column);
                }
                if (getColumnClass(column) == ParamLocation.class) {
                    RestParamProperty parameter = paramsTableModel.getParameterAt(row);
                    JComboBox comboBox = (JComboBox) ((DefaultCellEditor) editor).getComponent();
                    comboBox.setModel(getLocationForParameter(parameter.getStyle()));
                    super.prepareEditor(editor, row, column);
                }
                return component;
            }
        };
        paramsTable.setName(REST_PARAMS_TABLE);
        paramsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

        if (showDefaultParamsButton) {
            defaultParamsAction = new UseDefaultParamsAction();
        }

        movePropertyDownAction = new MovePropertyDownAction(paramsTable, params, "Moves selected parameter down one row");
        movePropertyUpAction = new MovePropertyUpAction(paramsTable, params, "Moves selected parameter up one row");


        if (showEditableButtons) {
            initEditableButtons();
        }


        paramsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        paramsTable.setDefaultEditor(ParameterStyle.class, new DefaultCellEditor(
                new JComboBox(getStylesForLocation(ParamLocation.RESOURCE))));
        paramsTable.setDefaultEditor(ParamLocation.class, new DefaultCellEditor(
                new JComboBox(ParamLocation.values())));
        // Workaround: for some reason the lower part of text gets clipped on some platforms
        paramsTable.setRowHeight(25);
        paramsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            public void valueChanged(ListSelectionEvent e) {
                int selectedRow = paramsTable.getSelectedRow();
                if (showEditableButtons) {
                    removeParamAction.setEnabled(selectedRow != -1);
                }
                if (showDefaultParamsButton) {
                    defaultParamsAction.setEnabled(paramsTable.getRowCount() > 0);
                }
                movePropertyDownAction.setEnabled(selectedRow < paramsTable.getRowCount() - 1);
                movePropertyUpAction.setEnabled(selectedRow > 0);

                if (selectedRow != -1) {
                    RestParamProperty selectedParameter = getSelectedParameter();
                    if (paramDetailsModel != null) {
                        updateDetailsFormWith(selectedParameter);
                        detailsForm.setEnabled(true);
                    }
                } else {
View Full Code Here

        return tableModel.isInMinimalMode();
    }

    public void extractParams(RestParamsPropertyHolder params, ParamLocation location) {
        for (int i = 0; i < paramsTable.getRowCount(); i++) {
            RestParamProperty prop = paramsTableModel.getParameterAt(i);
            if (paramsTableModel.getParamLocationAt(i) == location) {
                params.addParameter(prop);
            }
        }
    }
View Full Code Here

    private ParametersField parametersField;

    @Before
    public void setUp() throws Exception {
        RestRequest request = ModelItemFactory.makeRestRequest();
        RestParamProperty matrixParam = request.getParams().addProperty(MATRIX_PARAM_NAME);
        matrixParam.setStyle(RestParamsPropertyHolder.ParameterStyle.MATRIX);
        matrixParam.setValue(MATRIX_PARAM_VALUE);
        RestParamProperty queryParam = request.getParams().addProperty(QUERY_PARAM_NAME);
        queryParam.setStyle(RestParamsPropertyHolder.ParameterStyle.QUERY);
        queryParam.setValue(QUERY_PARAM_VALUE);

        parametersField = new ParametersField(request);
    }
View Full Code Here

        restResource.addNewMethod(restRequest.getRestMethod().getName());
        RestMethodConfig restMethodConfig = restResource.getRestMethodList().get(0).getConfig();
        restMethodConfig.setMethod("GET");

        restService().addEndpoint(ENDPOINT);
        RestParamProperty restParamProperty = restRequest.getParams().getProperty(PARAMETER_NAME);
        restParamProperty.setValue(PARAMETER_VALUE);
        return restResource;
    }
View Full Code Here

        requestTableHolderModel = createDefaultPropertyHolderTableModel(requestParams);
    }

    @Test
    public void doesNotSetDefaultValueIfModelItemIsRestRequest() throws Exception {
        RestParamProperty property = requestParams.getPropertyAt(0);
        assertThat(property.getValue(), is(PARAM_VALUE));
        assertThat(property.getDefaultValue(), is(EMPTY_STRING));
    }
View Full Code Here

        assertThat(property.getDefaultValue(), is(EMPTY_STRING));
    }

    @Test
    public void setsDefaultValueIfModelItemIsRestMethod() throws Exception {
        RestParamProperty property = methodParams.getPropertyAt(0);
        assertThat(property.getValue(), is(PARAM_VALUE));
        assertThat(property.getDefaultValue(), is(PARAM_VALUE));
    }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.impl.rest.support.RestParamProperty

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.