Merge pull request #46 from nicksavers/master
Destroy temp-db after unit test & .gitignore dmp-files
This commit is contained in:
commit
f1c1c5a5a6
|
@ -18,10 +18,13 @@
|
|||
*.ear
|
||||
/target
|
||||
/src/main/java/samples
|
||||
|
||||
# Output #
|
||||
/blockchain
|
||||
/state
|
||||
/details
|
||||
/logs
|
||||
/dmp
|
||||
|
||||
*.db
|
||||
*.xlsx
|
||||
|
|
|
@ -22,8 +22,7 @@ economy for memory allocation
|
|||
share - code section
|
||||
|
||||
- [ ] **LLL_to_ASM compiler** list style language to EVM assembly compiler:
|
||||
|
||||
-
|
||||
- [ ] **Use home-directory** Create .ethereumj in home-directory for blockchain, state & details database. Make configurable in system.properties so developer can choose user.dir without the creation of .ethereumj directory.
|
||||
|
||||
##### UnitTest:
|
||||
----------------
|
||||
|
|
|
@ -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,14 +39,14 @@ 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);
|
||||
} else{
|
||||
} else {
|
||||
fileName = "system.properties";
|
||||
input = SystemProperties.class.getClassLoader().getResourceAsStream(fileName);
|
||||
if (input == null) {
|
||||
|
@ -101,9 +102,9 @@ public class SystemProperties {
|
|||
if(prop.isEmpty()) return DEFAULT_DISCOVERY_PORT;
|
||||
return Integer.parseInt(prop.getProperty("peer.discovery.port"));
|
||||
}
|
||||
|
||||
|
||||
public boolean databaseReset() {
|
||||
if(prop.isEmpty()) return false;
|
||||
if(prop.isEmpty()) return DEFAULT_DB_RESET;
|
||||
return Boolean.parseBoolean(prop.getProperty("database.reset"));
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ public class DatabaseImpl implements Database {
|
|||
|
||||
private static Logger logger = LoggerFactory.getLogger(DatabaseImpl.class);
|
||||
private DB db;
|
||||
private String name;
|
||||
|
||||
private String name;
|
||||
|
||||
public DatabaseImpl(String name) {
|
||||
// Initialize Database
|
||||
this.name = name;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -11,7 +20,7 @@ import org.spongycastle.util.encoders.Hex;
|
|||
* Created on: 11/06/2014 14:54
|
||||
*/
|
||||
public class TrackDatabaseTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void test1() {
|
||||
|
||||
|
@ -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