Search in sources :

Example 1 with ResourcesFile

use of es.bsc.compss.types.resources.ResourcesFile in project compss by bsc-wdc.

the class ResourcesFileTest method creation_XMLstring_XSDpath.

@Test
public void creation_XMLstring_XSDpath() throws URISyntaxException, JAXBException, SAXException, ResourcesFileValidationException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    String defaultResources = buildXMLString();
    // Instantiate ResourcesFile
    ResourcesFile resources = new ResourcesFile(defaultResources, xsd_path, LOGGER);
    // Checkers
    assertNotNull(resources);
    int numWorkers_byName = resources.getComputeNodes_names().size();
    assertEquals("Should have a worker", numWorkers_byName, 1);
    int numWorkers_byList = resources.getComputeNodes_list().size();
    assertEquals("Should have a worker", numWorkers_byList, 1);
    int numWorkers_byHashMap = resources.getComputeNodes_hashMap().size();
    assertEquals("Should have a worker", numWorkers_byHashMap, 1);
}
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 2 with ResourcesFile

use of es.bsc.compss.types.resources.ResourcesFile in project compss by bsc-wdc.

the class ResourcesFileTest method XMLtoFile.

/*
     * *************************************************************** 
     * Dumpers checkers
     ***************************************************************/
@Test
public void XMLtoFile() throws URISyntaxException, SAXException, JAXBException, ResourcesFileValidationException, IOException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    File defaultResources = new File(DEFAULT_XML_PATH);
    // Instantiate ResourcesFile
    ResourcesFile resources = new ResourcesFile(defaultResources, xsd_path, LOGGER);
    // Checkers
    assertNotNull(resources);
    File xml = new File(XML_TMP_PATH);
    resources.toFile(xml);
    boolean compareFile = FileUtils.contentEquals(defaultResources, 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 3 with ResourcesFile

use of es.bsc.compss.types.resources.ResourcesFile in project compss by bsc-wdc.

the class ResourcesFileTest method gridXML.

@Test
public void gridXML() throws URISyntaxException, JAXBException, SAXException, ResourcesFileValidationException, IOException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    File gridResources = new File(GRID_XML_PATH);
    // Instantiate ResourcesFile
    ResourcesFile resources = new ResourcesFile(gridResources, xsd_path, LOGGER);
    // Checkers
    assertNotNull(resources);
    File xml = new File(XML_TMP_PATH);
    resources.toFile(xml);
    boolean compareFile = FileUtils.contentEquals(gridResources, 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 4 with ResourcesFile

use of es.bsc.compss.types.resources.ResourcesFile in project compss by bsc-wdc.

the class ResourcesFileTest method creation_XMLfile_XSDpath.

@Test
public void creation_XMLfile_XSDpath() throws URISyntaxException, JAXBException, SAXException, ResourcesFileValidationException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    File defaultResources = new File(DEFAULT_XML_PATH);
    // Instantiate ResourcesFile
    ResourcesFile resources = new ResourcesFile(defaultResources, xsd_path, LOGGER);
    // Checkers
    assertNotNull(resources);
    int numWorkers_byName = resources.getComputeNodes_names().size();
    assertEquals("Should have a worker", numWorkers_byName, 1);
    int numWorkers_byList = resources.getComputeNodes_list().size();
    assertEquals("Should have a worker", numWorkers_byList, 1);
    int numWorkers_byHashMap = resources.getComputeNodes_hashMap().size();
    assertEquals("Should have a worker", numWorkers_byHashMap, 1);
}
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 5 with ResourcesFile

use of es.bsc.compss.types.resources.ResourcesFile in project compss by bsc-wdc.

the class ResourcesFileTest method fullXML.

/*
     * ***************************************************************
     *  Different types of XML checkers
     ***************************************************************/
@Test
public void fullXML() throws URISyntaxException, JAXBException, SAXException, ResourcesFileValidationException, IOException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    File fullResources = new File(FULL_XML_PATH);
    // Instantiate ResourcesFile
    ResourcesFile resources = new ResourcesFile(fullResources, xsd_path, LOGGER);
    // Checkers
    assertNotNull(resources);
    File xml = new File(XML_TMP_PATH);
    resources.toFile(xml);
    boolean compareFile = FileUtils.contentEquals(fullResources, 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