Changeset 3272


Ignore:
Timestamp:
Apr 26, 2007, 11:10:10 AM (15 years ago)
Author:
Nicklas Nordborg
Message:

References #535: Use docbook's stylesheet in BASE2's helptexts

TestHelp? now import web client help texts as part of the test. Useful for checking that the
texts comes out as expected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/test/TestHelp.java

    r2304 r3272  
    2323*/
    2424import net.sf.basedb.core.*;
     25import net.sf.basedb.plugins.HelpImporter;
     26import net.sf.basedb.util.FileUtil;
     27
     28import java.io.InputStream;
    2529import java.util.Date;
    2630
     
    5256//    if (id != 0) test_load_external_id(clientId, "help.text");
    5357
     58    test_import("net.sf.basedb.clients.web", "../../data/helptexts.xml");
     59   
    5460    // Standard test: Delete
    5561    if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter();
     
    220226  }
    221227  */
     228 
     229  static void test_import(String clientId, String filename)
     230  {
     231    if (!TestUtil.hasPermission(Permission.WRITE, Item.CLIENT)) return;
     232    DbControl dc = null;
     233    try
     234    {
     235      dc = TestUtil.getDbControl();
     236      Client client = Client.getByExternalId(dc, clientId);
     237      dc.close();
     238      java.io.File file = new java.io.File(filename);
     239      if (file.exists())
     240      {
     241        InputStream is = FileUtil.getInputStream(file);
     242        HelpImporter helpImp = new HelpImporter();
     243        helpImp.init(TestUtil.getSessionControl(), null, null);
     244        helpImp.installHelpTexts(client, true, is);
     245        helpImp.done();
     246        write("--Import help texts OK");
     247      }
     248      else
     249      {
     250        write("--Import help texts SKIPPED (help text file doesn't exists");
     251      }
     252    }
     253    catch (Throwable ex)
     254    {
     255      write("--Import help texts FAILED");
     256      ex.printStackTrace();
     257      ok = false;
     258    }
     259    finally
     260    {
     261      if (dc != null) dc.close();
     262    }
     263   
     264   
     265   
     266  }
    222267
    223268}
Note: See TracChangeset for help on using the changeset viewer.