Skip to content

Commit

Permalink
Makes the different ConnectioNConfigXmlTestBase be consistent in how …
Browse files Browse the repository at this point in the history
…they invoke the

code under test. Some of these generate ConcurrentModificationExceptions, while
others have been fixed.
  • Loading branch information
balazsracz committed Dec 17, 2018
1 parent 20e6baa commit b2b4c5f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Expand Up @@ -3,6 +3,8 @@
import org.junit.*;
import org.jdom2.Element;
import jmri.jmrix.ConnectionConfig;
import jmri.util.ThreadingUtil;

import javax.swing.JPanel;

/**
Expand Down Expand Up @@ -39,8 +41,11 @@ public void loadTest() throws jmri.configurexml.JmriConfigureXmlException {
jmri.util.JUnitUtil.resetProfileManager();
// This test requires a configure manager.
jmri.util.JUnitUtil.initConfigureManager();
cc.loadDetails(new JPanel());
cc.setDisabled(true); // so we don't try to start the connection on load.
// Running this on the UI thread fixes some ConcurrentModificationExceptions errors.
ThreadingUtil.runOnGUI(()-> {
cc.loadDetails(new JPanel());
cc.setDisabled(true); // so we don't try to start the connection on load.
});
Element e = xmlAdapter.store(cc);
try {
//load what we just produced.
Expand Down
Expand Up @@ -40,10 +40,12 @@ public void loadTest() throws jmri.configurexml.JmriConfigureXmlException {
// This test requires a configure manager.
jmri.util.JUnitUtil.initConfigureManager();
// Running this on the UI thread fixes some ConcurrentModificationExceptions errors.
ThreadingUtil.runOnGUI(()->{cc.loadDetails(new JPanel());});
ThreadingUtil.runOnGUI(()->{
cc.loadDetails(new JPanel());
cc.setDisabled(true); // so we don't try to start the connection on load.
});
// load details MAY produce an error message if no ports are found.
jmri.util.JUnitAppender.suppressErrorMessage("No usable ports returned");
cc.setDisabled(true); // so we don't try to start the connection on load.
Element e = xmlAdapter.store(cc);
//load what we just produced.
xmlAdapter.load(e,e);
Expand Down

0 comments on commit b2b4c5f

Please sign in to comment.