Package inspector.jqcml.model

Examples of inspector.jqcml.model.QcML


        writer.writeCv(new Cv("name", "uri", "id"));
    }

    @Test(expected = IllegalStateException.class)
    public void writeQcML_duplicateID() {
        QcML qcml = new QcML();
        qcml.setFileName("Invalid.qcML");

        Cv cv = new Cv("name", "uri", "id");
        qcml.addCv(cv);

        QualityAssessment run = new QualityAssessment("id");
        QualityParameter param = new QualityParameter("name", cv, "id");
        param.setAccession("accession");
        run.addQualityParameter(param);
        qcml.addRunQuality(run);

        writer.writeQcML(qcml);
    }
View Full Code Here


        writer.writeQcML(qcml);
    }

    @Test(expected = IllegalStateException.class)
    public void writeQcML_missingContent() {
        QcML qcml = new QcML();
        qcml.setFileName("Invalid.qcML");

        QualityAssessment run = new QualityAssessment("run");
        QualityParameter param = new QualityParameter("name", new Cv("name", "uri", "cv"), "param");
        param.setAccession("accession");
        run.addQualityParameter(param);
        qcml.addRunQuality(run);

        writer.writeQcML(qcml);
    }
View Full Code Here

  }

  @Test
  public void getQcML_invalidVersionNumber() {
    // warning should be logged
    QcML qcml = reader.getQcML(getClass().getResource("/InvalidVersionNumber.qcML").getFile());

    assertNotNull(qcml);

    assertEquals(QcMLFileReader.QCML_VERSION, qcml.getVersion());
  }
View Full Code Here

    writer.writeQcML(null);
  }

  @Test
  public void writeQcML_invalidVersion() {
    QcML qcml = new QcML();
    qcml.setFileName("Invalid_version.qcML");
    String version = "My.version.number";
    qcml.setVersion(version);

    Cv cv = new Cv("name", "uri", "cv");
    qcml.addCv(cv);

    QualityAssessment run = new QualityAssessment("run");
    QualityParameter param = new QualityParameter("name", cv, "param");
    param.setAccession("accession");
    run.addQualityParameter(param);
    qcml.addRunQuality(run);

    assertEquals(version, qcml.getVersion());

    // warning should be logged
    writer.writeQcML(qcml);

    assertEquals(QcMLFileWriter.QCML_VERSION, qcml.getVersion());
  }
View Full Code Here

                List<Integer> result = qcmlQuery.getResultList();
                if(result.size() > 0) {
                    // delete the old qcML
                    logger.info("Duplicate qcML <id={}>: delete old qcML <primaryKey={}>", qcml.getFileName(), result.get(0));
                    QcML oldQcml = entityManager.find(QcML.class, result.get(0));
                    entityManager.getTransaction().begin();
                    entityManager.remove(oldQcml);
                    entityManager.getTransaction().commit();
                }
View Full Code Here

    try {
      TypedQuery<QcML> query = entityManager.createQuery("SELECT qcml FROM QcML qcml WHERE qcml.fileName = :fileName", QcML.class);
      query.setParameter("fileName", qcmlFile);
     
      QcML qcml = query.getSingleResult();

      if(!qcml.getVersion().equals(QCML_VERSION)) {
        logger.warn("The qcML version <{}> doesn't correspond to the qcML XML schema version <{}>", qcml.getVersion(), QCML_VERSION);
      }

      return qcml;
    }
    catch(NoResultException e) {
View Full Code Here

 
  @Before
  public void setUp() {
    // constructed qcML
    SecureRandom random = new SecureRandom();
    qcmlExpected = new QcML();
    // add Cv's
    for(int i = 0; i < 5; i++) {
      Cv cv = new Cv();
      cv.setFullName("cv item " + i);
      cv.setUri("/path/to/cv/" + i);
View Full Code Here

  @Override
  public QcML getQcML(String qcmlFile) {
    try {
      setFile(qcmlFile);
      QcML qcml = unmarshaller.unmarshal(currentFile);

      if(!qcml.getVersion().equals(QCML_VERSION)) {
        logger.warn("The qcML version <{}> doesn't correspond to the qcML XML schema version <{}>", qcml.getVersion(), QCML_VERSION);
        qcml.setVersion(QCML_VERSION);
      }

      return qcml;

    } catch(IllegalStateException e) {
View Full Code Here

   */
  public QcML unmarshal(File file) {
    logger.info("Unmarshal full file <{}>", file.getAbsolutePath());
   
    try {
      QcML result = (QcML) unmarshaller.unmarshal(createSource(file));
      result.setFileName(file.getName());

      return result;
     
    } catch (FileNotFoundException e) {
      logger.error("The specified file to unmarshal doesn't exist: <{}>", file.getAbsolutePath());
View Full Code Here

TOP

Related Classes of inspector.jqcml.model.QcML

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.