Search in sources :

Example 6 with ProjectFile

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

the class ProjectFileTest method fullXML.

/*
     * ***************************************************************
     * Different types of XML checkers
     ***************************************************************/
@Test
public void fullXML() throws URISyntaxException, JAXBException, SAXException, ProjectFileValidationException, IOException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    File fullProject = new File(FULL_XML_PATH);
    // Instantiate ResourcesFile
    ProjectFile project = new ProjectFile(fullProject, xsd_path, logger);
    // Checkers
    assertNotNull(project);
    File xml = new File(XML_TMP_PATH);
    project.toFile(xml);
    boolean compareFile = FileUtils.contentEquals(fullProject, xml);
    assertEquals("Dump content not equal", true, compareFile);
}
Also used : ProjectFile(es.bsc.compss.types.project.ProjectFile) File(java.io.File) ProjectFile(es.bsc.compss.types.project.ProjectFile) Test(org.junit.Test)

Example 7 with ProjectFile

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

the class ProjectFileTest method creation_XMLfile_XSDpath.

@Test
public void creation_XMLfile_XSDpath() throws URISyntaxException, JAXBException, SAXException, ProjectFileValidationException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    File defaultProject = new File(DEFAULT_XML_PATH);
    // Instantiate ResourcesFile
    ProjectFile project = new ProjectFile(defaultProject, xsd_path, logger);
    // Checkers
    assertNotNull(project);
    int numWorkers_byName = project.getComputeNodes_names().size();
    assertEquals("Should have a worker", numWorkers_byName, 1);
    int numWorkers_byList = project.getComputeNodes_list().size();
    assertEquals("Should have a worker", numWorkers_byList, 1);
    int numWorkers_byHashMap = project.getComputeNodes_hashMap().size();
    assertEquals("Should have a worker", numWorkers_byHashMap, 1);
}
Also used : ProjectFile(es.bsc.compss.types.project.ProjectFile) File(java.io.File) ProjectFile(es.bsc.compss.types.project.ProjectFile) Test(org.junit.Test)

Example 8 with ProjectFile

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

the class ResourceLoader method loadFiles.

private static void loadFiles() throws ResourcesFileValidationException, ProjectFileValidationException {
    LOGGER.info("ResourceLoader loading files");
    // Load resources
    try {
        LOGGER.debug("ResourceLoader loading resources.xml");
        ResourceLoader.resources = new ResourcesFile(new File(resources_XML), resources_XSD, LOGGER);
    } catch (SAXException | JAXBException e) {
        throw new ResourcesFileValidationException(e);
    }
    // Load project
    try {
        LOGGER.debug("ResourceLoader loading project.xml");
        ResourceLoader.project = new ProjectFile(new File(project_XML), project_XSD, LOGGER);
    } catch (SAXException | JAXBException e) {
        throw new ProjectFileValidationException(e);
    }
}
Also used : ResourcesFile(es.bsc.compss.types.resources.ResourcesFile) JAXBException(javax.xml.bind.JAXBException) ResourcesFileValidationException(es.bsc.compss.types.resources.exceptions.ResourcesFileValidationException) ProjectFile(es.bsc.compss.types.project.ProjectFile) ProjectFileValidationException(es.bsc.compss.types.project.exceptions.ProjectFileValidationException) ProjectFile(es.bsc.compss.types.project.ProjectFile) File(java.io.File) ResourcesFile(es.bsc.compss.types.resources.ResourcesFile) SAXException(org.xml.sax.SAXException)

Example 9 with ProjectFile

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

the class ProjectFileTest method XMLtoFile.

/*
     * *************************************************************** 
     * Dumpers checkers
     ***************************************************************/
@Test
public void XMLtoFile() throws URISyntaxException, SAXException, JAXBException, ProjectFileValidationException, IOException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    File defaultProject = new File(DEFAULT_XML_PATH);
    // Instantiate ResourcesFile
    ProjectFile project = new ProjectFile(defaultProject, xsd_path, logger);
    // Checkers
    assertNotNull(project);
    File xml = new File(XML_TMP_PATH);
    project.toFile(xml);
    boolean compareFile = FileUtils.contentEquals(defaultProject, xml);
    assertEquals("Dump content not equal", true, compareFile);
}
Also used : ProjectFile(es.bsc.compss.types.project.ProjectFile) File(java.io.File) ProjectFile(es.bsc.compss.types.project.ProjectFile) Test(org.junit.Test)

Example 10 with ProjectFile

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

the class ProjectFileTest method XMLtoString.

@Test
public void XMLtoString() throws URISyntaxException, SAXException, JAXBException, ProjectFileValidationException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    File defaultProject = new File(DEFAULT_XML_PATH);
    // Instantiate ResourcesFile
    ProjectFile project = new ProjectFile(defaultProject, xsd_path, logger);
    // Checkers
    assertNotNull(project);
    String real_xml = project.getString();
    String ideal_xml = buildXMLString();
    assertEquals("To string method doesn't produce the correct dump", real_xml, ideal_xml);
}
Also used : ProjectFile(es.bsc.compss.types.project.ProjectFile) File(java.io.File) ProjectFile(es.bsc.compss.types.project.ProjectFile) Test(org.junit.Test)

Aggregations

ProjectFile (es.bsc.compss.types.project.ProjectFile)12 File (java.io.File)12 Test (org.junit.Test)11 Schema (javax.xml.validation.Schema)2 SchemaFactory (javax.xml.validation.SchemaFactory)2 ProjectFileValidationException (es.bsc.compss.types.project.exceptions.ProjectFileValidationException)1 ResourcesFile (es.bsc.compss.types.resources.ResourcesFile)1 ResourcesFileValidationException (es.bsc.compss.types.resources.exceptions.ResourcesFileValidationException)1 JAXBException (javax.xml.bind.JAXBException)1 SAXException (org.xml.sax.SAXException)1