use of es.bsc.compss.types.resources.ResourcesFile in project compss by bsc-wdc.
the class ResourcesFileTest method rocciXML.
@Test
public void rocciXML() throws URISyntaxException, JAXBException, SAXException, ResourcesFileValidationException, IOException {
// Get XSD Schema path
String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
// Get default resources file
File rocciResources = new File(ROCCI_XML_PATH);
// Instantiate ResourcesFile
ResourcesFile resources = new ResourcesFile(rocciResources, xsd_path, LOGGER);
// Checkers
assertNotNull(resources);
File xml = new File(XML_TMP_PATH);
resources.toFile(xml);
boolean compareFile = FileUtils.contentEquals(rocciResources, xml);
assertEquals("Dump content not equal", true, compareFile);
}
use of es.bsc.compss.types.resources.ResourcesFile in project compss by bsc-wdc.
the class ResourcesFileTest method computeNodeCreationWithGATAndRead.
@Test
public void computeNodeCreationWithGATAndRead() 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";
float memSize = 32.5f;
float storageSize = 256.0f;
String osType = OSTypeType.LINUX.value();
String adaptorName = "gat";
// int minPort = 20;
// int maxPort = 40;
// String executor ="ssh";
boolean batch = true;
String queue = "default";
List<String> queues = new ArrayList<String>();
queues.add(queue);
boolean interactive = true;
String gatprop = "sshtrillead";
String user = "user";
String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
// Instantiate ResourcesFile
ResourcesFile resources = new ResourcesFile(xsd_path, LOGGER);
resources.addComputeNode(nodeName, procName, cu, arch, speed, null, -1f, ResourcesFile.createProcessorProperty(key, value), adaptorName, batch, queues, interactive, gatprop, user, memSize, null, storageSize, null, osType, null, null);
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(key, resources.getProcessorProperty(procExtracted).getKey());
assertEquals(value, resources.getProcessorProperty(procExtracted).getValue());
assertEquals(memSize, resources.getMemorySize(cn), 0);
assertEquals(storageSize, resources.getStorageSize(cn), 0);
assertEquals(osType, resources.getOperatingSystemType(cn));
assertEquals(String.class, resources.getAdaptorProperties(cn, adaptorName).getClass());
assertEquals(gatprop, resources.getAdaptorProperties(cn, adaptorName));
assertEquals(queue, resources.getAdaptorQueues(cn, adaptorName).get(0));
}
use of es.bsc.compss.types.resources.ResourcesFile in project compss by bsc-wdc.
the class ResourcesFileTest method servicesXML.
@Test
public void servicesXML() throws URISyntaxException, JAXBException, SAXException, ResourcesFileValidationException, IOException {
// Get XSD Schema path
String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
// Get default resources file
File servicesResources = new File(SERVICES_XML_PATH);
// Instantiate ResourcesFile
ResourcesFile resources = new ResourcesFile(servicesResources, xsd_path, LOGGER);
// Checkers
assertNotNull(resources);
File xml = new File(XML_TMP_PATH);
resources.toFile(xml);
boolean compareFile = FileUtils.contentEquals(servicesResources, xml);
assertEquals("Dump content not equal", true, compareFile);
}
use of es.bsc.compss.types.resources.ResourcesFile in project compss by bsc-wdc.
the class ResourcesFileTest method computeNodeCreationWithNIOAndRead.
@Test
public void computeNodeCreationWithNIOAndRead() throws SAXException, JAXBException, ResourcesFileValidationException {
int cu = 5;
float speed = 2.6f;
String nodeName = "blablahost";
String procName = "Proc1";
String arch = "amd64";
String type = "GPU";
float internalMemorySize = 0.01f;
String key = "procKey";
String value = "procValue";
float memSize = 32.5f;
float storageSize = 256.0f;
String osType = OSTypeType.LINUX.value();
String adaptorName = "nio";
int minPort = 20;
int maxPort = 40;
String executor = "ssh";
// boolean batch = true;
// String queue = "default";
// boolean interactive = true;
// String gatprop = "sshtrillead";
String user = "user";
String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
// Instantiate ResourcesFile
ResourcesFile resources = new ResourcesFile(xsd_path, LOGGER);
resources.addComputeNode(nodeName, procName, cu, arch, speed, type, internalMemorySize, ResourcesFile.createProcessorProperty(key, value), adaptorName, maxPort, minPort, executor, user, memSize, null, storageSize, null, osType, null, null);
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(type, resources.getProcessorType(procExtracted));
assertEquals(internalMemorySize, resources.getProcessorMemorySize(procExtracted), 0);
assertEquals(key, resources.getProcessorProperty(procExtracted).getKey());
assertEquals(value, resources.getProcessorProperty(procExtracted).getValue());
assertEquals(memSize, resources.getMemorySize(cn), 0);
assertEquals(storageSize, resources.getStorageSize(cn), 0);
assertEquals(osType, resources.getOperatingSystemType(cn));
assertEquals(NIOAdaptorProperties.class, resources.getAdaptorProperties(cn, adaptorName).getClass());
assertEquals(minPort, ((NIOAdaptorProperties) resources.getAdaptorProperties(cn, adaptorName)).getMinPort());
assertEquals(maxPort, ((NIOAdaptorProperties) resources.getAdaptorProperties(cn, adaptorName)).getMaxPort());
assertEquals(executor, ((NIOAdaptorProperties) resources.getAdaptorProperties(cn, adaptorName)).getRemoteExecutionCommand());
}
use of es.bsc.compss.types.resources.ResourcesFile in project compss by bsc-wdc.
the class ResourcesFileTest method jclouds_gceXML.
@Test
public void jclouds_gceXML() throws URISyntaxException, JAXBException, SAXException, ResourcesFileValidationException, IOException {
// Get XSD Schema path
String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
// Get default resources file
File gceResources = new File(JCLOUDS_GCE_XML_PATH);
// Instantiate ResourcesFile
ResourcesFile resources = new ResourcesFile(gceResources, xsd_path, LOGGER);
// Checkers
assertNotNull(resources);
File xml = new File(XML_TMP_PATH);
resources.toFile(xml);
boolean compareFile = FileUtils.contentEquals(gceResources, xml);
assertEquals("Dump content not equal", true, compareFile);
}
Aggregations