EMMA Coverage Report (generated Tue Aug 23 05:57:12 CDT 2011)
[all classes][felix.test]

COVERAGE SUMMARY FOR SOURCE FILE [SchedulerTest.java]

nameclass, %method, %block, %line, %
SchedulerTest.java100% (1/1)100% (4/4)91%  (155/171)88%  (30/34)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SchedulerTest100% (1/1)100% (4/4)91%  (155/171)88%  (30/34)
testSillyPlanner (): void 100% (1/1)90%  (144/160)87%  (26/30)
<static initializer> 100% (1/1)100% (7/7)100% (3/3)
SchedulerTest (): void 100% (1/1)100% (3/3)100% (1/1)
testDecomposition (): void 100% (1/1)100% (1/1)100% (1/1)

1package felix.test;
2 
3import static org.junit.Assert.*;
4 
5import java.util.ArrayList;
6import java.util.HashMap;
7import java.util.HashSet;
8 
9 
10import org.junit.BeforeClass;
11import org.junit.Test;
12 
13import tuffy.util.Timer;
14import tuffy.util.UIMan;
15import felix.compiler.StaticAnalyzer;
16import felix.dstruct.ConcurrentOperatorsBucket;
17import felix.dstruct.ExecutionPlan;
18import felix.dstruct.StatOperator;
19import felix.executor.Executor;
20import felix.main.Felix;
21import felix.optimizer.Scheduler;
22import felix.parser.FelixCommandOptions;
23import felix.util.FelixConfig;
24import felix.util.FelixUIMan;
25 
26 
27/**
28 * Test the scheduler: 1) cost-based optimizer; 2) planner of the
29 * operator order.
30 * @author Ce Zhang
31 *
32 */
33public class SchedulerTest extends Felix{
34        
35        public static ArrayList<Double> planCosts = new ArrayList<Double>();
36        public static String exeTime = "";
37        
38        /**
39         * Test the planner for operator order: One operator A should run before
40         * operator B if A provide information to B or A has a larger precedence.
41         */
42        @Test
43        public final void testSillyPlanner() {
44                try{
45                        String[] args = {"-e", "test/felix/compiler_test_evidence.db", "-i", "test/felix/compiler_test_prog.mln",
46                                        "-o", "test/testOutput.txt", "-queryFile", "test/felix/compiler_test_query.db"};
47                        FelixConfig.overrideID();
48                        FelixCommandOptions options = FelixUIMan.parseCommand(args);
49 
50 
51                        Timer.start("Felix-Timer");
52                        this.options = options;
53                        resetACoupleAuxDataStructures();
54 
55                        fq = this.parseFelixQuery();
56 
57                        sa = new StaticAnalyzer(this.fq, options);
58                        sa.parse();
59 
60                        Scheduler sc = new Scheduler(this, this.fq, options);
61                        ExecutionPlan ep = sc.schedule();
62                        
63                        for(int i = 0; i < ep.operators.size(); i++){
64                                for(int j = 0; j < ep.operators.size(); j ++){
65                                        
66                                        if( i >= j ){
67                                                continue;
68                                        }
69                                        
70                                        ConcurrentOperatorsBucket oup = ep.operators.get(j);
71                                        ConcurrentOperatorsBucket odown = ep.operators.get(i);
72                                        
73                                        if(i < j){
74                                                if(sc.getOperatorBucketGraph().getDownStreamOperator(oup).contains(odown) && 
75                                                                sc.getOperatorBucketGraph().getDownStreamOperator(odown).contains(oup)){
76                                                        assertTrue(oup.getPrecedence() >= odown.getPrecedence());
77                                                }else if(sc.getOperatorBucketGraph().getDownStreamOperator(oup).contains(odown)){
78                                                        assertTrue(true);
79                                                }else if(sc.getOperatorBucketGraph().getDownStreamOperator(odown).contains(oup)){
80                                                        assertTrue(false);
81                                                }else{
82                                                        assertTrue(true);
83                                                }
84                                        }
85                                        
86                                }
87                        }        
88                        
89                }catch(Exception e){
90                        e.printStackTrace();
91                }
92        }
93        
94        /**
95         * Test the cost-based optimizer on a sampled Enron dataset.
96         */
97        @Test
98        public final void testDecomposition(){
99                
100                try{
101/*
102                        double minCost = Double.MAX_VALUE;
103                        double nTime = -1;
104                        
105                        int numberOfIters = 10;
106                        String tobprint = "";
107                        double sum = 0;
108                        for(int i=0;i<numberOfIters;i++){
109                                sum = 0;
110                                Config.pickRandom = true;
111                                String[] args = {"-e", "test/mobius/enron.evid.db.5k", "-i", "test/mobius/enron.prog.mln--",
112                                                "-o", "test/testOutput.txt", "-queryFile", "test/mobius/query.db", "-mcsatSamples", "0"};
113                                
114                                CommandOptions opt = UIMan.parseCommand(args);
115                                Config.explainMode = opt.explainMode;
116                                planCosts.clear();
117                                
118                                new Mobius().run(opt);
119                                
120                                String time = exeTime;
121                                for(Double d : planCosts){
122                                        sum += d;
123                                }
124                                Config.pickRandom = false;
125                                
126                                tobprint += "\nEstimated Cost : " + sum + "\t|\t Execution Time: " + time + "\n";
127                                tobprint += planCosts.toString() + "\n";
128                                System.err.println(tobprint);
129                                
130                                //Manually check whether output is reasonable
131                                
132                        }
133                        */
134                        
135                }catch(Exception e){
136                        e.printStackTrace();
137                        assertTrue(false);
138                }
139 
140        }
141        
142}
143 
144 
145 
146 
147 
148 

[all classes][felix.test]
EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov