コード例 #1
0
  public void testLoadSchemaFromFile() throws ResourceException, URISyntaxException {
    String absoluteSchemaFilePath =
        FileTools.resourceFile("/schema/" + this.adjustSchemaName("BasicSchema.xsd"))
            .getAbsolutePath();
    File testSchemasDirectory = new File(absoluteSchemaFilePath).getParentFile().getParentFile();
    String testSchemasDirectoryPath = testSchemasDirectory.getPath();
    String relativeSchemaFilePath =
        "." + absoluteSchemaFilePath.substring(testSchemasDirectoryPath.length());

    MWOXProject project =
        new MWOXProject("Test Load Schema From File", MappingsModelTestTools.buildSPIManager());
    project.setSaveDirectory(testSchemasDirectory);
    MWXmlSchemaRepository repository = project.getSchemaRepository();

    // test absolute file location
    MWXmlSchema absolutePathSchema =
        repository.createSchemaFromFile("AbsolutePathSchemaFromFile", absoluteSchemaFilePath);
    absolutePathSchema.reload();

    // test relative file location
    MWXmlSchema relativePathSchema =
        repository.createSchemaFromFile("RelativePathSchemaFromFile", relativeSchemaFilePath);
    relativePathSchema.reload();
  }