Commit e9b9823d authored by Fabien Triolet's avatar Fabien Triolet
Browse files

new version of tests

parent 6bb93028
/**
* $Id: AllTests.java,v 1.1 2002-09-30 08:48:05 jerome Exp $
* $Id: AllTests.java,v 1.2 2002-10-28 09:13:56 triolet Exp $
*
* Transmorpher
*
......@@ -32,6 +32,9 @@ import junit.framework.*;
import fr.fluxmedia.transmorpher.Graph.GraphSuite;
import fr.fluxmedia.transmorpher.Utils.UtilsSuite;
import fr.fluxmedia.transmorpher.stdlib.StdlibSuite;
import fr.fluxmedia.transmorpher.TProcessFactory.TProcessFactorySuite;
//import fr.fluxmedia.transmorpher.File.FileSuite;
public class AllTests {
......@@ -45,7 +48,9 @@ public class AllTests {
suite.addTest(fr.fluxmedia.transmorpher.Graph.GraphSuite.suite());
suite.addTest(fr.fluxmedia.transmorpher.Utils.UtilsSuite.suite());
// suite.addTest(fr.fluxmedia.transmorpher.File.FileSuite.suite());
suite.addTest(fr.fluxmedia.transmorpher.stdlib.StdlibSuite.suite());
suite.addTest(fr.fluxmedia.transmorpher.TProcessFactory.TProcessFactorySuite.suite());
return suite;
}
}
......
package fr.fluxmedia.tmcontrib.generator;
import junit.framework.TestCase;
// JUnitDoclet begin import
import fr.fluxmedia.tmcontrib.generator.CSVXMLReader;
// JUnitDoclet end import
/**
* Generated by JUnitDoclet, a tool provided by
* ObjectFab GmbH under LGPL.
* Please see www.junitdoclet.org, www.gnu.org
* and www.objectfab.de for informations about
* the tool, the licence and the the authors.
*/
public class CSVXMLReaderTest
// JUnitDoclet begin extends_implements
extends TestCase
// JUnitDoclet end extends_implements
{
// JUnitDoclet begin class
fr.fluxmedia.tmcontrib.generator.CSVXMLReader csvxmlreader = null;
// JUnitDoclet end class
public CSVXMLReaderTest(String name) {
// JUnitDoclet begin method CSVXMLReaderTest()
super(name);
// JUnitDoclet end method CSVXMLReaderTest()
}
public void setUp() throws Exception {
// JUnitDoclet begin method setUp()
super.setUp();
csvxmlreader = new fr.fluxmedia.tmcontrib.generator.CSVXMLReader();
// JUnitDoclet end method setUp()
}
public void tearDown() throws Exception {
// JUnitDoclet begin method tearDown()
csvxmlreader = null;
super.tearDown();
// JUnitDoclet end method tearDown()
}
public void testParse() throws Exception {
// JUnitDoclet begin method testParse()
// JUnitDoclet end method testParse()
}
public void testSetSeparator() throws Exception {
// JUnitDoclet begin method testSetSeparator()
// JUnitDoclet end method testSetSeparator()
}
/**
* JUnitDoclet moves marker to this method, if there is not match
* for them in the regenerated code and if the marker is not empty.
* This way, no test gets lost when regenerating after renaming.
* Method testVault is supposed to be empty.
*/
public void testVault() throws Exception {
// JUnitDoclet begin method testVault()
// JUnitDoclet end method testVault()
}
}
......@@ -28,7 +28,9 @@ public class GeneratorSuite
suite = new TestSuite("fr.fluxmedia.tmcontrib.generator");
suite.addTestSuite(fr.fluxmedia.tmcontrib.generator.ReadCSVTest.class);
suite.addTestSuite(fr.fluxmedia.tmcontrib.generator.tidyTest.class);
suite.addTestSuite(fr.fluxmedia.tmcontrib.generator.CSVXMLReaderTest.class);
suite.addTestSuite(fr.fluxmedia.tmcontrib.generator.readvcsTest.class);
......
package fr.fluxmedia.tmcontrib.generator;
import junit.framework.TestCase;
// JUnitDoclet begin import
import fr.fluxmedia.tmcontrib.generator.ReadCSV;
// JUnitDoclet end import
/**
* Generated by JUnitDoclet, a tool provided by
* ObjectFab GmbH under LGPL.
* Please see www.junitdoclet.org, www.gnu.org
* and www.objectfab.de for informations about
* the tool, the licence and the the authors.
*/
public class ReadCSVTest
// JUnitDoclet begin extends_implements
extends TestCase
// JUnitDoclet end extends_implements
{
// JUnitDoclet begin class
fr.fluxmedia.tmcontrib.generator.ReadCSV readcsv = null;
// JUnitDoclet end class
public ReadCSVTest(String name) {
// JUnitDoclet begin method ReadCSVTest()
super(name);
// JUnitDoclet end method ReadCSVTest()
}
public void setUp() throws Exception {
// JUnitDoclet begin method setUp()
super.setUp();
readcsv = new fr.fluxmedia.tmcontrib.generator.ReadCSV();
// JUnitDoclet end method setUp()
}
public void tearDown() throws Exception {
// JUnitDoclet begin method tearDown()
readcsv = null;
super.tearDown();
// JUnitDoclet end method tearDown()
}
public void testRead() throws Exception {
// JUnitDoclet begin method testRead()
// JUnitDoclet end method testRead()
}
/**
* JUnitDoclet moves marker to this method, if there is not match
* for them in the regenerated code and if the marker is not empty.
* This way, no test gets lost when regenerating after renaming.
* Method testVault is supposed to be empty.
*/
public void testVault() throws Exception {
// JUnitDoclet begin method testVault()
// JUnitDoclet end method testVault()
}
}
......@@ -43,21 +43,11 @@ extends TestCase
// JUnitDoclet end method tearDown()
}
public void testExecProcess() throws Exception {
// JUnitDoclet begin method testExecProcess()
// JUnitDoclet end method testExecProcess()
}
public void testRead() throws Exception {
// JUnitDoclet begin method testRead()
// JUnitDoclet end method testRead()
}
public void testRun() throws Exception {
// JUnitDoclet begin method testRun()
// JUnitDoclet end method testRun()
}
/**
......
......@@ -43,21 +43,11 @@ extends TestCase
// JUnitDoclet end method tearDown()
}
public void testExecProcess() throws Exception {
// JUnitDoclet begin method testExecProcess()
// JUnitDoclet end method testExecProcess()
}
public void testRead() throws Exception {
// JUnitDoclet begin method testRead()
// JUnitDoclet end method testRead()
}
public void testRun() throws Exception {
// JUnitDoclet begin method testRun()
// JUnitDoclet end method testRun()
}
/**
......
......@@ -29,36 +29,37 @@ public class GraphSuite
suite = new TestSuite("fr.fluxmedia.transmorpher.Graph");
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.QueryTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.PortTest.class);
//Suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ChannelTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.FeedBackTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ProcessTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.TransformerTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ApplyQueryTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.RepeatTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ApplyProcessTest.class);
suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.TransmorpherTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.IteratorTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.DispatchTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.StdOutTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.NullTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.GenerateTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.StdInTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.RepeatProcessTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ApplyExternalTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.SerializeTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ServletTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.MergeTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.PortListTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ApplyRulesetTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.MainTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.RulesetTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.QueryTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.PortTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ChannelTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.FeedBackTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ProcessTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.TransformerTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ApplyQueryTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.RepeatTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ApplyProcessTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.TransmorpherTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.IteratorTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.DispatchTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.StdOutTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.NullTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.GenerateTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.StdInTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.RepeatProcessTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ApplyExternalTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.SerializeTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ServletTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.MergeTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.PortListTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.ApplyRulesetTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.MainTest.class);
// suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.RulesetTest.class);
suite.addTest(fr.fluxmedia.transmorpher.Graph.Rules.RulesSuite.suite());
// JUnitDoclet begin method suite()
suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.TransmorpherTest.class);
// JUnitDoclet end method suite()
return suite;
......
......@@ -30,12 +30,6 @@ extends TestCase
}
public void setUp() throws Exception {
// JUnitDoclet begin method setUp()
super.setUp();
// JUnitDoclet end method setUp()
}
public void testInit() throws Exception {
// JUnitDoclet begin method setUp()
mapatt = new fr.fluxmedia.transmorpher.Graph.Rules.MapAtt("att", "subs" );
assertTrue( mapatt.match.equals("att") );
......
......@@ -18,7 +18,7 @@ import junit.framework.TestCase;
public class RulesSuite
// JUnitDoclet begin extends_implements
extends TestCase // ?? JE
extends TestCase // ?? JE
// JUnitDoclet end extends_implements
{
// JUnitDoclet begin class
......
......@@ -48,6 +48,7 @@ public class RulesSuite
// JUnitDoclet begin method suite()
suite.addTestSuite(fr.fluxmedia.transmorpher.Graph.Rules.CompleteTest.class);
// JUnitDoclet end method suite()
return suite;
......
......@@ -78,6 +78,11 @@ extends TestCase
// JUnitDoclet end method testGenerateEnd()
}
public void testGenerateTransformerMethod() throws Exception {
// JUnitDoclet begin method testGenerateTransformerMethod()
// JUnitDoclet end method testGenerateTransformerMethod()
}
/**
......
......@@ -3,6 +3,14 @@ package fr.fluxmedia.transmorpher.TProcessFactory;
import junit.framework.TestCase;
// JUnitDoclet begin import
import fr.fluxmedia.transmorpher.TProcessFactory.ContentHandlerInfo;
import org.xml.sax.helpers.LocatorImpl;
import org.xml.sax.Locator;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl ;
import org.xml.sax.helpers.DefaultHandler ;
import org.xml.sax.SAXException;
// JUnitDoclet end import
/**
......@@ -32,8 +40,10 @@ extends TestCase
public void setUp() throws Exception {
// JUnitDoclet begin method setUp()
super.setUp();
contenthandlerinfo = new fr.fluxmedia.transmorpher.TProcessFactory.ContentHandlerInfo();
// JUnitDoclet end method setUp()
contenthandlerinfo = new fr.fluxmedia.transmorpher.TProcessFactory.ContentHandlerInfo(0);
// JUnitDoclet end method setUp()
}
public void tearDown() throws Exception {
......@@ -45,41 +55,152 @@ extends TestCase
public void testGetStringParameter() throws Exception {
// JUnitDoclet begin method testGetStringParameter()
ContentHandlerInfo test=new ContentHandlerInfo(2,"test");
assertEquals(test.getCommand(),2);
assertEquals(test.getStringParameter(0),"test");
test=new ContentHandlerInfo(1,"test0","test1","test2");
assertEquals(test.getCommand(),1);
for (int i=0;i<3;i++)
assertEquals(test.getStringParameter(i),"test"+i);
test=null;
// JUnitDoclet end method testGetStringParameter()
}
public void testGetIntParameter() throws Exception {
// JUnitDoclet begin method testGetIntParameter()
char[] ch={'t','e'};
ContentHandlerInfo test=new ContentHandlerInfo(2,ch,0,2);
assertEquals(test.getIntParameter(0),0);
assertEquals(test.getIntParameter(1),2);
ch=null;
test=null;
// JUnitDoclet end method testGetIntParameter()
}
public void testGetLocatorParameter() throws Exception {
// JUnitDoclet begin method testGetLocatorParameter()
// JUnitDoclet end method testGetLocatorParameter()
Locator loc=new LocatorImpl();
ContentHandlerInfo test=new ContentHandlerInfo(2,loc);
assertEquals(test.getLocatorParameter(),loc);
loc=null;
test=null;
// JUnitDoclet end method testGetLocatorParameter()
}
public void testGetAttributes() throws Exception {
// JUnitDoclet begin method testGetAttributes()
Attributes att=new AttributesImpl();
ContentHandlerInfo test=new ContentHandlerInfo(2,"t","t","t",att);
//test creates a new Attributes object with att.
//assertEquals(test.getAttributes(),att);
// JUnitDoclet end method testGetAttributes()
}
public void testGetCommand() throws Exception {
// JUnitDoclet begin method testGetCommand()
assertEquals(contenthandlerinfo.getCommand(),0);
ContentHandlerInfo test=new ContentHandlerInfo(2);
assertEquals(test.getCommand(),2);
test=null;
// JUnitDoclet end method testGetCommand()
}
public void testGetCharParameter() throws Exception {
// JUnitDoclet begin method testGetCharParameter()
char[] ch={'t','e','s','t'};
char[] chTest;
ContentHandlerInfo test=new ContentHandlerInfo(2,ch,0,2);
chTest=test.getCharParameter();
for (int i=0;i<chTest.length;i++)
assertEquals(ch[i],chTest[i]);
ch=null;
chTest=null;
test=null;
// JUnitDoclet end method testGetCharParameter()
}
public void testToString() throws Exception {
// JUnitDoclet begin method testToString()
ContentHandlerInfo test = new ContentHandlerInfo(0);
assertEquals(test.toString(),"START_ELEMENT");
test = new ContentHandlerInfo(1);
assertEquals(test.toString(),"END_ELEMENT");
test = new ContentHandlerInfo(2);
assertEquals(test.toString(),"START_DOCUMENT");
test = new ContentHandlerInfo(3);
assertEquals(test.toString(),"END_DOCUMENT");
test = new ContentHandlerInfo(4);
assertEquals(test.toString(),"SET_DOCUMENT_LOCATOR");
test = new ContentHandlerInfo(5);
assertEquals(test.toString(),"SKIPPED_ENTITY");
test = new ContentHandlerInfo(6);
assertEquals(test.toString(),"IGNORABLE_WHITESPACE");
test = new ContentHandlerInfo(7);
assertEquals(test.toString(),"PROCESSING_INSTRUCTION");
test = new ContentHandlerInfo(8);
assertEquals(test.toString(),"CHARACTERS");
test = new ContentHandlerInfo(9);
assertEquals(test.toString(),"START_PREFIX_MAPPING");
test = new ContentHandlerInfo(10);
assertEquals(test.toString(),"END_PREFIX_MAPPING");
test=null;
// JUnitDoclet end method testToString()
}
public void testSendEvent() throws Exception {
// JUnitDoclet begin method testSendEvent()
UnitTestHandler defHandler = new UnitTestHandler();
Attributes att=new AttributesImpl();
ContentHandlerInfo test=new ContentHandlerInfo(0,"","","test",att);
test.sendEvent(defHandler);
test=new ContentHandlerInfo(1,"","","test");
test.sendEvent(defHandler);
test=new ContentHandlerInfo(2);
test.sendEvent(defHandler);
test=new ContentHandlerInfo(3);
test.sendEvent(defHandler);
Locator loc=new LocatorImpl();
test=new ContentHandlerInfo(4,loc);
test=new ContentHandlerInfo(7,"target","data");
test.sendEvent(defHandler);
char[] ch={'t','e','s','t'};
test=new ContentHandlerInfo(8,ch,0,4);
test.sendEvent(defHandler);
test=new ContentHandlerInfo(9,"aa","bb");
test.sendEvent(defHandler);
test=new ContentHandlerInfo(10,"aa");
test.sendEvent(defHandler);
// JUnitDoclet end method testSendEvent()
}
......@@ -95,5 +216,61 @@ extends TestCase
// JUnitDoclet begin method testVault()
// JUnitDoclet end method testVault()
}
class UnitTestHandler extends DefaultHandler{
boolean isDocument=false;
Object test="";
public void startDocument() throws SAXException {
isDocument=true;
}
public void endDocument() throws SAXException {
assertTrue(isDocument);
isDocument=false;
}
public void startElement(String ns, String localName, String name, Attributes atts) throws SAXException {
assertEquals(ns,"");
assertEquals(localName,"");
assertTrue(atts!=null);
assertEquals(name,"test");
}
public final void setDocumentLocator(Locator locator) {
assertTrue(locator!=null);
test=locator;
}
public final void processingInstruction(java.lang.String target, java.lang.String data) throws SAXException {
assertEquals(target,"target");
assertEquals(data,"data");
test=target;
}
public void endElement(String ns, String localName, String name) throws SAXException {
assertEquals(ns,"");
assertEquals(localName,"");
assertEquals(name,"test");
}
public final void characters(char[] ch, int start, int length) throws SAXException{
assertEquals(ch[start],'t');
assertEquals(length,4);
test=ch;
}
public void startPrefixMapping(String ns,String uri) throws SAXException{
assertEquals(ns,"aa");
assertEquals(uri,"bb");
}
public void endPrefixMapping(String ns) throws SAXException{
assertEquals(ns,"aa");
}
public Object getTest(){
return test;
}
}
}
......@@ -28,20 +28,22 @@ public class TProcessFactorySuite
suite = new TestSuite("fr.fluxmedia.transmorpher.TProcessFactory");
suite.addTestSuite(fr.fluxmedia.transmorpher.TProcessFactory.TChannelTest.class);
suite.addTestSuite(fr.fluxmedia.transmorpher.TProcessFactory.ContentHandlerInfoTest.class);
suite.addTestSuite(fr.fluxmedia.transmorpher.TProcessFactory.TProcessComponentTest.class);
suite.addTestSuite(fr.fluxmedia.