use of net.sergeych.tools.Binder in project universa by UniversaBlockchain.
the class PermissionsTest method validPermissionIds.
@Test
public void validPermissionIds() throws Exception {
Contract c = Contract.fromDslFile(ROOT_CONTRACT);
c.addSignerKeyFromFile(PRIVATE_KEY_PATH);
byte[] sealed = c.seal();
assertTrue(c.check());
Binder s = DefaultBiMapper.serialize(c);
s.getBinderOrThrow("definition", "permissions");
}
use of net.sergeych.tools.Binder in project universa by UniversaBlockchain.
the class PermissionsTest method shouldModifyDescNullStateDataValues.
@Test
public void shouldModifyDescNullStateDataValues() throws Exception {
PrivateKey ownerKey2 = TestKeys.privateKey(1);
Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
Binder d = c.getStateData();
Contract c1 = c.createRevision(ownerKey2);
Binder d1 = c1.getStateData();
final String oldValue = "An example of smart contract.";
final String newValue = null;
final String field = "description";
setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
sealCheckTrace(c1, true);
}
use of net.sergeych.tools.Binder in project universa by UniversaBlockchain.
the class PermissionsTest method shouldNotModifySeveralStateDataValues.
@Test
public void shouldNotModifySeveralStateDataValues() throws Exception {
PrivateKey ownerKey2 = TestKeys.privateKey(1);
Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
Binder d = c.getStateData();
Contract c1 = c.createRevision(ownerKey2);
Binder d1 = c1.getStateData();
String oldValue = "An example of smart contract.";
String newValue = "UniversaSmartContract";
String field = "description";
setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
oldValue = "blockchain-partnership.";
newValue = "blockchain-universa.";
field = "partner_name";
setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
d1.addToInt("transactional_units_left", -50);
d1.addToInt("direction", 5);
d1.addToInt("option", -1);
sealCheckTrace(c1, false);
}
use of net.sergeych.tools.Binder in project universa by UniversaBlockchain.
the class PermissionsTest method shouldNotModifyStateDataValues.
@Test
public void shouldNotModifyStateDataValues() throws Exception {
PrivateKey ownerKey2 = TestKeys.privateKey(1);
Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
Binder d = c.getStateData();
Contract c1 = c.createRevision(ownerKey2);
Binder d1 = c1.getStateData();
final String oldValue = "1";
final String newValue = "2";
final String field = "option";
setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
sealCheckTrace(c1, false);
}
use of net.sergeych.tools.Binder in project universa by UniversaBlockchain.
the class PermissionsTest method shouldPopulateWithEmptyStateDataValues.
@Test
public void shouldPopulateWithEmptyStateDataValues() throws Exception {
PrivateKey ownerKey2 = TestKeys.privateKey(1);
Contract c = basicContractCreation(SUBSCRIPTION_WITH_DATA, PRIVATE_KEY, ownerKey2);
Binder d = c.getStateData();
Contract c1 = c.createRevision(ownerKey2);
Binder d1 = c1.getStateData();
final String oldValue = "An example of smart contract.";
final String newValue = "";
final String field = "description";
setAndCheckOldNewValues(d, d1, oldValue, newValue, field);
sealCheckTrace(c1, true);
}
Aggregations