WorldAdm generates
This commit is contained in:
parent
e516770fca
commit
f2bfaee5d7
@ -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=true
|
||||||
annotation.processing.enabled.in.editor=false
|
annotation.processing.enabled.in.editor=false
|
||||||
annotation.processing.processors.list=
|
annotation.processing.processors.list=
|
||||||
|
@ -25,8 +25,12 @@
|
|||||||
*/
|
*/
|
||||||
package opensesim.world;
|
package opensesim.world;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
import opensesim.world.Exchange;
|
import opensesim.world.Exchange;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import static jdk.vm.ci.code.CodeUtil.K;
|
||||||
import opensesim.sesim.interfaces.Asset;
|
import opensesim.sesim.interfaces.Asset;
|
||||||
import opensesim.sesim.interfaces.Trader;
|
import opensesim.sesim.interfaces.Trader;
|
||||||
|
|
||||||
@ -38,9 +42,26 @@ public class Account {
|
|||||||
ConcurrentHashMap <Asset,Double> assets;
|
ConcurrentHashMap <Asset,Double> assets;
|
||||||
|
|
||||||
Trader owner;
|
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){
|
Account(Exchange exchange){
|
||||||
assets = new ConcurrentHashMap<>();
|
assets = new ConcurrentHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Account(long masterKey){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,10 @@ public class World implements GetJson {
|
|||||||
putJson(cfg);
|
putJson(cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkMasterKey(long masterkey){
|
||||||
|
return masterkey == this.masterkey;
|
||||||
|
}
|
||||||
|
|
||||||
private AbstractAsset createAsset_p(JSONObject cfg) throws SeSimException {
|
private AbstractAsset createAsset_p(JSONObject cfg) throws SeSimException {
|
||||||
AbstractAsset a;
|
AbstractAsset a;
|
||||||
String class_name;
|
String class_name;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package opensesim.world;
|
package opensesim.world;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,7 +36,7 @@ public class WorldAdm {
|
|||||||
public World world;
|
public World world;
|
||||||
public long masterKey;
|
public long masterKey;
|
||||||
public WorldAdm(JSONObject cfg){
|
public WorldAdm(JSONObject cfg){
|
||||||
masterKey = 123456;
|
masterKey = new Random().nextLong();
|
||||||
world = new World(cfg,masterKey);
|
world = new World(cfg,masterKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user