From 4b2c03843e0e559d1c849f4f201f53072be7fe14 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Tue, 27 May 2003 11:04:04 +0000 Subject: [PATCH] INTEGRATION: CWS qadev6 (1.1.8); FILE MERGED 2003/05/21 10:10:40 sg 1.1.8.1: #109369#: scenarios are loaded in this class, so derived classes can use it. --- qadevOOo/runner/share/DescGetter.java | 46 ++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/qadevOOo/runner/share/DescGetter.java b/qadevOOo/runner/share/DescGetter.java index 0b15013cadfa..8e13f38575a2 100644 --- a/qadevOOo/runner/share/DescGetter.java +++ b/qadevOOo/runner/share/DescGetter.java @@ -2,9 +2,9 @@ * * $RCSfile: DescGetter.java,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change:$Date: 2003-01-27 16:27:48 $ + * last change:$Date: 2003-05-27 12:04:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,14 +62,52 @@ package share; +import java.util.Vector; +import java.io.BufferedReader; +import java.io.FileReader; + /** * * Base Interface to get a description for a given TestJob * */ -public interface DescGetter { +public abstract class DescGetter { - public DescEntry[] getDescriptionFor(String entry, String DescPath, boolean debug); + public abstract DescEntry[] getDescriptionFor(String entry, + String DescPath, boolean debug); + + protected abstract DescEntry getDescriptionForSingleJob( + String job, String descPath, boolean debug); + + protected DescEntry[] getScenario(String url, String descPath, + boolean debug) { + Vector entryList = new Vector(); + String line = ""; + BufferedReader scenario = null; + DescEntry[] entries = null; + try { + scenario = new BufferedReader(new FileReader(url)); + } catch (java.io.FileNotFoundException fnfe) { + System.out.println("Couldn't find file "+url); + return entries; + } + while (line != null) { + try { + if (line.startsWith("-o")) { + entryList.add(getDescriptionForSingleJob( + line.substring(3).trim(), descPath, debug)); + } + line = scenario.readLine(); + } catch (java.io.IOException ioe) { + if (debug) + System.out.println("Exception while reading scenario"); + } + } + + entries = new DescEntry[entryList.size()]; + entries = (DescEntry[])entryList.toArray(entries); + return entries; + } }