Search in sources :

Example 26 with Hash

use of com.iota.iri.model.Hash in project iri by iotaledger.

the class MilestoneViewModelTest method previous.

@Test
public void previous() throws Exception {
    int first = 1;
    int next = 2;
    MilestoneViewModel nextMilestone = new MilestoneViewModel(next, new Hash("99CDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUV99999"));
    nextMilestone.store(tangle);
    new MilestoneViewModel(first, new Hash("9ACDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUV99999")).store(tangle);
    assertTrue(first == nextMilestone.previous(tangle).index());
}
Also used : Hash(com.iota.iri.model.Hash) RocksDBPersistenceProviderTest(com.iota.iri.storage.rocksDB.RocksDBPersistenceProviderTest)

Example 27 with Hash

use of com.iota.iri.model.Hash in project iri by iotaledger.

the class MilestoneViewModelTest method nextWithSnapshot.

@Test
public void nextWithSnapshot() throws Exception {
    int firstSnapshot = 8;
    int next = 9;
    MilestoneViewModel milestoneViewModelmid = new MilestoneViewModel(next, new Hash("GBCDEBGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUV99999"));
    milestoneViewModelmid.store(tangle);
    MilestoneViewModel milestoneViewModel = new MilestoneViewModel(firstSnapshot, new Hash("GBCDEFGHIJKLMNODQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUV99999"));
    milestoneViewModel.store(tangle);
// assertTrue(next == milestoneViewModel.nextWithSnapshot().index());
}
Also used : Hash(com.iota.iri.model.Hash) RocksDBPersistenceProviderTest(com.iota.iri.storage.rocksDB.RocksDBPersistenceProviderTest)

Example 28 with Hash

use of com.iota.iri.model.Hash in project iri by iotaledger.

the class MilestoneViewModelTest method getHash.

@Test
public void getHash() throws Exception {
    Hash milestoneHash = new Hash("DBCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUV99999");
    MilestoneViewModel milestoneViewModel = new MilestoneViewModel(++index, milestoneHash);
    assertEquals(milestoneHash, milestoneViewModel.getHash());
}
Also used : Hash(com.iota.iri.model.Hash) RocksDBPersistenceProviderTest(com.iota.iri.storage.rocksDB.RocksDBPersistenceProviderTest)

Example 29 with Hash

use of com.iota.iri.model.Hash in project iri by iotaledger.

the class MilestoneViewModelTest method updateSnapshot.

@Test
public void updateSnapshot() throws Exception {
    Hash milestoneHash = new Hash("CBCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUV99999");
    MilestoneViewModel milestoneViewModel = new MilestoneViewModel(++index, milestoneHash);
    assertTrue(milestoneViewModel.store(tangle));
    MilestoneViewModel.clear();
    assertEquals(MilestoneViewModel.get(tangle, index).getHash(), milestoneHash);
}
Also used : Hash(com.iota.iri.model.Hash) RocksDBPersistenceProviderTest(com.iota.iri.storage.rocksDB.RocksDBPersistenceProviderTest)

Example 30 with Hash

use of com.iota.iri.model.Hash in project iri by iotaledger.

the class MilestoneViewModelTest method index.

@Test
public void index() throws Exception {
    Hash milestoneHash = new Hash("EBCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUVWXYZ9ABCDEFGHIJKLMNOPQRSTUV99999");
    MilestoneViewModel milestoneViewModel = new MilestoneViewModel(++index, milestoneHash);
    assertTrue(index == milestoneViewModel.index());
}
Also used : Hash(com.iota.iri.model.Hash) RocksDBPersistenceProviderTest(com.iota.iri.storage.rocksDB.RocksDBPersistenceProviderTest)

Aggregations

Hash (com.iota.iri.model.Hash)75 Test (org.junit.Test)16 TransactionViewModel (com.iota.iri.controllers.TransactionViewModel)12 RocksDBPersistenceProviderTest (com.iota.iri.storage.rocksDB.RocksDBPersistenceProviderTest)12 HttpString (io.undertow.util.HttpString)8 TransactionViewModelTest.getRandomTransactionHash (com.iota.iri.controllers.TransactionViewModelTest.getRandomTransactionHash)6 HashMap (java.util.HashMap)6 HashSet (java.util.HashSet)4 Map (java.util.Map)4 Curl (com.iota.iri.hash.Curl)3 PearlDiver (com.iota.iri.hash.PearlDiver)3 TransactionRequester (com.iota.iri.network.TransactionRequester)3 Converter (com.iota.iri.utils.Converter)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 Gson (com.google.gson.Gson)2 GsonBuilder (com.google.gson.GsonBuilder)2 com.iota.iri (com.iota.iri)2 Configuration (com.iota.iri.conf.Configuration)2 DefaultConfSettings (com.iota.iri.conf.Configuration.DefaultConfSettings)2