Search in sources :

Example 1 with AdaptorType

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());
}
Also used : AdaptorType(es.bsc.compss.types.resources.jaxb.AdaptorType) ComputeNodeType(es.bsc.compss.types.resources.jaxb.ComputeNodeType) ProcessorType(es.bsc.compss.types.resources.jaxb.ProcessorType) ResourcesFile(es.bsc.compss.types.resources.ResourcesFile) ProcessorPropertyType(es.bsc.compss.types.resources.jaxb.ProcessorPropertyType) LinkedList(java.util.LinkedList) File(java.io.File) ResourcesFile(es.bsc.compss.types.resources.ResourcesFile) Test(org.junit.Test)

Aggregations

ResourcesFile (es.bsc.compss.types.resources.ResourcesFile)1 AdaptorType (es.bsc.compss.types.resources.jaxb.AdaptorType)1 ComputeNodeType (es.bsc.compss.types.resources.jaxb.ComputeNodeType)1 ProcessorPropertyType (es.bsc.compss.types.resources.jaxb.ProcessorPropertyType)1 ProcessorType (es.bsc.compss.types.resources.jaxb.ProcessorType)1 File (java.io.File)1 LinkedList (java.util.LinkedList)1 Test (org.junit.Test)1