Package org.apache.jmeter.gui

Examples of org.apache.jmeter.gui.JMeterGUIComponent


     */
    private static Test suiteGUIComponents() throws Exception {
        TestSuite suite = new TestSuite("GuiComponents");
        Iterator<Object> iter = getObjects(JMeterGUIComponent.class).iterator();
        while (iter.hasNext()) {
            JMeterGUIComponent item = (JMeterGUIComponent) iter.next();
            if (item instanceof JMeterTreeNode) {
                System.out.println("o.a.j.junit.JMeterTest INFO: JMeterGUIComponent: skipping all tests  " + item.getClass().getName());
                continue;
            }
            if (item instanceof ObsoleteGui){
                continue;
            }
            TestSuite ts = new TestSuite(item.getClass().getName());
            ts.addTest(new JMeterTest("GUIComponents1", item));
            if (item instanceof TestBeanGUI) {
                System.out.println("o.a.j.junit.JMeterTest INFO: JMeterGUIComponent: skipping some tests " + item.getClass().getName());
            } else {
                ts.addTest(new JMeterTest("GUIComponents2", item));
                ts.addTest(new JMeterTest("runGUITitle", item));
            }
            suite.addTest(ts);
View Full Code Here


        TestSuite suite = new TestSuite("BeanComponents");
        Iterator<Object> iter = getObjects(TestBean.class).iterator();
        while (iter.hasNext()) {
            Class<? extends Object> c = iter.next().getClass();
            try {
                JMeterGUIComponent item = new TestBeanGUI(c);
                // JMeterGUIComponent item = (JMeterGUIComponent) iter.next();
                TestSuite ts = new TestSuite(item.getClass().getName());
                ts.addTest(new JMeterTest("GUIComponents2", item));
                ts.addTest(new JMeterTest("runGUITitle", item));
                suite.addTest(ts);
            } catch (IllegalArgumentException e) {
                System.out.println("o.a.j.junit.JMeterTest Cannot create test for " + c.getName() + " " + e);
View Full Code Here

            menuMap.put(PRE_PROCESSORS, preProcessors);
            Collections.sort(guiClasses);
            Iterator iter = guiClasses.iterator();
            while (iter.hasNext())
            {
                JMeterGUIComponent item;
                try
                {
                    item =
                        (JMeterGUIComponent) Class
                            .forName((String) iter.next())
                            .newInstance();
                }
                catch (Throwable e)
                {
                    continue;
                }
                if (elementsToSkip.contains(item.getClass().getName())
                    || elementsToSkip.contains(item.getStaticLabel()))
                {
                    continue;
                }
                else
                {
                    elementsToSkip.add(item.getClass().getName());
                }
                Collection categories = item.getMenuCategories();
                if (categories == null)
                {
                    continue;
                }
                if (categories.contains(TIMERS))
                {
                    timers.add(
                        new MenuInfo(
                            item.getStaticLabel(),
                            item.getClass().getName()));
                }

                if (categories.contains(POST_PROCESSORS))
                {
                    postProcessors.add(
                        new MenuInfo(
                            item.getStaticLabel(),
                            item.getClass().getName()));
                }

                if (categories.contains(PRE_PROCESSORS))
                {
                    preProcessors.add(
                        new MenuInfo(
                            item.getStaticLabel(),
                            item.getClass().getName()));
                }

                if (categories.contains(CONTROLLERS))
                {
                    controllers.add(
                        new MenuInfo(
                            item.getStaticLabel(),
                            item.getClass().getName()));
                }

                if (categories.contains(SAMPLERS))
                {
                    samplers.add(
                        new MenuInfo(
                            item.getStaticLabel(),
                            item.getClass().getName()));
                }

                if (categories.contains(NON_TEST_ELEMENTS))
                {
                    nonTestElements.add(
                        new MenuInfo(
                            item.getStaticLabel(),
                            item.getClass().getName()));
                }

                if (categories.contains(LISTENERS))
                {
                    listeners.add(
                        new MenuInfo(
                            item.getStaticLabel(),
                            item.getClass().getName()));
                }

                if (categories.contains(CONFIG_ELEMENTS))
                {
                    configElements.add(
                        new MenuInfo(
                            item.getStaticLabel(),
                            item.getClass().getName()));
                }
                if (categories.contains(ASSERTIONS))
                {
                    assertions.add(
                        new MenuInfo(
                            item.getStaticLabel(),
                            item.getClass().getName()));
                }

            }
        }
        catch (Exception e)
View Full Code Here

        }
        component.setProperty(
            TestElement.GUI_CLASS,
            NameUpdater.getCurrentName(
                component.getPropertyAsString(TestElement.GUI_CLASS)));
        JMeterGUIComponent guicomp = GuiPackage.getInstance().getGui(component);
        guicomp.configure(component);
        guicomp.modifyTestElement(component);
        JMeterTreeNode newNode =
            new JMeterTreeNode((TestElement) component, this);

        // This check the state of the TestElement and if returns false it
        // disable the loaded node
View Full Code Here

     * object it encounters as it goes.
     */
    public void addNode(Object node, HashTree subTree)
    {
        log.debug("Node is class:" + node.getClass());
        JMeterGUIComponent treeNode = (JMeterGUIComponent) node;
        if (checkMode)
        {
            if (previousGuiItems.containsKey(treeNode))
            {
                if (!previousGuiItems
                    .get(treeNode)
                    .equals(treeNode.createTestElement()))
                {
                    dirty = true;
                }
            }
            else
            {
                dirty = true;
            }
        }
        else if (removeMode)
        {
            previousGuiItems.remove(treeNode);
        }
        else
        {
            previousGuiItems.put(
                treeNode,
                treeNode.createTestElement().clone());
        }
    }
View Full Code Here

    public void doAction(ActionEvent e) {
        GuiPackage guiPackage = GuiPackage.getInstance();
        final String actionCommand = e.getActionCommand();
        if (actionCommand.equals(ActionNames.CLEAR)) {
            JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
            if (guiComp instanceof Clearable){
                ((Clearable) guiComp).clearData();
            }
        } else if (actionCommand.equals(ActionNames.RESET_GUI)) {
            JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
            guiComp.clearGui();
        } else {
            guiPackage.getMainFrame().clearData();
            for (JMeterTreeNode node : guiPackage.getTreeModel().getNodesOfType(Clearable.class)) {
                JMeterGUIComponent guiComp = guiPackage.getGui(node.getTestElement());
                if (guiComp instanceof Clearable){
                    Clearable item = (Clearable) guiComp;
                    try {
                        item.clearData();
                    } catch (Exception ex) {
View Full Code Here

                 */
                if (name.endsWith("JMeterTreeNode") || name.endsWith("TestBeanGUI")) {
                    continue;// Don't try to instantiate these
                }

                JMeterGUIComponent item;
                try {
                    Class<?> c = Class.forName(name);
                    if (TestBean.class.isAssignableFrom(c)) {
                        item = new TestBeanGUI(c);
                    } else {
                        item = (JMeterGUIComponent) c.newInstance();
                    }
                } catch (NoClassDefFoundError e) {
                    log.warn("Missing jar? Could not create " + name + ". " + e);
                    continue;
                } catch (Throwable e) {
                    log.warn("Could not instantiate " + name, e);
                    continue;
                }
                if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) {
                    log.info("Skipping " + name);
                    continue;
                } else {
                    elementsToSkip.add(name);
                }
                Collection<String> categories = item.getMenuCategories();
                if (categories == null) {
                    log.debug(name + " participates in no menus.");
                    continue;
                }

                if (categories.contains(POST_PROCESSORS)) {
                    postProcessors.add(new MenuInfo(item.getStaticLabel(), name));
                }

                if (categories.contains(PRE_PROCESSORS)) {
                    preProcessors.add(new MenuInfo(item.getStaticLabel(), name));
                }

                if (categories.contains(CONTROLLERS)) {
                    controllers.add(new MenuInfo(item.getStaticLabel(), name));
                }

                if (categories.contains(NON_TEST_ELEMENTS)) {
                    nonTestElements.add(new MenuInfo(item.getStaticLabel(), name));
                }

                if (categories.contains(LISTENERS)) {
                    listeners.add(new MenuInfo(item.getStaticLabel(), name));
                }

                if (categories.contains(CONFIG_ELEMENTS)) {
                    configElements.add(new MenuInfo(item.getStaticLabel(), name));
                }

                if (categories.contains(TABLES)) {
                    tables.add(new MenuInfo(item.getStaticLabel(), name));
                }

                if (categories.contains(REPORT_PAGE)) {
                    reportPage.add(new MenuInfo(item.getStaticLabel(), name));
                }
            }
        } catch (Exception e) {
            log.error("", e);
        }
View Full Code Here

    public void doAction(ActionEvent e) throws IllegalUserActionException {
        if (!commands.contains(e.getActionCommand())) {
            throw new IllegalUserActionException("Invalid user command:" + e.getActionCommand());
        }
        if (e.getActionCommand().equals(ActionNames.SAVE_GRAPHICS)) {
            JMeterGUIComponent component = GuiPackage.getInstance().getCurrentGui();
            // get the JComponent from the visualizer
            if (component instanceof Printable) {
                JComponent comp = ((Printable) component).getPrintableComponent();
                saveImage(comp);
            }
        }
        if (e.getActionCommand().equals(ActionNames.SAVE_GRAPHICS_ALL)) {
            JMeterGUIComponent component = GuiPackage.getInstance().getCurrentGui();
            JComponent comp=((JComponent) component).getRootPane();
            saveImage(comp);
        }
    }
View Full Code Here

                if (name.endsWith("JMeterTreeNode") // $NON-NLS-1$
                        || name.endsWith("TestBeanGUI")) {// $NON-NLS-1$
                    continue;// Don't try to instantiate these
                }

                JMeterGUIComponent item;
                try {
                    Class<?> c = Class.forName(name);
                    if (TestBean.class.isAssignableFrom(c)) {
                        item = new TestBeanGUI(c);
                    } else {
                        item = (JMeterGUIComponent) c.newInstance();
                    }
                } catch (NoClassDefFoundError e) {
                    log.warn("Missing jar? Could not create " + name + ". " + e);
                    continue;
                } catch (Throwable e) {
                    log.warn("Could not instantiate " + name, e);
                    if (e instanceof Error){
                        throw (Error) e;
                    }
                    if (e instanceof RuntimeException){
                        throw (RuntimeException) e;
                    }
                    continue;
                }
                if (elementsToSkip.contains(name) || elementsToSkip.contains(item.getStaticLabel())) {
                    log.info("Skipping " + name);
                    continue;
                } else {
                    elementsToSkip.add(name);
                }
                Collection<String> categories = item.getMenuCategories();
                if (categories == null) {
                    log.debug(name + " participates in no menus.");
                    continue;
                }
                if (categories.contains(THREADS)) {
View Full Code Here

    public void doAction(ActionEvent e) {
        GuiPackage guiPackage = GuiPackage.getInstance();
        final String actionCommand = e.getActionCommand();
        if (actionCommand.equals(ActionNames.CLEAR)) {
            JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
            if (guiComp instanceof Clearable){
                ((Clearable) guiComp).clearData();
            }
        } else if (actionCommand.equals(ActionNames.RESET_GUI)) {
            JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
            guiComp.clearGui();
        } else {
            Iterator<?> iter = guiPackage.getTreeModel().getNodesOfType(Clearable.class).iterator();
            while (iter.hasNext()) {
                JMeterTreeNode node = null;
                JMeterGUIComponent guiComp = null;
                try {
                    node = (JMeterTreeNode) iter.next();
                    guiComp = guiPackage.getGui(node.getTestElement());
                    if (guiComp instanceof Clearable){
                        Clearable item = (Clearable) guiComp;
View Full Code Here

TOP

Related Classes of org.apache.jmeter.gui.JMeterGUIComponent

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.