Example #1
0
 @Test
 public void testUsers() {
   try {
     int expected = getDataSet().getTable("User").getRowCount();
     int actual = getSecurityDAO().listAllUsers().size();
     for (User u : getSecurityDAO().listAllUsers()) {
       System.out.println(u.toString());
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 public JSONObject downloadPlateInputForm(HttpSession session, JSONObject json) {
   if (json.has("documentFormat")) {
     String documentFormat = json.getString("documentFormat");
     try {
       File f =
           misoFileManager.getNewFile(
               Plate.class,
               "forms",
               "PlateInputForm-" + LimsUtils.getCurrentDateAsString() + "." + documentFormat);
       FormUtils.createPlateInputSpreadsheet(f);
       return JSONUtils.SimpleJSONResponse("" + f.getName().hashCode());
     } catch (Exception e) {
       e.printStackTrace();
       return JSONUtils.SimpleJSONError("Failed to get plate input form: " + e.getMessage());
     }
   } else {
     return JSONUtils.SimpleJSONError("Missing project ID or document format supplied.");
   }
 }
Example #3
0
  @Test
  public void testPools() {
    try {
      int expected = getDataSet().getTable("Pool").getRowCount();

      int actual = getPoolDAO().count();

      TestCase.assertEquals("Wrong number of Pools", expected, actual);
      System.out.println("Expected number of Pools: " + expected + ", actual: " + actual);

      for (Pool d : random(getPoolDAO(), actual, 1)) {
        TestCase.assertNotNull(d);
        TestCase.assertNotNull(d.getId());
      }
    } catch (Exception e) {
      e.printStackTrace();
      TestCase.fail();
    }
  }
Example #4
0
  @Test
  public void testPlatforms() {
    try {
      // get row count of experiments in the dataset
      int expected = getDataSet().getTable("Platform").getRowCount();

      // get number of experiments from the DAO
      int actual = getPlatformDAO().count();

      // test data contains 2 experiments, check size of returned list
      TestCase.assertEquals("Wrong number of Platform", expected, actual);
      System.out.println("Expected number of Platform: " + expected + ", actual: " + actual);

      for (Platform d : random(getPlatformDAO(), actual, 5)) {
        TestCase.assertNotNull(d);
        TestCase.assertNotNull(d.getPlatformId());
      }
    } catch (Exception e) {
      e.printStackTrace();
      TestCase.fail();
    }
  }
Example #5
0
  @Test
  public void testDilutions() {
    try {
      int ec = getDataSet().getTable("emPCRDilution").getRowCount();
      int lc = getDataSet().getTable("LibraryDilution").getRowCount();

      int expected = ec + lc;
      int actualL = getEmPCRDilutionDAO().count();
      int actualE = getLibraryDilutionDAO().count();
      TestCase.assertEquals("Wrong number of dilutions", expected, (actualL + actualE));
      System.out.println(
          "Expected number of dilutions: " + expected + ", actual: " + (actualL + actualE));

      //      for (Dilution d : random(getDilutionDAO(), actual, 5)) {
      //        TestCase.assertNotNull(d);
      //        TestCase.assertNotNull(d.getDilutionId());
      //      }

      ((MockSQLSecurityDAO) getSecurityDAO()).clearCaches();
    } catch (Exception e) {
      e.printStackTrace();
      TestCase.fail();
    }
  }