Example #1
0
  // @Test
  public void validateDoubfulRanks() {

    try {
      BufferedReader bufferedReader =
          new BufferedReader(
              new FileReader(new File("/home/alext/Downloads/NCBI/taxdump/nodes.dmp")));
      String line;
      while ((line = bufferedReader.readLine()) != null) {
        String[] split = line.split("\t\\|\t");
        if (split[2].equals("forma")) {
          System.out.println(line);
          // break;
        }
      }
      bufferedReader.close();
    } catch (FileNotFoundException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    } catch (IOException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }
  }
  static {
    String bibFilePath = testDataParentPath + File.separator + "mhldMergeBibs1346.mrc";
    try {
      RawRecordReader rawRecRdr = new RawRecordReader(new FileInputStream(new File(bibFilePath)));
      while (rawRecRdr.hasNext()) {
        RawRecord rawRec = rawRecRdr.next();
        Record rec = rawRec.getAsRecord(true, false, "999", "MARC8");
        String id = rec.getControlNumber();
        // String id = RecordTestingUtils.getRecordIdFrom001(rec);
        ALL_UNMERGED_BIBS.put(id, rec);
      }
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }

    bibFilePath = testDataParentPath + File.separator + "mhldMerged1346.mrc";
    try {
      RawRecordReader rawRecRdr = new RawRecordReader(new FileInputStream(new File(bibFilePath)));
      while (rawRecRdr.hasNext()) {
        RawRecord rawRec = rawRecRdr.next();
        Record rec = rawRec.getAsRecord(true, false, "999", "MARC8");
        String id = rec.getControlNumber();
        // String id = RecordTestingUtils.getRecordIdFrom001(rec);
        ALL_MERGED_BIB_RESULTS.put(id, rec);
      }
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
  }
  @Test
  public void testCreateCises() {
    for (int i = 0; i < this.numCIS; i++) {
      String cisId;
      String testTitle = "CPA: ";
      LOG.info("[#" + testCaseNumber + "] " + testTitle);

      // Create CIS
      LOG.info("############## CREATED CIS with Id:" + cssId + " (" + cssPassword + ")");
      Future<ICisOwned> futureCis =
          TestCase1096.cisManager.createCis(
              cisName, cisType, cisMembershipCriteria, cisDescription);
      ICisOwned newCis = null;
      assertNotNull("Future new CIS is null", futureCis);

      // Retrieve future CIS
      try {
        newCis = futureCis.get(10, TimeUnit.SECONDS);
      } catch (InterruptedException e) {
        LOG.error("[Error " + e.getLocalizedMessage() + "] " + testTitle, e);
        fail("[Error InterruptedException] " + testTitle);
      } catch (ExecutionException e) {
        LOG.error("[Error " + e.getLocalizedMessage() + "] " + testTitle, e);
        fail("[Error ExecutionException] " + testTitle);
      } catch (TimeoutException e) {
        LOG.error("[Error " + e.getLocalizedMessage() + "] " + testTitle, e);
        fail("[Error TimeoutException] " + testTitle);
      }
      assertNotNull("New CIS is null", newCis);

      // Retrieve CIS id
      cisId = newCis.getCisId();
      cisIds.add(cisId);
      assertNotNull("New CIS id is null", cisIds);

      // Check if the CIS is on the CIS Management registry
      ICis cisRetrieved = TestCase1096.cisManager.getCis(cisId);
      assertNotNull("New CIS is not stored", cisRetrieved);
      assertEquals("New CIS and retrived CIS should be the same but are not", newCis, cisRetrieved);
    }
    LOG.info("Starting simulation and injection of fake activities..");
    ArrayList<String[]> data = new ArrayList<String[]>();
    try {
      URL u = NominalTestCase.class.getClassLoader().getResource("msn-data-xml.csv");
      BufferedReader br = new BufferedReader(new InputStreamReader(u.openStream()));
      CSVParser parser = new CSVParser(br, CSVStrategy.EXCEL_STRATEGY);
      String[] value = parser.getLine();
      while (value != null) {
        data.add(value);
        value = parser.getLine();
      }
    } catch (FileNotFoundException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    } catch (IOException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }
    long msgCounter = 0;
    for (String[] line : data) {
      msgCounter++;
      TestCase1096.cisManager
          .getCis(cisIds.get(0))
          .getActivityFeed()
          .addActivity(makeMessage(line[1], line[2], "nonsense", "0"), this);
      if (msgCounter > 2000) {
        break;
      }
    }
    LOG.info("cisIds.size(): " + cisIds.size());
    assert (cisIds.size() == this.numCIS);
  }