5 * Created on May 29, 2007, 12:00 PM
8 package galago
.tupleflow
;
10 import galago
.tupleflow
.IncompatibleProcessorException
;
11 import galago
.tupleflow
.NullProcessor
;
12 import galago
.tupleflow
.Parameters
;
13 import galago
.tupleflow
.Processor
;
14 import galago
.tupleflow
.Sorter
;
15 import galago
.tupleflow
.TupleFlowParameters
;
16 import galago
.tupleflow
.TypeReader
;
17 import galago
.types
.DocumentLengthWordCount
;
18 import java
.io
.IOException
;
19 import junit
.framework
.*;
25 public class SorterTest
extends TestCase
{
27 public SorterTest(String testName
) {
31 public void testGetInputClass() {
32 System
.out
.println("getInputClass");
33 Sorter instance
= new Sorter( new DocumentLengthWordCount().getOrder( "+document", "+length" ) );
35 Parameters p
= new Parameters();
36 p
.add( "class", DocumentLengthWordCount
.class.toString() );
37 String expResult
= DocumentLengthWordCount
.class.toString();
38 String result
= instance
.getInputClass( new FakeParameters( p
) );
39 assertEquals(expResult
, result
);
42 public void testGetOutputClass() {
43 System
.out
.println("getOutputClass");
44 Sorter instance
= new Sorter( new DocumentLengthWordCount().getOrder( "+document", "+length" ) );
46 Parameters p
= new Parameters();
47 p
.add( "class", DocumentLengthWordCount
.class.toString() );
48 String expResult
= DocumentLengthWordCount
.class.toString();
49 String result
= instance
.getOutputClass( new FakeParameters( p
) );
50 assertEquals(expResult
, result
);
53 public void testProcess() throws Exception
{
54 System
.out
.println("process");
55 DocumentLengthWordCount object
= new DocumentLengthWordCount();
56 Sorter instance
= new Sorter( new DocumentLengthWordCount().getOrder( "+document", "+length" ) );
58 instance
.process(object
);
61 public void testClose() throws Exception
{
62 System
.out
.println("close");
63 System
.out
.println("process");
64 DocumentLengthWordCount object
= new DocumentLengthWordCount();
65 Sorter instance
= new Sorter( new DocumentLengthWordCount().getOrder( "+document", "+length" ) );
67 instance
.setProcessor( new NullProcessor( DocumentLengthWordCount
.class ) );
68 instance
.process(object
);
72 public void testSetProcessor() throws IncompatibleProcessorException
{
73 System
.out
.println("close");
74 System
.out
.println("process");
75 DocumentLengthWordCount object
= new DocumentLengthWordCount();
76 Sorter instance
= new Sorter( new DocumentLengthWordCount().getOrder( "+document", "+length" ) );
78 instance
.setProcessor( new NullProcessor( DocumentLengthWordCount
.class ) );