Changeset 2600 in josm for trunk/test/functional


Ignore:
Timestamp:
2009-12-09T21:26:36+01:00 (10 years ago)
Author:
Gubaer
Message:

Updates of test cases
New: JOSM Fixture - can be used in unit and functional tests

Location:
trunk/test/functional/org/openstreetmap/josm
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r2569 r2600  
    3232import org.openstreetmap.josm.data.osm.Way;
    3333import org.openstreetmap.josm.data.projection.Mercator;
     34import org.openstreetmap.josm.gui.io.UploadStrategy;
    3435import org.openstreetmap.josm.gui.io.UploadStrategySpecification;
    3536import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     
    125126        OsmServerWriter writer = new OsmServerWriter();
    126127        Changeset cs = new Changeset();
    127         writer.uploadOsm(UploadStrategySpecification.createSingleRequestUploadStrategy(), primitives,cs,NullProgressMonitor.INSTANCE);
     128        writer.uploadOsm(new UploadStrategySpecification().setStrategy(UploadStrategy.SINGLE_REQUEST_STRATEGY), primitives,cs,NullProgressMonitor.INSTANCE);
    128129        OsmApi.getOsmApi().closeChangeset(cs, NullProgressMonitor.INSTANCE);
    129130    }
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r2578 r2600  
    3333import org.openstreetmap.josm.data.osm.Way;
    3434import org.openstreetmap.josm.data.projection.Mercator;
     35import org.openstreetmap.josm.gui.io.UploadStrategy;
    3536import org.openstreetmap.josm.gui.io.UploadStrategySpecification;
    3637import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     
    129130        OsmServerWriter writer = new OsmServerWriter();
    130131        Changeset cs  = new Changeset();
    131         writer.uploadOsm(UploadStrategySpecification.createSingleRequestUploadStrategy(), primitives, cs, NullProgressMonitor.INSTANCE);
     132        writer.uploadOsm(new UploadStrategySpecification().setStrategy(UploadStrategy.SINGLE_REQUEST_STRATEGY), primitives, cs, NullProgressMonitor.INSTANCE);
    132133        OsmApi.getOsmApi().closeChangeset(cs, NullProgressMonitor.INSTANCE);
    133134    }
  • trunk/test/functional/org/openstreetmap/josm/io/UploadStrategySelectionPanelTest.java

    r2569 r2600  
    33
    44import java.awt.BorderLayout;
     5import java.awt.FlowLayout;
     6import java.awt.event.ActionEvent;
     7import java.awt.event.ActionListener;
    58
    69import javax.swing.JFrame;
     10import javax.swing.JLabel;
     11import javax.swing.JPanel;
     12import javax.swing.JTextField;
    713
     14import org.openstreetmap.josm.fixtures.JOSMFixture;
    815import org.openstreetmap.josm.gui.io.UploadStrategySelectionPanel;
     16import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    917
    1018public class UploadStrategySelectionPanelTest extends JFrame {
    1119
    12     private UploadStrategySelectionPanel pnl;
     20    private UploadStrategySelectionPanel uploadStrategySelectionPanel;
    1321
    1422    protected void build()  {
    1523        getContentPane().setLayout(new BorderLayout());
    16         pnl = new UploadStrategySelectionPanel();
    17         getContentPane().add(pnl, BorderLayout.CENTER);
     24        uploadStrategySelectionPanel = new UploadStrategySelectionPanel();
     25        getContentPane().add(uploadStrategySelectionPanel, BorderLayout.CENTER);
     26        getContentPane().add(buildControlPanel(), BorderLayout.SOUTH);
    1827        setSize(400,400);
    1928    }
    2029
     30
     31    protected JPanel buildControlPanel() {
     32        JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT));
     33        pnl.add(new JLabel("Num objects:"));
     34        final JTextField tf;
     35        pnl.add(tf = new JTextField(8));
     36        tf.addActionListener(
     37                new ActionListener() {
     38                    public void actionPerformed(ActionEvent arg0) {
     39                        int n = 0;
     40                        try {
     41                            n = Integer.parseInt(tf.getText());
     42                        } catch(NumberFormatException e) {
     43                            e.printStackTrace();
     44                            return;
     45                        }
     46                        uploadStrategySelectionPanel.setNumUploadedObjects(n);
     47                    }
     48                }
     49        );
     50        return pnl;
     51    }
    2152    public UploadStrategySelectionPanelTest() {
    2253        build();
    23         pnl.setNumUploadedObjects(1500);
     54        uploadStrategySelectionPanel.setNumUploadedObjects(51000);
    2455    }
    2556
    26     public static void main(String args[]) {
     57    public static void main(String args[]) throws OsmApiInitializationException {
     58        JOSMFixture josmFixture = JOSMFixture.createFunctionalTestFixture();
     59        OsmApi.getOsmApi().initialize(NullProgressMonitor.INSTANCE);
    2760        new UploadStrategySelectionPanelTest().setVisible(true);
    2861    }
Note: See TracChangeset for help on using the changeset viewer.