Search in sources :

Example 6 with ResourcesFile

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

Example 7 with ResourcesFile

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

Example 8 with ResourcesFile

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

Example 9 with ResourcesFile

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

Example 10 with ResourcesFile

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

Aggregations

ResourcesFile (es.bsc.compss.types.resources.ResourcesFile)15 File (java.io.File)15 Test (org.junit.Test)14 ComputeNodeType (es.bsc.compss.types.resources.jaxb.ComputeNodeType)3 ProcessorType (es.bsc.compss.types.resources.jaxb.ProcessorType)3 Schema (javax.xml.validation.Schema)2 SchemaFactory (javax.xml.validation.SchemaFactory)2 ProjectFile (es.bsc.compss.types.project.ProjectFile)1 ProjectFileValidationException (es.bsc.compss.types.project.exceptions.ProjectFileValidationException)1 ResourcesFileValidationException (es.bsc.compss.types.resources.exceptions.ResourcesFileValidationException)1 AdaptorType (es.bsc.compss.types.resources.jaxb.AdaptorType)1 ProcessorPropertyType (es.bsc.compss.types.resources.jaxb.ProcessorPropertyType)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 JAXBException (javax.xml.bind.JAXBException)1 SAXException (org.xml.sax.SAXException)1