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);
}
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);
}
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);
}
}
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);
}
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);
}
Aggregations