Select to view content in your preferred language

JMap JUnit Testing

1259
4
Jump to solution
10-04-2012 12:12 PM
CarlosColón-Maldonado
Frequent Contributor
Greetings,

I'd like to know if there is sample code available that would facilitate basic automated testing on a JMap, particularly zooming, extent and center setting, panning, and containing map overlay events. I've tried a couple of Swing JUnit testing approaches discussed online, even on basic mockup containers, but none of them seem to stabilize it so that I could get expected results at every run (execute tests better in debug, specially with stops). I am shying away from external frameworks that either extend JUnit or implement their own in order to minimize application/development dependencies, but I'm not ruling it out.

Thanks in advanced,

Carlos
0 Kudos
1 Solution

Accepted Solutions
CarlosColón-Maldonado
Frequent Contributor
I'd like to report that the functionality demonstrated in the MapExtentApp code, shown below, from the 10.1.1 sample apps helped in creating junit tests we needed on the JMap.


    map.addMapEventListener(new MapEventListenerAdapter() {         @Override         public void mapExtentChanged(MapEvent arg0) {             if (map.isReady()) {                 StringBuilder str = new StringBuilder();                 str.append("MinX: " + map.getExtent().getXMin() + "\n");                 str.append("MinY: " + map.getExtent().getYMin() + "\n");                 str.append("MaxX: " + map.getExtent().getXMax() + "\n");                 str.append("MaxY: " + map.getExtent().getYMax() + "\n");                 txtStatus.setText(str.toString());             }        }     });  

View solution in original post

0 Kudos
4 Replies
CarlosColón-Maldonado
Frequent Contributor
I'd like to post that we are continuing to observe intermittent automated test failures when testing classes that contain a JMap because it is simply not ready for use, hence expected extensions and center points of extensions are not correct. The correct extensions are needed in order to determine panning spans, point centering determinations, proper type of loaded base and operational maps, etc. We've also tried callback methods from concurrent threads to await for that state and operations hang indefinitely.

Any hint or tip would be greatly appreciated.
0 Kudos
EricBader
Honored Contributor
Hi,
Can you explain what you mean by "extensions"?
0 Kudos
CarlosColón-Maldonado
Frequent Contributor
Hi,
Can you explain what you mean by "extensions"?


The values/properties of the "Envelope" obtained from the "getExtent" method of the JMap, where you obtain "com.esri.core.geometry.Point" representations of its corners, with which you may further determine panning actions and verify new map center locations.

We want to be able to pan the map to expected points or "Envelope" values on panning actions, regardless of scale and zoom.

Thanks for responding.
0 Kudos
CarlosColón-Maldonado
Frequent Contributor
I'd like to report that the functionality demonstrated in the MapExtentApp code, shown below, from the 10.1.1 sample apps helped in creating junit tests we needed on the JMap.


    map.addMapEventListener(new MapEventListenerAdapter() {         @Override         public void mapExtentChanged(MapEvent arg0) {             if (map.isReady()) {                 StringBuilder str = new StringBuilder();                 str.append("MinX: " + map.getExtent().getXMin() + "\n");                 str.append("MinY: " + map.getExtent().getYMin() + "\n");                 str.append("MaxX: " + map.getExtent().getXMax() + "\n");                 str.append("MaxY: " + map.getExtent().getYMax() + "\n");                 txtStatus.setText(str.toString());             }        }     });  
0 Kudos