use of com.yahoo.rdl.Struct in project athenz by yahoo.
the class PolicyUpdaterConfiguration method readZpuConfiguration.
private Struct readZpuConfiguration(String pathToFile) {
LOG.info("Reading configuration file: {}", pathToFile);
Struct conf = null;
try {
Path path = Paths.get(pathToFile);
conf = JSON.fromBytes(Files.readAllBytes(path), Struct.class);
} catch (Exception e) {
}
return conf;
}
use of com.yahoo.rdl.Struct in project athenz by yahoo.
the class InstanceAWSECSProviderTest method testGetInstanceId.
@Test
public void testGetInstanceId() {
InstanceAWSECSProvider provider = new InstanceAWSECSProvider();
provider.initialize("provider", "com.yahoo.athenz.instance.provider.impl.InstanceAWSECSProvider", null, null);
AWSAttestationData data = new AWSAttestationData();
data.setTaskid("task1234");
assertEquals(provider.getInstanceId(data, null, "id-1234"), "task1234");
data.setTaskid(null);
Struct doc = new Struct();
doc.put(InstanceAWSProvider.ATTR_INSTANCE_ID, "data1234");
assertEquals(provider.getInstanceId(data, doc, "data1234"), "data1234");
data.setTaskid("");
assertEquals(provider.getInstanceId(data, doc, "id-1234"), "id-1234");
data.setTaskid("task1234");
assertEquals(provider.getInstanceId(data, doc, "id-1234"), "task1234");
}
use of com.yahoo.rdl.Struct in project athenz by yahoo.
the class ZMSFileChangeLogStoreCommon method setLastModificationTimestamp.
public void setLastModificationTimestamp(String newLastModTime) {
lastModTime = newLastModTime;
if (lastModTime == null) {
delete(LAST_MOD_FNAME);
} else {
// update the last modification timestamp
Struct lastModStruct = new Struct();
lastModStruct.put(ATTR_LAST_MOD_TIME, lastModTime);
put(LAST_MOD_FNAME, jsonValueAsBytes(lastModStruct, Struct.class));
}
}
use of com.yahoo.rdl.Struct in project athenz by yahoo.
the class DBServiceTest method createEntityObject.
private Entity createEntityObject(String domainName, String entityName) {
Entity entity = new Entity();
entity.setName(ResourceUtils.entityResourceName(domainName, entityName));
Struct value = new Struct();
value.put("Key1", "Value1");
entity.setValue(value);
return entity;
}
use of com.yahoo.rdl.Struct in project athenz by yahoo.
the class DBServiceTest method testExecutePutEntity.
@Test
public void testExecutePutEntity() {
String domainName = "createentitydom1";
String entityName = "entity1";
TopLevelDomain dom1 = createTopLevelDomainObject(domainName, "Test Domain1", "testOrg", adminUser);
zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom1);
Entity entity1 = createEntityObject(domainName, entityName);
zms.dbService.executePutEntity(mockDomRsrcCtx, domainName, entityName, entity1, auditRef, "putEntity");
Entity entity2 = zms.getEntity(mockDomRsrcCtx, domainName, entityName);
assertNotNull(entity2);
assertEquals(entity2.getName(), ResourceUtils.entityResourceName(domainName, entityName));
Struct value = entity2.getValue();
assertEquals("Value1", value.getString("Key1"));
zms.deleteTopLevelDomain(mockDomRsrcCtx, domainName, auditRef);
}
Aggregations