Examples of Calculator


Examples of org.apache.jmeter.util.Calculator

            if (totalTime > overallTime) {
              fail("Total: "+totalTime+" > overall time: "+ overallTime);
            }
           
            // Check that calculator gets the correct statistics from the sample
            Calculator calculator = new Calculator();
            calculator.addSample(resWithSubResults);
            assertEquals(600, calculator.getTotalBytes());
            assertEquals(1, calculator.getCount());
            assertEquals(1d / (totalTime / 1000d), calculator.getRate(),0.0001d); // Allow for some margin of error
            // Check that the throughput uses the time elapsed for the sub results
            assertFalse(1d / (sampleWithSubResultsTime / 1000d) <= calculator.getRate());
        }
View Full Code Here

Examples of org.apache.jmeter.util.Calculator

                fail("TestElapsed: " + overallTime + " - " + " ParentElapsed: " + parentElapsedTotal
                        + " = " + diff + " not in [0," + maxDiff + "]; nanotime="+nanoTime);
            }
           
            // Check that calculator gets the correct statistics from the sample
            Calculator calculator = new Calculator();
            calculator.addSample(parent);
            assertEquals(600, calculator.getTotalBytes());
            assertEquals(1, calculator.getCount());
            assertEquals(1d / (parentElapsedTotal / 1000d), calculator.getRate(),0.0001d); // Allow for some margin of error
            // Check that the throughput uses the time elapsed for the sub results
            assertFalse(1d / (parentElapsed / 1000d) <= calculator.getRate());
        }
View Full Code Here

Examples of org.apache.jmeter.util.Calculator

    public String getLabelResource() {
        return "summary_report"//$NON-NLS-1$
    }

    public void add(SampleResult res) {
        Calculator row = null;
        final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
        synchronized (lock) {
            row = tableRows.get(sampleLabel);
            if (row == null) {
                row = new Calculator(sampleLabel);
                tableRows.put(row.getLabel(), row);
                model.insertRow(row, model.getRowCount() - 1);
            }
        }
        /*
         * Synch is needed because multiple threads can update the counts.
         */
        synchronized(row) {
            row.addSample(res);
        }
        Calculator tot = tableRows.get(TOTAL_ROW_LABEL);
        synchronized(tot) {
            tot.addSample(res);
        }
        model.fireTableDataChanged();
    }
View Full Code Here

Examples of org.apache.jmeter.util.Calculator

    public void clearData() {
        //Synch is needed because a clear can occur while add occurs
        synchronized (lock) {
            model.clearData();
            tableRows.clear();
            tableRows.put(TOTAL_ROW_LABEL, new Calculator(TOTAL_ROW_LABEL));
            model.addRow(tableRows.get(TOTAL_ROW_LABEL));
        }
    }
View Full Code Here

Examples of org.apache.jmeter.util.Calculator

    public void add(final SampleResult res) {
        final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
        JMeterUtils.runSafe(new Runnable() {
            @Override
            public void run() {
                Calculator row = null;
                synchronized (lock) {
                    row = tableRows.get(sampleLabel);
                    if (row == null) {
                        row = new Calculator(sampleLabel);
                        tableRows.put(row.getLabel(), row);
                        model.insertRow(row, model.getRowCount() - 1);
                    }
                }
                /*
                 * Synch is needed because multiple threads can update the counts.
                 */
                synchronized(row) {
                    row.addSample(res);
                }
                Calculator tot = tableRows.get(TOTAL_ROW_LABEL);
                synchronized(tot) {
                    tot.addSample(res);
                }
                model.fireTableDataChanged();               
            }
        });
    }
View Full Code Here

Examples of org.apache.jmeter.util.Calculator

    public void clearData() {
        //Synch is needed because a clear can occur while add occurs
        synchronized (lock) {
            model.clearData();
            tableRows.clear();
            tableRows.put(TOTAL_ROW_LABEL, new Calculator(TOTAL_ROW_LABEL));
            model.addRow(tableRows.get(TOTAL_ROW_LABEL));
        }
    }
View Full Code Here

Examples of org.apache.jmeter.util.Calculator

            if (totalTime > overallTime) {
                fail("Total: "+totalTime+" > overall time: "+ overallTime);
            }
           
            // Check that calculator gets the correct statistics from the sample
            Calculator calculator = new Calculator();
            calculator.addSample(resWithSubResults);
            assertEquals(600, calculator.getTotalBytes());
            assertEquals(1, calculator.getCount());
            assertEquals(1d / (totalTime / 1000d), calculator.getRate(),0.0001d); // Allow for some margin of error
            // Check that the throughput uses the time elapsed for the sub results
            assertFalse(1d / (sampleWithSubResultsTime / 1000d) <= calculator.getRate());
        }
View Full Code Here

Examples of org.apache.jmeter.util.Calculator

            if (totalTime > overallTime) {
                fail("Total: "+totalTime+" > overall time: "+ overallTime);
            }
           
            // Check that calculator gets the correct statistics from the sample
            Calculator calculator = new Calculator();
            calculator.addSample(resWithSubResults);
            assertEquals(600, calculator.getTotalBytes());
            assertEquals(1, calculator.getCount());
            assertEquals(1d / (totalTime / 1000d), calculator.getRate(),0.0001d); // Allow for some margin of error
            // Check that the throughput uses the time elapsed for the sub results
            assertFalse(1d / (sampleWithSubResultsTime / 1000d) <= calculator.getRate());
        }
View Full Code Here

Examples of org.apache.jmeter.util.Calculator

    public String getLabelResource() {
        return "summary_report"//$NON-NLS-1$
    }

    public void add(SampleResult res) {
        Calculator row = null;
        final String sampleLabel = res.getSampleLabel(useGroupName.isSelected());
        synchronized (tableRows) {
            row = (Calculator) tableRows.get(sampleLabel);
            if (row == null) {
                row = new Calculator(sampleLabel);
                tableRows.put(row.getLabel(), row);
                model.insertRow(row, model.getRowCount() - 1);
            }
        }
        /*
         * Synch is needed because multiple threads can update the counts.
         */
        synchronized(row) {
            row.addSample(res);
        }
        Calculator tot = ((Calculator) tableRows.get(TOTAL_ROW_LABEL));
        synchronized(tot) {
            tot.addSample(res);
        }
        model.fireTableDataChanged();
    }
View Full Code Here

Examples of org.apache.openejb.itest.failover.ejb.Calculator

            final Properties environment = new Properties();
            environment.put(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName());
            environment.put(Context.PROVIDER_URL, "ejbd://localhost:" + blue.getServerService("ejbd").getPort());

            final InitialContext context = new InitialContext(environment);
            final Calculator bean = (Calculator) context.lookup("CalculatorBeanRemote");

            // Invoke BLUE a few times
            invoke(bean, 10, "blue");

            // Kill BLUE
            blue.kill();

            // Invocations should now fail (and not failover)
            try {
                bean.name();
                Assert.fail("Server should be down and failover not hooked up");
            } catch (final Exception e) {
                // pass
            }
        }

        // Now we start RED
        red.start(1, TimeUnit.MINUTES);

        // Wait for the reconnectDelay so GREEN can find RED
        Thread.sleep((long) (reconnectDelay.getTime(TimeUnit.MILLISECONDS) * 1.5));

        // Verify Failover is now functional

        {
            // RED was never started so GREEN never found any peers

            // Lets invoke GREEN then shut it down and verify we have
            // no other peers to invoke
            final StandaloneServer green = servers.get("green");
            final Properties environment = new Properties();
            environment.put(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName());
            environment.put(Context.PROVIDER_URL, "ejbd://localhost:" + green.getServerService("ejbd").getPort());

            final InitialContext context = new InitialContext(environment);
            final Calculator bean = (Calculator) context.lookup("CalculatorBeanRemote");


            // Invoke GREEN a few times
            invoke(bean, 10, "green");

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.