Changeset 4625


Ignore:
Timestamp:
Nov 4, 2008, 4:45:36 PM (15 years ago)
Author:
Martin Svensson
Message:

References #1151 Created new classes which do the power user-role test and user-role test with batch importers. The new functionallity is not tested yet.

Location:
trunk/src/test/net/sf/basedb/test/roles
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/test/net/sf/basedb/test/roles/AdminTest.java

    r4514 r4625  
    4747import net.sf.basedb.plugins.PrintMapFlatFileImporter;
    4848import net.sf.basedb.plugins.ReporterMapFlatFileImporter;
     49import net.sf.basedb.plugins.batchimport.ArrayBatchImporter;
     50import net.sf.basedb.plugins.batchimport.ArrayDesignImporter;
     51import net.sf.basedb.plugins.batchimport.ArraySlideImporter;
     52import net.sf.basedb.plugins.batchimport.BioSourceImporter;
     53import net.sf.basedb.plugins.batchimport.ExtractImporter;
     54import net.sf.basedb.plugins.batchimport.HybridizationImporter;
     55import net.sf.basedb.plugins.batchimport.LabeledExtractImporter;
     56import net.sf.basedb.plugins.batchimport.RawBioAssayImporter;
     57import net.sf.basedb.plugins.batchimport.SampleImporter;
     58import net.sf.basedb.plugins.batchimport.ScanImporter;
    4959import net.sf.basedb.test.AffymetrixData;
    5060import net.sf.basedb.test.FileUtil;
     
    98108      plugins.add(PluginDefinition.getByClassName(dc, ReporterMapFlatFileImporter.class.getName()));
    99109      plugins.add(PluginDefinition.getByClassName(dc, PrintMapFlatFileImporter.class.getName()));
     110     
     111      plugins.add(PluginDefinition.getByClassName(dc, ArrayDesignImporter.class.getName()));
     112      plugins.add(PluginDefinition.getByClassName(dc, ArrayBatchImporter.class.getName()));
     113      plugins.add(PluginDefinition.getByClassName(dc, ArraySlideImporter.class.getName()));           
    100114      addPermissions(dc, powerUser, plugins, USE);
     115     
     116      plugins.clear();
     117      plugins.add(PluginDefinition.getByClassName(dc, BioSourceImporter.class.getName()));
     118      plugins.add(PluginDefinition.getByClassName(dc, SampleImporter.class.getName()));
     119      plugins.add(PluginDefinition.getByClassName(dc, ExtractImporter.class.getName()));
     120      plugins.add(PluginDefinition.getByClassName(dc, LabeledExtractImporter.class.getName()));
     121      plugins.add(PluginDefinition.getByClassName(dc, HybridizationImporter.class.getName()));
     122      plugins.add(PluginDefinition.getByClassName(dc, ScanImporter.class.getName()));
     123      plugins.add(PluginDefinition.getByClassName(dc, RawBioAssayImporter.class.getName()));
     124      addPermissions(dc, user, plugins, USE);
    101125      dc.commit();
    102126     
  • trunk/src/test/net/sf/basedb/test/roles/Run.java

    r4514 r4625  
    4343    boolean all = cmds.contains("all");
    4444    boolean logMemoryUsage = cmds.contains("-m");
     45    boolean useBatchImporters = cmds.contains("-b");
    4546   
    4647    int tests = 0;
     
    6162    {
    6263      TestUtil.begin(logMemoryUsage, true);
    63       ok = PowerUserTest.run();
     64      ok = useBatchImporters ? PowerUserBatchImporterTest.run() : PowerUserTest.run();
    6465      tests++;
    6566    }
     
    6768    {
    6869      TestUtil.begin(logMemoryUsage, true);
    69       ok = UserTest.run();
     70      ok = useBatchImporters ? UserBatchImporterTest.run() : UserTest.run();
    7071      tests++;
    7172    }
     
    8889  {
    8990    TestUtil.write(
    90       "test.sh roles [-m] <cmds>\n" +
     91      "test.sh roles [OPTION] <cmds>\n" +
    9192      "     -m = log memory usage to file memory.log\n" +
     93      "   -b = use the batch importers to insert items into BASE.\n" + 
    9294      "     cmds = list of tests to run; all, root, admin, power, user, guest\n\n");
    9395   
  • trunk/src/test/net/sf/basedb/test/roles/Util.java

    r4548 r4625  
    3232import net.sf.basedb.core.ArraySlide;
    3333import net.sf.basedb.core.BioAssaySet;
     34import net.sf.basedb.core.BioSource;
    3435import net.sf.basedb.core.DbControl;
    3536import net.sf.basedb.core.Experiment;
     
    4748import net.sf.basedb.core.Protocol;
    4849import net.sf.basedb.core.Quota;
     50import net.sf.basedb.core.RawBioAssay;
    4951import net.sf.basedb.core.RawDataType;
    5052import net.sf.basedb.core.Role;
     53import net.sf.basedb.core.Sample;
    5154import net.sf.basedb.core.Software;
    5255import net.sf.basedb.core.Unit;
     
    270273    return query.list(dc).get(0);
    271274  }
    272  
     275
     276  /**
     277    Returns the first raw bioassay that was found with a certain name
     278   */
     279  public static RawBioAssay findRawBioAssay(DbControl dc, String name)
     280  {
     281    ItemQuery<RawBioAssay> query = RawBioAssay.getQuery();
     282    query.restrict(Restrictions.eq(Hql.property("name"), Expressions.string(name)));
     283    return query.list(dc).get(0);
     284  }
     285 
     286  /**
     287    Returns the first sample that was found with a certain name
     288   */
     289  public static Sample findSample(DbControl dc, String name)
     290  {
     291    ItemQuery<Sample> query = Sample.getQuery();
     292    query.restrict(Restrictions.eq(Hql.property("name"), Expressions.string(name)));
     293    return query.list(dc).get(0);
     294  }
     295 
     296  /**
     297    Returns the first biosource that was found with a certain name
     298   */
     299  public static BioSource findBioSource(DbControl dc, String name)
     300  {
     301    ItemQuery<BioSource> query = BioSource.getQuery();
     302    query.restrict(Restrictions.eq(Hql.property("name"), Expressions.string(name)));
     303    return query.list(dc).get(0);
     304  }
    273305}
Note: See TracChangeset for help on using the changeset viewer.