Commit b9527adb65a94d85312262d01cf918d9bdb4632f
1 parent
9b3a62f6
Exists in
master
and in
1 other branch
feature de detalhamento da avaliação
git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/ASES%20-%20Web/ASES%20-%20Web/Fontes/avaliador-web@9539 c2178572-b5ca-4887-91d2-9e3a90c7d55b
Showing
11 changed files
with
341 additions
and
52 deletions
Show diff stats
src/main/java/br/com/ases/business/AvaliacaoBusiness.java
1 | 1 | package br.com.ases.business; |
2 | 2 | |
3 | 3 | import java.util.List; |
4 | +import java.util.Map; | |
4 | 5 | |
5 | 6 | import br.com.ases.controller.EseloController.Nota; |
7 | +import br.com.ases.domain.OccurrenceKey; | |
8 | +import br.com.checker.emag.Occurrence; | |
6 | 9 | import br.com.checker.emag.OccurrenceClassification; |
7 | 10 | import br.com.checker.emag.SummarizedOccurrence; |
8 | 11 | |
9 | 12 | |
10 | 13 | public interface AvaliacaoBusiness { |
11 | - | |
12 | - public List<SummarizedOccurrence> ocorrenciasNaoComputadas(List<SummarizedOccurrence> ocorrenciasAvaliadas,OccurrenceClassification tipo ); | |
13 | - public Nota obterNota(List<SummarizedOccurrence> occurrences,String url); | |
14 | + Nota obterNota(List<SummarizedOccurrence> occurrences,String url); | |
15 | + Map<OccurrenceKey,Map<String,List<Occurrence>>> retornarCriterios(Map<OccurrenceClassification,List<Occurrence>> resultadoAvaliacao); | |
14 | 16 | } | ... | ... |
src/main/java/br/com/ases/business/impl/AvaliacaoBusinessImpl.java
1 | 1 | package br.com.ases.business.impl; |
2 | 2 | |
3 | 3 | import java.util.ArrayList; |
4 | -import java.util.Date; | |
4 | +import java.util.HashMap; | |
5 | 5 | import java.util.List; |
6 | +import java.util.Map; | |
7 | +import java.util.Map.Entry; | |
6 | 8 | |
7 | 9 | import br.com.ases.business.AvaliacaoBusiness; |
8 | 10 | import br.com.ases.controller.EseloController.Nota; |
11 | +import br.com.ases.domain.OccurrenceKey; | |
9 | 12 | import br.com.ases.infra.WebChecker; |
10 | 13 | import br.com.caelum.vraptor.ioc.Component; |
14 | +import br.com.checker.emag.Occurrence; | |
11 | 15 | import br.com.checker.emag.OccurrenceClassification; |
12 | 16 | import br.com.checker.emag.SummarizedOccurrence; |
13 | 17 | |
... | ... | @@ -20,23 +24,6 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness{ |
20 | 24 | |
21 | 25 | private static final String CALCULAR_NOTA_REST = "https://sistemas-treinamento.ifbaiano.edu.br/eselo/calcular-nota"; |
22 | 26 | |
23 | - public List<SummarizedOccurrence> ocorrenciasNaoComputadas(List<SummarizedOccurrence> ocorrenciasAvaliadas,OccurrenceClassification tipo ) { | |
24 | - | |
25 | - List<SummarizedOccurrence> ocorrenciasNaoComputadas = new ArrayList<SummarizedOccurrence>(); | |
26 | - | |
27 | - SummarizedOccurrence.Builder builder = null; | |
28 | - for(int i = tipo.getStart() ;i <= tipo.getEnd() ; i++) { | |
29 | - builder = new SummarizedOccurrence.Builder() | |
30 | - .setCheckPoint(String.valueOf(i)); | |
31 | - if(!ocorrenciasAvaliadas.contains(builder.build())){ | |
32 | - ocorrenciasNaoComputadas.add(builder.setType(tipo) | |
33 | - .setIsError(false).build()); | |
34 | - } | |
35 | - } | |
36 | - | |
37 | - return ocorrenciasNaoComputadas; | |
38 | - } | |
39 | - | |
40 | 27 | public Nota obterNota(List<SummarizedOccurrence> occurrences,String url) { |
41 | 28 | |
42 | 29 | WebChecker.PostParams postParams = WebChecker.from(CALCULAR_NOTA_REST).withPostRequest() |
... | ... | @@ -55,10 +42,84 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness{ |
55 | 42 | Gson g = new GsonBuilder().create(); |
56 | 43 | Nota nota = g.fromJson(postParams.execute().getContent(), Nota.class); |
57 | 44 | |
45 | + return nota; | |
46 | + } | |
47 | + | |
48 | + | |
49 | + | |
50 | + public Map<OccurrenceKey,Map<String,List<Occurrence>>> retornarCriterios(Map<OccurrenceClassification,List<Occurrence>> resultadoAvaliacao){ | |
58 | 51 | |
52 | + Map<OccurrenceKey,Map<String,List<Occurrence>>> resultadoCriterios = new HashMap<OccurrenceKey, Map<String,List<Occurrence>>>(); | |
59 | 53 | |
54 | + for( Entry<OccurrenceClassification,List<Occurrence>> entrada: resultadoAvaliacao.entrySet()) { | |
55 | + | |
56 | + for(Entry<OccurrenceKey,List<Occurrence>> ocorrenciasPorRN : agruparOcorrenciaPorRN(entrada.getValue()).entrySet()){ | |
60 | 57 | |
61 | - return nota; | |
58 | + if(resultadoCriterios.get(ocorrenciasPorRN.getKey())== null) | |
59 | + resultadoCriterios.put(ocorrenciasPorRN.getKey(), new HashMap<String, List<Occurrence>>()); | |
60 | + | |
61 | + | |
62 | + Map<String,List<Occurrence>> mapaCriterios = resultadoCriterios.get(ocorrenciasPorRN.getKey()); | |
63 | + for(Occurrence ocorrencia : ocorrenciasPorRN.getValue()){ | |
64 | + | |
65 | + if (mapaCriterios.get(ocorrencia.getCriterio()) == null) | |
66 | + mapaCriterios.put(ocorrencia.getCriterio(), new ArrayList<Occurrence>()); | |
67 | + | |
68 | + mapaCriterios.get(ocorrencia.getCriterio()).add(ocorrencia); | |
69 | + | |
70 | + } | |
71 | + } | |
72 | + | |
73 | + } | |
74 | + | |
75 | + return resultadoCriterios; | |
76 | + | |
62 | 77 | } |
63 | - | |
78 | + | |
79 | + | |
80 | + private Map<OccurrenceKey,List<Occurrence>> agruparOcorrenciaPorRN(List<Occurrence> occurrences) { | |
81 | + | |
82 | + Map<OccurrenceKey,List<Occurrence>> map = new HashMap<OccurrenceKey, List<Occurrence>>(); | |
83 | + OccurrenceKey occurrenceKey = null; | |
84 | + for(Occurrence occurrence : occurrences) { | |
85 | + occurrenceKey = new OccurrenceKey(occurrence); | |
86 | + | |
87 | + if(map.get(occurrenceKey) ==null) { | |
88 | + map.put(occurrenceKey, new ArrayList<Occurrence>()); | |
89 | + map.get(occurrenceKey).add(occurrence); | |
90 | + }else { | |
91 | + map.get(occurrenceKey).add(occurrence); | |
92 | + } | |
93 | + | |
94 | + } | |
95 | + return map; | |
96 | + } | |
97 | + | |
98 | + public static Map<OccurrenceClassification,List<Occurrence>> resultadoAvaliacao = new HashMap<OccurrenceClassification, List<Occurrence>>(); | |
99 | + | |
100 | + static { | |
101 | + Occurrence ocorrencia1 = new Occurrence(10, 5, "1", true, "<a hrf=\"#home\">Tag home completa</a>",OccurrenceClassification.MARK,"1"); | |
102 | + Occurrence ocorrencia2 = new Occurrence(55, 10, "1", false, "<a hrf=\"#home2\">Tag home completa 2</a>",OccurrenceClassification.MARK,"1"); | |
103 | + Occurrence ocorrencia3 = new Occurrence(60, 5, "2", true, "<h1>Teste</h1>",OccurrenceClassification.MARK,"2"); | |
104 | + Occurrence ocorrencia4 = new Occurrence(90, 10, "2", false, "<h2>Teste H2</h2>",OccurrenceClassification.MARK,"3"); | |
105 | + List<Occurrence> ocorrenciasMarcacao = new ArrayList<Occurrence>(); | |
106 | + ocorrenciasMarcacao.add(ocorrencia1); | |
107 | + ocorrenciasMarcacao.add(ocorrencia2); | |
108 | + ocorrenciasMarcacao.add(ocorrencia3); | |
109 | + ocorrenciasMarcacao.add(ocorrencia4); | |
110 | + | |
111 | + Occurrence ocorrencia1Comportamento = new Occurrence(10, 5, "3", true, "<a hrf=\"#home\">Tag home completa</a>",OccurrenceClassification.BEHAVIOR,"1"); | |
112 | + Occurrence ocorrencia2Comportamento = new Occurrence(55, 10, "3", false, "<a hrf=\"#home2\">Tag home completa 2</a>",OccurrenceClassification.BEHAVIOR,"1"); | |
113 | + Occurrence ocorrencia3Comportamento = new Occurrence(60, 5, "3", true, "<h1>Teste</h1>",OccurrenceClassification.BEHAVIOR,"2"); | |
114 | + Occurrence ocorrencia4Comportamento = new Occurrence(90, 10, "4", false, "<h2>Teste H2</h2>",OccurrenceClassification.BEHAVIOR,"2"); | |
115 | + List<Occurrence> ocorrenciasComportamento = new ArrayList<Occurrence>(); | |
116 | + ocorrenciasComportamento.add(ocorrencia1Comportamento); | |
117 | + ocorrenciasComportamento.add(ocorrencia2Comportamento); | |
118 | + ocorrenciasComportamento.add(ocorrencia3Comportamento); | |
119 | + ocorrenciasComportamento.add(ocorrencia4Comportamento); | |
120 | + | |
121 | + resultadoAvaliacao.put(OccurrenceClassification.MARK, ocorrenciasMarcacao); | |
122 | + resultadoAvaliacao.put(OccurrenceClassification.BEHAVIOR, ocorrenciasComportamento); | |
123 | + } | |
124 | + | |
64 | 125 | } | ... | ... |
src/main/java/br/com/ases/controller/AvaliacaoController.java
1 | 1 | package br.com.ases.controller; |
2 | 2 | |
3 | 3 | import static br.com.checker.emag.core.Checker.behavior; |
4 | +import static br.com.checker.emag.core.Checker.content; | |
4 | 5 | import static br.com.checker.emag.core.Checker.form; |
5 | 6 | import static br.com.checker.emag.core.Checker.from; |
6 | 7 | import static br.com.checker.emag.core.Checker.marking; |
7 | 8 | import static br.com.checker.emag.core.Checker.multimedia; |
8 | -import static br.com.checker.emag.core.Checker.content; | |
9 | 9 | import static br.com.checker.emag.core.Checker.presentation; |
10 | 10 | |
11 | 11 | import java.io.BufferedReader; |
... | ... | @@ -25,6 +25,8 @@ import net.sf.jasperreports.engine.JRException; |
25 | 25 | import br.com.ases.business.AvaliacaoBusiness; |
26 | 26 | import br.com.ases.business.impl.AvaliacaoBusinessImpl; |
27 | 27 | import br.com.ases.controller.EseloController.Nota; |
28 | +import br.com.ases.domain.DetalheAvaliacao; | |
29 | +import br.com.ases.domain.OccurrenceKey; | |
28 | 30 | import br.com.ases.domain.ResumoAvaliacao; |
29 | 31 | import br.com.ases.infra.WebChecker; |
30 | 32 | import br.com.ases.model.utilities.ManagerReport; |
... | ... | @@ -47,11 +49,14 @@ public class AvaliacaoController { |
47 | 49 | private AvaliacaoBusiness avaliacaoBusiness; |
48 | 50 | private Map<OccurrenceClassification,List<SummarizedOccurrence>> ocorrencias = new HashMap<OccurrenceClassification, List<SummarizedOccurrence>>(); |
49 | 51 | private ServletContext application; |
52 | + private DetalheAvaliacao detalheAvaliacao; | |
50 | 53 | |
51 | - public AvaliacaoController (Result result, AvaliacaoBusiness avaliacaoBusiness,ServletContext application) { | |
54 | + public AvaliacaoController (Result result, AvaliacaoBusiness avaliacaoBusiness,ServletContext application,DetalheAvaliacao detalheAvaliacao) { | |
52 | 55 | this.result = result; |
53 | 56 | this.avaliacaoBusiness = avaliacaoBusiness; |
54 | 57 | this.application = application; |
58 | + this.detalheAvaliacao = detalheAvaliacao; | |
59 | + | |
55 | 60 | } |
56 | 61 | |
57 | 62 | |
... | ... | @@ -123,6 +128,7 @@ public class AvaliacaoController { |
123 | 128 | result.include("nota",avaliacaoBusiness.obterNota(checker.checkSumarized(),url)); |
124 | 129 | this.sumarizarResultasNoResponse(checker.checkSumarized(), result); |
125 | 130 | |
131 | + this.detalheAvaliacao.inicializar(avaliacaoBusiness.retornarCriterios(AvaliacaoBusinessImpl.resultadoAvaliacao)); | |
126 | 132 | VRaptorRequestHolder.currentRequest().getServletContext().setAttribute("resultadoAvaliacao", checker.checkSumarized()); |
127 | 133 | |
128 | 134 | } |
... | ... | @@ -308,11 +314,9 @@ public class AvaliacaoController { |
308 | 314 | } |
309 | 315 | |
310 | 316 | |
311 | - @Path("/detalhes-avaliacao") | |
312 | - public void detalhesAvaliacao(String checkPoint, String hashCode){ | |
313 | - List<SummarizedOccurrence> res = (List<SummarizedOccurrence>) VRaptorRequestHolder.currentRequest().getServletContext().getAttribute("resultadoAvaliacao"); | |
314 | - result.include("detalhesAvaliacao",res); | |
315 | - //result.include("recomendacao",resultado.getMapDescription().get(resultado.getCheckPoint())); | |
317 | + @Path("/detalhes-avaliacao/{rn}") | |
318 | + public void detalhesAvaliacao(OccurrenceKey rn){ | |
319 | + result.include("detalhe",this.detalheAvaliacao.get(rn)); | |
316 | 320 | } |
317 | 321 | |
318 | 322 | } |
319 | 323 | \ No newline at end of file | ... | ... |
src/main/java/br/com/ases/converters/OccurrenceKeyConverter.java
0 → 100644
... | ... | @@ -0,0 +1,24 @@ |
1 | +package br.com.ases.converters; | |
2 | + | |
3 | +import java.util.ResourceBundle; | |
4 | + | |
5 | +import org.apache.commons.lang3.StringUtils; | |
6 | + | |
7 | +import br.com.ases.domain.OccurrenceKey; | |
8 | +import br.com.caelum.vraptor.Convert; | |
9 | +import br.com.caelum.vraptor.Converter; | |
10 | +import br.com.caelum.vraptor.ioc.RequestScoped; | |
11 | + | |
12 | +@Convert(OccurrenceKey.class) | |
13 | +@RequestScoped | |
14 | +public class OccurrenceKeyConverter implements Converter<OccurrenceKey> { | |
15 | + | |
16 | + public OccurrenceKey convert(String value, | |
17 | + Class<? extends OccurrenceKey> type, ResourceBundle bundle) { | |
18 | + | |
19 | + if (StringUtils.isEmpty(value)) return null; | |
20 | + | |
21 | + return OccurrenceKey.valueOf(value); | |
22 | + } | |
23 | + | |
24 | +} | ... | ... |
... | ... | @@ -0,0 +1,73 @@ |
1 | +package br.com.ases.domain; | |
2 | + | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.List; | |
5 | +import java.util.Map; | |
6 | +import java.util.Map.Entry; | |
7 | + | |
8 | +import lombok.Getter; | |
9 | +import br.com.ases.infra.CriterioProperties; | |
10 | +import br.com.caelum.vraptor.Resource; | |
11 | +import br.com.caelum.vraptor.ioc.SessionScoped; | |
12 | +import br.com.checker.emag.Occurrence; | |
13 | + | |
14 | +@Resource | |
15 | +@SessionScoped | |
16 | +public class DetalheAvaliacao { | |
17 | + | |
18 | + private CriterioProperties criterioProperties; | |
19 | + private Map<OccurrenceKey,Map<String,List<Occurrence>>> detalhes; | |
20 | + | |
21 | + public DetalheAvaliacao(CriterioProperties criterioProperties){ | |
22 | + this.criterioProperties = criterioProperties; | |
23 | + } | |
24 | + | |
25 | + public void inicializar(Map<OccurrenceKey,Map<String,List<Occurrence>>> detalhes) { | |
26 | + this.detalhes = detalhes; | |
27 | + } | |
28 | + | |
29 | + | |
30 | + public Detalhe get(OccurrenceKey rn) { | |
31 | + return new Detalhe(rn.getCode(),this.detalhes.get(rn)); | |
32 | + } | |
33 | + | |
34 | + | |
35 | + public @Getter class Detalhe { | |
36 | + | |
37 | + private List<Criterio> criterios; | |
38 | + private List<Occurrence> ocorrencias; | |
39 | + | |
40 | + public Detalhe(String rn,Map<String, List<Occurrence>> map) { | |
41 | + | |
42 | + this.ocorrencias = new ArrayList<Occurrence>(); | |
43 | + this.criterios = new ArrayList<DetalheAvaliacao.Criterio>(); | |
44 | + | |
45 | + for(Entry<String, List<Occurrence>> entry : map.entrySet()){ | |
46 | + criterios.add(new Criterio(rn,entry.getKey(),entry.getValue())); | |
47 | + | |
48 | + for(Occurrence ocorrencia : entry.getValue()) | |
49 | + ocorrencias.add(ocorrencia); | |
50 | + } | |
51 | + } | |
52 | + | |
53 | + } | |
54 | + | |
55 | + public @Getter class Criterio { | |
56 | + private String id; | |
57 | + private String descricao; | |
58 | + private List<String> linhas; | |
59 | + private String numeroOcorrencias; | |
60 | + | |
61 | + public Criterio(String rn, String key,List<Occurrence> ocorrencias) { | |
62 | + this.linhas = new ArrayList<String>(); | |
63 | + //TODO concatenar rn + key | |
64 | + this.descricao = criterioProperties.getDescricao("1.1"); | |
65 | + | |
66 | + this.id = key; | |
67 | + for(Occurrence ocorrencia : ocorrencias) { | |
68 | + linhas.add(ocorrencia.getLine().toString()); | |
69 | + } | |
70 | + this.numeroOcorrencias = String.valueOf(ocorrencias.size()); | |
71 | + } | |
72 | + } | |
73 | +} | ... | ... |
... | ... | @@ -0,0 +1,25 @@ |
1 | +package br.com.ases.domain; | |
2 | + | |
3 | +import lombok.EqualsAndHashCode; | |
4 | +import lombok.Getter; | |
5 | +import br.com.checker.emag.Occurrence; | |
6 | + | |
7 | + | |
8 | +@EqualsAndHashCode | |
9 | +public @Getter class OccurrenceKey { | |
10 | + private String code; | |
11 | + | |
12 | + public OccurrenceKey (Occurrence occurrence) { | |
13 | + this.code = occurrence.getCode(); | |
14 | + } | |
15 | + | |
16 | + private OccurrenceKey(String code){ | |
17 | + this.code = code; | |
18 | + } | |
19 | + | |
20 | + public static OccurrenceKey valueOf(String code){ | |
21 | + return new OccurrenceKey(code); | |
22 | + } | |
23 | + | |
24 | + | |
25 | +} | |
0 | 26 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,32 @@ |
1 | +package br.com.ases.infra; | |
2 | + | |
3 | +import java.io.IOException; | |
4 | +import java.util.Properties; | |
5 | + | |
6 | +import javax.servlet.ServletContext; | |
7 | + | |
8 | +import br.com.caelum.vraptor.Resource; | |
9 | +import br.com.caelum.vraptor.ioc.ApplicationScoped; | |
10 | + | |
11 | +@Resource | |
12 | +@ApplicationScoped | |
13 | +public class CriterioProperties { | |
14 | + | |
15 | + private static String PROPERTIES_PATH = "/WEB-INF/criteriosDescriptions.properties"; | |
16 | + private Properties properties = new Properties(); | |
17 | + | |
18 | + public CriterioProperties(ServletContext servletContext) { | |
19 | + | |
20 | + try { | |
21 | + this.properties.load(servletContext.getResourceAsStream(PROPERTIES_PATH)); | |
22 | + } catch (IOException e) { | |
23 | + e.printStackTrace(); | |
24 | + } | |
25 | + } | |
26 | + | |
27 | + public String getDescricao(String key) { | |
28 | + return this.properties.getProperty(key); | |
29 | + } | |
30 | + | |
31 | + | |
32 | +} | ... | ... |
src/main/webapp/WEB-INF/criteriosDescriptions.properties
0 → 100644
... | ... | @@ -0,0 +1,10 @@ |
1 | +#DESCRICAO DOS CRITERIOS DE CADA RN | |
2 | +#FORMATO DA CHAEVE = X.Y --- ONDE X É O NÚMERO DA RN E Y O NÚMERO DO CRITERIO | |
3 | + | |
4 | + | |
5 | +1.1=Descrição criterio 1 da RN 1 | |
6 | + | |
7 | +2.1=Descrição criterio 1 da RN 2 | |
8 | +2.2=Descrição criterio 2 da RN 2 | |
9 | + | |
10 | + | |
0 | 11 | \ No newline at end of file | ... | ... |
src/main/webapp/WEB-INF/jsp/avaliacao/detalhesAvaliacao.jsp
... | ... | @@ -29,18 +29,18 @@ |
29 | 29 | </tr> |
30 | 30 | |
31 | 31 | |
32 | - <c:forEach items="${detalhesAvaliacao}" var="detalhe"> | |
32 | + <c:forEach items="${detalhe.criterios}" var="criterio"> | |
33 | 33 | |
34 | 34 | |
35 | 35 | <tr> |
36 | - <td class="celula" width="2%"> ${detalhe.checkPoint} </td> | |
37 | - <td class="celula" width="60%" align="left">${detalhe.description}</td> | |
36 | + <td class="celula" width="2%"> ${criterio.id} </td> | |
37 | + <td class="celula" width="60%" align="left">${criterio.descricao}</td> | |
38 | 38 | |
39 | - <td class="celula">${detalhe.numberOfOccurrences}</td> | |
39 | + <td class="celula">${criterio.numeroOcorrencias}</td> | |
40 | 40 | <td class="celula"> |
41 | - | |
42 | - <a href="#${detalhe.stringLines}" class="sublinharLink"> ${detalhe.stringLines}</a> | |
43 | - | |
41 | + <c:forEach items="${criterio.linhas}" var="linha"> | |
42 | + <a href="#${linha}" class="sublinharLink"> ${linha}</a> - | |
43 | + </c:forEach> | |
44 | 44 | </td> |
45 | 45 | </tr> |
46 | 46 | |
... | ... | @@ -57,9 +57,8 @@ |
57 | 57 | </div> |
58 | 58 | <div id="codigo" align="left"> |
59 | 59 | <pre> |
60 | - <!-- <a name="0048">0048 :<script type="text/javascript" </a> --> | |
61 | - <c:forEach items="${detalhesAvaliacao}" var="detalhe"> | |
62 | - <a name="${detalhe.stringLines}">${detalhe.sourceCode}</a> | |
60 | + <c:forEach items="${detalhe.ocorrencias}" var="ocorrencia"> | |
61 | + <a name="${ocorrencia.line}">${ocorrencia.line}: ${ocorrencia.tag}</a> | |
63 | 62 | </c:forEach> |
64 | 63 | </pre> |
65 | 64 | </div> | ... | ... |
src/main/webapp/WEB-INF/tags/listaResultado.tag
... | ... | @@ -19,12 +19,7 @@ |
19 | 19 | |
20 | 20 | <td class="celula">${item.numberOfOccurrences}</td> |
21 | 21 | <td class="celula"> |
22 | - | |
23 | - <a class="sublinharLink" onclick=" $( '.dialog_${item.checkPoint}' ).dialog();">${item.stringLines}</a> | |
24 | - <div id="dialog" title="Codigo Fonte" class="dialog_${item.checkPoint}"> | |
25 | - <p>${item.sourceCode}</p> | |
26 | - </div> | |
27 | - | |
22 | + <a class="sublinharLink" href="detalhes-avaliacao/${item.checkPoint}">${item.stringLines}</a> | |
28 | 23 | </td> |
29 | 24 | </tr> |
30 | 25 | </c:if> |
... | ... | @@ -55,12 +50,7 @@ |
55 | 50 | |
56 | 51 | <td class="celula">${item.numberOfOccurrences}</td> |
57 | 52 | <td class="celula"> |
58 | - | |
59 | - <a class="sublinharLink" onclick=" $( '.dialog_${item.checkPoint}' ).dialog();">${item.stringLines}</a> | |
60 | - <div id="dialog" title="Codigo Fonte" class="dialog_${item.checkPoint}"> | |
61 | - <p>${item.sourceCode}</p> | |
62 | - </div> | |
63 | - | |
53 | + <a class="sublinharLink" href="detalhes-avaliacao/${item.checkPoint}">${item.stringLines}</a> | |
64 | 54 | </td> |
65 | 55 | </tr> |
66 | 56 | </c:if> | ... | ... |
src/test/java/br/com/ases/business/AvaliacaoBusinessTest.java
0 → 100644
... | ... | @@ -0,0 +1,69 @@ |
1 | +package br.com.ases.business; | |
2 | + | |
3 | +import java.util.ArrayList; | |
4 | +import java.util.HashMap; | |
5 | +import java.util.List; | |
6 | +import java.util.Map; | |
7 | +import java.util.Map.Entry; | |
8 | + | |
9 | +import org.junit.Test; | |
10 | +import org.junit.runner.RunWith; | |
11 | +import org.junit.runners.JUnit4; | |
12 | + | |
13 | +import br.com.ases.business.impl.AvaliacaoBusinessImpl; | |
14 | +import br.com.ases.domain.OccurrenceKey; | |
15 | +import br.com.checker.emag.Occurrence; | |
16 | +import br.com.checker.emag.OccurrenceClassification; | |
17 | + | |
18 | +@RunWith(JUnit4.class) | |
19 | +public class AvaliacaoBusinessTest { | |
20 | + | |
21 | + @Test | |
22 | + public void deveAgruparResultadoAvaliacaoPorCriterios() { | |
23 | + AvaliacaoBusiness avaliacaoBusiness = new AvaliacaoBusinessImpl(); | |
24 | + | |
25 | + Occurrence ocorrencia1 = new Occurrence(10, 5, "1", true, "<a hrf=\"#home\">Tag home completa</a>",OccurrenceClassification.MARK,"1"); | |
26 | + Occurrence ocorrencia2 = new Occurrence(55, 10, "1", false, "<a hrf=\"#home2\">Tag home completa 2</a>",OccurrenceClassification.MARK,"1"); | |
27 | + Occurrence ocorrencia3 = new Occurrence(60, 5, "2", true, "<h1>Teste</h1>",OccurrenceClassification.MARK,"2"); | |
28 | + Occurrence ocorrencia4 = new Occurrence(90, 10, "2", false, "<h2>Teste H2</h2>",OccurrenceClassification.MARK,"3"); | |
29 | + List<Occurrence> ocorrenciasMarcacao = new ArrayList<Occurrence>(); | |
30 | + ocorrenciasMarcacao.add(ocorrencia1); | |
31 | + ocorrenciasMarcacao.add(ocorrencia2); | |
32 | + ocorrenciasMarcacao.add(ocorrencia3); | |
33 | + ocorrenciasMarcacao.add(ocorrencia4); | |
34 | + | |
35 | + Occurrence ocorrencia1Comportamento = new Occurrence(10, 5, "3", true, "<a hrf=\"#home\">Tag home completa</a>",OccurrenceClassification.BEHAVIOR,"1"); | |
36 | + Occurrence ocorrencia2Comportamento = new Occurrence(55, 10, "3", false, "<a hrf=\"#home2\">Tag home completa 2</a>",OccurrenceClassification.BEHAVIOR,"1"); | |
37 | + Occurrence ocorrencia3Comportamento = new Occurrence(60, 5, "3", true, "<h1>Teste</h1>",OccurrenceClassification.BEHAVIOR,"2"); | |
38 | + Occurrence ocorrencia4Comportamento = new Occurrence(90, 10, "4", false, "<h2>Teste H2</h2>",OccurrenceClassification.BEHAVIOR,"2"); | |
39 | + List<Occurrence> ocorrenciasComportamento = new ArrayList<Occurrence>(); | |
40 | + ocorrenciasComportamento.add(ocorrencia1Comportamento); | |
41 | + ocorrenciasComportamento.add(ocorrencia2Comportamento); | |
42 | + ocorrenciasComportamento.add(ocorrencia3Comportamento); | |
43 | + ocorrenciasComportamento.add(ocorrencia4Comportamento); | |
44 | + | |
45 | + Map<OccurrenceClassification,List<Occurrence>> resultadoAvaliacao = new HashMap<OccurrenceClassification, List<Occurrence>>(); | |
46 | + | |
47 | + resultadoAvaliacao.put(OccurrenceClassification.MARK, ocorrenciasMarcacao); | |
48 | + resultadoAvaliacao.put(OccurrenceClassification.BEHAVIOR, ocorrenciasComportamento); | |
49 | + | |
50 | + avaliacaoBusiness.retornarCriterios(resultadoAvaliacao); | |
51 | + | |
52 | + for(Entry<OccurrenceKey,Map<String,List<Occurrence>>> entry : avaliacaoBusiness.retornarCriterios(resultadoAvaliacao).entrySet() ) { | |
53 | + | |
54 | + System.out.println("RN numero : "+ entry.getKey().getCode()+"\n"); | |
55 | + System.out.println("Criterios ----- \n"); | |
56 | + | |
57 | + for(Entry<String,List<Occurrence>> entry2 : entry.getValue().entrySet() ) { | |
58 | + System.out.println("Criterio : " + entry2.getKey()+" \n Linhas : "); | |
59 | + for(Occurrence oc : entry2.getValue()) | |
60 | + System.out.println(oc.getLine() + " - "); | |
61 | + } | |
62 | + | |
63 | + System.out.println(" ---------------------------"); | |
64 | + } | |
65 | + | |
66 | + | |
67 | + } | |
68 | + | |
69 | +} | ... | ... |