Search in sources :

Example 1 with ProjectFile

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

the class ProjectFileTest method jclouds_gceXML.

@Test
public void jclouds_gceXML() throws URISyntaxException, JAXBException, SAXException, ProjectFileValidationException, IOException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    File gceProject = new File(JCLOUDS_GCE_XML_PATH);
    // Instantiate ResourcesFile
    ProjectFile project = new ProjectFile(gceProject, xsd_path, logger);
    // Checkers
    assertNotNull(project);
    File xml = new File(XML_TMP_PATH);
    project.toFile(xml);
    boolean compareFile = FileUtils.contentEquals(gceProject, 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 2 with ProjectFile

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

the class ProjectFileTest method servicesXML.

@Test
public void servicesXML() throws URISyntaxException, JAXBException, SAXException, ProjectFileValidationException, IOException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    File servicesProject = new File(SERVICES_XML_PATH);
    // Instantiate ResourcesFile
    ProjectFile project = new ProjectFile(servicesProject, xsd_path, logger);
    // Checkers
    assertNotNull(project);
    File xml = new File(XML_TMP_PATH);
    project.toFile(xml);
    boolean compareFile = FileUtils.contentEquals(servicesProject, 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 3 with ProjectFile

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

the class ProjectFileTest method creation_XMLstring_XSDschema.

@Test
public void creation_XMLstring_XSDschema() throws URISyntaxException, JAXBException, SAXException, ProjectFileValidationException {
    // Instantiate XSD Schema
    SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Schema xsd = sf.newSchema(new File(SCHEMA_PATH));
    // Get default resources file
    String defaultProject = buildXMLString();
    // Instantiate ResourcesFile
    ProjectFile project = new ProjectFile(defaultProject, xsd, 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 : SchemaFactory(javax.xml.validation.SchemaFactory) Schema(javax.xml.validation.Schema) ProjectFile(es.bsc.compss.types.project.ProjectFile) File(java.io.File) ProjectFile(es.bsc.compss.types.project.ProjectFile) Test(org.junit.Test)

Example 4 with ProjectFile

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

the class ProjectFileTest method creation_XMLstring_XSDpath.

@Test
public void creation_XMLstring_XSDpath() throws URISyntaxException, JAXBException, SAXException, ProjectFileValidationException {
    // Get XSD Schema path
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Get default resources file
    String defaultProject = buildXMLString();
    // 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 5 with ProjectFile

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

the class ProjectFileTest method creation_XMLfile_XSDschema.

/*
     * *************************************************************** 
     * CONSTRUCTOR TESTS
     ***************************************************************/
@Test
public void creation_XMLfile_XSDschema() throws URISyntaxException, JAXBException, SAXException, ProjectFileValidationException {
    // Instantiate XSD Schema
    SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Schema xsd = sf.newSchema(new File(SCHEMA_PATH));
    // Get default resources file
    File defaultProject = new File(DEFAULT_XML_PATH);
    // Instantiate ResourcesFile
    ProjectFile project = new ProjectFile(defaultProject, xsd, 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 : SchemaFactory(javax.xml.validation.SchemaFactory) Schema(javax.xml.validation.Schema) 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