Pluglet API tests

git-svn-id: svn://10.0.0.236/trunk@63162 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rpallath%eng.sun.com
2000-03-16 22:06:17 +00:00
parent 60fb3a6608
commit 637c2bb6ce
17 changed files with 2029 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
#!/bin/perl
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Sun Microsystems,
# Inc. Portions created by Sun are
# Copyright (C) 1999 Sun Microsystems, Inc. All
# Rights Reserved.
#
# Contributor(s):
###################################################################
#
# configurator.pl - properties configuration utility
#
# see configurator.readme for details
#
# Global variables
$infile = @ARGV[0];
$outfile = @ARGV[1];
$template = @ARGV[2];
if( $#ARGV < 2) {
printf "Usage: perl configurator.pl infile outfile template\n";
printf "See configurator.readme for details.\n";
exit 0;
};
open( in, $infile )
or die( join '', "Can't open", $infile, " for reading. So bye\n" );
open( out, join '',">",$outfile )
or die( join '', "Can't open", $outfile, " for writing. So bye\n" );
open( temple, $template )
or die( join '', "Can't open template file ",$template," for reading. So bye.\n" );
# Now we will read out all the template file lines into the array.
@storage = <temple>;
while( $l = <in> ) {
# Sign '=' was found and a line isn't a comment
if( ($l !=~ /#/) && ($l =~ /=/) ) {
chop $l;
$l=~s/\r|\n//g;
# avoid linebreaks
@list = split '=',$l;
# Now opening template file
$keyvalue = @list[1];
$keyname = @list[0];
# Now search for keyname and replace it with the actual value.
$pattern = join '', "<",$keyname,">";
for( $i=0; $i<= $#storage; $i++ ) {
$line = @storage[$i];
if( $line =~ /$pattern/ ) {
$line=~s/$pattern/$keyvalue/g;
$storage[$i] = $line;
} # if
} # for
} # if
} # while
# end-of-search
# preparing the output file
for( $i=0; $i <= $#storage; $i++ ) {
printf out $storage[$i];
}
# job was done

View File

@@ -0,0 +1,85 @@
configurator.pl readme file
---------------------------------------------------------
1. About
This utility is necessary for test building. Each
test in suite has each own number of properties.
It is also necessary to the end-user to configurate
properties correct, because of different platforms
test is running under and different situation test
suite must be used.
2. Usage
perl conigurator.pl infile outfile templatefile
infile:
the input file with the key valies. For more
details see "File format section"
outfile:
the output file, that generates from template
and input file. For more details see "File
format section"
template:
the template file, that describes the format
of output file. For more details see "File
format section"
3. File format.
3.1 Input file
The input file format seems to be very easy.
"#" sign in the beginning means comment, empty
lines are ignored. The key features described
as this :
KeyName = KeyValue
generator utility searches for such a strings
and inserts Key values into the key names fields
as it describes in the template section.
3.2 Template file
The template file is a simple file, that uses
signs as following to insert the key values
into the text. Here comes the example.
- Example 1
See some text is goes and Oo-<here>-oO we will insert
the "here" key value, that goes from the input file
-
So, generator will search the string in the input
file like this :
- Example 2
# "Here" key
here = my own value
-
The output will be like this :
- Example 3
See some text is goes and Oo- my own value -oO we
will insert the "here" key value, that goes from the
input file
-
4. FAQ
TBD

View File

@@ -0,0 +1,8 @@
#
# example.input
#
# This file shows, how you can use the input key values
#
key1= somebody@mail.1
key2= noone@mail.2
key3= anonymous@mail.3 (# This does not seems to be a comment)

View File

@@ -0,0 +1,12 @@
#
# example.template
#
# This file shows, how you can use the
# template values.
#
Welcome to the template. You can send a dummy mail to the
one man : somebody@mail.1. If you does like this example you can
send the email to noone@mail.2, anonymous@mail.3 (# This does not seems to be a comment) . Note, that all these
email addresses are in space - there's no such a domains.

View File

@@ -0,0 +1,13 @@
#
# example.template
#
# This file shows, how you can use the
# template values.
#
Welcome to the template. You can send a dummy mail to the
one man : <key1>. If you does like this example you can
send the email to <key2>, <key3> . Note, that all these
email addresses are in space - there's no such a domains.
Thank you.