Coverage Report - br.mia.test.controler.ControladorStep
 
Classes in this File Line Coverage Branch Coverage Complexity
ControladorStep
0%
0/83
0%
0/12
2,333
 
 1  
 package br.mia.test.controler;
 2  
 
 3  
 import java.awt.datatransfer.UnsupportedFlavorException;
 4  
 import java.io.IOException;
 5  
 import java.sql.SQLException;
 6  
 
 7  
 import br.mia.test.model.CasoUso;
 8  
 import br.mia.test.model.Fluxo;
 9  
 import br.mia.test.model.RegraNegocio;
 10  
 import br.mia.test.model.Step;
 11  
 import br.mia.test.model.dao.DAOStep;
 12  
 import br.mia.test.testcase.DadosTeste;
 13  
 import br.mia.test.util.Util;
 14  
 
 15  0
 public class ControladorStep
 16  0
 {
 17  
 
 18  
     public void deletarStep(Step step, CasoUso useCase, Fluxo flow)
 19  
             throws InstantiationException, IllegalAccessException,
 20  
             ClassNotFoundException, SQLException, IOException {
 21  
 
 22  0
         if (step.getId() != 0) {
 23  0
             DAOStep dao = new DAOStep();
 24  0
 
 25  0
             dao.deleteStep(step);
 26  0
 
 27  0
             flow.getSteps().remove(step);
 28  0
 
 29  
         }
 30  
 
 31  0
     }
 32  0
 
 33  
     public void inserirData(DadosTeste data, Step step) {
 34  0
         DAOStep dao = new DAOStep();
 35  0
         try {
 36  0
             dao.insertData(data, step);
 37  0
         } catch (Exception e1) {
 38  0
 
 39  0
             ControladorErro.trata(e1, this);
 40  0
         }
 41  
 
 42  0
     }
 43  0
 
 44  
     public void inserirPasso(Step step, Fluxo flow) {
 45  0
         DAOStep dao = new DAOStep();
 46  0
         try {
 47  0
             step.setCondicional(Boolean.FALSE);
 48  0
             step = dao.insert(step, flow);
 49  0
             flow.getSteps().add(step);
 50  0
         } catch (Exception e1) {
 51  0
             ControladorErro.trata(e1, this);
 52  0
         }
 53  0
     }
 54  
 
 55  0
     public void inserirRegra(RegraNegocio data, Step step, Fluxo flow) {
 56  0
         DAOStep dao = new DAOStep();
 57  0
         try {
 58  0
             dao.insertRule(data, step, flow);
 59  0
         } catch (Exception e1) {
 60  0
             ControladorErro.trata(e1, this);
 61  0
         }
 62  0
     }
 63  
 
 64  
     public void colar(Fluxo fluxo) throws UnsupportedFlavorException,
 65  0
             IOException {
 66  0
         String conteudo = Util.getClipboardContents();
 67  0
 
 68  0
         String[] linhas = conteudo.split("\n");
 69  0
 
 70  0
         for (int i = 0; i <= linhas.length - 1; i++) {
 71  0
 
 72  0
             String descricaoAux = linhas[i].toString();
 73  0
             if (descricaoAux.replaceAll(" ", "").length() > 0) {
 74  0
 
 75  0
                 Step step = new Step();
 76  0
                 step.setDescricao(linhas[i]);
 77  0
 
 78  0
                 DAOStep dao = new DAOStep();
 79  0
                 try {
 80  0
                     step = dao.insert(step, fluxo);
 81  0
                     fluxo.getSteps().add(step);
 82  0
                 } catch (Exception e1) {
 83  0
                     ControladorErro.trata(e1, this);
 84  
                 }
 85  
 
 86  
             }
 87  0
         }
 88  0
     }
 89  
 
 90  
     public void subir(Step step, Step stepAnterior, Fluxo flow,
 91  
             CasoUso useCase, int numero) {
 92  0
 
 93  0
         int indice1 = step.getOrdem();
 94  0
         int indice2 = stepAnterior.getOrdem();
 95  0
 
 96  0
         Step aux = step;
 97  0
 
 98  0
         step = stepAnterior;
 99  0
         stepAnterior = aux;
 100  0
 
 101  0
         step.setOrdem(indice1);
 102  0
         stepAnterior.setOrdem(indice2);
 103  0
 
 104  0
         flow.getSteps().set(numero - 1, step);
 105  0
 
 106  0
         flow.getSteps().set(numero, stepAnterior);
 107  0
 
 108  0
         DAOStep daoStep = new DAOStep();
 109  
 
 110  
         try {
 111  0
 
 112  0
             daoStep.update(step, flow, useCase);
 113  0
             daoStep.update(stepAnterior, flow, useCase);
 114  0
 
 115  0
         } catch (Exception e1) {
 116  0
             ControladorErro.trata(e1, this);
 117  
         }
 118  0
 
 119  0
     }
 120  
 
 121  
 }