use of es.bsc.compss.types.resources.jaxb.AdaptorType in project compss by bsc-wdc.
the class ResourcesFileTest method staticProcessorAdaptorComputeNodeCreationAndRead.
@Test
public void staticProcessorAdaptorComputeNodeCreationAndRead() throws SAXException, JAXBException, ResourcesFileValidationException {
int cu = 5;
float speed = 2.6f;
String nodeName = "blablahost";
String procName = "Proc1";
String arch = "amd64";
String key = "procKey";
String value = "procValue";
String adaptorName = "nio";
boolean batch = false;
boolean interactive = true;
String gatprop = "gat_prop";
String user = "user";
ProcessorPropertyType pp = ResourcesFile.createProcessorProperty(key, value);
ProcessorType proc = ResourcesFile.createProcessor(procName, cu, arch, speed, "CPU", 0.0f, pp);
AdaptorType ad = ResourcesFile.createAdaptor(adaptorName, batch, null, interactive, gatprop, user);
String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
// Instantiate ResourcesFile
ResourcesFile resources = new ResourcesFile(xsd_path, LOGGER);
List<ProcessorType> processors = new LinkedList<ProcessorType>();
processors.add(proc);
List<AdaptorType> adaptors = new LinkedList<AdaptorType>();
adaptors.add(ad);
resources.addComputeNode(nodeName, processors, adaptors);
ComputeNodeType cn = resources.getComputeNode(nodeName);
ProcessorType procExtracted = resources.getProcessors(cn).get(0);
assertEquals(procName, procExtracted.getName());
assertEquals(cu, resources.getProcessorComputingUnits(procExtracted));
assertEquals(arch, resources.getProcessorArchitecture(procExtracted));
assertEquals(speed, resources.getProcessorSpeed(procExtracted), 0);
assertEquals("CPU", resources.getProcessorType(procExtracted));
assertEquals(-1.0f, resources.getProcessorMemorySize(procExtracted), 0);
assertEquals(key, resources.getProcessorProperty(procExtracted).getKey());
assertEquals(value, resources.getProcessorProperty(procExtracted).getValue());
}
Aggregations