Skip to content
Permalink
Browse files

temp folders in tests

single directory create, no subdirectory
  • Loading branch information...
icklesteve committed Jul 28, 2019
1 parent 8807e05 commit 593b9e20607e0f37d65877af55dd849e8aee06ab
@@ -933,7 +933,7 @@ public void removeRow(int row, boolean removeXml) {
}

/**
* Search the directory for nodes, ie userPref/cbus/nodes/123.xml
* Search the directory for nodes, ie userPref/cbus/123.xml
* Add any found to the Node Manager Table
* (Modeled after a method in jmri.jmrit.dispatcher.TrainInfoFile )
*/
@@ -962,13 +962,8 @@ public void startupSearchNodeXmlFile() {
});
}

// operational variables
private String fileLocation = FileUtil.getUserFilesPath()
+ "cbus" + File.separator + "nodes" + File.separator;

public void setFileLocation(String testLocation) {
fileLocation = testLocation;
}
private String fileLocation = FileUtil.getProfilePath()
+ "cbus" + File.separator;

/**
* Disconnect from the network
@@ -362,7 +362,7 @@ protected boolean removeNode( boolean rotate){
public static class CbusNodeBackupFile extends XmlFile {

private String fileLocation = FileUtil.getProfilePath()
+ "cbus" + File.separator + "nodes" + File.separator; // NOI18N
+ "cbus" + File.separator; // NOI18N

public String getDefaultFileName(int nodeNum) {
return getFileLocation() + getFileName(nodeNum);
@@ -373,7 +373,7 @@ public File getFile(int nodeNum, boolean store) {
File chkdir = new File(getFileLocation());
if (!chkdir.exists()) {
if (!chkdir.mkdir()) {
log.error("Create directory: cbus/node/ failed for node {} directory {}",
log.error("Create directory: cbus/ failed for node {} directory {}",
nodeNum,getFileLocation());
return null;
}
@@ -11,7 +11,9 @@
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

/**
*
@@ -378,14 +380,16 @@ public void testNextUrgentFetch() {
t = null;

}


@Rule
public TemporaryFolder folder = new TemporaryFolder();

// The minimal setup for log4J
@Before
public void setUp() {
public void setUp() throws java.io.IOException {
JUnitUtil.setUp();
JUnitUtil.resetInstanceManager();
JUnitUtil.resetProfileManager();
JUnitUtil.resetProfileManager(new jmri.profile.NullProfile(folder.newFolder(jmri.profile.Profile.PROFILE)));
memo = new CanSystemConnectionMemo();
tcis = new TrafficControllerScaffold();
memo.setTrafficController(tcis);
@@ -10,7 +10,9 @@
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

/**
*
@@ -717,12 +719,15 @@ public void testgetNodeTypeString() {

}

@Rule
public TemporaryFolder folder = new TemporaryFolder();

// The minimal setup for log4J
@Before
public void setUp() {
public void setUp() throws java.io.IOException {
JUnitUtil.setUp();
JUnitUtil.resetInstanceManager();
JUnitUtil.resetProfileManager();
JUnitUtil.resetProfileManager(new jmri.profile.NullProfile(folder.newFolder(jmri.profile.Profile.PROFILE)));

memo = new CanSystemConnectionMemo();
tcis = new TrafficControllerScaffold();
@@ -4,15 +4,17 @@
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

/**
*
* @author Paul Bender Copyright (C) 2017
* @author Steve Young Copyright (C) 2019
*/
public class CbusNodeXmlTest {

@Test
public void testCTor() {

@@ -22,12 +24,15 @@ public void testCTor() {
Assert.assertNotNull("exists",t);

}

@Rule
public TemporaryFolder folder = new TemporaryFolder();

// The minimal setup for log4J
@Before
public void setUp() {
public void setUp() throws java.io.IOException {
JUnitUtil.setUp();
JUnitUtil.resetProfileManager();
JUnitUtil.resetProfileManager(new jmri.profile.NullProfile(folder.newFolder(jmri.profile.Profile.PROFILE)));
}

@After

0 comments on commit 593b9e2

Please sign in to comment.
You can’t perform that action at this time.