示例#1
0
  @Test
  public void testSmallFasta() {

    try {
      InputStream inStream = this.getClass().getResourceAsStream("/test.fasta");

      FastaReader<ProteinSequence, AminoAcidCompound> fastaReader =
          new FastaReader<ProteinSequence, AminoAcidCompound>(
              inStream,
              new GenericFastaHeaderParser<ProteinSequence, AminoAcidCompound>(),
              new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()));

      LinkedHashMap<String, ProteinSequence> b;

      int nrSeq = 0;

      while ((b = fastaReader.process(10)) != null) {
        for (String key : b.keySet()) {
          nrSeq++;

          // #282 would result in an endless loop
          // this makes sure it has been fixed.
          assertTrue(
              "Looks like there is a problem with termination of processing of the FASTA file!",
              nrSeq < 15);
        }
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      java.util.logging.Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);

      fail(ex.getMessage());
    }
  }
示例#2
0
  @Test
  public void testSmallFasta2() {

    try {
      InputStream inStream = this.getClass().getResourceAsStream("/test.fasta");

      FastaReader<ProteinSequence, AminoAcidCompound> fastaReader =
          new FastaReader<ProteinSequence, AminoAcidCompound>(
              inStream,
              new GenericFastaHeaderParser<ProteinSequence, AminoAcidCompound>(),
              new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet()));

      int nrSeq = 0;

      LinkedHashMap<String, ProteinSequence> b = fastaReader.process();

      assertNotNull(b);

      // #282 make sure that process() still works

      assertTrue(b.keySet().size() == 10);

    } catch (Exception ex) {
      ex.printStackTrace();
      java.util.logging.Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);

      fail(ex.getMessage());
    }
  }
 @Before
 public void setUp() {
   if (!Boolean.parseBoolean(System.getProperty("test.solr.verbose"))) {
     java.util.logging.Logger.getLogger("org.apache.solr")
         .setLevel(java.util.logging.Level.SEVERE);
     Utils.setLog4jLogLevel(org.apache.log4j.Level.WARN);
   }
   testDataParentPath = System.getProperty("test.data.path");
   testConfigFname = System.getProperty("test.config.file");
   // System.out.println("-----testDataParentPath = "+testDataParentPath);
 }