Package com.eviware.soapui.model.testsuite

Examples of com.eviware.soapui.model.testsuite.TestAssertion


                    assertionListPopup.add(new ShowOnlineHelpAction(getHelpUrl()));
                    return;
                }
                int[] indices = assertionList.getSelectedIndices();
                if (indices.length == 1) {
                    TestAssertion assertion = assertionListModel.getAssertionAt(ix);
                    ActionSupport.addActions(ActionListBuilder.buildActions(assertion), assertionListPopup);

                } else {
                    TestAssertion[] testAssertion = new TestAssertion[indices.length];
                    for (int c = 0; c < indices.length; c++) {
                        testAssertion[c] = assertionListModel.getAssertionAt(indices[c]);
                    }

                    ActionSupport.addActions(ActionListBuilder.buildMultiActions(testAssertion), assertionListPopup);
                }
            }

            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
            }

            public void popupMenuCanceled(PopupMenuEvent e) {
            }
        });

        assertionList.setComponentPopupMenu(assertionListPopup);

        assertionList.addMouseListener(new MouseAdapter() {

            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() < 2) {
                    return;
                }

                int ix = assertionList.getSelectedIndex();
                if (ix == -1) {
                    return;
                }

                Object obj = assertionList.getModel().getElementAt(ix);
                if (obj instanceof TestAssertion) {
                    TestAssertion assertion = (TestAssertion) obj;
                    if (assertion.isConfigurable()) {
                        assertion.configure();
                    }

                    return;
                }

                if (obj instanceof AssertionError) {
                    AssertionError error = (AssertionError) obj;
                    if (error.getLineNumber() >= 0) {
                        selectError(error);
                    } else {
                        Toolkit.getDefaultToolkit().beep();
                    }
                } else {
                    Toolkit.getDefaultToolkit().beep();
                }
            }
        });

        assertionList.addKeyListener(new KeyAdapter() {
            public void keyPressed(KeyEvent e) {
                int ix = assertionList.getSelectedIndex();
                if (ix == -1) {
                    return;
                }

                int[] indices = assertionList.getSelectedIndices();
                if (indices.length == 1) {
                    TestAssertion assertion = assertionListModel.getAssertionAt(ix);
                    if (e.getKeyChar() == KeyEvent.VK_ENTER) {
                        if (assertion.isConfigurable()) {
                            assertion.configure();
                        }
                    } else {
                        ActionList actions = ActionListBuilder.buildActions(assertion);
                        if (actions != null) {
                            actions.dispatchKeyEvent(e);
View Full Code Here


                moveAssertionDownAction.setEnabled(ix >= 0);

                if (ix == -1) {
                    return;
                }
                TestAssertion assertion = assertionListModel.getAssertionAt(ix);
                configureAssertionAction.setEnabled(assertion != null && assertion.isConfigurable());
            }
        });

        return toolbar;
    }
View Full Code Here

        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                                                      boolean cellHasFocus) {
            setEnabled(list.isEnabled());

            if (value instanceof TestAssertion) {
                TestAssertion assertion = (TestAssertion) value;
                setText(assertion.getLabel() + " - " + assertion.getStatus().toString());
                setIcon(assertion.getIcon());

                if (assertion.isDisabled() && isEnabled()) {
                    setEnabled(false);
                }
            } else if (value instanceof AssertionError) {
                AssertionError assertion = (AssertionError) value;
                setText(" -> " + assertion.toString());
                setIcon(null);
            } else if (value instanceof String) {
                setText(value.toString());
            }
View Full Code Here

        private void init() {
            assertable.addAssertionsListener(this);

            for (int c = 0; c < assertable.getAssertionCount(); c++) {
                TestAssertion assertion = assertable.getAssertionAt(c);
                addAssertion(assertion);
            }
        }
View Full Code Here

        public void release() {
            items.clear();

            for (int c = 0; c < assertable.getAssertionCount(); c++) {
                TestAssertion assertion = assertable.getAssertionAt(c);
                assertion.removePropertyChangeListener(this);
            }

            assertable.removeAssertionsListener(this);
        }
View Full Code Here

        }

        public void assertionMoved(TestAssertion newAssertion, int ix, int offset) {
            synchronized (this) {
                // int ix = items.indexOf( assertion );
                TestAssertion assertion = (TestAssertion) items.get(ix);
                // if first selected can't move up and if last selected can't move
                // down
                if ((ix == 0 && offset == -1) || (ix == items.size() - 1 && offset == 1)) {
                    return;
                }

                assertion.removePropertyChangeListener(this);
                items.remove(ix);
                fireIntervalRemoved(this, ix, ix);

                // remove associated errors
                while (ix < items.size() && items.get(ix) instanceof AssertionError) {
View Full Code Here

            int ix = assertionList.getSelectedIndex();
            if (ix == -1) {
                return;
            }

            TestAssertion assertion = assertionListModel.getAssertionAt(ix);
            if (assertion.isConfigurable()) {
                assertion.configure();
            } else {
                Toolkit.getDefaultToolkit().beep();
            }
        }
View Full Code Here

        }

        public void actionPerformed(ActionEvent e) {
            int ix = assertionList.getSelectedIndex();
            TestAssertion assertion = assertionListModel.getAssertionAt(ix);
            if (ix != -1) {
                assertion = assertable.moveAssertion(ix, -1);
            }
            assertionList.setSelectedValue(assertion, true);
        }
View Full Code Here

        }

        public void actionPerformed(ActionEvent e) {
            int ix = assertionList.getSelectedIndex();
            TestAssertion assertion = assertionListModel.getAssertionAt(ix);
            if (ix != -1) {
                assertion = assertable.moveAssertion(ix, 1);
            }
            assertionList.setSelectedValue(assertion, true);
        }
View Full Code Here

        if (!TestAssertionRegistry.getInstance().canAddMultipleAssertions(selection, assertable)) {
            UISupport.showErrorMessage("This assertion can only be added once");
            return false;
        }

        TestAssertion assertion = assertable.addAssertion(selection);
        if (assertion == null) {
            UISupport.showErrorMessage("Failed to add assertion");
            return false;
        }

        recentAssertionHandler.add(selection);

        if (assertion.isConfigurable()) {
            assertion.configure();
            return true;
        }

        return true;
    }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.model.testsuite.TestAssertion

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.