WorldAdm generates

This commit is contained in:
7u83 2018-12-05 20:07:36 +01:00
parent e516770fca
commit f2bfaee5d7
5 changed files with 47 additions and 2 deletions

View File

@ -1,4 +1,4 @@
#Wed, 05 Dec 2018 19:04:38 +0100
#Wed, 05 Dec 2018 20:01:07 +0100
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=

View File

@ -25,8 +25,12 @@
*/
package opensesim.world;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import opensesim.world.Exchange;
import java.util.concurrent.ConcurrentHashMap;
import static jdk.vm.ci.code.CodeUtil.K;
import opensesim.sesim.interfaces.Asset;
import opensesim.sesim.interfaces.Trader;
@ -38,9 +42,26 @@ public class Account {
ConcurrentHashMap <Asset,Double> assets;
Trader owner;
Exchange exchange;
public Map<Asset,Double> getAssets() {
return Collections.unmodifiableMap(assets);
}
public Trader getOwner() {
return owner;
}
public Exchange getExchange() {
return exchange;
}
Account(Exchange exchange){
assets = new ConcurrentHashMap<>();
}
Account(long masterKey){
}
}

View File

@ -124,6 +124,10 @@ public class World implements GetJson {
this.masterkey=masterkey;
putJson(cfg);
}
public boolean checkMasterKey(long masterkey){
return masterkey == this.masterkey;
}
private AbstractAsset createAsset_p(JSONObject cfg) throws SeSimException {
AbstractAsset a;

View File

@ -25,6 +25,7 @@
*/
package opensesim.world;
import java.util.Random;
import org.json.JSONObject;
/**
@ -35,7 +36,7 @@ public class WorldAdm {
public World world;
public long masterKey;
public WorldAdm(JSONObject cfg){
masterKey = 123456;
masterKey = new Random().nextLong();
world = new World(cfg,masterKey);
}

View File

@ -61,4 +61,23 @@ public class ExchangeTest {
}
/**
* Test of createAccount method, of class Exchange.
*/
@Test
public void testCreateAccount() {
System.out.println("createAccount");
Exchange instance = new Exchange(null,(JSONObject)null);
Account expResult = null;
Account result = instance.createAccount();
assertEquals(expResult, result);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}