Changeset 5702


Ignore:
Timestamp:
Aug 19, 2011, 2:35:10 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1615: Add test program in BASE 2.17 that create data that need special handling when updating to BASE 3

An extra test program has been added to the 'roles' test program. It is started with:

./test.sh roles extra

The other tests (except the 'guest' test) in the test program must have been executed first:

./test.sh roles root admin power user
Location:
branches/2.17-stable/src/test/net/sf/basedb/test/roles
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.17-stable/src/test/net/sf/basedb/test/roles/AdminTest.java

    r5327 r5702  
    7070  <li>Create user: {@link #createPowerUser(DbControl, Group)}
    7171  <li>Create guest: {@link #createGuest(DbControl, Group)}
     72  <li>Create extra user: {@link #createExtraUser(DbControl, Group)}
    7273  <li>Create fileformat for import:
    7374  <li>Import reporters:
     
    9899      User user = createUser(dc, g);
    99100      User guest = createGuest(dc, g);
     101      User extra = createExtraUser(dc, g);
    100102      dc.commit();
    101103     
     
    217219  }
    218220 
     221  /**
     222    Create "extra" user with power user rights.
     223  */
     224  public static User createExtraUser(DbControl dc, Group group)
     225  {
     226    TestUtil.write("--Creating extra user\n");
     227    Role powerUser = Role.getById(dc, SystemItems.getId(Role.POWER_USER));
     228    Quota quota = Quota.getById(dc, SystemItems.getId(Quota.UNRESTRICTED));
     229    User extra = Util.createUser(dc, "Extra user", "extra", "extra", quota, null,
     230        Collections.singleton(powerUser), Collections.singleton(group));
     231    Directory.createHomeDirectory(dc, extra, true);
     232    return extra;
     233  }
     234
     235 
    219236  public static void addPermissions(DbControl dc, User user, Collection<SharedItem> items, Set<Permission> permissions)
    220237  {
  • branches/2.17-stable/src/test/net/sf/basedb/test/roles/Run.java

    r4628 r5702  
    7777      tests++;
    7878    }
     79    if (ok && (all || cmds.contains("extra")))
     80    {
     81      TestUtil.begin(logMemoryUsage, true);
     82      ok = ExtraTest.run();
     83      tests++;
     84    }
    7985    TestUtil.stop();
    8086   
  • branches/2.17-stable/src/test/net/sf/basedb/test/roles/UserTest.java

    r5260 r5702  
    223223        // Hybridizations, etc.
    224224//        dc = TestUtil.getDbControl();
    225         Hybridization h1 = createHybridization(dc, "Hybridization A.00h", "Array slide A.1", le1, leRef);
    226         Hybridization h2 = createHybridization(dc, "Hybridization A.24h", "Array slide A.2", le2, leRef);
    227         Hybridization h1DyeSwap = createHybridization(dc, "Hybridization A.00h (dye-swap)", "Array slide A.3", le1DyeSwap, leRefDyeSwap);
    228         Hybridization h2DyeSwap = createHybridization(dc, "Hybridization A.24h (dye-swap)", "Array slide A.4", le2DyeSwap, leRefDyeSwap);
     225        Hybridization h1 = createHybridization(dc, "Hybridization A.00h", "Array slide A.1", false, le1, leRef);
     226        Hybridization h2 = createHybridization(dc, "Hybridization A.24h", "Array slide A.2", false,le2, leRef);
     227        Hybridization h1DyeSwap = createHybridization(dc, "Hybridization A.00h (dye-swap)", "Array slide A.3", false,le1DyeSwap, leRefDyeSwap);
     228        Hybridization h2DyeSwap = createHybridization(dc, "Hybridization A.24h (dye-swap)", "Array slide A.4", false,le2DyeSwap, leRefDyeSwap);
    229229 
    230230        // Affymetrix
    231         Hybridization affyHyb1 = createHybridization(dc, "Affymetrix hyb A.1", "Affymetrix slide A.1", le1);
    232         Hybridization affyHyb2 = createHybridization(dc, "Affymetrix hyb A.2", "Affymetrix slide A.2", le2);
    233         Hybridization affyHyb3 = createHybridization(dc, "Affymetrix hyb A.3", "Affymetrix slide A.3", leRef);
     231        Hybridization affyHyb1 = createHybridization(dc, "Affymetrix hyb A.1", "Affymetrix slide A.1", false,le1);
     232        Hybridization affyHyb2 = createHybridization(dc, "Affymetrix hyb A.2", "Affymetrix slide A.2", false,le2);
     233        Hybridization affyHyb3 = createHybridization(dc, "Affymetrix hyb A.3", "Affymetrix slide A.3", false,leRef);
    234234       
    235235        sc1 = createScan(dc, "Scan A.00h", h1, 400f, volt);
     
    436436    Create a hybridization.
    437437  */
    438   public static Hybridization createHybridization(DbControl dc, String name, String arraySlideName, LabeledExtract... extracts)
     438  public static Hybridization createHybridization(DbControl dc, String name, String arraySlideName,
     439      boolean multiArray, LabeledExtract... extracts)
    439440  {
    440441    TestUtil.write("--Creating hybridization: " + name + "\n");
    441442    Hybridization hyb = Hybridization.getNew(dc);
    442443    hyb.setName(name);
    443     hyb.setArraySlide(Util.findArraySlide(dc, arraySlideName));
     444    if (multiArray)
     445    {
     446      hyb.setNumArrays(extracts.length);
     447    }
     448    if (arraySlideName != null)
     449    {
     450      hyb.setArraySlide(Util.findArraySlide(dc, arraySlideName));
     451    }
    444452    BioMaterialEvent creationEvent = hyb.getCreationEvent();
    445453    creationEvent.setProtocol(Util.findProtocol(dc, "Hybridization A"));
    446454    creationEvent.setHardware(Util.findHardware(dc, "Hybridization station A"));
     455    int grp = 1;
    447456    for (LabeledExtract le : extracts)
    448457    {
    449458      creationEvent.addSource(le, 50.0f);
     459      if (multiArray)
     460      {
     461        creationEvent.setSourceGroup(le, grp);
     462        grp++;
     463      }
    450464    }
    451465    dc.saveItem(hyb);
Note: See TracChangeset for help on using the changeset viewer.