Delete temp database after unit test
This commit is contained in:
parent
48d8ca9de2
commit
c82a929d30
|
@ -27,6 +27,7 @@ public class SystemProperties {
|
|||
private static String DEFAULT_SAMPLES_DIR = "samples";
|
||||
private static String DEFAULT_COINBASE_SECRET = "monkey";
|
||||
private static int DEFAULT_ACTIVE_PEER_CHANNEL_TIMEOUT = 5;
|
||||
private static Boolean DEFAULT_DB_RESET = false;
|
||||
private static Boolean DEFAULT_DUMP_FULL = false;
|
||||
private static String DEFAULT_DUMP_DIR = "dmp";
|
||||
private static Boolean DEFAULT_DUMP_CLEAN_ON_RESTART = true;
|
||||
|
@ -38,10 +39,10 @@ public class SystemProperties {
|
|||
public SystemProperties() {
|
||||
|
||||
try {
|
||||
File file = null;
|
||||
String dir = System.getProperty("user.dir");
|
||||
String fileName = dir + "/config/system.properties";
|
||||
file = new File(fileName);
|
||||
String userDir = System.getProperty("user.dir");
|
||||
System.out.println(userDir);
|
||||
String fileName = userDir + "/config/system.properties";
|
||||
File file = new File(fileName);
|
||||
|
||||
if (file.exists()) {
|
||||
input = new FileInputStream(file);
|
||||
|
@ -103,7 +104,7 @@ public class SystemProperties {
|
|||
}
|
||||
|
||||
public boolean databaseReset() {
|
||||
if(prop.isEmpty()) return false;
|
||||
if(prop.isEmpty()) return DEFAULT_DB_RESET;
|
||||
return Boolean.parseBoolean(prop.getProperty("database.reset"));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import javax.swing.table.DefaultTableModel;
|
|||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
|
@ -156,6 +155,7 @@ class ContractCallDialog extends JDialog implements MessageAwareDialog {
|
|||
gasInput.setText("1000");
|
||||
|
||||
JComboBox<AccountWrapper> creatorAddressCombo = new JComboBox<AccountWrapper>() {
|
||||
private static final long serialVersionUID = -3748305421049121671L;
|
||||
@Override
|
||||
public ComboBoxUI getUI() {
|
||||
return super.getUI();
|
||||
|
|
|
@ -23,11 +23,11 @@ peer.discovery.port = 30303
|
|||
#peer.active.ip = 131.104.247.135
|
||||
#peer.active.port = 30303
|
||||
|
||||
# RomanJ general
|
||||
# RomanJ
|
||||
#peer.active.ip = 54.211.14.10
|
||||
#peer.active.port = 30303
|
||||
|
||||
#poc5.testnet.ethereum.org
|
||||
# PoC-5 testnet
|
||||
peer.active.ip = 54.72.69.180
|
||||
peer.active.port = 30303
|
||||
|
||||
|
@ -75,7 +75,7 @@ samples.dir = samples
|
|||
# the existing database will be
|
||||
# destroyed and all the data will be
|
||||
# downloaded from peers again
|
||||
database.reset = true
|
||||
database.reset = false
|
||||
|
||||
# this string is computed
|
||||
# to be eventually the address
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
package org.ethereum.db;
|
||||
|
||||
import org.junit.Assert;
|
||||
import static org.iq80.leveldb.impl.Iq80DBFactory.factory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.iq80.leveldb.Options;
|
||||
import org.junit.AfterClass;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
|
||||
|
@ -20,23 +29,33 @@ public class TrackDatabaseTest {
|
|||
|
||||
trackDatabase1.put(Hex.decode("abcdef"), Hex.decode("abcdef"));
|
||||
byte[] value = trackDatabase1.get(Hex.decode("abcdef"));
|
||||
Assert.assertEquals("abcdef", Hex.toHexString(value));
|
||||
assertEquals("abcdef", Hex.toHexString(value));
|
||||
|
||||
trackDatabase1.startTrack();
|
||||
trackDatabase1.put(Hex.decode("abcdef"), Hex.decode("ffffff"));
|
||||
value = trackDatabase1.get(Hex.decode("abcdef"));
|
||||
Assert.assertEquals("ffffff", Hex.toHexString(value));
|
||||
assertEquals("ffffff", Hex.toHexString(value));
|
||||
|
||||
trackDatabase1.rollbackTrack();
|
||||
value = trackDatabase1.get(Hex.decode("abcdef"));
|
||||
Assert.assertEquals("abcdef", Hex.toHexString(value));
|
||||
assertEquals("abcdef", Hex.toHexString(value));
|
||||
|
||||
trackDatabase1.startTrack();
|
||||
trackDatabase1.put(Hex.decode("abcdef"), Hex.decode("ffffff"));
|
||||
trackDatabase1.commitTrack();
|
||||
value = trackDatabase1.get(Hex.decode("abcdef"));
|
||||
Assert.assertEquals("ffffff", Hex.toHexString(value));
|
||||
assertEquals("ffffff", Hex.toHexString(value));
|
||||
|
||||
db1.close();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void destroyDB() {
|
||||
try {
|
||||
Options options = new Options();
|
||||
factory.destroy(new File("temp"), options);
|
||||
} catch (IOException e) {
|
||||
fail("Destroying temp-db failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,26 +19,14 @@ peer.discovery.port = 30303
|
|||
#peer.active.ip = 54.204.10.41
|
||||
#peer.active.port = 30303
|
||||
|
||||
# Some dude in Canada
|
||||
#peer.active.ip = 131.104.247.135
|
||||
#peer.active.port = 30303
|
||||
|
||||
# Nick
|
||||
#peer.active.ip = 82.217.72.169
|
||||
#peer.active.port = 30303
|
||||
|
||||
|
||||
# RomanJ general
|
||||
# RomanJ
|
||||
peer.active.ip = 54.211.14.10
|
||||
peer.active.port = 50505
|
||||
|
||||
#poc5.testnet.ethereum.org
|
||||
# PoC-5 testnet
|
||||
#peer.active.ip = 54.72.69.180
|
||||
#peer.active.port = 30303
|
||||
|
||||
#peer.active.ip = 151.64.223.120
|
||||
#peer.active.port = 30304
|
||||
|
||||
# specify if the mechanism
|
||||
# to discover more and more
|
||||
# peers and check the already
|
||||
|
@ -82,7 +70,6 @@ samples.dir = samples
|
|||
# downloaded from peers again
|
||||
database.reset = true
|
||||
|
||||
|
||||
# this string is computed
|
||||
# to be eventually the address
|
||||
# that get the miner reward
|
||||
|
|
Loading…
Reference in New Issue